Documentation ¶
Index ¶
- type InfoObject
- type MemObject
- type ShutdownCallback
- type SysHelper
- func (instance *SysHelper) FindCurrentProcess() (*os.Process, error)
- func (instance *SysHelper) GetInfo() *InfoObject
- func (instance *SysHelper) GetOS() string
- func (instance *SysHelper) GetOSVersion() string
- func (instance *SysHelper) GracefulShutdownBackground(actions map[string]ShutdownCallback, logger gg_.ILogger) chan struct{}
- func (instance *SysHelper) GracefulShutdownWithContext(ctx context.Context, timeout time.Duration, ...) chan struct{}
- func (instance *SysHelper) ID() (string, error)
- func (instance *SysHelper) IsLinux() bool
- func (instance *SysHelper) IsMac() bool
- func (instance *SysHelper) IsWindows() bool
- func (instance *SysHelper) KillCurrentProcess() error
- func (instance *SysHelper) KillProcessByPid(pid int) error
- func (instance *SysHelper) OnSignal(callback func(s os.Signal), signals ...os.Signal) (err error)
- func (instance *SysHelper) ProtectedID(appID string) (string, error)
- func (instance *SysHelper) Shutdown(a ...string) error
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
type ShutdownCallback ¶
type SysHelper ¶
type SysHelper struct { }
var Sys *SysHelper
func (*SysHelper) FindCurrentProcess ¶
func (*SysHelper) GetInfo ¶
func (instance *SysHelper) GetInfo() *InfoObject
func (*SysHelper) GetOSVersion ¶
func (*SysHelper) GracefulShutdownBackground ¶
func (instance *SysHelper) GracefulShutdownBackground(actions map[string]ShutdownCallback, logger gg_.ILogger) chan struct{}
func (*SysHelper) GracefulShutdownWithContext ¶
func (*SysHelper) ID ¶
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) KillCurrentProcess ¶
func (*SysHelper) KillProcessByPid ¶
func (*SysHelper) ProtectedID ¶
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
Click to show internal directories.
Click to hide internal directories.