Documentation
¶
Overview ¶
Package socket provides method for parsing addresses and opening listening sockets, supporting direct TCP/UNIX sockets and sockets provided by launchd/systemd for socket activation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open a listening socket with the given network and address. Supports 'unix', 'tcp', 'launchd' and 'systemd' as the network.
For 'tcp' sockets, the address must be a host and a port. The opened socket will be bound with SO_REUSEPORT.
For 'unix' sockets, the address must be a path. The socket file will be set to unlink on close automatically.
For 'launchd' sockets, the address must be the name of the socket from the plist file. Only one socket maybe configured in the plist for that name, multiple sockets per name (e.g. separate IPv4/IPv4 sockets) are not supported.
For 'systemd' sockets, the address must be the name of the socket. In the systemd unit file, the FileDescriptorName option must be set and needs to match the address string.
func ParseAddress ¶
ParseAddress parses a string representing a TCP address or UNIX socket for our backend target. The input can be or the form "HOST:PORT" for a TCP socket, "unix:PATH" for a UNIX socket, and "systemd:NAME" or "launchd:NAME" for a socket provided by launchd/systemd for socket activation.
func ParseAndOpen ¶
ParseAndOpen combines the functionality of the ParseAddress and Open methods.
func ParseHTTPAddress ¶
ParseHTTPAddress parses a string representing a TCP address or HTTP/HTTPS address If the input is HTTP/HTTPS, return address will strip away the prefix Otherwise, return address will be same as input https is default to be true, unless http:// prefix is found
Types ¶
This section is empty.