util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToReadBundleFile = errors.New("failed to read bundle file")
	ErrNoCertBundleFound      = errors.New("no ca bundle found")
	ErrFailedToCreateCertDir  = errors.New("failed to create cert dir")
	ErrFailedToWriteCertFile  = errors.New("failed to write cert file")
	ErrUnknownCertFileType    = errors.New("unknown cert file type")
)
View Source
var CaBundles = [][]string{
	{"/etc/ssl/certs/ca-certificates.crt"},
	{"/etc/pki/tls/certs/ca-bundle.crt", "/etc/pki/tls/certs/ca-extra.crt"},
	{"/etc/ssl/ca-bundle.pem"},
	{"/etc/pki/tls/cacert.pem"},
	{"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"},
	{"/etc/ssl/cert.pem"},
}

CaBundles paths on various systems, see https://go.dev/src/crypto/x509/root_linux.go

Functions

func CIDConfigDir

func CIDConfigDir() string

func CIDStateDir

func CIDStateDir() string

func ExportMachineCACertsToFile

func ExportMachineCACertsToFile(target string) error

ExportMachineCACertsToFile exports the machine CA certificates to a file

func GetCertFileByType

func GetCertFileByType(certFileType string) (string, error)

GetCertFileByType returns the cert file by type (ca-bundle, java-keystore)

func GetContainerUser

func GetContainerUser() string

GetContainerUser returns the user id and group id of the current user to mirror it in the container TODO: This is not working yet because of some issues, we still require root as of now

func GetStringOrDefault

func GetStringOrDefault(value string, defaultValue string) string

func MergeMaps

func MergeMaps(maps ...map[string]string) map[string]string

MergeMaps merges multiple maps into one

func RandomUUIDWithoutDashes

func RandomUUIDWithoutDashes() string

func RegexFormat

func RegexFormat(input string, regexExpr string, outputTemplate string) (string, error)

RegexFormat will evaluate a regex expr to render a template

func ResolveEnvMap

func ResolveEnvMap(env map[string]string) map[string]string

Types

This section is empty.

Jump to

Keyboard shortcuts

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