utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChmodAndChownRecursively

func ChmodAndChownRecursively(logger *logrus.Entry, path string, uid int, gid int, mode os.FileMode) error

func ChmodIfUnmatched

func ChmodIfUnmatched(logger *logrus.Entry, path string, stat fs.FileInfo, desiredPerm fs.FileMode) error
func CleanupNotExistingSymlinks(logger *logrus.Entry, path string) error

func ExecuteCommand

func ExecuteCommand(logger *logrus.Entry, cmd *exec.Cmd, secrets []string) error

func ExecuteCommandWithAllOutput

func ExecuteCommandWithAllOutput(logger *logrus.Entry, cmd *exec.Cmd, secrets []string) (*bytes.Buffer, *bytes.Buffer, error)

func ExecuteCommandWithOutput

func ExecuteCommandWithOutput(logger *logrus.Entry, cmd *exec.Cmd, secrets []string) (*bytes.Buffer, error)

func IsPermModeMatched

func IsPermModeMatched(stat fs.FileInfo, desiredPerm fs.FileMode) bool
func IsSymlink(fi os.FileInfo) bool

func NewObscuredOutputWriter

func NewObscuredOutputWriter(wrappedWriter io.Writer, secrets []string) (*bytes.Buffer, io.Writer)

func NewWrappedOutputWriter

func NewWrappedOutputWriter(wrappedWriter io.Writer) (*bytes.Buffer, io.Writer)

func ObscureString

func ObscureString(str string, secrets []string) string

func RandBytes

func RandBytes(length ...int) ([]byte, error)

RandBytes generates bytes according to the given length, defaults to 32.

func RandomHashString

func RandomHashString(length ...int) string

RandomHashString generates a random SHA256 string with the maximum length of 64.

func RandomInt64

func RandomInt64(upper ...int64) int64

RandomInt64 generates a random integer.

func RedirectCmdWithObscureOutputWriter

func RedirectCmdWithObscureOutputWriter(cmd *exec.Cmd, secrets []string) (*bytes.Buffer, *bytes.Buffer)

Types

type ObscuredWriter

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

func NewObscuredWriter

func NewObscuredWriter(wrappedWriter io.Writer, secrets []string) *ObscuredWriter

func (*ObscuredWriter) Write

func (w *ObscuredWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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