system

package
v1.0.45 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Zlib Imports: 13 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 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

Types

type Chan

type Chan struct {
	S chan os.Signal
}

func Exit added in v0.2.7

func Exit() *Chan

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 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