Versions in this module Expand all Collapse all v4 v4.0.2 Mar 11, 2024 v4.0.1 Feb 9, 2024 v4.0.0 Feb 8, 2024 Changes in this version + const MkdirFailErrRegexp + const NoSuchFileErrRegexp + const NoSuchUserErrRegexp + const OSDarwin + const OSDragonfly + const OSFreebsd + const OSLinux + const OSNacl + const OSNetbsd + const OSOpenbsd + const OSSolaris + const OSWindows + var CompatSalt = string([]byte{ ... }) + var Digits = []rune("0123456789") + var FastInsecureHash = false + var LowerAlpha = []rune("abcdefghijklmnopqrstuvwxyz") + var MinAgentPasswordLength = base64.StdEncoding.EncodedLen(randomPasswordBytes) + var OSUnix = []string + var UUIDSnippet = block1 + "-" + block2 + "-" + block3 + "-" + block4 + "-" + block5 + var UpperAlpha = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ") + func AgentPasswordHash(password string) string + func AtomicWriteFile(filename string, contents []byte, perms os.FileMode) (err error) + func AtomicWriteFileAndChange(filename string, contents []byte, change func(string) error) (err error) + func ChownPath(path, username string) error + func CommandString(args ...string) string + func ConformYAML(input interface{}) (interface{}, error) + func ContextWithDeadline(parent context.Context, clk clock.Clock, deadline time.Time) (context.Context, context.CancelFunc) + func ContextWithTimeout(parent context.Context, clk clock.Clock, timeout time.Duration) (context.Context, context.CancelFunc) + func CopyFile(dest, source string) error + func EnsureBaseDir(baseDir, path string) string + func EnvUsername() (string, error) + func ExpandPath(path string) (string, error) + func GetAddressForInterface(interfaceName string) (string, error) + func GetIPv4Address(addresses []net.Addr) (string, error) + func GetIPv6Address(addresses []net.Addr) (string, error) + func GetV4OrV6AddressForInterface(interfaceName string) (string, error) + func Gunzip(data []byte) ([]byte, error) + func Gzip(data []byte) []byte + func Home() string + func IsFileOwner(path, username string) (bool, error) + func IsRcPassthroughError(err error) bool + func IsUbuntu() bool + func IsValidUUIDString(s string) bool + func JoinServerPath(elem ...string) string + func LocalUsername() (string, error) + func MakeFileURL(in string) string + func MoveFile(source, destination string) (bool, error) + func NewMultiReaderSeeker(readers ...io.ReadSeeker) io.ReadSeeker + func NewRcPassthroughError(code int) error + func NormalizePath(dir string) (string, error) + func OSIsUnix(os string) bool + func OSUsername() (string, error) + func ParseSize(str string) (MB uint64, err error) + func RandomBytes(n int) ([]byte, error) + func RandomPassword() (string, error) + func RandomSalt() (string, error) + func RandomString(n int, validRunes []rune) string + func ReadFileSHA256(filename string) (string, int64, error) + func ReadSHA256(source io.Reader) (string, int64, error) + func ReadYaml(path string, obj interface{}) error + func RelativeURLPath(basePath, targPath string) (string, error) + func ReplaceFile(source, destination string) error + func ResolveSudo(username string) string + func ResolveUsername(resolveSudo func(string) string, usernameFuncs ...func() (string, error)) (string, error) + func RunCommand(command string, args ...string) (output string, err error) + func SetHome(s string) error + func Setenv(env []string, entry string) []string + func ShQuote(s string) string + func SortStringsNaturally(s []string) []string + func Timeit(action string) func() + func UniqueDirectory(path, name string) (string, error) + func UseMultipleCPUs() + func UserHomeDir(userName string) (hDir string, err error) + func UserPasswordHash(password string, salt string) string + func WinCmdQuote(s string) string + func WinPSQuote(s string) string + func WriteYaml(path string, obj interface{}) error + type Attempt struct + func (a *Attempt) HasNext() bool + func (a *Attempt) Next() bool + type AttemptStrategy struct + Delay time.Duration + Min int + Total time.Duration + func (s AttemptStrategy) Start() *Attempt + type BackoffTimer struct + func NewBackoffTimer(config BackoffTimerConfig) *BackoffTimer + func (t *BackoffTimer) Reset() + func (t *BackoffTimer) Start() + type BackoffTimerConfig struct + Clock clock.Clock + Factor int64 + Func func() + Jitter bool + Max time.Duration + Min time.Duration + type Countdown interface + Reset func() + Start func() + type Limiter interface + Acquire func() bool + AcquireWait func() + Release func() error + func NewLimiter(maxAllowed int) Limiter + func NewLimiterWithPause(maxAllowed int, minPause, maxPause time.Duration, clk clock.Clock) Limiter + type RcPassthroughError struct + Code int + func (e *RcPassthroughError) Error() string + type SizeReaderAt interface + Size func() int64 + func NewMultiReaderAt(parts ...SizeReaderAt) SizeReaderAt + type SizeTracker struct + func (st *SizeTracker) Write(data []byte) (n int, err error) + func (st SizeTracker) Size() int64 + type UUID [16]byte + func MustNewUUID() UUID + func NewUUID() (UUID, error) + func UUIDFromString(s string) (UUID, error) + func (uuid UUID) Copy() UUID + func (uuid UUID) Raw() [16]byte + func (uuid UUID) String() string Other modules containing this package github.com/juju/utils/v3