bootstrap

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package bootstrap provides types and functions to resolve upstream hostnames and to dial retrieved addresses.

Index

Constants

View Source
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
)
View Source
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

func NewDialContext(timeout time.Duration, l *slog.Logger, addrs ...string) (h DialHandler)

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.

func ResolveDialContext

func ResolveDialContext(
	u *url.URL,
	timeout time.Duration,
	r Resolver,
	preferV6 bool,
	l *slog.Logger,
) (h DialHandler, err error)

ResolveDialContext returns a DialHandler that uses addresses resolved from u using resolver. l and u must not be nil.

type Network

type Network = types.Network

Network is a network type for use in Resolver's methods.

type Resolver

type Resolver = types.Resolver

Resolver resolves the hostnames to IP addresses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL