dns

package
v0.0.0-...-a5a926a Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchHost = &net.DNSError{Err: "no such host", IsNotFound: true}
View Source
var (
	Logger logger = term.DefaultTerm
)
View Source
var ResolverAt = DirectResolverAt

Functions

func CheckDomainDNSReady

func CheckDomainDNSReady(ctx context.Context, domain string, validCNAMEs []string) bool

The DNS is considered ready if the CNAME of the domain is pointing to the ALB domain and in sync OR if the A record of the domain is pointing to the same IP addresses of the ALB domain and in sync

func FindNSServers

func FindNSServers(ctx context.Context, domain string) ([]*net.NS, error)

func IpAddrsToIPs

func IpAddrsToIPs(ipAddrs []net.IPAddr) []net.IP

func NSHosts

func NSHosts(ns []*net.NS) []string

func SameIPs

func SameIPs(a, b []net.IP) bool

Types

type DNSRequest

type DNSRequest struct {
	Type   string
	Domain string
}

type DNSResponse

type DNSResponse struct {
	Records []string
	Error   error
}

type DirectResolver

type DirectResolver struct {
	NSServer string
}

func (DirectResolver) LookupCNAME

func (r DirectResolver) LookupCNAME(ctx context.Context, domain string) (string, error)

func (DirectResolver) LookupIPAddr

func (r DirectResolver) LookupIPAddr(ctx context.Context, domain string) ([]net.IPAddr, error)

func (DirectResolver) LookupNS

func (r DirectResolver) LookupNS(ctx context.Context, domain string) ([]*net.NS, error)

type ErrCNAMEFound

type ErrCNAMEFound string

func (ErrCNAMEFound) CNAME

func (e ErrCNAMEFound) CNAME() string

func (ErrCNAMEFound) Error

func (e ErrCNAMEFound) Error() string

type ErrUnexpectedRequest

type ErrUnexpectedRequest DNSRequest

func (ErrUnexpectedRequest) Error

func (e ErrUnexpectedRequest) Error() string

type MockResolver

type MockResolver struct {
	Records map[DNSRequest]DNSResponse
}

func (MockResolver) LookupCNAME

func (r MockResolver) LookupCNAME(ctx context.Context, domain string) (string, error)

func (MockResolver) LookupIPAddr

func (r MockResolver) LookupIPAddr(ctx context.Context, domain string) ([]net.IPAddr, error)

func (MockResolver) LookupNS

func (r MockResolver) LookupNS(ctx context.Context, domain string) ([]*net.NS, error)

type Resolver

type Resolver interface {
	LookupIPAddr(ctx context.Context, domain string) ([]net.IPAddr, error)
	LookupCNAME(ctx context.Context, domain string) (string, error)
	LookupNS(ctx context.Context, domain string) ([]*net.NS, error)
}

func DirectResolverAt

func DirectResolverAt(nsServer string) Resolver

type RootResolver

type RootResolver struct{}

func (RootResolver) LookupCNAME

func (r RootResolver) LookupCNAME(ctx context.Context, domain string) (string, error)

func (RootResolver) LookupIPAddr

func (r RootResolver) LookupIPAddr(ctx context.Context, domain string) ([]net.IPAddr, error)

func (RootResolver) LookupNS

func (r RootResolver) LookupNS(ctx context.Context, domain string) ([]*net.NS, error)

Jump to

Keyboard shortcuts

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