Documentation
¶
Overview ¶
Package dnslabel converts arbitrary strings into DNS-safe label format (RFC 1123). It has no dependencies on the CEL or Go template engines so it can be shared by both without creating an import cycle.
Index ¶
Constants ¶
View Source
const MaxLabelLength = 63
MaxLabelLength is the maximum length of a DNS label per RFC 1123.
Variables ¶
This section is empty.
Functions ¶
func Slugify ¶
Slugify converts an arbitrary string into a DNS-safe label (RFC 1123).
The transformation:
- Converts to lowercase
- Replaces any character not in [a-z0-9-] with a hyphen
- Collapses consecutive hyphens into a single hyphen
- Strips leading and trailing hyphens
- Truncates to 63 characters (the DNS label limit)
- Strips any trailing hyphen introduced by truncation
Returns an empty string if the input is empty or contains no valid characters.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.