Documentation ¶
Index ¶
- func GetSysFd(conn net.Conn) (int, error)
- type Connection
- func (v *Connection) Close() error
- func (v *Connection) LocalAddr() net.Addr
- func (v *Connection) Read(b []byte) (int, error)
- func (v *Connection) RemoteAddr() net.Addr
- func (v *Connection) Reusable() bool
- func (v *Connection) SetDeadline(t time.Time) error
- func (v *Connection) SetReadDeadline(t time.Time) error
- func (v *Connection) SetReusable(reusable bool)
- func (v *Connection) SetWriteDeadline(t time.Time) error
- func (v *Connection) SysFd() (int, error)
- func (v *Connection) Write(b []byte) (int, error)
- type ConnectionID
- type ConnectionRecyler
- type ExpiringConnection
- type Pool
- type Reuser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connection ¶
Connection is an implementation of net.Conn with re-usability.
func NewConnection ¶
func NewConnection(id ConnectionID, conn net.Conn, manager ConnectionRecyler, reuser *Reuser) *Connection
func (*Connection) Close ¶
func (v *Connection) Close() error
Close implements net.Conn.Close(). If the connection is reusable, the underlying connection will be recycled.
func (*Connection) LocalAddr ¶
func (v *Connection) LocalAddr() net.Addr
func (*Connection) RemoteAddr ¶
func (v *Connection) RemoteAddr() net.Addr
func (*Connection) Reusable ¶
func (v *Connection) Reusable() bool
func (*Connection) SetDeadline ¶
func (v *Connection) SetDeadline(t time.Time) error
func (*Connection) SetReadDeadline ¶
func (v *Connection) SetReadDeadline(t time.Time) error
func (*Connection) SetReusable ¶
func (v *Connection) SetReusable(reusable bool)
func (*Connection) SetWriteDeadline ¶
func (v *Connection) SetWriteDeadline(t time.Time) error
func (*Connection) SysFd ¶
func (v *Connection) SysFd() (int, error)
type ConnectionID ¶
ConnectionID is the ID of a connection.
func NewConnectionID ¶
func NewConnectionID(source v2net.Address, dest v2net.Destination) ConnectionID
NewConnectionID creates a new ConnectionId.
type ConnectionRecyler ¶
type ConnectionRecyler interface { // Put returns a connection back to a connection pool. Put(ConnectionID, net.Conn) }
ConnectionRecyler is the interface for recycling connections.
type ExpiringConnection ¶
type ExpiringConnection struct {
// contains filtered or unexported fields
}
ExpiringConnection is a connection that will expire in certain time.
func (*ExpiringConnection) Expired ¶
func (ec *ExpiringConnection) Expired() bool
Expired returns true if the connection has expired.
Click to show internal directories.
Click to hide internal directories.