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

hostid

package
v0.22.0-test3 Latest Latest
Warning

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

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

Documentation

Overview

Package hostid defines Epithet's stable, non-secret host identifiers.

Index

Constants

View Source
const (
	// SchemeV1 identifies the first host-ID representation. It is part of the
	// canonical text stored on hosts and copied into inventory.
	SchemeV1 = "epithet-host-v1"
)

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the native system-wide host-ID path for this operating system. Callers may offer an explicit override for other layouts.

Types

type ID

type ID string

ID is a canonical Epithet host identifier. It identifies a logical host but is neither secret nor an authentication credential.

func EnsureFile

func EnsureFile(path string) (id ID, created bool, err error)

EnsureFile returns the existing canonical host ID at path or creates a new one. It never replaces an existing directory entry. The parent directory must already exist with its final ownership and permissions.

func Generate

func Generate() (ID, error)

Generate returns a new v1 host ID with 256 bits of operating-system randomness.

func Parse

func Parse(value string) (ID, error)

Parse validates canonical v1 host-ID text.

func ReadFile

func ReadFile(path string) (ID, error)

ReadFile reads one canonical host ID. A file may omit its final newline or contain exactly one; all other surrounding whitespace and additional lines are rejected.

func (ID) MarshalText

func (id ID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (ID) String

func (id ID) String() string

String returns the canonical external representation of id.

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (ID) Validate

func (id ID) Validate() error

Validate reports whether id is a canonical host ID.

Jump to

Keyboard shortcuts

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