exchanger

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 14 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