names

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NormalizedPrefix is added to device names that had to be encoded
	// because their original interface name was not DNS-1123 compliant.
	NormalizedPrefix = "normalized-"
)

Variables

This section is empty.

Functions

func GetOriginalName

func GetOriginalName(deviceName string) string

GetOriginalName retrieves the original interface name from a deviceName. If deviceName was prefixed with NormalizedPrefix (indicating it was encoded), it decodes the name. Otherwise, it assumes deviceName is the original name.

func SetDeviceName

func SetDeviceName(ifName string) string

SetDeviceName determines the appropriate name for a device in Kubernetes. If the original interface name (ifName) is already a valid DNS-1123 label, it's returned as is. Otherwise, it's encoded using Base32, prefixed with NormalizedPrefix, and returned. Linux interface names (often limited by IFNAMSIZ, typically 16) plus the base32 encoding and the normalized prefix (11) are within the DNS-1123 label, which has a maximum length of 63.

Types

This section is empty.

Jump to

Keyboard shortcuts

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