Documentation
¶
Overview ¶
Package types contains shared types used by both upstream and bootstrap packages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsequentResolver ¶
type ConsequentResolver struct {
// contains filtered or unexported fields
}
ConsequentResolver is a slice of resolvers that are queried in order until the first successful non-empty response, as opposed to just successful response requirement in ParallelResolver.
func NewConsequentResolver ¶
func NewConsequentResolver(resolvers ...Resolver) *ConsequentResolver
NewConsequentResolver creates a new ConsequentResolver with the specified resolvers.
func (*ConsequentResolver) LookupNetIP ¶
func (r *ConsequentResolver) LookupNetIP(ctx context.Context, network Network, host string) ([]netip.Addr, error)
LookupNetIP implements the Resolver interface for ConsequentResolver.
type Network ¶
type Network = string
Network is a network type for use in Resolver's methods.
const ( // NetworkIP is a network type for both address families. NetworkIP Network = "ip" // NetworkIP4 is a network type for IPv4 address family. NetworkIP4 Network = "ip4" // NetworkIP6 is a network type for IPv6 address family. NetworkIP6 Network = "ip6" // NetworkTCP is a network type for TCP connections. NetworkTCP Network = "tcp" // NetworkUDP is a network type for UDP connections. NetworkUDP Network = "udp" )
type ParallelResolver ¶
type ParallelResolver struct {
// contains filtered or unexported fields
}
ParallelResolver is a slice of resolvers that are queried concurrently until the first successful response is returned, as opposed to all resolvers being queried in order in ConsequentResolver.
func NewParallelResolver ¶
func NewParallelResolver(resolvers ...Resolver) *ParallelResolver
NewParallelResolver creates a new ParallelResolver with the specified resolvers.
func (*ParallelResolver) LookupNetIP ¶
func (r *ParallelResolver) LookupNetIP(ctx context.Context, network Network, host string) ([]netip.Addr, error)
LookupNetIP implements the Resolver interface for ParallelResolver.
type Resolver ¶
type Resolver interface {
LookupNetIP(ctx context.Context, network Network, host string) ([]netip.Addr, error)
}
Resolver resolves the hostnames to IP addresses.
type StaticResolver ¶
type StaticResolver struct {
// contains filtered or unexported fields
}
StaticResolver is a resolver which always responds with an underlying slice of IP addresses.
func NewStaticResolver ¶
func NewStaticResolver(addrs []netip.Addr) *StaticResolver
NewStaticResolver creates a new StaticResolver with the specified addresses.
func (*StaticResolver) LookupNetIP ¶
func (r *StaticResolver) LookupNetIP(ctx context.Context, network Network, host string) ([]netip.Addr, error)
LookupNetIP implements the Resolver interface for StaticResolver.