dhsclient

package
v0.0.0-...-638037a Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Lookup(name string, rType uint16) *dns.Msg
	LookupAppend(r *dns.Msg, name string, rType uint16)
}

Client is an interface all clients should conform to.

type CloudflareDNS

type CloudflareDNS struct {
	BaseURL string
}

func NewCloudFlareDNS

func NewCloudFlareDNS(modOptions ...ModDoHOption) *CloudflareDNS

func (*CloudflareDNS) Lookup

func (c *CloudflareDNS) Lookup(name string, rType uint16) *dns.Msg

func (*CloudflareDNS) LookupAppend

func (c *CloudflareDNS) LookupAppend(r *dns.Msg, name string, rType uint16)

type DoHOption

type DoHOption struct {
	BaseURL string
}

type ModDoHOption

type ModDoHOption func(option *DoHOption)

func WithBaseURL

func WithBaseURL(s string) ModDoHOption

type RequestResponse

type RequestResponse 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 client 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 []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
	} `json:"Answer"`
	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/

Jump to

Keyboard shortcuts

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