Documentation
¶
Index ¶
- Variables
- func CheckLabels(groups, tags []string, labels map[string]string) error
- func ConnAddrKey(c *store.Conn) string
- func ConnFamily(c *store.Conn) string
- func ExpandHome(p string) string
- func HasControl(s string) bool
- func LookupIPs(ctx context.Context, host string) []string
- func MapURLSecretRefs(rawURL string, fn func(opt, name string) string) string
- func NameTaken(kind, name string) error
- func NormAddr(a string) string
- func ProtectedUsers(st *store.State, users []string) []string
- func RenameSecretRefs(st *store.State, from, to string) []string
- func SecretUsers(st *store.State, name string) []string
- func ValidLabelName(kind, n string) error
- func ValidName(kind, n string) error
- func ValidPort(p int) error
- func ValidUser(u string) error
- func ViaChain(via string) []string
- func WaySteps(s *store.State, via string, seen map[string]bool) []string
- type URLSecretRef
Constants ¶
This section is empty.
Variables ¶
var LookupHost = net.DefaultResolver.LookupHost
LookupHost is the resolver (tests replace it).
var NameRe = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$`)
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 ¶
CheckLabels validates the groups, tags and labels of an inventory entry.
func ConnAddrKey ¶
ConnAddrKey is what makes two conns the same resource (as in protectedConn): the file, the bucket, or the family and address.
func ConnFamily ¶
ConnFamily is the command a conn works with: db, cache or storage.
func ExpandHome ¶
func HasControl ¶
func MapURLSecretRefs ¶
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 NormAddr ¶
NormAddr is a host name the way DNS compares it: lower case, without the root dot ("Target." is "target") or IPv6 brackets.
func ProtectedUsers ¶
ProtectedUsers are the protected servers, conns and VPNs among users.
func RenameSecretRefs ¶
RenameSecretRefs points every reference to credential:from at credential:to and returns what it changed.
func SecretUsers ¶
SecretUsers lists the servers, conns, keys and VPNs whose references point at the vault secret name.
func ValidLabelName ¶
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).
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.