doh

package
v0.0.0-...-6548317 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: BSD-3-Clause-Clear Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DOH_ENDPOINT string = "https://cloudflare-dns.com/dns-query"

Variables

View Source
var ErrEmptyResponse = errors.New("empty response")

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTP *resty.Client
}

func New

func New() *Client

func (*Client) A

func (client *Client) A(query string) (*DOHResponse, error)

func (*Client) AAAA

func (client *Client) AAAA(query string) (*DOHResponse, error)

func (*Client) CNAME

func (client *Client) CNAME(query string) (*DOHResponse, error)

func (*Client) MX

func (client *Client) MX(query string) (*DOHResponse, error)

func (*Client) NS

func (client *Client) NS(query string) (*DOHResponse, error)

func (*Client) PTR

func (client *Client) PTR(query string) (*DOHResponse, error)

func (*Client) Query

func (client *Client) Query(recordType Record, query string) (*DOHResponse, error)

func (*Client) SOA

func (client *Client) SOA(query string) (*DOHResponse, error)

func (*Client) TXT

func (client *Client) TXT(query string) (*DOHResponse, error)

type DOHAnswer

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

type DOHError

type DOHError struct {
	Error string `json:"error"`
}

type DOHQuestion

type DOHQuestion struct {
	Name string `json:"name"`
	Type int    `json:"type"`
}

type DOHResponse

type DOHResponse 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 []DOHQuestion `json:"Question"`
	Answer   []DOHAnswer   `json:"Answer"`
}

type Record

type Record string
const (
	RECORD_A     Record = "A"
	RECORD_AAAA  Record = "AAAA"
	RECORD_CNAME Record = "CNAME"
	RECORD_MX    Record = "MX"
	RECORD_NS    Record = "NS"
	RECORD_PTR   Record = "PTR"
	RECORD_SOA   Record = "SOA"
	RECORD_TXT   Record = "TXT"
)

func (Record) String

func (r Record) String() string

Jump to

Keyboard shortcuts

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