utils

package
v0.0.0-...-720764a Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger *logger.Logger

	LogLevelMap = map[string]int{
		"debug":    100,
		"info":     200,
		"notice":   300,
		"warning":  400,
		"error":    500,
		"critical": 502,
		"alert":    509,
	}
)

Functions

func ArePortsReachable

func ArePortsReachable(ip string, ports ...string) error

func CheckIfPathExist

func CheckIfPathExist(path string) bool

func CheckIfServiceIsInstalled

func CheckIfServiceIsInstalled(serv string) (bool, error)

func CreateLinuxService

func CreateLinuxService(serviceName string, execStart string) error

func CreatePathIfNotExist

func CreatePathIfNotExist(path string) error

func DownloadFile

func DownloadFile(url string, headers map[string]string, fileName string, path string, skipTlsVerification bool) error

func Execute

func Execute(c string, dir string, arg ...string) error

func GenerateKey

func GenerateKey(baseKey string) ([]byte, error)

func GenerateKeyByUUID

func GenerateKeyByUUID(baseKey string, uuid string) ([]byte, error)

func GetHostAliases

func GetHostAliases(hostname string) ([]string, error)

func GetIPAddress

func GetIPAddress() (string, error)

func GetMyPath

func GetMyPath() string

func IncrementReconnectDelay

func IncrementReconnectDelay(delay time.Duration, maxReconnectDelay time.Duration) time.Duration

func InitLogger

func InitLogger(filename string)

func PrintBanner

func PrintBanner()

func ReadJson

func ReadJson(fileName string, data interface{}) error

func ReadYAML

func ReadYAML(path string, result interface{}) error

func StopService

func StopService(name string) error

func UninstallService

func UninstallService(name string) error

func WriteJSON

func WriteJSON(path string, data interface{}) error

func WriteSecretStringToFile

func WriteSecretStringToFile(fileName string, body string) error

WriteSecretStringToFile writes a file that holds credential material: 0600, re-applied on every write so a file created before this existed does not keep its old world-readable mode.

func WriteSecretYAML

func WriteSecretYAML(url string, data interface{}) error

WriteSecretYAML is WriteYAML for files that hold credential material.

func WriteStringToFile

func WriteStringToFile(fileName string, body string) error

func WriteYAML

func WriteYAML(url string, data interface{}) error

Types

type LogLevels

type LogLevels struct {
	Level string `yaml:"level"`
}

type OSInfo

type OSInfo struct {
	Hostname       string
	OsType         string
	Platform       string
	CurrentUser    string
	Mac            string
	OsMajorVersion string
	OsMinorVersion string
	Aliases        string
	Addresses      string
}

func GetOsInfo

func GetOsInfo() (OSInfo, error)

Jump to

Keyboard shortcuts

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