Documentation ¶
Overview ¶
Package network provides a portable interface for network I/O, constraining its usage allowing only to send & receive data in a packet format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { // Err is filled when the connection gets closed. Err error // contains filtered or unexported fields }
Conn manages the serialization and deserialization of the entire communication system between booster nodes. Only one consumer per time is allowed.
func (*Conn) Consume ¶
Consume keeps on reading on the connection, decoding each message received and exiting with an error if it is not able to decode the data collected into a packet. Each packet is sent into the decoded channel. When it gets closed, check c.Err.
func (*Conn) Recv ¶
Recv reads one packet from the connection. Returns an error if the connection is already consuming packets.
func (*Conn) RemoteAddr ¶
RemoteAddr returns the address of the remote endpoint.
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer wraps a network dialer.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener wraps a net.Listener.
type NetworkIO ¶ added in v0.4.0
type NetworkIO struct { Ticker *time.Ticker NextCopyDelay time.Duration sync.Mutex N int64 // N is the number of bytes transmitted Bandwidth int64 // contains filtered or unexported fields }
NetworkIO implements the io.CopyN method, keeping track of the bandwidth while doing so.
func (*NetworkIO) CopyN ¶ added in v0.4.0
CopyN copies data from src into dst, using a buffer of size n. Keeps track of the number of bytes copied.
func (*NetworkIO) TickerFunc ¶ added in v0.4.0
TickerFunc calls f repeatedly after d. Badwidth is calculated right before calling f.