dns

package
v0.0.0-...-78b9045 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package dns standardizes checks for domain validity. All functions support punycode and unicode domains (IDN) by default.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasListedSuffix

func HasListedSuffix(domain string) bool

HasListedSuffix returns true if the domain has a TLD that appears on the public suffix list and false otherwise. Converts to ASCII to ensure suffix check succeeds but does no other normalization.

func IsListedSuffix

func IsListedSuffix(etld string) bool

IsListedSuffix returns true iff the argument `etld` is on the public suffix list, e.g., is a public or private effective top-level domain (eTLD).

func IsPossibleDomain

func IsPossibleDomain(domain string) bool

IsPossibleDomain returns true if `domain` syntactically matches RFC 1035 and is or uses a known public or private TLD. Converts to ASCII to ensure suffix check succeeds but does no other normalization.

func IsRegisterableDomain

func IsRegisterableDomain(domain string) bool

IsRegisterableDomain returns true if `domain` syntactically matches RFC 1035 and uses a known public or private TLD but is not a TLD itself. This means the domain could be registered and used by a 3rd party, but the check does not resolve to see if it has been registered. Converts to ASCII to ensure suffix check succeeds but does no other normalization.

func Normalize

func Normalize(domain string) (string, error)

Normalize is used to sanitize domain names so common inconsistencies do not occur. Domains flowing into the system from 3rd parties should always be normalized before storing and further processing. This function will: * trim trailing & leading whitespace * lowercase * convert to punycode An error is returned if the punycode conversion fails.

func Valid

func Valid(domain string) bool

Valid returns true if the domain passes govalidator's DNS check and was parseable by IDNA.

Types

This section is empty.

Jump to

Keyboard shortcuts

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