inventory

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LookupHost = net.DefaultResolver.LookupHost

LookupHost is the resolver (tests replace it).

View Source
var NameRe = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$`)
View Source
var UserRe = regexp.MustCompile(`^[A-Za-z0-9_.][A-Za-z0-9_.@$-]{0,63}$`)

UserRe is a login name: what useradd, Active Directory (user@domain) and cloud images use. No spaces, no shell or URL characters.

Functions

func CheckLabels

func CheckLabels(groups, tags []string, labels map[string]string) error

CheckLabels validates the groups, tags and labels of an inventory entry.

func ConnAddrKey

func ConnAddrKey(c *store.Conn) string

ConnAddrKey is what makes two conns the same resource (as in protectedConn): the file, the bucket, or the family and address.

func ConnFamily

func ConnFamily(c *store.Conn) string

ConnFamily is the command a conn works with: db, cache or storage.

func ExpandHome

func ExpandHome(p string) string

func HasControl

func HasControl(s string) bool

func LookupIPs

func LookupIPs(ctx context.Context, host string) []string

LookupIPs resolves a name with a short timeout; an IP is itself.

func MapURLSecretRefs

func MapURLSecretRefs(rawURL string, fn func(opt, name string) string) string

MapURLSecretRefs calls fn for every query option of the URL whose value is credential:NAME and writes back the name fn returns; an empty name takes the option out of the URL. It splits the URL the way net/url does (the query runs from the first ? to the #) and edits the text in place, so options it does not change keep their order and their escaping. Secret names need no escaping (ValidName).

func NameTaken

func NameTaken(kind, name string) error

func NormAddr

func NormAddr(a string) string

NormAddr is a host name the way DNS compares it: lower case, without the root dot ("Target." is "target") or IPv6 brackets.

func ProtectedUsers

func ProtectedUsers(st *store.State, users []string) []string

ProtectedUsers are the protected servers, conns and VPNs among users.

func RenameSecretRefs

func RenameSecretRefs(st *store.State, from, to string) []string

RenameSecretRefs points every reference to credential:from at credential:to and returns what it changed.

func SecretUsers

func SecretUsers(st *store.State, name string) []string

SecretUsers lists the servers, conns, keys and VPNs whose references point at the vault secret name.

func ValidLabelName

func ValidLabelName(kind, n string) error

ValidLabelName checks a group or tag name, or a label key: the same rule as host names, so every one of them can be written in a selector (@GROUP, tag:TAG, label:KEY=VALUE).

func ValidName

func ValidName(kind, n string) error

func ValidPort

func ValidPort(p int) error

func ValidUser

func ValidUser(u string) error

func ViaChain

func ViaChain(via string) []string

ViaChain splits a --via value ("vpn1,bastion") into its steps.

func WaySteps

func WaySteps(s *store.State, via string, seen map[string]bool) []string

WaySteps are the names on a --via path and on the paths of its servers.

Types

type URLSecretRef

type URLSecretRef struct{ Option, Name string }

URLSecretRef is a conn URL option whose value is credential:NAME, such as the CA certificate of a registry: ?ca=credential:NAME.

func URLSecretRefs

func URLSecretRefs(rawURL string) []URLSecretRef

URLSecretRefs lists the options of a conn URL that name a vault secret, in the order they are written.

Jump to

Keyboard shortcuts

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