Documentation
¶
Overview ¶
Package validate holds input validators shared by the CLI and the TUI so the two entry points enforce identical domain and DNS server rules.
Index ¶
Constants ¶
const DefaultDNSServer = "8.8.8.8:53"
DefaultDNSServer is the resolver used when none is given; the CLI, the TUI and the DNS server error message all use this one constant (#80).
Variables ¶
This section is empty.
Functions ¶
func DNSServer ¶
DNSServer checks that server is a valid ip:port address with an IP host and a port in the range 1-65535.
Encrypted transports are written as URLs (#86): tls://host[:port] for DNS over TLS (port 853 by default) and https://host/path for DNS over HTTPS. Their host may be a name, which is resolved with the system resolver.
func DoTAddress ¶ added in v0.9.0
DoTAddress splits a tls://host[:port] server into the address to dial (port 853 by default) and the host to verify the certificate against. An IPv6 host may be bracketed with or without a port: tls://[2001:db8::1], tls://[2001:db8::1]:853 and tls://2001:db8::1 are all accepted (#115). Both the validator and the DNS dialer use it, so they cannot disagree.
func Domain ¶
Domain checks that domain is non-empty, within the 253-character limit, and conforms to DNS naming rules: 1-63 characters per label, and a TLD that is either alphabetic (2+) or a punycode xn-- prefix. Labels other than the TLD may contain underscores (_dmarc, _domainkey), as wordlist entries can.
func NormalizeDomain ¶ added in v0.9.0
NormalizeDomain turns a target as users type or paste it into the canonical form every entry point scans: trimmed, lowercase, no trailing dot, IDNs in punycode. It also strips a URL scheme and path, a :port and a leading "*.", returning a one-line note for each so the caller can say what it did (#54). The result is checked with Domain.
Types ¶
This section is empty.