Help us shape the future of Go! Take the 2026 Go Developer Survey

hostpattern

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hostpattern implements the hostname-pattern language shared by inventory resolution and Writ host selectors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(raw, name string) bool

Match validates raw and matches name. It is intended for compiled policy values; malformed patterns fail closed.

func NormalizeName added in v0.30.0

func NormalizeName(s string) string

NormalizeName applies ASCII case folding at host ingress boundaries.

Types

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

Pattern is a validated, anchored hostname pattern. Dots are label separators: * and ? stay within one label, while ** is legal only as a complete label and crosses zero or more labels.

func Parse

func Parse(raw string) (Pattern, error)

Parse validates raw against Epithet's deliberately small hostname-pattern language. In particular, it rejects the additional syntax understood by the doublestar matching engine so a dependency change cannot silently broaden a policy or inventory entry.

func (Pattern) Match

func (p Pattern) Match(name string) bool

Match reports whether name matches the complete pattern. A slash is never a valid hostname label character here because it is the internal separator used to give doublestar DNS-label semantics.

func (Pattern) String

func (p Pattern) String() string

String returns the pattern as authored.

Jump to

Keyboard shortcuts

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