Documentation ¶
Index ¶
- Constants
- Variables
- func AddLanguages(zones map[string]*Zone, languages []string)
- func AddLocations(zones map[string]*Zone, locations []string)
- func AddRDAPURLs(zones map[string]*Zone, urls []string)
- func AddTags(zones map[string]*Zone, tags []string)
- func CanDial(network, addr string) error
- func CheckPublicSuffix(zones map[string]*Zone)
- func CloseN(rc io.ReadCloser, n int64) (int64, error)
- func CountNameServers(zones map[string]*Zone)
- func Fetch(u string) (*http.Response, error)
- func FetchGTLDsFromICANN(zones map[string]*Zone) error
- func FetchIDNTablesFromIANA(zones map[string]*Zone) error
- func FetchNameServers(zones, allZones map[string]*Zone) error
- func FetchRDAPFromIANA(zones map[string]*Zone) error
- func FetchRootZone(zones map[string]*Zone, addNew bool) error
- func FetchRubyWhoisServers(zones map[string]*Zone, addNew bool) error
- func FetchSpecialUseDomainsFromIANA(zones map[string]*Zone, addNew bool) error
- func FindWildcards(zones map[string]*Zone) error
- func GenerateGo(zones map[string]*Zone) error
- func GuessLanguages(zones map[string]*Zone)
- func IndexOfString(haystack []string, s string) (int, int)
- func IndexOfStrings(haystack []string, needle []string) int
- func IndexOrAppendString(haystack *[]string, s string) (int, int, int)
- func IndexOrAppendStrings(haystack *[]string, needle []string) (int, int)
- func LogError(err error)
- func LogFatal(err error)
- func LogWarning(err error)
- func LogWarningFor(err error, label string)
- func LogWarningForAt(err error, label string, offset int)
- func Normalize(s string) string
- func NormalizeDomains(in []string) []string
- func NormalizeURL(s string) string
- func QueryIANA(zones map[string]*Zone) error
- func QueryWhoisServers(zones map[string]*Zone) error
- func ReadMetadata(zones map[string]*Zone) (errs []error)
- func ReadZones() (zones map[string]*Zone, errs []error)
- func ReadZonesFile() (zones map[string]*Zone, errs []error)
- func RemoveLocations(zones map[string]*Zone, locations []string)
- func RemoveTags(zones map[string]*Zone, tags []string)
- func Sort(domains []string)
- func SortedDomains(zones map[string]*Zone) []string
- func TLDs(zones map[string]*Zone) map[string]*Zone
- func ToASCII(s string) string
- func ToASCIIURL(s string) string
- func Trace(spec string, args ...interface{})
- func UpdateInfoURLs(zones map[string]*Zone)
- func ValidateTags(zones map[string]*Zone) error
- func VerifyNameServers(zones map[string]*Zone)
- func VerifyWhois(zones map[string]*Zone)
- func WriteMetadata(zones map[string]*Zone, delete bool) error
- func WriteZonesFile(zones map[string]*Zone) error
- type ISODate
- type Policy
- type Set
- type Zone
- func (z *Zone) ASCII() string
- func (z *Zone) AddPolicy(ptype, key, value, comment string)
- func (z *Zone) AddTags(tags ...string) int
- func (z *Zone) HasMetadata() bool
- func (z *Zone) IsBrand() bool
- func (z *Zone) IsGeneric() bool
- func (z *Zone) IsIDN() bool
- func (z *Zone) IsRetiredOrWithdrawn() bool
- func (z *Zone) IsTLD() bool
- func (z *Zone) Normalize()
- func (z *Zone) ParentDomain() string
- func (z *Zone) RemoveTags(tags ...string) int
Constants ¶
const ( // TypeLength specifies a length constraint for labels. // The Policy.Key will be "min" or "max". TypeLength = "length" // KeyMin specifies a mininum length constraint for a label. KeyMin = "min" // KeyMax specifies a maximum length constraint for a label. KeyMax = "max" // TypeIDNTable specifies a location for an IDN table a language or script. TypeIDNTable = "idn-table" // TypeIDNDisallowed specifies that IDN labels are disallowed by the operator for this zone. TypeIDNDisallowed = "idn-disallowed" )
const ( TagAdult = "adult" TagBrand = "brand" TagCity = "city" TagClosed = "closed" TagCommunity = "community" TagCountry = "country" TagGeneric = "generic" TagGeo = "geo" TagInfrastructure = "infrastructure" TagPrivate = "private" TagRegion = "region" TagReserved = "reserved" TagRetired = "retired" TagSpecial = "special" TagSponsored = "sponsored" TagTest = "test" TagWithdrawn = "withdrawn" )
Well-known tags
Variables ¶
var ( // Concurrency specifies the maximimum number of concurrent build operations to execute. Concurrency = 32 // Timeout specifies the maximum duration to wait for network operations to complete. Timeout = 10 * time.Second )
var BaseDir = "."
BaseDir specifies the base working directory that contains the ZoneDB flat-file database.
var ( // Verbose enables verbose logging Verbose bool )
Functions ¶
func AddLanguages ¶
func AddLocations ¶
func AddRDAPURLs ¶
func CanDial ¶
CanDial verifies if possible to connect to a given network and address. Returns nil for successful dial or an error.
func CheckPublicSuffix ¶
CheckPublicSuffix compares the zones against the Public Suffix List.
func CloseN ¶
func CloseN(rc io.ReadCloser, n int64) (int64, error)
CloseN drains rc up to a maximum of n bytes and closes rc. It returns the number of bytes drained and the first error encountered. Regardless of any errors, rc.Close() is guaranteed to be called.
func CountNameServers ¶
CountNameServers counts unique name servers for zones.
func FetchGTLDsFromICANN ¶
FetchGTLDsFromICANN retrieves the list of gTLDs from ICANN.
func FetchIDNTablesFromIANA ¶
FetchIDNTablesFromIANA fetches IDN table references from the IANA website.
func FetchNameServers ¶
FetchNameServers fetches NS records for zones.
func FetchRDAPFromIANA ¶
FetchRDAPFromIANA retrieves the map of zones to RDAP service endpoints from IANA.
func FetchRootZone ¶
FetchRootZone fetches the IANA root zone file and adds name servers to zones.
func FetchRubyWhoisServers ¶
FetchRubyWhoisServers fetches whois servers from the Ruby Whois project.
func FetchSpecialUseDomainsFromIANA ¶
FetchSpecialUseDomainsFromIANA fetches special use domains from the IANA website.
func FindWildcards ¶
FindWildcards finds wildcard DNS records for a zone.
func GenerateGo ¶
GenerateGo generates a Go source representation of ZoneDB.
func GuessLanguages ¶
func IndexOfString ¶
IndexOfString finds s as a substring in haystack, returning the index and offset of s in haystack. Returns -1, -1 if s is not present in haystack.
func IndexOfStrings ¶
IndexOfStrings finds a rank-sorted slice of domain names (needle) within a larger slice (haystack).
func IndexOrAppendString ¶
IndexOrAppendString finds or adds s to haystack, returning the index and offset of s in haystack. Returns 0, 0, 0 for an empty string.
func IndexOrAppendStrings ¶
IndexOrAppendStrings finds or appends a slice of rank-sorted domain names (needle) Returns 0,0 for a zero-length needle.
func LogFatal ¶
func LogFatal(err error)
LogFatal logs an error to stderr and exits with a non-zero exit code.
func LogWarningFor ¶
LogWarningFor logs an error to stderr for a given label.
func LogWarningForAt ¶
LogWarningForAt logs a warning to stderr for a given label and offset.
func NormalizeDomains ¶
NormalizeDomains normalizes a slice of domain names. Returns a sorted, de-duplicated, normalized list of domain names.
func NormalizeURL ¶
NormalizeURL normalizes the domain name part of a URL, with a Unicode (non-IDNA encoded) hostname. Returns a blank string if it is unable to parse s as a valid URL.
func QueryWhoisServers ¶
QueryWhoisServers queries whois-servers.net for CNAME’d whois servers.
func ReadMetadata ¶
ReadMetadata reads JSON files for each zone in the metadata directory.
func ReadZonesFile ¶
ReadZonesFile reads and parses the zones.txt file.
func RemoveLocations ¶
func RemoveTags ¶
RemoveTags removes one or more tags from a Zone.
func Sort ¶
func Sort(domains []string)
Sort sorts a slice of domain names by rank. Rank sort defined as: 1. Label count (TLDs followed by second- and third-level domains), then 2. lexically sorted reversed label order (TLD first, then second-level label, etc.) Example: com, net, org, uk, uk.com, ac.uk, co.uk, ...
func SortedDomains ¶
SortedDomains returns a list of domain names sorted by rank.
func ToASCIIURL ¶
ToASCIIURL normalizes the domain name part of a URL to ASCII/punycode.
func UpdateInfoURLs ¶
func ValidateTags ¶ added in v1.0.4155
ValidateTags validates tags in one or more zones.
func VerifyNameServers ¶
VerifyNameServers verifies the name servers for zones.
func VerifyWhois ¶
VerifyWhois verifies that the whois servers respond on TCP port 43.
func WriteMetadata ¶
WriteMetadata writes the metadata/*.json files.
func WriteZonesFile ¶
WriteZonesFile writes the zones.txt file.
Types ¶
type ISODate ¶
func (*ISODate) UnmarshalJSON ¶
type Policy ¶
type Policy struct { Type string `json:"type"` Key string `json:"key,omitempty"` Value string `json:"value,omitempty"` Comment string `json:"comment,omitempty"` }
Policy represents a registry or technical policy applicable to subdomains of a zone.
type Set ¶
Set implements a unique set of strings.
type Zone ¶
type Zone struct { Domain string `json:"domain,omitempty"` RegistryOperator string `json:"registryOperator,omitempty"` InfoURL string `json:"infoURL,omitempty"` WhoisServer string `json:"whoisServer,omitempty"` WhoisURL string `json:"whoisURL,omitempty"` RDAPURLs []string `json:"rdapURLs,omitempty"` NameServers []string `json:"nameServers,omitempty"` Wildcards []string `json:"wildcards,omitempty"` Locations []string `json:"locations,omitempty"` Languages []string `json:"languages,omitempty"` Tags []string `json:"tags,omitempty"` Policies []Policy `json:"policies,omitempty"` // Exported for use in text/template IDNDisallowed bool `json:"-"` ParentOffset, SubdomainsOffset, SubdomainsEnd int `json:"-"` TagBits uint64 `json:"-"` // contains filtered or unexported fields }
Zone represents a build-time DNS zone (public suffix).
func (*Zone) HasMetadata ¶
HasMetadata returns true if the Zone has any metadata necessary for emitting a metadata JSON file.
func (*Zone) IsRetiredOrWithdrawn ¶
IsRetiredOrWithdrawn returns true if the zone is retired or withdrawn.
func (*Zone) Normalize ¶
func (z *Zone) Normalize()
Normalize formats a build.Zone into normal form suitable for serialization.
func (*Zone) ParentDomain ¶
ParentDomain returns the parent domain name (if any) for the Zone.
func (*Zone) RemoveTags ¶
RemoveTags removes tags from z, returning the number of tag(s) removed, if any.