exchanger

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exchanger

type Exchanger interface {
	Exchange(ctx context.Context, msg []byte) ([]byte, error)
	String() string
}

Exchanger is an interface for DNS synchronous query.

func NewExchanger

func NewExchanger(addr string, opts ...Option) (Exchanger, error)

NewExchanger create an Exchanger. The addr should be URL-like format, e.g. udp://1.1.1.1:53, tls://1.1.1.1:853, https://1.0.0.1/dns-query

type Option

type Option func(opts *Options)

Option allows a common way to set Exchanger options.

func LoggerOption

func LoggerOption(logger logger.ILogger) Option

LoggerOption sets the logger for Exchanger.

func RouterOption

func RouterOption(router *chain.Router) Option

RouterOption sets the router for Exchanger.

func TLSConfigOption

func TLSConfigOption(cfg *tls.Config) Option

TLSConfigOption sets the TLS config for Exchanger.

func TimeoutOption

func TimeoutOption(timeout time.Duration) Option

TimeoutOption sets the timeout for Exchanger.

type Options

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

Jump to

Keyboard shortcuts

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