Documentation
¶
Overview ¶
Package nettype defines an interface that doesn't exist in the Go net package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnPacketConn ¶ added in v1.38.0
type ConnPacketConn interface {
net.Conn
net.PacketConn
}
ConnPacketConn is the interface that's a superset of net.Conn and net.PacketConn.
type HalfCloser ¶ added in v1.104.0
HalfCloser is an interface to abstract around various Conn types that allow closing of the read and write streams independently of each other. It is normally used as a typecast for a `net.Conn` to get access to these functions. If you use it for this purpose, you should either be absolutely certain that the `net.Conn` you have represents a half-closable connection (eg. TCP or unix socket), or check for and handle a failure to cast.
type PacketConn ¶ added in v1.30.0
type PacketConn interface {
WriteToUDPAddrPort([]byte, netip.AddrPort) (int, error)
ReadFromUDPAddrPort([]byte) (int, netip.AddrPort, error)
io.Closer
LocalAddr() net.Addr
SetDeadline(time.Time) error
SetReadDeadline(time.Time) error
SetWriteDeadline(time.Time) error
}
PacketConn is like a net.PacketConn but uses the newer netip.AddrPort write/read methods.
type PacketListener ¶
type PacketListener interface {
ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error)
}
PacketListener defines the ListenPacket method as implemented by net.ListenConfig, net.ListenPacket, and tstest/natlab.
type PacketListenerWithNetIP ¶ added in v1.30.0
type PacketListenerWithNetIP interface {
ListenPacket(ctx context.Context, network, address string) (PacketConn, error)
}
func MakePacketListenerWithNetIP ¶ added in v1.30.0
func MakePacketListenerWithNetIP(ln PacketListener) PacketListenerWithNetIP