dnsclient

package
v0.0.0-...-5e8f11c Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomResolver

type CustomResolver interface {
	LookupRaw(name string, rType uint16) *dns.Msg
	LookupRawAppend(r *dns.Msg, name string, rType uint16)
	LookupRawA(name string) []*dns.A
	LookupRawTXT(name string) *dns.TXT
}

func NewCloudFlareDNS

func NewCloudFlareDNS(modOptions ...ModOption) CustomResolver

func NewDoH

func NewDoH(modOptions ...ModOption) CustomResolver

func NewGoogleDNS

func NewGoogleDNS(modOptions ...ModOption) CustomResolver

func NewTraditionDNS

func NewTraditionDNS(modOptions ...ModOption) CustomResolver

type DoH

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

func (*DoH) LookupRaw

func (c *DoH) LookupRaw(name string, rType uint16) *dns.Msg

func (*DoH) LookupRawA

func (c *DoH) LookupRawA(name string) (result []*dns.A)

func (*DoH) LookupRawAppend

func (c *DoH) LookupRawAppend(r *dns.Msg, name string, rType uint16)

func (*DoH) LookupRawTXT

func (c *DoH) LookupRawTXT(name string) *dns.TXT

func (*DoH) RefreshCache

func (c *DoH) RefreshCache()

type DohCommon

type DohCommon struct {
	Name string `json:"name"` // Always matches name in the Question section
	Type int    `json:"type"` // Standard DNS RR type
	TTL  int    `json:"TTL"`  // Record's time-to-live in seconds
	Data string `json:"data"` // Data
}

type DohResponse

type DohResponse struct {
	Status   int  `json:"Status"` // 0=NOERROR, 2=SERVFAIL - Standard DNS response code (32 bit integer)
	TC       bool `json:"TC"`     // Whether the response is truncated
	RD       bool `json:"RD"`     // Always true for Google Public DNS
	RA       bool `json:"RA"`     // Always true for Google Public DNS
	AD       bool `json:"AD"`     // Whether all response data was validated with DNSSEC
	CD       bool `json:"CD"`     // Whether the dnsclient asked to disable DNSSEC
	Question []struct {
		Name string `json:"name"` // FQDN with trailing dot
		Type int    `json:"type"` // Standard DNS RR type
	} `json:"Question"`
	Answer           []*DohCommon  `json:"Answer"`
	Authority        []*DohCommon  `json:"Authority"`
	Additional       []interface{} `json:"Additional"`
	EdnsClientSubnet string        `json:"edns_client_subnet"` // IP address / scope prefix-length
	Comment          string        `json:"Comment"`            // Diagnostics information in case of an error
}

requestResponse contains the response from a DNS query. Both Google and Cloudflare seem to share a scheme here. As in:

https://tools.ietf.org/id/draft-bortzmeyer-dns-json-01.html

https://developers.google.com/speed/public-dns/docs/dns-over-https#dns_response_in_json https://developers.cloudflare.com/1.1.1.1/dns-over-https/json-format/

type ModOption

type ModOption func(option *Option)

func WithBaseURL

func WithBaseURL(s string) ModOption

type Option

type Option struct {
	Endpoint string
	Client   *http.Client
	ClientIP string // dnsclient public ip, for cdn
	Hosts    map[string]string
}

type Tradition

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

func (*Tradition) LookupRaw

func (c *Tradition) LookupRaw(name string, rType uint16) *dns.Msg

func (*Tradition) LookupRawA

func (c *Tradition) LookupRawA(name string) []*dns.A

func (*Tradition) LookupRawAppend

func (c *Tradition) LookupRawAppend(r *dns.Msg, name string, rType uint16)

func (*Tradition) LookupRawTXT

func (c *Tradition) LookupRawTXT(name string) *dns.TXT

Jump to

Keyboard shortcuts

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