Documentation
¶
Overview ¶
Package security is the public re-export of lablink's TLS and shared-secret helpers, so external callers (for example github.com/nijosmsft/gokd) can resolve the same transport configuration and auth token as LabLinkServer.
Index ¶
- Constants
- func AllowInsecure(flagValue bool) (bool, error)
- func FirstNonEmpty(values ...string) string
- func FirstPresentEnv(names ...string) string
- func ResolveToken(explicitValue, explicitFile string, envValueNames, envFileNames []string) (string, string, error)
- type ClientTransportConfig
- type TransportMode
Constants ¶
const ( // TransportModeMTLS denotes mTLS gRPC transport. TransportModeMTLS = internal.TransportModeMTLS // TransportModeInsecure denotes the legacy plaintext transport. TransportModeInsecure = internal.TransportModeInsecure )
Variables ¶
This section is empty.
Functions ¶
func AllowInsecure ¶
AllowInsecure returns whether the legacy plaintext gRPC transport is permitted, given an explicit flag value and the LABLINK_ALLOW_INSECURE env var.
func FirstNonEmpty ¶
FirstNonEmpty returns the first non-empty string from values.
func FirstPresentEnv ¶
FirstPresentEnv returns the value of the first environment variable in names that is set and non-empty, or "" if none are.
func ResolveToken ¶
func ResolveToken(explicitValue, explicitFile string, envValueNames, envFileNames []string) (string, string, error)
ResolveToken resolves the shared agent auth token from explicit values, explicit files, environment variables, or environment-pointed files.
envValueNames lists env vars that may hold the literal token value. envFileNames lists env vars that may hold a path to a file containing the token. Returns the token plus a human-readable description of where it came from.
Types ¶
type ClientTransportConfig ¶
type ClientTransportConfig = internal.ClientTransportConfig
ClientTransportConfig re-exports the internal client TLS configuration.
func ResolveClientTransport ¶
func ResolveClientTransport(modeValue string, allowInsecure bool, caCertPath, certPath, keyPath, serverName string) (ClientTransportConfig, error)
ResolveClientTransport resolves the client TLS configuration from command-line / env inputs, mirroring how LabLinkServer initializes its pool.
type TransportMode ¶
type TransportMode = internal.TransportMode
TransportMode re-exports the internal TransportMode enum (mtls / insecure).