device

package
v0.0.0-...-7f3e7ba Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2019 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package device provides access to hardware and system information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentIP

func CurrentIP() (ip string)

CurrentIP returns the device's current public IP address.

func IfaceHash

func IfaceHash() string

IfaceHash generates a unique device identifier based on the MAC addresses of hardware interfaces.

I'm concerned that this isn't a good way to generate device identifiers. Alternatives: use a file to store a generated UUID.

Types

type Metrics

type Metrics struct {
	CPUPercent float64 `json:"cpuUsage"`
	MemPercent float64 `json:"memoryUsage"`
	// contains filtered or unexported fields
}

Metrics represents overall system metrics.

type Monitor

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

Monitor provides a source of Metrics.

func NewMonitor

func NewMonitor() Monitor

NewMonitor returns a new Monitor.

func (Monitor) Close

func (mon Monitor) Close()

Close shuts down the Monitor.

func (Monitor) GetMetrics

func (mon Monitor) GetMetrics() Metrics

GetMetrics provides current system metrics.

Jump to

Keyboard shortcuts

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