hostnames

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstDotSuffix

func FirstDotSuffix(host string) (string, bool)

FirstDotSuffix returns the suffix of a hostname starting from the first dot, e.g., "a.example.com" -> ".example.com". Returns false if there is no dot.

func IsValidWildcard

func IsValidWildcard(pattern string) bool

IsValidWildcard returns true if the pattern is a single-label wildcard and the part after "*." contains at least two labels (e.g., "example.com"). This intentionally rejects broad patterns like "*.com".

func IsWildcard

func IsWildcard(pattern string) bool

IsWildcard returns true if the pattern begins with a single-label wildcard ("*.").

func Normalize

func Normalize(host string) string

Normalize converts a hostname to its canonical ASCII lower-case form. - Trims spaces - Drops a trailing dot - Applies IDNA Lookup ToASCII mapping - Lower-cases the result

func NormalizeOrWildcard

func NormalizeOrWildcard(host string) string

NormalizeOrWildcard behaves like Normalize but preserves a leading single-label wildcard pattern "*." if present.

func WildcardSuffix

func WildcardSuffix(pattern string) (string, bool)

WildcardSuffix returns the canonical suffix (including the leading dot), e.g., for "*.example.com" it returns ".example.com". The boolean is false if the pattern is not a valid single-label wildcard.

Types

This section is empty.

Jump to

Keyboard shortcuts

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