domain

package
v0.48.0-dev2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDomainsList added in v0.44.0

func ValidateDomainsList(domains []string) error

ValidateDomainsList checks if each domain in the list is valid

Types

type Domain

type Domain string

Domain represents a punycode-encoded domain string. This should only be converted from a string when the string already is in punycode, otherwise use FromString.

func FromString

func FromString(s string) (Domain, error)

FromString creates a Domain from a string, converting it to punycode.

func (Domain) PunycodeString added in v0.40.0

func (d Domain) PunycodeString() string

PunycodeString returns the punycode representation of the Domain. This should only be used if a punycode domain is expected but only a string is supported.

func (Domain) SafeString

func (d Domain) SafeString() string

SafeString converts the Domain to a non-punycode string, falling back to the punycode string if conversion fails.

func (Domain) String

func (d Domain) String() (string, error)

String converts the Domain to a non-punycode string. For an infallible conversion, use SafeString.

type List

type List []Domain

List is a slice of punycode-encoded domain strings.

func FromPunycodeList

func FromPunycodeList(s []string) List

FromPunycodeList creates a List from a slice of Punycode-encoded domain strings.

func FromStringList

func FromStringList(s []string) (List, error)

FromStringList creates a DomainList from a slice of string.

func ValidateDomains added in v0.37.0

func ValidateDomains(domains []string) (List, error)

ValidateDomains checks if each domain in the list is valid and returns a punycode-encoded DomainList.

func (List) Equal added in v0.38.0

func (d List) Equal(domains List) bool

func (List) PunycodeString

func (d List) PunycodeString() string

PunycodeString converts the List to a comma-separated string of Punycode-encoded domains.

func (List) SafeString

func (d List) SafeString() string

SafeString converts List to a comma-separated non-punycode string. If a domain cannot be converted, the original string is used.

func (List) String

func (d List) String() (string, error)

String converts List to a comma-separated string.

func (List) ToPunycodeList

func (d List) ToPunycodeList() []string

ToPunycodeList converts the List to a slice of Punycode-encoded domain strings.

func (List) ToSafeStringList

func (d List) ToSafeStringList() []string

ToSafeStringList converts the List to a slice of non-punycode strings. If a domain cannot be converted, the original string is used.

func (List) ToStringList

func (d List) ToStringList() ([]string, error)

ToStringList converts a List to a slice of string.

Jump to

Keyboard shortcuts

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