dnsresolver

package
v17.6.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateURL

func ValidateURL(rawAddress string) error

ValidateURL validates Gitaly address URL having dns scheme. The URL follows three forms: * dns://authority-port:authority-host/host:port * dns:///host:port * dns:host:port Either form, the real address is the URL's path

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder is an object to build the resolver for a connection. A client connection uses the builder specified by grpc.WithResolvers dial option or the one fetched from global Resolver registry. The local option has higher precedence than the global one.

func NewBuilder

func NewBuilder(opts *BuilderConfig) *Builder

NewBuilder creates a builder option with an input option

func (*Builder) Build

Build returns a resolver that periodically resolves the input target. Each client connection maintains a resolver. It's a part of client connection's life cycle. The target follows gRPC desc resolution format (https://github.com/grpc/grpc/blob/master/doc/naming.md). As this builds a DNS resolver, we care about dns URL only: dns:[//authority/]host[:port] If the authority is missing (dns:host[:port]), it fallbacks to use OS resolver.

func (*Builder) Scheme

func (d *Builder) Scheme() string

Scheme returns the scheme handled by this builder. Client connection queries the resolver based on the target URL scheme. This builder handles dns://*/* targets.

type BuilderConfig

type BuilderConfig struct {
	// RefreshRate determines the periodic refresh rate of the resolver. The resolver may issue
	// the resolver earlier if client connection demands
	RefreshRate time.Duration
	// LookupTimeout determines the timeout of underlying DNS query.
	LookupTimeout time.Duration
	// Backoff defines the backoff strategy when the resolver fails to resolve or pushes new
	// state to client connection
	Backoff backoff.Strategy
	// DefaultGrpcPort sets the gRPC port if the target URL doesn't specify a target port
	DefaultGrpcPort string
	// contains filtered or unexported fields
}

BuilderConfig defines the configuration for customizing the builder.

Jump to

Keyboard shortcuts

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