Documentation
¶
Overview ¶
Package bootstrap provides types and functions to resolve upstream hostnames and to dial retrieved addresses.
Index ¶
- Constants
- func NewParallelResolver(resolvers ...Resolver) *types.ParallelResolver
- type DialHandler
- func NewDialContext(timeout time.Duration, l *slog.Logger, addrs ...string) (h DialHandler)
- func NewDialContextWithOpts(opts upstream.UpstreamOptions, l *slog.Logger, addrs ...string) (h DialHandler)
- func ResolveDialContext(u *url.URL, timeout time.Duration, r Resolver, preferV6 bool, l *slog.Logger) (h DialHandler, err error)
- type Network
- type Resolver
Constants ¶
const ( // NetworkIP is a network type for both address families. NetworkIP = types.NetworkIP // NetworkIP4 is a network type for IPv4 address family. NetworkIP4 = types.NetworkIP4 // NetworkIP6 is a network type for IPv6 address family. NetworkIP6 = types.NetworkIP6 // NetworkTCP is a network type for TCP connections. NetworkTCP = types.NetworkTCP // NetworkUDP is a network type for UDP connections. NetworkUDP = types.NetworkUDP )
const ErrNoResolvers errors.Error = "no resolvers specified"
ErrNoResolvers is returned when zero resolvers specified.
Variables ¶
This section is empty.
Functions ¶
func NewParallelResolver ¶
func NewParallelResolver(resolvers ...Resolver) *types.ParallelResolver
NewParallelResolver creates a new ParallelResolver with the specified resolvers.
Types ¶
type DialHandler ¶
type DialHandler = upstream.DialHandler
DialHandler is a dial function for creating unencrypted network connections to the upstream server. It establishes the connection to the server specified at initialization and ignores the addr. network must be one of NetworkTCP or NetworkUDP. This is exported from the upstream package to avoid circular imports.
func NewDialContext ¶
NewDialContext returns a DialHandler that dials addrs and returns the first successful connection. At least a single addr should be specified. l must not be nil.
func NewDialContextWithOpts ¶
func NewDialContextWithOpts(opts upstream.UpstreamOptions, l *slog.Logger, addrs ...string) (h DialHandler)
NewDialContextWithOpts returns a DialHandler that dials addrs and returns the first successful connection using the provided UpstreamOptions. At least a single addr should be specified. l must not be nil.