Documentation
¶
Index ¶
- func LoadUUID(ctx context.Context) string
- type Conn
- func (c *Conn) AcceptTime() time.Time
- func (c *Conn) ByteCounters() (uint64, uint64)
- func (c *Conn) Close() error
- func (c *Conn) GetCC() (string, error)
- func (c *Conn) Info() (inetdiag.BBRInfo, tcp.LinuxTCPInfo, error)
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) SaveUUID(ctx context.Context) context.Context
- func (c *Conn) SetCC(cc string) error
- func (c *Conn) UUID() string
- func (c *Conn) Write(b []byte) (int, error)
- type ConnInfo
- type Listener
- type TCPLikeConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
Conn is an extended net.Conn that stores its accept time, a copy of the underlying socket's file descriptor, and counters for read/written bytes.
func FromTCPLikeConn ¶ added in v0.4.0
func FromTCPLikeConn(tcpConn TCPLikeConn) (*Conn, error)
FromTCPLikeConn creates a netx.Conn from a TCPLikeConn.
func (*Conn) AcceptTime ¶
AcceptTime returns this connection's accept time.
func (*Conn) ByteCounters ¶
ByteCounters returns the read and written byte counters, in this order.
func (*Conn) GetCC ¶
GetCC gets the current congestion control algorithm from the underlying file descriptor.
func (*Conn) Info ¶
Info returns the BBRInfo and TCPInfo structs associated with the underlying socket. It returns an error if TCPInfo cannot be read.
func (*Conn) SaveUUID ¶ added in v0.3.0
SaveUUID saves this connection's UUID in a context.Context using a globally unique key. LoadUUID should be used to retrieve the uuid from the context.
type ConnInfo ¶
type ConnInfo interface {
ByteCounters() (uint64, uint64)
Info() (inetdiag.BBRInfo, tcp.LinuxTCPInfo, error)
AcceptTime() time.Time
UUID() string
GetCC() (string, error)
SetCC(string) error
SaveUUID(context.Context) context.Context
}
ConnInfo provides operations on a net.Conn's underlying file descriptor.
func ToConnInfo ¶
ToConnInfo is a helper function to convert a net.Conn into a netx.ConnInfo. It panics if netConn does not contain a type supporting ConnInfo.
type Listener ¶
type Listener struct {
*net.TCPListener
}
Listener is a TCPListener. Connections accepted by this listener provide extra methods to interact with the connection's underlying file descriptor.
func NewListener ¶
func NewListener(l *net.TCPListener) *Listener
NewListener returns a netx.Listener.