utils

package
v0.0.0-...-0eb8750 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const FilePathPresumedToBeStdin = "-"
View Source
const FilePathThatIsStdin = "/dev/stdin"

Variables

This section is empty.

Functions

func DiffSets

func DiffSets(lhs, rhs map[string]interface{}) (map[string]interface{}, map[string]interface{})

returns: (added, removed) added is those in lhs but not rhs, removed is those in rhs but not lhs

func DockerCliFromCtx

func DockerCliFromCtx(ctx context.Context) (*client.Client, error)

func FetchHTTPConfig

func FetchHTTPConfig(url string, tlsConfig *tls.Config, username, password string) (io.Reader, error)

FetchHTTPConfig fetches configuration from an HTTP(S) endpoint

func FetchHTTPConfigReadCloser

func FetchHTTPConfigReadCloser(url string, tlsConfig *tls.Config, username, password string) (io.ReadCloser, error)

FetchHTTPConfig fetches configuration from an HTTP(S) endpoint

func GetStatefulDir

func GetStatefulDir(ctx context.Context) string

func GetTLSConfig

func GetTLSConfig(caCertPath, clientCertPath, clientKeyPath string) (*tls.Config, error)

GetTLSConfig creates a TLS configuration from the provided certificate files

func IsIPNetListNotEqu

func IsIPNetListNotEqu(lhs, rhs []net.IPNet) bool

func IsUDPAddrNotEqu

func IsUDPAddrNotEqu(spec, curr *net.UDPAddr) bool

func NewURLReader

func NewURLReader(url string, options *URLReaderTransportOptions) (io.ReadCloser, error)

func NormalizeContainerName

func NormalizeContainerName(containerName string) string

func ResolvePath

func ResolvePath(path string) string

func ServiceNameFromCtx

func ServiceNameFromCtx(ctx context.Context) (string, error)

func SetClientAuthInCtx

func SetClientAuthInCtx(ctx context.Context, clientAuth *ClientAuth) context.Context

func SetDockerCliInCtx

func SetDockerCliInCtx(ctx context.Context, cli *client.Client) context.Context

func SetServiceNameInCtx

func SetServiceNameInCtx(ctx context.Context, serviceName string) context.Context

func SetStatefulDirInCtx

func SetStatefulDirInCtx(ctx context.Context, statefulDir string) context.Context

func StatefulDirFromCtx

func StatefulDirFromCtx(ctx context.Context) (string, error)

Types

type ClientAuth

type ClientAuth struct {
	TLSClientCertFile     string
	TLSClientKeyFile      string
	TLSTrustedCACertFile  string
	HTTPBasicAuthUsername string
	HTTPBasicAuthPassword string
}

func ClientAuthFromCtx

func ClientAuthFromCtx(ctx context.Context) (*ClientAuth, error)

type CtxKey

type CtxKey string
const CtxKeyClientAuth CtxKey = "client_auth"

type URLReader

type URLReader struct {
	// contains filtered or unexported fields
}

A object of struct type URLReader is an implementation of io.ReadCloser, it is the responsibility of the caller to close the reader

func (*URLReader) Close

func (reader *URLReader) Close() error

func (*URLReader) Read

func (reader *URLReader) Read(p []byte) (n int, err error)

type URLReaderTransportOptions

type URLReaderTransportOptions struct {
	TLSConfig *tls.Config
	Username  string
	Password  string
}

Jump to

Keyboard shortcuts

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