exchanger

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.Logger) 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