Documentation
¶
Overview ¶
Package netaddr parses listen and backend addresses and opens or dials them.
Index ¶
- type Endpoint
- func (e *Endpoint) Address() string
- func (e *Endpoint) DialContext(ctx context.Context, _ string, _ string) (net.Conn, error)
- func (e *Endpoint) IsH2C() bool
- func (e *Endpoint) IsLoopback() bool
- func (e *Endpoint) IsUnix() bool
- func (e *Endpoint) Listen(ctx context.Context) (net.Listener, error)
- func (e *Endpoint) Network() string
- func (e *Endpoint) Port() uint16
- func (e *Endpoint) Socket() string
- func (e *Endpoint) URL() *url.URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is a parsed listen or backend address. Backend endpoints also carry a target URL, an h2c flag, and a resolved port.
func ParseBackend ¶
ParseBackend parses a backend URL: http, https, or h2c over TCP, or "http+unix:"/"h2c+unix:" over a unix socket (absolute path or "@" name).
func ParseListen ¶
ParseListen parses a listener address. A "unix:" prefix selects a unix socket (absolute path or "@" abstract name); anything else is a TCP host:port.
func (*Endpoint) Address ¶
Address reports the listener or dial address: a unix socket or a TCP host:port.
func (*Endpoint) DialContext ¶
DialContext dials the endpoint's unix socket, ignoring the requested network and address so a transport reaches this backend regardless of the URL host.
func (*Endpoint) IsLoopback ¶
IsLoopback reports whether the backend host is a loopback IP address.
func (*Endpoint) Listen ¶
Listen binds a stream listener for the endpoint, clearing a stale unix socket so a restart can rebind it.