Documentation
¶
Overview ¶
Package listener creates listeners that serve a single IP address family.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TCP ¶
TCP listens on addr and port, serving only addr's address family.
The network is selected per family deliberately. Go turns a wildcard listen on "tcp" into a dual-stack socket, so a later IPv6 wildcard on the same port fails as already in use. "tcp6" sets IPV6_V6ONLY, which lets an IPv4 and an IPv6 listener share a port.
func UDP ¶
UDP listens on addr, serving only addr's address family.
The network is selected per family for the same reason as in TCP: a bare "udp" listen on a wildcard address yields a dual-stack socket, so binding both families to one port fails on the second bind. Services that listen on the same port in both families, such as TFTP and syslog, need this.
Types ¶
type Bind ¶
Bind is the listen address of a single address family. Enabled selects whether the family is served, and an enabled Bind must carry an address: serving is a decision made once rather than inferred from an address that may simply be unset.
Addr and Port are separate because each is set by its own flag, which a netip.AddrPort cannot expose.