gonet
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package gonet provides a Go net package compatible wrapper for a tcpip stack.
Index¶
- type TCPConn
- func DialContextTCP(ctx context.Context, s *stack.Stack, addr tcpip.FullAddress, ...) (*TCPConn, error)
- func DialTCP(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProtocolNumber) (*TCPConn, error)
- func DialTCPWithBind(ctx context.Context, s *stack.Stack, localAddr, remoteAddr tcpip.FullAddress, ...) (*TCPConn, error)
- func NewTCPConn(wq *waiter.Queue, ep tcpip.Endpoint) *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¶
typeTCPConn¶
type TCPConn struct {// contains filtered or unexported fields}A TCPConn is a wrapper around a TCP tcpip.Endpoint that implements the net.Conninterface.
funcDialContextTCP¶
func DialContextTCP(ctxcontext.Context, s *stack.Stack, addrtcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*TCPConn,error)
DialContextTCP creates a new TCPConn connected to the specified addresswith the option of adding cancellation and timeouts.
funcDialTCP¶
func DialTCP(s *stack.Stack, addrtcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*TCPConn,error)
DialTCP creates a new TCPConn connected to the specified address.
funcDialTCPWithBind¶
func DialTCPWithBind(ctxcontext.Context, s *stack.Stack, localAddr, remoteAddrtcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*TCPConn,error)
DialTCPWithBind creates a new TCPConn connected to the specifiedremoteAddress with its local address bound to localAddr.
funcNewTCPConn¶
NewTCPConn creates a new TCPConn.
func (*TCPConn)CloseRead¶
CloseRead shuts down the reading side of the TCP connection. Most callersshould 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 callersshould 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 andnet.PacketConn.SetReadDeadline.
func (*TCPConn)SetWriteDeadline¶
SetWriteDeadline implements net.Conn.SetWriteDeadline andnet.PacketConn.SetWriteDeadline.
typeTCPListener¶
type TCPListener struct {// contains filtered or unexported fields}A TCPListener is a wrapper around a TCP tcpip.Endpoint that implementsnet.Listener.
funcListenTCP¶
func ListenTCP(s *stack.Stack, addrtcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*TCPListener,error)
ListenTCP creates a new TCPListener.
funcNewTCPListener¶
NewTCPListener creates a new TCPListener from a listening tcpip.Endpoint.
typeUDPConn¶
type UDPConn struct {// contains filtered or unexported fields}A UDPConn is a wrapper around a UDP tcpip.Endpoint that implementsnet.Conn and net.PacketConn.
funcDialUDP¶
func DialUDP(s *stack.Stack, laddr, raddr *tcpip.FullAddress, networktcpip.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.
funcNewUDPConn¶
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 andnet.PacketConn.SetReadDeadline.
func (*UDPConn)SetWriteDeadline¶
SetWriteDeadline implements net.Conn.SetWriteDeadline andnet.PacketConn.SetWriteDeadline.