dnsx

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dnsx contains the library logic

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Options{
	BaseResolvers:     DefaultResolvers,
	MaxRetries:        5,
	QuestionTypes:     []uint16{miekgdns.TypeA},
	TraceMaxRecursion: math.MaxUint16,
	Hostsfile:         true,
}

DefaultOptions contains the default configuration options

View Source
var DefaultResolvers = []string{
	"udp:114.114.114.114:53",
	"udp:180.76.76.76:53",
	"udp:112.124.47.27:53",
	"udp:223.5.5.5:53",
	"udp:223.6.6.6:53",
	"udp:1.1.1.1:53",
	"udp:1.0.0.1:53",
	"udp:8.8.8.8:53",
	"udp:8.8.4.4:53",
	"udp:9.9.9.9:53",
	"udp:149.112.112.112:53",
	"udp:208.67.222.222:53",
	"udp:208.67.220.220:53",
}

DefaultResolvers contains the list of resolvers known to be trusted.

Functions

func StringToRequestType

func StringToRequestType(tp string) (rt uint16, err error)

StringToRequestType conversion helper

Types

type AsnResponse

type AsnResponse struct {
	AsNumber  string   `json:"as-number,omitempty" csv:"as_number"`
	AsName    string   `json:"as-name,omitempty" csv:"as_name"`
	AsCountry string   `json:"as-country,omitempty" csv:"as_country"`
	AsRange   []string `json:"as-range,omitempty" csv:"as_range"`
}

func (*AsnResponse) String

func (o *AsnResponse) String() string

type DNSX

type DNSX struct {
	Options *Options
	// contains filtered or unexported fields
}

DNSX is structure to perform dns lookups

func New

func New(options Options) (*DNSX, error)

New creates a dns resolver

func (*DNSX) AXFR

func (d *DNSX) AXFR(hostname string) (*retryabledns.AXFRData, error)

Trace performs a DNS trace of the specified types and returns raw responses

func (*DNSX) CdnCheck

func (d *DNSX) CdnCheck(domain string) (bool, string, error)

CdnCheck verifies if the given ip is part of Cdn ranges

func (*DNSX) Lookup

func (d *DNSX) Lookup(hostname string) ([]string, error)

Lookup performs a DNS A question and returns corresponding IPs

func (*DNSX) QueryMultiple

func (d *DNSX) QueryMultiple(hostname string) (*retryabledns.DNSData, error)

QueryMultiple performs a DNS question of the specified types and returns raw responses

func (*DNSX) QueryOne

func (d *DNSX) QueryOne(hostname string) (*retryabledns.DNSData, error)

QueryOne performs a DNS question of a specified type and returns raw responses

func (*DNSX) Trace

func (d *DNSX) Trace(hostname string) (*retryabledns.TraceData, error)

Trace performs a DNS trace of the specified types and returns raw responses

type MarshalOption

type MarshalOption func(d *ResponseData)

func WithoutAllRecords

func WithoutAllRecords() MarshalOption

type Options

type Options struct {
	BaseResolvers     []string
	MaxRetries        int
	QuestionTypes     []uint16
	Trace             bool
	TraceMaxRecursion int
	Hostsfile         bool
	OutputCDN         bool
	QueryAll          bool
}

Options contains configuration options

type ResponseData

type ResponseData struct {
	*retryabledns.DNSData
	IsCDNIP bool         `json:"cdn,omitempty" csv:"cdn"`
	CDNName string       `json:"cdn-name,omitempty" csv:"cdn-name"`
	ASN     *AsnResponse `json:"asn,omitempty" csv:"asn"`
}

ResponseData to show output result

func (*ResponseData) JSON

func (d *ResponseData) JSON(options ...MarshalOption) (string, error)

Jump to

Keyboard shortcuts

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