lookup

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DNSKEY_ZSK uint16 = 256 // Zone Signing Key
	DNSKEY_KSK uint16 = 257 // Key Signing Key
)

DNSSEC key flags

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSClient

type DNSClient interface {
	Exchange(m *dns.Msg, address string) (r *dns.Msg, rtt time.Duration, err error)
}

DNSClient interface abstracts the dns.Client to allow mocking in tests.

type DnsLookup

type DnsLookup struct {
	RootDNSSECRecords        []*dns.DS
	RequireAuthenticatedData bool
	// contains filtered or unexported fields
}

func NewDnsLookup

func NewDnsLookup(nameservers []NameServer) *DnsLookup

func (*DnsLookup) Authenticate

func (d *DnsLookup) Authenticate(msg *dns.Msg, ctx context.Context) error

Authenticate verifies the DNSSEC signatures in the DNS response message

func (*DnsLookup) Query

func (d *DnsLookup) Query(name string, rrtype uint16) (*dns.Msg, time.Duration, error)

func (*DnsLookup) QueryA

func (d *DnsLookup) QueryA(name string) ([]dns.A, *dns.Msg, time.Duration, error)

QueryA retrieves A records for the given name.

func (*DnsLookup) QueryAAAA

func (d *DnsLookup) QueryAAAA(name string) ([]dns.AAAA, *dns.Msg, time.Duration, error)

QueryAAAA retrieves AAAA records for the given name.

func (*DnsLookup) QueryCAA

func (d *DnsLookup) QueryCAA(name string) ([]dns.CAA, *dns.Msg, time.Duration, error)

QueryCAA retrieves CAA records for the given name.

func (*DnsLookup) QueryCNAME

func (d *DnsLookup) QueryCNAME(name string) ([]dns.CNAME, *dns.Msg, time.Duration, error)

QueryCNAME retrieves CNAME records for the given name.

func (*DnsLookup) QueryDNSKEY

func (d *DnsLookup) QueryDNSKEY(name string) ([]dns.DNSKEY, *dns.Msg, time.Duration, error)

QueryDNSKEY retrieves DNSKEY records for the given name.

func (*DnsLookup) QueryDS

func (d *DnsLookup) QueryDS(name string) ([]dns.DS, *dns.Msg, time.Duration, error)

QueryDS retrieves DS records for the given name.

func (*DnsLookup) QueryMX

func (d *DnsLookup) QueryMX(name string) ([]dns.MX, *dns.Msg, time.Duration, error)

QueryMX retrieves MX records for the given name.

func (*DnsLookup) QueryNAPTR

func (d *DnsLookup) QueryNAPTR(name string) ([]dns.NAPTR, *dns.Msg, time.Duration, error)

QueryNAPTR retrieves NAPTR records for the given name.

func (*DnsLookup) QueryNS

func (d *DnsLookup) QueryNS(name string) ([]dns.NS, *dns.Msg, time.Duration, error)

QueryNS retrieves NS records for the given name.

func (*DnsLookup) QueryPTR

func (d *DnsLookup) QueryPTR(name string) ([]dns.PTR, *dns.Msg, time.Duration, error)

QueryPTR retrieves PTR records for the given name.

func (*DnsLookup) QueryRRSIG

func (d *DnsLookup) QueryRRSIG(name string) ([]dns.RRSIG, *dns.Msg, time.Duration, error)

QueryRRSIG retrieves RRSIG records for the given name.

func (*DnsLookup) QuerySOA

func (d *DnsLookup) QuerySOA(name string) ([]dns.SOA, *dns.Msg, time.Duration, error)

QuerySOA retrieves SOA records for the given name.

func (*DnsLookup) QuerySPF

func (d *DnsLookup) QuerySPF(name string) ([]dns.SPF, *dns.Msg, time.Duration, error)

QuerySPF retrieves SPF records for the given name.

func (*DnsLookup) QuerySRV

func (d *DnsLookup) QuerySRV(name string) ([]dns.SRV, *dns.Msg, time.Duration, error)

QuerySRV retrieves SRV records for the given name.

func (*DnsLookup) QueryTXT

func (d *DnsLookup) QueryTXT(name string) ([]dns.TXT, *dns.Msg, time.Duration, error)

QueryTXT retrieves TXT records for the given name.

func (*DnsLookup) SetLogger

func (d *DnsLookup) SetLogger(l zerolog.Logger)

type NameServer

type NameServer interface {
	Query(name string, rrtype uint16) (*dns.Msg, time.Duration, error)
	String() string
}

NameServer interface defines the methods for a DNS name server.

func NewTcpNameserver

func NewTcpNameserver(address, port string) NameServer

NewTcpNameserver creates a NameServerConcrete instance using TCP protocol.

func NewTlsNameserver

func NewTlsNameserver(address, port, domain string) NameServer

NewTlsNameserver creates a NameServerConcrete instance using TCP over TLS protocol. The domain parameter is required for TLS certificate verification.

func NewUdpNameserver

func NewUdpNameserver(address, port string) NameServer

NewUdpNameserver creates a NameServerConcrete instance using UDP protocol.

type NameServerConcrete

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

NameServerConcrete represents the details of a DNS name server, including protocol, address, port, and client.

func (NameServerConcrete) Query

func (n NameServerConcrete) Query(name string, rrtype uint16) (*dns.Msg, time.Duration, error)

Query sends a DNS query to the NameServerConcrete.

func (NameServerConcrete) String

func (n NameServerConcrete) String() string

String returns a human-readable string representation of the NameServerConcrete details.

type SignatureSet

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

SignatureSet represents a set of DNS records along with their corresponding RRSIG and DNSKEY

type SignatureSets

type SignatureSets []*SignatureSet

SignatureSets represents a collection of SignatureSet pointers

Jump to

Keyboard shortcuts

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