security

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 1 Imported by: 0

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

View Source
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

func AllowInsecure(flagValue bool) (bool, error)

AllowInsecure returns whether the legacy plaintext gRPC transport is permitted, given an explicit flag value and the LABLINK_ALLOW_INSECURE env var.

func FirstNonEmpty

func FirstNonEmpty(values ...string) string

FirstNonEmpty returns the first non-empty string from values.

func FirstPresentEnv

func FirstPresentEnv(names ...string) string

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).

Jump to

Keyboard shortcuts

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