aghos

package
v0.107.0-b.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package aghos contains utilities for functions requiring system calls and other OS-specific APIs. OS-specific network handling should go to aghnet instead.

Index

Constants

View Source
const MaxCmdOutputSize = 2 * 1024

MaxCmdOutputSize is the maximum length of performed shell command output.

Variables

View Source
var NativeEndian = binary.LittleEndian

NativeEndian is the native endianness of this system.

Functions

func ConfigureSyslog

func ConfigureSyslog(serviceName string) error

ConfigureSyslog reroutes standard logger output to syslog.

func HaveAdminRights

func HaveAdminRights() (bool, error)

HaveAdminRights checks if the current user has root (administrator) rights.

func IsOpenWrt

func IsOpenWrt() (ok bool)

IsOpenWrt returns true if host OS is OpenWrt.

func RunCommand

func RunCommand(command string, arguments ...string) (int, string, error)

RunCommand runs shell command.

func SendProcessSignal

func SendProcessSignal(pid int, sig syscall.Signal) error

SendProcessSignal sends signal to a process.

func SetGroup added in v0.107.0

func SetGroup(groupName string) (err error)

SetGroup sets the effective group ID of the calling process.

func SetRlimit

func SetRlimit(val uint64) (err error)

SetRlimit sets user-specified limit of how many fd's we can use.

See https://github.com/AdguardTeam/AdGuardHome/internal/issues/659.

func SetUser added in v0.107.0

func SetUser(userName string) (err error)

SetUser sets the effective user ID of the calling process.

func Unsupported added in v0.107.0

func Unsupported(op string) (err error)

Unsupported is a helper that returns an *UnsupportedError with the Op field set to op and the OS field set to the current OS.

Types

type UnsupportedError added in v0.107.0

type UnsupportedError struct {
	Op string
	OS string
}

UnsupportedError is returned by functions and methods when a particular operation Op cannot be performed on the current OS.

func (*UnsupportedError) Error added in v0.107.0

func (err *UnsupportedError) Error() (msg string)

Error implements the error interface for *UnsupportedError.

Jump to

Keyboard shortcuts

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