dns

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DOH = "https://cloudflare-dns.com/dns-query?type=TXT&name=%s"
)
View Source
const (
	TXT_PAYLOAD_V1 = "ps:true;v:1;sig:%s;ca:%d;uuid:%s;prev:%s"
)

Variables

This section is empty.

Functions

func Init

func Init()

Types

type DNS

type DNS struct {
	*validator.Base
}

func (*DNS) GeneratePostPayload

func (dns *DNS) GeneratePostPayload() (post map[string]string)

func (*DNS) GenerateSignPayload

func (dns *DNS) GenerateSignPayload() (payload string)

func (*DNS) Validate

func (dns *DNS) Validate() (err error)

type DOHAnswer

type DOHAnswer struct {
	// The record owner.
	Name string `json:"name"`
	// The type of DNS record. These are defined here: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4Open external link.
	Type int `json:"type"`
	// The number of seconds the answer can be stored in cache before it is considered stale.
	TTL uint `json:"ttl"`
	// The value of the DNS record for the given name and type. The data will be in text for standardized record types and in hex for unknown types.
	Data string `json:"data"`
}

type DOHQuestion

type DOHQuestion struct {
	// The record name requested.
	Name string `json:"name"`
	// The type of DNS record requested. These are defined here: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4Open external link.
	Type int `json:"type"`
}

type DOHResponse

type DOHResponse struct {
	// The Response Code of the DNS Query. These are defined here: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6Open external link.
	Status uint `json:"Status"`
	//If true, it means the truncated bit was set. This happens when the DNS answer is larger than a single UDP or TCP packet. TC will almost always be false with Cloudflare DNS over HTTPS because Cloudflare supports the maximum response size.
	TC bool `json:"TC"`
	// If true, it means the Recursive Desired bit was set. This is always set to true for Cloudflare DNS over HTTPS.
	RD bool `json:"RD"`
	// If true, it means the Recursion Available bit was set. This is always set to true for Cloudflare DNS over HTTPS.
	RA bool `json:"RA"`
	// If true, it means that every record in the answer was verified with DNSSEC.
	AD bool `json:"AD"`
	// If true, the client asked to disable DNSSEC validation. In this case, Cloudflare will still fetch the DNSSEC-related records, but it will not attempt to validate the records.
	CD       bool          `json:"CD"`
	Question []DOHQuestion `json:"Question"`
	// If Answer is empty, this field will appear.
	Authority *[]DOHAnswer `json:"Authority"`
	Answer    *[]DOHAnswer `json:"Answer"`
}

https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-https/make-api-requests/dns-json/

type TXTPayload

type TXTPayload struct {
	Version   uint
	Signature string
	CreatedAt time.Time

	Previous *string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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