utils

package
v0.14.12 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseTransport = &http.Transport{
	MaxIdleConns:        200,
	MaxIdleConnsPerHost: 20,
	IdleConnTimeout:     15 * time.Second,
	DisableKeepAlives:   false,
	DialContext: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	}).DialContext,
	TLSHandshakeTimeout:   10 * time.Second,
	TLSClientConfig:       &tls.Config{InsecureSkipVerify: true},
	ExpectContinueTimeout: 1 * time.Second,
}
View Source
var MountTransport = &http.Transport{
	MaxIdleConns:       0,
	DisableKeepAlives:  true,
	DisableCompression: false,
	IdleConnTimeout:    0,
	DialContext: (&net.Dialer{
		Timeout:   5 * time.Minute,
		KeepAlive: 0,
	}).DialContext,
	TLSHandshakeTimeout: 5 * time.Minute,
	TLSClientConfig: &tls.Config{
		InsecureSkipVerify: true,
	},
	ExpectContinueTimeout: 1 * time.Minute,
	WriteBufferSize:       0,
	ReadBufferSize:        0,
	ForceAttemptHTTP2:     false,
}

Functions

func CalculateDigest

func CalculateDigest(data any) (string, error)

func ClearIOStats added in v0.14.5

func ClearIOStats(pid int)

func ComputeDelay added in v0.14.6

func ComputeDelay() time.Duration

func DecodePath added in v0.8.0

func DecodePath(orig string) string

func DriveLetterPort

func DriveLetterPort(letter rune) (string, error)

func EncodePath added in v0.8.0

func EncodePath(path string) string

func GenerateKeyPair

func GenerateKeyPair(bitSize int) ([]byte, []byte, error)

func GeneratePublicKeyFromPrivateKey added in v0.3.2

func GeneratePublicKeyFromPrivateKey(encodedPrivateKey []byte) ([]byte, error)

func GetLocalIPs added in v0.7.0

func GetLocalIPs() ([]string, error)

func GetProcIO added in v0.14.0

func GetProcIO(pid int) (read, write int64, readSpeed, writeSpeed float64, err error)

func GetTaskLogPath added in v0.4.2

func GetTaskLogPath(upid string) string

func HashHostname added in v0.14.6

func HashHostname(host string) uint32

func HumanReadableBytes added in v0.14.0

func HumanReadableBytes(bytes int64) string

humanReadableBytes formats the given number of bytes into a human-readable string.

func HumanReadableSpeed added in v0.14.4

func HumanReadableSpeed(speed float64) string

func IsMounted added in v0.8.0

func IsMounted(path string) bool

func IsRequestFromSelf added in v0.7.0

func IsRequestFromSelf(r *http.Request) bool

func IsValid

func IsValid(path string) bool

func IsValidID added in v0.8.0

func IsValidID(id string) bool

func IsValidNamespace added in v0.4.0

func IsValidNamespace(namespace string) bool

func IsValidPathString added in v0.4.0

func IsValidPathString(path string) bool

func RandomHostname added in v0.14.6

func RandomHostname() string

randomHostname generates a pseudo-random string to use as a fallback hostname.

func Slugify added in v0.12.0

func Slugify(input string) string

func ValidateOnCalendar added in v0.8.0

func ValidateOnCalendar(value string) error

ValidateOnCalendar checks if a string is a valid systemd timer OnCalendar value

func ValidateTargetPath added in v0.8.0

func ValidateTargetPath(path string) bool

func WaitForLogFile added in v0.8.0

func WaitForLogFile(taskUpid string, maxWait time.Duration) error

Types

type DriveInfo added in v0.9.3

type DriveInfo struct {
	Letter     string `json:"letter"`
	Type       string `json:"type"`
	VolumeName string `json:"volume_name"`
	FileSystem string `json:"filesystem"`
	TotalBytes uint64 `json:"total_bytes"`
	UsedBytes  uint64 `json:"used_bytes"`
	FreeBytes  uint64 `json:"free_bytes"`
	Total      string `json:"total"`
	Used       string `json:"used"`
	Free       string `json:"free"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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