gluon

package
v0.0.0-...-0eeec4f Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gluon provides types for Gluon-firmware style mesh node metadata and means to (un)serialize it.

Index

Constants

View Source
const (
	// A.L.F.R.E.D. packet type ID for Gluon NodeInfo data
	NODEINFO_PACKETTYPE = 158
	// A.L.F.R.E.D. packet version for Gluon NodeInfo data
	NODEINFO_PACKETVERSION = 0
)
View Source
const (
	// A.L.F.R.E.D. packet type ID for Gluon Statistics data
	STATISTICS_PACKETTYPE = 159
	// A.L.F.R.E.D. packet version for Gluon Statistics data
	STATISTICS_PACKETVERSION = 0
)

Variables

View Source
var ErrParse = errors.New("parse error")

Functions

This section is empty.

Types

type AutoUpdater

type AutoUpdater struct {
	Enabled bool   `json:"enabled,omitempty"`
	Branch  string `json:"branch,omitempty"`
}

type BatmanAdv

type BatmanAdv struct {
	Compat  int    `json:"compat,omitempty"`
	Version string `json:"version,omitempty"`
}

type Clients

type Clients struct {
	Wifi  int `json:"wifi,omitempty"`
	Total int `json:"total,omitempty"`
}

type FastD

type FastD struct {
	Enabled bool   `json:"enabled,omitempty"`
	Version string `json:"version,omitempty"`
}

type Firmware

type Firmware struct {
	Base    string `json:"base,omitempty"`
	Release string `json:"release,omitempty"`
}

type Hardware

type Hardware struct {
	Model string `json:"model,omitempty"`
}

type Location

type Location struct {
	Longitude float64 `json:"longitude,omitempty"`
	Latitude  float64 `json:"latitude,omitempty"`
}

type Memory

type Memory struct {
	Cached  int `json:"cached,omitempty"`
	Total   int `json:"total,omitempty"`
	Buffers int `json:"buffers,omitempty"`
	Free    int `json:"free,omitempty"`
}

type Network

type Network struct {
	Mac            string                `json:"mac,omitempty"`
	Addresses      []net.IP              `json:"addresses,omitempty"`
	MeshInterfaces []alfred.HardwareAddr `json:"mesh_interfaces,omitempty"`
}

type NodeInfo

type NodeInfo struct {
	Source alfred.HardwareAddr
	Data   *NodeInfoData
}

wrapper type for storing the metadata and its origin

func (*NodeInfo) GetPacketType

func (ni *NodeInfo) GetPacketType() uint8

func (*NodeInfo) ReadAlfred

func (ni *NodeInfo) ReadAlfred(data alfred.Data) error

read structured information from A.L.F.R.E.D. packet

type NodeInfoData

type NodeInfoData struct {
	NodeID   string    `json:"node_id,omitempty"`
	Network  *Network  `json:"network,omitempty"`
	Hostname string    `json:"hostname,omitempty"`
	Location *Location `json:"location,omitempty"`
	Software *Software `json:"software,omitempty"`
	Hardware *Hardware `json:"hardware,omitempty"`
	Owner    *Owner    `json:"owner,omitempty"`
}

mesh node metadata

type Owner

type Owner struct {
	Contact string `json:"contact,omitempty"`
}

type Processes

type Processes struct {
	Total   int `json:"total,omitempty"`
	Running int `json:"running,omitempty"`
}

type Software

type Software struct {
	FastD       *FastD       `json:"fastd,omitempty"`
	AutoUpdater *AutoUpdater `json:"autoupdater,omitempty"`
	BatmanAdv   *BatmanAdv   `json:"batman-adv,omitempty"`
	Firmware    *Firmware    `json:"firmware,omitempty"`
}

type Statistics

type Statistics struct {
	Source alfred.HardwareAddr
	Data   *StatisticsData
}

wrapper type for storing the statistics data and its origin

func (*Statistics) GetPacketType

func (stat *Statistics) GetPacketType() uint8

func (*Statistics) ReadAlfred

func (stat *Statistics) ReadAlfred(data alfred.Data) error

read structured information from A.L.F.R.E.D. packet

type StatisticsData

type StatisticsData struct {
	NodeID      string               `json:"node_id"`
	Clients     *Clients             `json:"clients,omitempty"`
	RootFSUsage float64              `json:"rootfs_usage,omitempty"`
	LoadAvg     float64              `json:"loadavg,omitempty"`
	Uptime      float64              `json:"uptime,omitempty"`
	IdleTime    float64              `json:"idletime,omitempty"`
	Gateway     *alfred.HardwareAddr `json:"gateway,omitempty"`
	Processes   *Processes           `json:"processes,omitempty"`
	Traffic     *Traffic             `json:"traffic,omitempty"`
	Memory      *Memory              `json:"memory,omitempty"`
}

mesh node statistics

type Traffic

type Traffic struct {
	Tx      *TrafficCounter `json:"tx,omitempty"`
	Rx      *TrafficCounter `json:"rx,omitempty"`
	MgmtTx  *TrafficCounter `json:"mgmt_tx,omitempty"`
	MgmtRx  *TrafficCounter `json:"mgmt_rx,omitempty"`
	Forward *TrafficCounter `json:"forward,omitempty"`
}

type TrafficCounter

type TrafficCounter struct {
	Bytes   int `json:"bytes,omitempty"`
	Packets int `json:"packets,omitempty"`
}

Jump to

Keyboard shortcuts

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