Documentation ¶
Index ¶
- Variables
- type AXFRData
- type Client
- func (c *Client) A(host string) (*DNSData, error)
- func (c *Client) AAAA(host string) (*DNSData, error)
- func (c *Client) ANY(host string) (*DNSData, error)
- func (c *Client) AXFR(host string) (*AXFRData, error)
- func (c *Client) CAA(host string) (*DNSData, error)
- func (c *Client) CNAME(host string) (*DNSData, error)
- func (c *Client) Do(msg *dns.Msg) (*dns.Msg, error)
- func (c *Client) MX(host string) (*DNSData, error)
- func (c *Client) NS(host string) (*DNSData, error)
- func (c *Client) PTR(host string) (*DNSData, error)
- func (c *Client) Query(host string, requestType uint16) (*DNSData, error)
- func (c *Client) QueryMultiple(host string, requestTypes []uint16) (*DNSData, error)
- func (c *Client) QueryMultipleWithResolver(host string, requestTypes []uint16, resolver Resolver) (*DNSData, error)
- func (c *Client) QueryParallel(host string, requestType uint16, resolvers []string) ([]*DNSData, error)
- func (c *Client) Resolve(host string) (*DNSData, error)
- func (c *Client) ResolveWithSyscall(host string) (*DNSData, error)
- func (c *Client) SOA(host string) (*DNSData, error)
- func (c *Client) SRV(host string) (*DNSData, error)
- func (c *Client) TXT(host string) (*DNSData, error)
- func (c *Client) Trace(host string, requestType uint16, maxrecursion int) (*TraceData, error)
- type DNSData
- func (d *DNSData) JSON() (string, error)
- func (d *DNSData) Marshal() ([]byte, error)
- func (d *DNSData) ParseFromEnvelopeChan(envChan chan *dns.Envelope) error
- func (d *DNSData) ParseFromMsg(msg *dns.Msg) error
- func (d *DNSData) ParseFromRR(rrs []dns.RR) error
- func (d *DNSData) Unmarshal(b []byte) error
- type DohProtocol
- type DohResolver
- type NetworkResolver
- type Options
- type Protocol
- type Resolver
- type RootDNS
- type TraceData
Constants ¶
This section is empty.
Variables ¶
var ( ErrMaxRetriesZero = errors.New("retries must be at least 1") ErrResolversEmpty = errors.New("resolvers list must not be empty") )
var CheckInternalIPs = false
CheckInternalIPs when set to true returns if DNS response IPs belong to internal IP ranges.
var RootDNSServers = []RootDNS{
{"a.root-servers.net", "198.41.0.4", "2001:503:ba3e::2:30", "Verisign, Inc"},
{"b.root-servers.net", "199.9.14.201", "2001:500:200::b", "University of Southern California, Information Sciences Institute"},
{"c.root-servers.net", "192.33.4.12", "2001:500:2::c", "Cogent Communications"},
{"d.root-servers.net", "199.7.91.13", "2001:500:2d::d", "University of Maryland"},
{"e.root-servers.net", "192.203.230.10", "2001:500:a8::e", "NASA (Ames Research Center)"},
{"f.root-servers.net", "192.5.5.241", "2001:500:2f::f", "Internet Systems Consortium, Inc."},
{"g.root-servers.net", "192.112.36.4", "2001:500:12::d0d", "US Department of Defense (NIC)"},
{"h.root-servers.net", "198.97.190.53", "2001:500:1::53", "US Army (Research Lab)"},
{"i.root-servers.net", "192.36.148.17", "2001:7fe::53", "Netnod"},
{"j.root-servers.net", "192.58.128.30", "2001:503:c27::2:30", "Verisign, Inc"},
{"k.root-servers.net", "193.0.14.129", "2001:7fd::1", "RIPE NCC"},
{"l.root-servers.net", "199.7.83.42", "2001:500:9f::42", "ICANN"},
{"m.root-servers.net", "202.12.27.33", "2001:dc3::35", "WIDE Project"},
}
var RootDNSServersIPv4 = []string{
"198.41.0.4:53", "199.9.14.201:53", "192.33.4.12:53", "199.7.91.13:53",
"192.203.230.10:53", "192.5.5.241:53", "192.112.36.4:53", "198.97.190.53:53",
"192.36.148.17:53", "192.58.128.30:53", "193.0.14.129:53", "199.7.83.42:53",
"202.12.27.33:53",
}
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { TCPFallback bool // contains filtered or unexported fields }
Client is a DNS resolver client to resolve hostnames.
func NewWithOptions ¶ added in v1.0.13
New creates a new dns client with options
func (*Client) QueryMultiple ¶
QueryMultiple sends a provided dns request and return the data
func (*Client) QueryMultipleWithResolver ¶ added in v1.0.14
func (c *Client) QueryMultipleWithResolver(host string, requestTypes []uint16, resolver Resolver) (*DNSData, error)
QueryMultiple sends a provided dns request and return the data with a specific resolver
func (*Client) QueryParallel ¶ added in v1.0.12
func (c *Client) QueryParallel(host string, requestType uint16, resolvers []string) ([]*DNSData, error)
QueryParallel sends a provided dns request to multiple resolvers in parallel
func (*Client) Resolve ¶
Resolve is the underlying resolve function that actually resolves a host and gets the ip records for that host.
func (*Client) ResolveWithSyscall ¶ added in v1.0.7
ResolveWithSyscall attempts to resolve the host through system calls
type DNSData ¶
type DNSData struct { Host string `json:"host,omitempty"` TTL uint32 `json:"ttl,omitempty"` Resolver []string `json:"resolver,omitempty"` A []string `json:"a,omitempty"` AAAA []string `json:"aaaa,omitempty"` CNAME []string `json:"cname,omitempty"` MX []string `json:"mx,omitempty"` PTR []string `json:"ptr,omitempty"` ANY []string `json:"any,omitempty"` SOA []string `json:"soa,omitempty"` NS []string `json:"ns,omitempty"` TXT []string `json:"txt,omitempty"` SRV []string `json:"srv,omitempty"` CAA []string `json:"caa,omitempty"` AllRecords []string `json:"all,omitempty"` Raw string `json:"raw,omitempty"` HasInternalIPs bool `json:"has_internal_ips,omitempty"` InternalIPs []string `json:"internal_ips,omitempty"` StatusCode string `json:"status_code,omitempty"` StatusCodeRaw int `json:"status_code_raw,omitempty"` TraceData *TraceData `json:"trace,omitempty"` AXFRData *AXFRData `json:"axfr,omitempty"` RawResp *dns.Msg `json:"raw_resp,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"` HostsFile bool `json:"hosts_file,omitempty"` }
DNSData is the data for a DNS request response
func (*DNSData) ParseFromEnvelopeChan ¶ added in v1.0.14
func (*DNSData) ParseFromMsg ¶
ParseFromMsg and enrich data
type DohProtocol ¶ added in v1.0.13
type DohProtocol string
const ( JsonAPI DohProtocol = "jsonapi" GET DohProtocol = "get" POST DohProtocol = "post" )
func (DohProtocol) String ¶ added in v1.0.13
func (p DohProtocol) String() string
func (DohProtocol) StringWithSemicolon ¶ added in v1.0.13
func (p DohProtocol) StringWithSemicolon() string
type DohResolver ¶ added in v1.0.13
type DohResolver struct { Protocol DohProtocol URL string }
func (DohResolver) Method ¶ added in v1.0.13
func (r DohResolver) Method() string
func (DohResolver) String ¶ added in v1.0.13
func (r DohResolver) String() string
type NetworkResolver ¶ added in v1.0.13
func (NetworkResolver) String ¶ added in v1.0.13
func (r NetworkResolver) String() string
type Protocol ¶ added in v1.0.13
type Protocol string