domain

package
v0.65.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidDomain added in v0.64.3

func IsValidDomain(domain string) bool

IsValidDomain checks if a single domain string is valid. Does not convert unicode to punycode - domain must already be ASCII/punycode. Allows wildcard prefix (*.example.com).

func IsValidDomainNoWildcard added in v0.64.3

func IsValidDomainNoWildcard(domain string) bool

IsValidDomainNoWildcard checks if a single domain string is valid without wildcard prefix. Use for zone domains and CNAME targets where wildcards are not allowed.

func ValidateDomainsList

func ValidateDomainsList(domains []string) error

ValidateDomainsList validates domains without punycode conversion. Use this for domains that must already be in ASCII/punycode format (e.g., extra DNS labels). Unlike ValidateDomains, this does not convert unicode to punycode - unicode domains will fail. Allows wildcard prefix (*.example.com). Maximum 32 domains.

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

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

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

ValidateDomains validates domains and converts unicode to punycode. Allows wildcard prefix (*.example.com). Maximum 32 domains.

func (List) Equal

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