doh

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RecordType

type RecordType uint16

RecordType ...

const (
	RecordTypeNone RecordType = 0  // RecordTypeNone ...
	RecordTypeA    RecordType = 1  // RecordTypeA IPv4
	RecordTypeAAAA RecordType = 28 // RecordTypeAAAA IPv6
)

type Response

type Response struct {
	// Status indicates the DNS query status code (0 = NOERROR, etc.)
	Status uint32
	// TC indicates whether the response was truncated (true if truncated)
	TC bool
	// RD indicates whether recursion was requested in the query
	RD bool
	// RA indicates whether the server supports recursion
	RA bool
	// AD indicates whether the response was authenticated (DNSSEC)
	AD bool
	// CD indicates whether the client requested that DNSSEC validation be disabled
	CD bool
	// Question contains the DNS query question section with name and type
	Question []struct {
		// Name is the domain name being queried
		Name string `json:"name"`
		// Type is the DNS record type being requested (A, AAAA, etc.)
		Type RecordType `json:"type"`
	}
	// Answer contains the DNS response answer section with resource records
	Answer []struct {
		// Name is the domain name for this resource record
		Name string `json:"name"`
		// Type is the DNS record type (A, AAAA, etc.)
		Type RecordType `json:"type"`
		// TTL is the time-to-live value for this resource record in seconds
		TTL uint16
		// Data is the textual representation of the resource record data
		Data string `json:"data"`
	}
	// EdnsClientSubnet is the EDNS client subnet information for geolocation
	EdnsClientSubnet string `json:"edns_client_subnet"`
	// Comment is an optional comment field for additional information
	Comment string
}

Response represents the JSON response structure for DNS over HTTPS (DoH) queries. It contains DNS query results and metadata about the response.

func LookupDoH

func LookupDoH(ctx context.Context, server, name string) (jr Response, err error)

LookupDoH lookup uname's ip from server

func LookupDoHWithType

func LookupDoHWithType(ctx context.Context, server, name string, typ RecordType) (jr Response, err error)

LookupDoHWithType ...

func (*Response) Hosts

func (jr *Response) Hosts() []string

Jump to

Keyboard shortcuts

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