dnsclient

package
v0.0.0-...-fe7efdf Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegularDns int64 = iota + 1
	DnsOverUDP
	DnsOverTCP
	DnsOverTLS
	DnsOverHTTPS
	DnsOverHTTPSWithForcedH3
	DnsOverQUIC
)

Variables

This section is empty.

Functions

func DohJsonResponseToDnsMsg

func DohJsonResponseToDnsMsg(dohResp DohJsonResponse) *dns.Msg

将 DoH JSON 响应转换为 dns.Msg

Types

type Answer

type Answer struct {
	Name string `json:"name"`
	Type uint16 `json:"type"`
	TTL  int    `json:"TTL"`
	Data string `json:"data"`
}

type DnsClient

type DnsClient interface {
	Exchange(req *dns.Msg) (resp *dns.Msg, ttt time.Duration, err error)
}

func NewDoHDnsClient

func NewDoHDnsClient(name, path string) DnsClient

func NewJDoHDnsClient

func NewJDoHDnsClient(name, path string) DnsClient

type DohJsonRequest

type DohJsonRequest struct {
	Name string `json:"name"`
	Type uint16 `json:"type"`
	DO   bool   `json:"do,omitempty"`
	CD   bool   `json:"cd,omitempty"`
}

DoH JSON schema using by Cloudflare and Google Cloudflare’s DNS over HTTPS endpoint also supports JSON format for querying DNS data. For lack of an agreed upon JSON schema for DNS over HTTPS in the Internet Engineering Task Force (IETF), Cloudflare has chosen to follow the same schema as Google’s DNS over HTTPS resolver.

type DohJsonResponse

type DohJsonResponse struct {
	Status           int           `json:"Status"`
	TC               bool          `json:"TC"`
	RD               bool          `json:"RD"`
	RA               bool          `json:"RA"`
	AD               bool          `json:"AD"`
	CD               bool          `json:"CD"`
	Question         []Question    `json:"Question"`
	Answer           []Answer      `json:"Answer"`
	Authority        []Answer      `json:"Authority,omitempty"`
	Additional       []interface{} `json:"Additional,omitempty"`
	EdnsClientSubnet string        `json:"edns_client_subnet,omitempty"`
	Comment          string        `json:"Comment,omitempty"`
}

type Question

type Question struct {
	Name string `json:"name"`
	Type uint16 `json:"type"`
}

Jump to

Keyboard shortcuts

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