normalization

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package normalization validates and canonicalizes user-provided domain names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrimSpace

func TrimSpace(str string) string

TrimSpace removes leading and trailing whitespace characters defined by the spec.

Types

type Error

type Error struct {
	// Tag is the stable normalization error code.
	Tag string
	// Params contains interpolation values for the error message template.
	Params map[string]string
}

Error represents one domain-normalization validation issue.

func NewError

func NewError(tag string, params map[string]string) (Error, error)

NewError builds an Error from a known tag and required parameters.

func NormalizeLabel

func NormalizeLabel(label string) ([]Error, string)

NormalizeLabel normalizes a single label and returns errors and the A-label.

func NormalizeName

func NormalizeName(name string) ([]Error, string)

NormalizeName normalizes a domain name and returns errors and the normalized name.

func (Error) Message

func (e Error) Message() string

Message returns the human-readable message for the normalization error.

func (Error) String

func (e Error) String() string

String implements fmt.Stringer using Message().

Jump to

Keyboard shortcuts

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