system

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: Zlib Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	IptUnk  = IPType(0)
	IptPub  = IPType(1)
	IptPriA = IPType(2)
	IptPriB = IPType(3)
	IptPriC = IPType(4)
)
View Source
const GB = 1024 * 1024 * 1024

Variables

View Source
var (
	ResolveIp = net.IP{}
	PublicIp  = net.IP{}
)

Functions

func CmdStart added in v1.0.58

func CmdStart(cmd *exec.Cmd, conf *Config, env ...string) (*exec.Cmd, error)

func GetPublicIP added in v0.5.39

func GetPublicIP() (net.IP, error)

func GetResolveIP added in v0.5.39

func GetResolveIP() (net.IP, error)

func GetResolveIPV2 added in v0.5.39

func GetResolveIPV2() (net.IP, error)

func IPEqualSelf

func IPEqualSelf(ip string) string

func Info

func Info() string

func IsPublicIP

func IsPublicIP(IP net.IP) bool

func PublicIPValid added in v0.7.0

func PublicIPValid() bool

func Quit

func Quit()

func Run added in v0.2.3

func Run()

func SelfPubIP

func SelfPubIP() string

func Shell added in v1.0.58

func Shell(args []string, config Config, env ...string) (*exec.Cmd, error)

func StripArgs added in v1.0.58

func StripArgs(args []string, arg string) []string

Types

type Chan

type Chan struct {
	S chan os.Signal
}

func Exit added in v0.2.7

func Exit() *Chan

type Config added in v1.0.58

type Config struct {
	Stdin     io.Reader
	Stdout    io.Writer
	Stderr    io.Writer
	EnableStd bool `json:"enableStd" yaml:"enableStd" xml:"enableStd"`
	EnableEnv bool `json:"enableEnv" yaml:"enableEnv" xml:"enableEnv"`
}

type CpuInfo added in v1.0.16

type CpuInfo struct {
	User   float64 `json:"user"`
	System float64 `json:"system"`
	Idle   float64 `json:"idle"`
	Nice   float64 `json:"nice"`
}

func Cpu added in v1.0.0

func Cpu() CpuInfo

type DiskPath added in v1.0.16

type DiskPath struct {
	Path        string  `json:"path,omitempty"`
	Total       uint64  `json:"total"`
	Free        uint64  `json:"free"`
	Used        uint64  `json:"used"`
	UsedPercent float64 `json:"usedPercent"`
}

func Disk added in v1.0.0

func Disk() DiskPath

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event represents a one-time event that may occur in the future.

func NewEvent

func NewEvent() *Event

NewEvent returns a new, ready-to-use Event.

func (*Event) Done

func (e *Event) Done() <-chan struct{}

Done returns a channel that will be closed when Fire is called.

func (*Event) Fire

func (e *Event) Fire() bool

Fire causes e to complete. It is safe to call multiple times, and concurrently. It returns true iff this call to Fire caused the signaling channel returned by Done to close.

func (*Event) HasFired

func (e *Event) HasFired() bool

HasFired returns true if Fire has been called.

type ExecResult added in v1.0.58

type ExecResult struct {
	Command   string
	Result    string
	Err       error
	StartTime time.Time
	EndTime   time.Time
}

func CmdRun added in v1.0.58

func CmdRun(cmd string, timeout int) ExecResult

func ShellRun added in v1.0.58

func ShellRun(cmd string) ExecResult

func (ExecResult) Error added in v1.0.58

func (r ExecResult) Error() string

type IPType

type IPType int8

func GetIPType

func GetIPType(IP net.IP) IPType

type MemInfo added in v1.0.0

type MemInfo struct {
	// Total amount of RAM on this system
	Total uint64 `json:"total"`

	// RAM available for programs to allocate
	//
	// This value is computed from the kernel specific values.
	Available uint64 `json:"available"`

	// RAM used by programs
	//
	// This value is computed from the kernel specific values.
	Used uint64 `json:"used"`

	// Percentage of RAM used by programs
	//
	// This value is computed from the kernel specific values.
	UsedPercent float64 `json:"usedPercent"`
}

func Mem added in v1.0.0

func Mem() MemInfo

Jump to

Keyboard shortcuts

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