Documentation ¶
Overview ¶
Package gonet provides a Go net package compatible wrapper for a tcpip stack.
Index ¶
- type TCPConn
- func (c *TCPConn) Close() error
- func (c *TCPConn) CloseRead() error
- func (c *TCPConn) CloseWrite() error
- func (c *TCPConn) LocalAddr() net.Addr
- func (c *TCPConn) Read(b []byte) (int, error)
- func (c *TCPConn) RemoteAddr() net.Addr
- func (d *TCPConn) SetDeadline(t time.Time) error
- func (d *TCPConn) SetReadDeadline(t time.Time) error
- func (d *TCPConn) SetWriteDeadline(t time.Time) error
- func (c *TCPConn) Write(b []byte) (int, error)
- type TCPListener
- type UDPConn
- func (c *UDPConn) Close() error
- func (c *UDPConn) LocalAddr() net.Addr
- func (c *UDPConn) Read(b []byte) (int, error)
- func (c *UDPConn) ReadFrom(b []byte) (int, net.Addr, error)
- func (c *UDPConn) RemoteAddr() net.Addr
- func (d *UDPConn) SetDeadline(t time.Time) error
- func (d *UDPConn) SetReadDeadline(t time.Time) error
- func (d *UDPConn) SetWriteDeadline(t time.Time) error
- func (c *UDPConn) Write(b []byte) (int, error)
- func (c *UDPConn) WriteTo(b []byte, addr net.Addr) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TCPConn ¶
type TCPConn struct {
// contains filtered or unexported fields
}
A TCPConn is a wrapper around a TCP tcpip.Endpoint that implements the net.Conn interface.
func DialContextTCP ¶
func DialContextTCP(ctx context.Context, s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*TCPConn, error)
DialContextTCP creates a new TCPConn connected to the specified address with the option of adding cancellation and timeouts.
func DialTCP ¶
func DialTCP(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*TCPConn, error)
DialTCP creates a new TCPConn connected to the specified address.
func NewTCPConn ¶
NewTCPConn creates a new TCPConn.
func (*TCPConn) CloseRead ¶
CloseRead shuts down the reading side of the TCP connection. Most callers should just use Close.
A TCP Half-Close is performed the same as CloseRead for *net.TCPConn.
func (*TCPConn) CloseWrite ¶
CloseWrite shuts down the writing side of the TCP connection. Most callers should just use Close.
A TCP Half-Close is performed the same as CloseWrite for *net.TCPConn.
func (*TCPConn) RemoteAddr ¶
RemoteAddr implements net.Conn.RemoteAddr.
func (*TCPConn) SetDeadline ¶
SetDeadline implements net.Conn.SetDeadline and net.PacketConn.SetDeadline.
func (*TCPConn) SetReadDeadline ¶
SetReadDeadline implements net.Conn.SetReadDeadline and net.PacketConn.SetReadDeadline.
func (*TCPConn) SetWriteDeadline ¶
SetWriteDeadline implements net.Conn.SetWriteDeadline and net.PacketConn.SetWriteDeadline.
type TCPListener ¶
type TCPListener struct {
// contains filtered or unexported fields
}
A TCPListener is a wrapper around a TCP tcpip.Endpoint that implements net.Listener.
func ListenTCP ¶
func ListenTCP(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*TCPListener, error)
ListenTCP creates a new TCPListener.
func NewTCPListener ¶
NewTCPListener creates a new TCPListener from a listening tcpip.Endpoint.
func (*TCPListener) Accept ¶
func (l *TCPListener) Accept() (net.Conn, error)
Accept implements net.Conn.Accept.
func (*TCPListener) Close ¶
func (l *TCPListener) Close() error
Close implements net.Listener.Close.
type UDPConn ¶
type UDPConn struct {
// contains filtered or unexported fields
}
A UDPConn is a wrapper around a UDP tcpip.Endpoint that implements net.Conn and net.PacketConn.
func DialUDP ¶
func DialUDP(s *stack.Stack, laddr, raddr *tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*UDPConn, error)
DialUDP creates a new UDPConn.
If laddr is nil, a local address is automatically chosen.
If raddr is nil, the UDPConn is left unconnected.
func NewUDPConn ¶
NewUDPConn creates a new UDPConn.
func (*UDPConn) RemoteAddr ¶
RemoteAddr implements net.Conn.RemoteAddr.
func (*UDPConn) SetDeadline ¶
SetDeadline implements net.Conn.SetDeadline and net.PacketConn.SetDeadline.
func (*UDPConn) SetReadDeadline ¶
SetReadDeadline implements net.Conn.SetReadDeadline and net.PacketConn.SetReadDeadline.
func (*UDPConn) SetWriteDeadline ¶
SetWriteDeadline implements net.Conn.SetWriteDeadline and net.PacketConn.SetWriteDeadline.