edgemax

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

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

Go to latest
Published: Feb 6, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A Client is a client for a Ubiquiti EdgeMAX device.

Client.Login must be called and return a nil error before any additional actions can be performed with a Client.

func NewClient

func NewClient(addr string, client *http.Client) (*Client, error)

NewClient creates a new Client, using the input EdgeMAX device address and an optional HTTP client. If no HTTP client is specified, a default one will be used.

Client.Login must be called and return a nil error before any additional actions can be performed with a Client.

func (*Client) Login

func (c *Client) Login(username, password string) error

Login authenticates against the EdgeMAX device using the specified username and password. Login must be called and return a nil error before any additional actions can be performed.

func (*Client) Stats

func (c *Client) Stats(
	systemCh chan<- SystemStat,
	dpiCh chan<- DPIStat,
	ifacesCh chan<- InterfacesStat,
) (func(), error)

Stats opens a websocket connection to an EdgeMAX device to retrieve statistics which are sent using the socket.

type DPIStat

type DPIStat map[string]map[string]struct {
	RXBytes string `json:"rx_bytes"`
	TXBytes string `json:"tx_bytes"`
}

DPIStat contains Deep Packet Inspection stats from an EdgeMAX device.

type InterfacesStat

type InterfacesStat map[string]struct {
	Mac   string `json:"mac"`
	Stats struct {
		RXBytes string `json:"rx_bytes"`
		TXBytes string `json:"tx_bytes"`
	} `json:"stats"`
}

InterfaceStat contains network interface data transmission statistics.

type SystemStat

type SystemStat struct {
	CPU    string `json:"cpu"`
	Uptime string `json:"uptime"`
	Mem    string `json:"mem"`
}

SystemStat is a stat which contains system statistics for an EdgeMAX device.

Jump to

Keyboard shortcuts

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