dns

package
v0.0.0-...-937a249 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNetworkNotSupported    = errors.New("network not supported")
	ErrAnswerNotReceived      = errors.New("response answer not received")
	ErrAnswerTypeMismatch     = errors.New("answer type is not expected")
	ErrAnswerTypeNotSupported = errors.New("answer type not supported")
	ErrRecordEmpty            = errors.New("record is empty")
	ErrIPMalformed            = errors.New("IP address malformed")
)
View Source
var (
	ErrIPNotFoundForVersion = errors.New("IP addresses found but not for IP version")
)
View Source
var (
	ErrTooManyTXTRecords = errors.New("too many TXT records")
)
View Source
var ErrUnknownProvider = errors.New("unknown public IP echo DNS provider")

Functions

func ValidateProvider

func ValidateProvider(provider Provider) error

Types

type Client

type Client interface {
	ExchangeContext(ctx context.Context, m *dns.Msg, a string) (r *dns.Msg, rtt time.Duration, err error)
}

Client is an interface for the DNS client used in the implementation in this package. You SHOULD NOT use this interface anywhere as it is implementation specific.

type Fetcher

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

func New

func New(options ...Option) (f *Fetcher, err error)

func (*Fetcher) IP

func (f *Fetcher) IP(ctx context.Context) (publicIP netip.Addr, err error)

func (*Fetcher) IP4

func (f *Fetcher) IP4(ctx context.Context) (publicIP netip.Addr, err error)

func (*Fetcher) IP6

func (f *Fetcher) IP6(ctx context.Context) (publicIP netip.Addr, err error)

type Option

type Option func(s *settings) error

func SetProviders

func SetProviders(first Provider, providers ...Provider) Option

func SetTimeout

func SetTimeout(timeout time.Duration) Option

type Provider

type Provider string
const (
	Cloudflare Provider = "cloudflare"
	OpenDNS    Provider = "opendns"
)

func ListProviders

func ListProviders() []Provider

Directories

Path Synopsis
Package mock_dns is a generated GoMock package.
Package mock_dns is a generated GoMock package.

Jump to

Keyboard shortcuts

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