Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface {
InboundConn
OutboundConn
Close() error
}
type Inbound ¶
An inbound transport is a channel'ed abstraction around a net.UDPConn. Provides an abstraction around inbound packets on the network to allow using the existing protocol implementation without a miIO network handy. Consumers of this interface should never close the underlying UDP connection without first calling Stop().
func NewInbound ¶
func NewInbound(socket InboundConn) Inbound
type InboundConn ¶
InboundConn is an abstraction around net.UDPConn to allow mocking during tests.
type Outbound ¶
type Outbound interface {
// Handle handles incoming packets and triggers waiting continuations.
Handle(pkt *packet.Packet) error
// Call makes a call, waits for a Response and returns the raw bytes returned.
Call(method string, params interface{}) ([]byte, error)
// CallAndDeserialize makes a call, waits for a Response and deserialises the JSON
// payload into `ret`.
CallAndDeserialize(method string, params interface{}, resp interface{}) error
// Send will send a raw packet without waiting for a Response.
Send(packet *packet.Packet) error
}
Outbound transport is an abstraction around a net.UDPConn for outbound interaction with a networked miIO device. Consumers should never close the underlying socket and continue to use the service. Outbound also provides retry and timeout logic.