gg_sys

package
v0.2.51 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InfoObject

type InfoObject struct {
	GoOS        string `json:"goos"`
	Kernel      string `json:"kernel"`
	Core        string `json:"core"`
	Platform    string `json:"platform"`
	OS          string `json:"os"`
	Hostname    string `json:"hostname"`
	CPUs        int    `json:"cpus"`
	MemoryUsage string `json:"memory_usage"`
}

func (*InfoObject) ToJsonString

func (instance *InfoObject) ToJsonString() string

func (*InfoObject) ToString

func (instance *InfoObject) ToString() string

func (*InfoObject) VarDump

func (instance *InfoObject) VarDump()

type MemObject

type MemObject struct {
	Alloc      uint64 `json:"alloc"`
	TotalAlloc uint64 `json:"total_alloc"`
	Sys        uint64 `json:"sys"`
	NumGC      uint32 `json:"num_gc"`
	HeapSys    uint64 `json:"heap_sys"`
}

func NewMemoryUsageInfo

func NewMemoryUsageInfo() *MemObject

func (*MemObject) String

func (instance *MemObject) String() string

func (*MemObject) ToString

func (instance *MemObject) ToString() string

type ShutdownCallback

type ShutdownCallback func(ctx context.Context) error

type SysHelper

type SysHelper struct {
}
var Sys *SysHelper

func (*SysHelper) FindCurrentProcess

func (instance *SysHelper) FindCurrentProcess() (*os.Process, error)

func (*SysHelper) GetInfo

func (instance *SysHelper) GetInfo() *InfoObject

func (*SysHelper) GetOS

func (instance *SysHelper) GetOS() string

func (*SysHelper) GetOSVersion

func (instance *SysHelper) GetOSVersion() string

func (*SysHelper) GracefulShutdownBackground

func (instance *SysHelper) GracefulShutdownBackground(actions map[string]ShutdownCallback, logger gg_.ILogger) chan struct{}

func (*SysHelper) GracefulShutdownWithContext

func (instance *SysHelper) GracefulShutdownWithContext(ctx context.Context, timeout time.Duration, actions map[string]ShutdownCallback, logger gg_.ILogger) chan struct{}

func (*SysHelper) ID

func (instance *SysHelper) ID() (string, error)

ID returns the platform specific machine id of the current host OS. Regard the returned id as "confidential" and consider using ProtectedID() instead. THANKS TO: github.com/denisbrodbeck/machineid

func (*SysHelper) IsLinux

func (instance *SysHelper) IsLinux() bool

func (*SysHelper) IsMac

func (instance *SysHelper) IsMac() bool

func (*SysHelper) IsWindows

func (instance *SysHelper) IsWindows() bool

func (*SysHelper) KillCurrentProcess

func (instance *SysHelper) KillCurrentProcess() error

func (*SysHelper) KillProcessByPid

func (instance *SysHelper) KillProcessByPid(pid int) error

func (*SysHelper) OnSignal

func (instance *SysHelper) OnSignal(callback func(s os.Signal), signals ...os.Signal) (err error)

func (*SysHelper) ProtectedID

func (instance *SysHelper) ProtectedID(appID string) (string, error)

ProtectedID returns a hashed version of the machine ID in a cryptographically secure way, using a fixed, application-specific key. Internally, this function calculates HMAC-SHA256 of the application ID, keyed by the machine ID. THANKS TO: github.com/denisbrodbeck/machineid

func (*SysHelper) Shutdown

func (instance *SysHelper) Shutdown(a ...string) error

Shutdown the machine

Jump to

Keyboard shortcuts

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