Documentation
¶
Overview ¶
Package domain provide functions to parse and handle domain names and labels.
Index ¶
Constants ¶
View Source
const ( // MaxName is maximum number of bytes for whole domain name. MaxName = 255 // MaxLabels is maximum number of labels domain name can consist of. MaxLabels = MaxName / 2 // MaxLabel is maximim number of bytes for single label. MaxLabel = 63 )
Variables ¶
View Source
var ( // ErrTooManyLabels is returned for domain name with more than 127 labels. ErrTooManyLabels = errors.New("too many labels") // ErrEmptyLabel indicates that domain name contains empty label. ErrEmptyLabel = errors.New("empty label") // ErrLabelTooLong is returned when one of domain labels has more than 63 characters. ErrLabelTooLong = errors.New("label too long") // ErrNameTooLong is returned when domain name has more than 255 characters. ErrNameTooLong = errors.New("name too long") // ErrInvalidEscape is returned for invalid escape sequence. ErrInvalidEscape = errors.New("invalid escape sequence") )
Functions ¶
func MakeHumanReadableLabel ¶
MakeHumanReadableLabel makes human-readable label by escaping according RFC-4343.
Types ¶
type Name ¶
type Name struct {
// contains filtered or unexported fields
}
Name is a structure which represents domain name.
func MakeNameFromReflection ¶
MakeNameFromReflection extracts domain name from value. The value should wrap Name or *Name otherwise MakeNameFromReflection panics.
func MakeNameFromString ¶
MakeNameFromString creates a Name from human-readable domain name string.
func (Name) GetLabel ¶
GetLabel returns label starting from given offset and offset of the next label. The method returns zero offset for the last label and -1 in case of error.
Click to show internal directories.
Click to hide internal directories.