Documentation ¶
Overview ¶
Package network provides an interface for the standard library's network operations. This is defined in a separate package to avoid issues with circular imports.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Network ¶
type Network interface { io.Closer // HasIPv4 returns true if the network supports IPv4. HasIPv4() bool // HasIPv6 returns true if the network supports IPv6. HasIPv6() bool // LookupHost looks up the given host using the local resolver. It returns a slice of that host's addresses. LookupHost(host string) ([]string, error) // Dial connects to the address on the named network. // Known networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only), "udp", "udp4" (IPv4-only), "udp6" (IPv6-only). Dial(network, address string) (stdnet.Conn, error) // DialContext connects to the address on the named network using the provided context. DialContext(ctx context.Context, network, address string) (stdnet.Conn, error) // Listen listens for incoming connections on the network address. // Known networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only). // If the address is an empty string, Listen listens on all available interfaces. Listen(network, address string) (stdnet.Listener, error) // ListenPacket listens for incoming packets addressed to the local address. // Known networks are "udp", "udp4" (IPv4-only), "udp6" (IPv6-only). // Caveat: The SetDeadline, SetReadDeadline, or SetWriteDeadline functions on the returned // PacketConn may not work as expected (due to gVisor issues). ListenPacket(network, address string) (stdnet.PacketConn, error) }
Network is an interface that abstracts the standard library's network operations.
Click to show internal directories.
Click to hide internal directories.