utils

package
v0.0.0-...-65751db Latest Latest
Warning

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

Go to latest
Published: Nov 11, 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 CheckIfServiceIsActive

func CheckIfServiceIsActive(serv string) (bool, error)

func CheckIfServiceIsInstalled

func CheckIfServiceIsInstalled(serv string) (bool, error)

func CreateLinuxService

func CreateLinuxService(serviceName string, execStart string) error

func DecryptAES

func DecryptAES(ciphertext, baseKey, uuid string) (string, error)

DecryptAES decrypts ciphertext using AES with a key derived from baseKey and uuid.

func EncryptAES

func EncryptAES(plaintext, baseKey, uuid string) (string, error)

EncryptAES encrypts plaintext using AES with a key derived from baseKey and uuid.

func ExecuteWithResult

func ExecuteWithResult(c string, dir string, arg ...string) (string, bool)

func ExecuteWithResultRaw

func ExecuteWithResultRaw(c string, dir string, arg ...string) (string, bool)

ExecuteWithResultRaw passes the command line to the shell unescaped on Windows, because Go's default quoting adds backslashes that cmd.exe rejects.

func GenerateKeyByUUID

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

GenerateKeyByUUID generates an AES key from baseKey and uuid.

func GetHostAliases

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

func GetIPAddress

func GetIPAddress() (string, error)

func IncrementReconnectDelay

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

func InitLogger

func InitLogger(filename string)

func PrintBanner

func PrintBanner()

func StartService

func StartService(name string) error

func StopService

func StopService(name string) error

func UninstallService

func UninstallService(name string) 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