const ( DefaultTimeout time.Duration = 1 * time.Second // Limits the size of a packet. Anything larger will cause // a decoding error. MaxPacketSize int = 10 * 1024 )
Connection is responsible for transferring packets via the network.
type Connection struct {
// contains filtered or unexported fields
}
func New(conn net.Conn, isIncoming bool) *Connection
func (c *Connection) AddAddresses(new []string)
func (c *Connection) Addresses() []string
Addresses returns a copy of address list associated with the connection.
func (c *Connection) ClearAddresses()
func (c *Connection) Close()
func (c *Connection) IsActive() bool
func (c *Connection) IsIncoming() bool
func (c *Connection) LocalAddr() string
func (c *Connection) Read() (*packet.Packet, error)
func (c *Connection) ReadFull(timeout time.Duration) (*packet.Packet, error)
func (c *Connection) RegisterCloseHandler(f func(*Connection))
func (c *Connection) RemoteAddr() string
func (c *Connection) String() string
func (c *Connection) Write(p *packet.Packet) error
func (c *Connection) WriteFull(p *packet.Packet, timeout time.Duration) error