util

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasenameToNamecoinKey

func BasenameToNamecoinKey(basename string) (string, error)

Convert a domain name basename (e.g. "example") to a Namecoin domain name key name ("d/example").

func NamecoinKeyToBasename

func NamecoinKeyToBasename(key string) (string, error)

Convert a Namecoin domain name key name (e.g. "d/example") to a domain name basename ("example").

func ParseFuzzyDomainName

func ParseFuzzyDomainName(name string) (string, error)

Takes a name in the form "d/example" or "example.bit" and converts it to the bareword "example". Returns an error if the input is in neither form.

func ParseFuzzyDomainNameNC

func ParseFuzzyDomainNameNC(name string) (bareName string, namecoinKey string, err error)

func SplitDomainByFloatingAnchor

func SplitDomainByFloatingAnchor(qname, anchor string) (subname, basename, rootname string, err error)

For domains of the form "Y1.Y2...Yn.ANCHOR.X1.X2...Xn.", returns the following values:

basename is the name appearing directly beneath the anchor (Yn).

subname contains any additional labels appearing beneath the anchor (Y1 through Y(n-1)), separated by dots.

rootname contains ANCHOR through Xn inclusive, separated by dots.

If no label corresponds to ANCHOR, an error is returned. If ANCHOR is the first label, basename is an empty string.

Examples, where anchor="bit":

"a.b.c.d."           -> merr.ErrNotInZone
"a.b.c.d.bit."       -> subname="a.b.c", basename="d", rootname="bit"
"d.bit."             -> subname="",      basename="d", rootname="bit"
"bit."               -> subname="",      basename="",  rootname="bit"
"bit.x.y.z."         -> subname="",      basename="",  rootname="bit.x.y.z"
"d.bit.x.y.z."       -> subname="",      basename="d", rootname="bit.x.y.z"
"c.d.bit.x.y.z."     -> subname="c",     basename="d", rootname="bit.x.y.z"
"a.b.c.d.bit.x.y.z." -> subname="a.b.c",     basename="d", rootname="bit.x.y.z"

func SplitDomainHead

func SplitDomainHead(name string) (head, rest string)

Split a domain name a.b.c.d.e into parts e (the head) and a.b.c.d (the rest).

func SplitDomainTail

func SplitDomainTail(name string) (tail, rest string)

Split a domain name a.b.c.d.e into parts a (the tail) and b.c.d.e (the rest).

func ValidateDomainLabel

func ValidateDomainLabel(label string) bool

func ValidateDomainName

func ValidateDomainName(name string) bool

func ValidateEmail

func ValidateEmail(email string) bool

func ValidateHostLabel

func ValidateHostLabel(label string) bool

func ValidateHostName

func ValidateHostName(name string) bool

func ValidateLabelLength

func ValidateLabelLength(label string) bool

func ValidateNameLength

func ValidateNameLength(name string) bool

func ValidateOwnerLabel

func ValidateOwnerLabel(label string) bool

func ValidateOwnerName

func ValidateOwnerName(name string) bool

func ValidateRelDomainName

func ValidateRelDomainName(name string) bool

func ValidateRelHostName

func ValidateRelHostName(name string) bool

func ValidateRelOwnerName

func ValidateRelOwnerName(name string) bool

func ValidateServiceName

func ValidateServiceName(label string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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