utils

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateExcl

func CreateExcl(path string, perm os.FileMode) (*os.File, error)

CreateExcl creates a new file at the given path with the specified permissions, failing if the file exists or if the path is a symbolic or hard link.

func CreateNoLinks(path string, perm os.FileMode) (*os.File, error)

CreateNoLinks creates or truncates the file at the given path with the specified permissions, failing if the path is a symbolic or hard link.

func GetAuthConfig

func GetAuthConfig(_ context.Context, optionalCert *x509.Certificate) (*tls.Config, error)

GetAuthConfig returns a TLS configuration for secure communication with the server.

func GetAuthContext

func GetAuthContext(ctx context.Context, tokenPath string) context.Context

GetAuthContext creates a new context with an authorization header.

func GetPerRPCCreds

func GetPerRPCCreds(tokenPath string) oauth.TokenSource

GetPerRPCCreds returns a PerRPCCredentials object that can be used for gRPC authentication.

func NoNullByteString

func NoNullByteString(s string) bool

NoNullByteString checks if the provided string does not contain any null bytes.

func NoNullByteURL

func NoNullByteURL(u string) bool

NoNullByteURL checks if the provided URL string does not contain any null bytes.

func OpenNoLinks(path string) (*os.File, error)

OpenNoLinks opens the file at the given path for reading, failing if the path is a symbolic or hard link.

func ReadFileNoLinks(path string) ([]byte, error)

ReadFileNoLinks reads and returns the contents of the file at the given path, failing if the path is a symbolic or hard link.

Types

This section is empty.

Jump to

Keyboard shortcuts

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