utils

package
v1.24.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCast = errors.New("unable to cast")

Functions

func CastToSlice

func CastToSlice[T any](tokenGroups any) ([]T, error)

func LookupGroup added in v1.16.0

func LookupGroup(groupName string) (int, error)

LookupGroup returns the numeric gid for groupName. It accepts either a numeric string or a system group name and returns an error if the group cannot be resolved.

func StringConcat added in v1.6.0

func StringConcat(strs ...string) string

StringConcat concatenates all provided strings and returns the result. It avoids intermediate allocations by using a strings.Builder.

func TransformCommonName added in v1.12.0

func TransformCommonName(mode config.OpenVPNCommonNameMode, commonName string) string

TransformCommonName returns the common name according to the provided mode. If mode is CommonNameModePlain the original name is returned, otherwise CommonNameModeOmitValue is returned.

Types

type OverlayFS added in v1.20.0

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

func NewOverlayFS added in v1.20.0

func NewOverlayFS(root, over fs.FS) *OverlayFS

NewOverlayFS creates a filesystem that overlays the provided overlay over the base root filesystem. Files present in the overlay take precedence over files in the root.

func (*OverlayFS) Open added in v1.20.0

func (f *OverlayFS) Open(name string) (fs.File, error)

type UserAgentTransport added in v1.13.0

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

func NewUserAgentTransport added in v1.13.0

func NewUserAgentTransport(rt http.RoundTripper) *UserAgentTransport

NewUserAgentTransport returns a transport that sets a default User-Agent header for all requests. If rt is nil the http.DefaultTransport is used.

func (*UserAgentTransport) RoundTrip added in v1.13.0

func (adt *UserAgentTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper, adding the User-Agent header before delegating to the wrapped RoundTripper.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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