Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // IP addresses of publicly-available nameservers. GoogleDNS = []string{"8.8.8.8", "8.8.4.4"} Level3 = []string{"4.2.2.1", "4.2.2.2", "4.2.2.3", "4.2.2.4", "4.2.2.5", "4.2.2.6"} OpenDNS = []string{"208.67.222.222", "208.67.220.220"} )
Functions ¶
This section is empty.
Types ¶
type ScanResult ¶
type ScanResult struct { Domain string `json:"domain"` SPF string `json:"spf"` DMARC string `json:"dmarc"` DKIM string `json:"-"` Duration time.Duration `json:"duration"` Err error `json:"-"` Error string `json:"error,omitempty"` }
ScanResult holds the results of scanning a domain's DNS records.
type Scanner ¶
type Scanner struct { // Nameservers is a slice of "host:port" strings of nameservers to // issue queries against. Nameservers []string // contains filtered or unexported fields }
Scanner is a type that queries the DNS records for domain names, looking for specific resource records.
func New ¶
func New(options ...ScannerOption) (*Scanner, error)
New initializes and returns a new *Scanner.
func (*Scanner) Scan ¶
func (sc *Scanner) Scan(name string) *ScanResult
Scan allows the caller to use the *Scanner's underlying data structures for performing a one-off scan of the given domain name.
func (*Scanner) Start ¶
func (sc *Scanner) Start(src Source) <-chan *ScanResult
Start consumes domain names from the Source src, scans the domain name's DNS records, and returns a channel of the results.
type ScannerOption ¶
ScannerOption defines a functional configuration type for a *Scanner.
func ConcurrentScans ¶
func ConcurrentScans(n int) ScannerOption
ConcurrentScans sets the number of domains that will be scanned concurrently.
If n <= 0, then this option will default to the return value of runtime.NumCPU().
func UseNameservers ¶
func UseNameservers(ns []string) ScannerOption
UseNameservers allows the caller to provide a custom set of nameservers for a *Scanner to use. If ns is nil, or zero-length, the *Scanner will use the nameservers specified in /etc/resolv.conf.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ScannerOption
WithTimeout sets the timeout duration of a DNS query.
type Source ¶
Source defines the interface of a data source that feeds a Scanner.
func TextSource ¶
TextSource returns a new Source that can be used by a Scanner to read newline-separated domain names from r.