Skip to content

Commit

Permalink
all: imp docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed Apr 7, 2023
1 parent 2973223 commit 6475e22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Package bootstrap provides types and functions to resolve upstream hostnames
// and dial retrieved addresses.
package bootstrap

import (
Expand All @@ -17,6 +19,8 @@ import (
// specified at initialization and ignores the addr.
type DialHandler func(ctx context.Context, network, addr string) (conn net.Conn, err error)

// ResolveDialContext returns a DialHandler that uses addresses resolved from
// u using resolvers.
func ResolveDialContext(
u *url.URL,
timeout time.Duration,
Expand Down Expand Up @@ -50,6 +54,8 @@ func ResolveDialContext(
return NewDialContext(timeout, resolverAddresses...), nil
}

// NewDialContext returns a DialHandler that dials to the addresses in addrs and
// returns the first succeeded connection.
func NewDialContext(timeout time.Duration, addrs ...string) (h DialHandler) {
dialer := &net.Dialer{
Timeout: timeout,
Expand Down
1 change: 1 addition & 0 deletions upstream/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/miekg/dns"
)

// Resolver is an alias for bootstrap.Resolver to avoid the import cycle.
type Resolver = bootstrap.Resolver

// exchangeResult is a structure that represents result of exchangeAsync
Expand Down

0 comments on commit 6475e22

Please sign in to comment.