zdevice

package
v0.0.0-...-0521b85 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CellularUnknown CellularNetworkType = iota
	CellularWifiMax
	Cellular2G
	Cellular3G
	Cellular4G
	Cellular5G
	CellularXG

	MacOSType   OSType = "macos"
	IOSType     OSType = "ios"
	AndroidType OSType = "android"
	WindowsType OSType = "windows"
	LinuxType   OSType = "linux"
	WebType     OSType = "web"

	ARM64Type            ArchitectureType = "arm64"
	AMD64Type            ArchitectureType = "amd64"
	WASMType             ArchitectureType = "wasm"
	ArchitectureTypeNone ArchitectureType = ""
)

Variables

View Source
var OverrideUUID string // used for unit tests and other testing that needs a know uuid

Functions

func BootTime

func BootTime() (t time.Time, err error)

func CPUUsage

func CPUUsage(maxCores int) (out []float64)

CPUUsage returns a slice of 0-1 where 1 is 100% of how much each CPU is utilized. Order unknown, but hopefully doesn't change if more than maxCores, it is recursivly halved, summing first half with last

func FreeAndUsedDiskSpace

func FreeAndUsedDiskSpace() (free int64, used int64)

func HardwareTypeAndVersion

func HardwareTypeAndVersion() (string, float32)

func InitNetworkBandwidth

func InitNetworkBandwidth()

func IsDesktop

func IsDesktop() bool

func MACAddress

func MACAddress() ([]byte, error)

GetMACAddress returns the MAC address as 6 bytes.

func MemoryAvailableUsedAndTotal

func MemoryAvailableUsedAndTotal() (available int64, used int64, total int64)

func Model

func Model() string

func Name

func Name() string

func NetworkBandwidthPerSec

func NetworkBandwidthPerSec() (map[string]NetIO, error)

NetworkBandwidthPerSec returns bytes pr sec/in out, and error/drop count pr sec all 0 if not sampled yet

func NetworkTraffic

func NetworkTraffic() (map[string]NetIO, error)

NetworkTraffic returns a map of interface-name to In/Out bytes/drops/errors

func OSVersion

func OSVersion() string

func UUID

func UUID() string

UUID returns a globally unique, permanent identifier string for the device we are running on. Returns a fixed, dummy id if running during tests. Format will always be in UUID 8-4-4-4-12 hex chars.

Types

type ArchitectureType

type ArchitectureType string

func Architecture

func Architecture() ArchitectureType

Architecture returns the main type of CPU used, ARM, AMD64, WASM

type BrowserType

type BrowserType string
const (
	Safari      BrowserType = "safari"
	Chrome      BrowserType = "chrome"
	Edge        BrowserType = "edge"
	Firefox     BrowserType = "firefox"
	Default     BrowserType = "default"
	BrowserNone BrowserType = ""
)

func WasmBrowser

func WasmBrowser() BrowserType

type CellularNetworkType

type CellularNetworkType int

type NetCount

type NetCount struct {
	Bytes  int64
	Errors int64
	Drops  int64
}

func (NetCount) Diff

func (n NetCount) Diff(old NetCount, div float64) NetCount

type NetIO

type NetIO struct {
	In  NetCount
	Out NetCount
}

type OSType

type OSType string

func OS

func OS() OSType

func OSTypeFromUserAgent

func OSTypeFromUserAgent(u *ua.UserAgent) OSType

func OSTypeFromUserAgentString

func OSTypeFromUserAgentString(uas string) OSType

func Platform

func Platform() OSType

Platform is the surface-system we are running on. For wasm in browser this is WebType, not underlying os browser is running on

Jump to

Keyboard shortcuts

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