Documentation ¶
Overview ¶
Package edgemax implements a client for Ubiquiti EdgeMAX devices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsecureHTTPClient ¶
InsecureHTTPClient creates a *http.Client which does not verify an EdgeMAX device's certificate chain and hostname.
Please think carefully before using this client: it should only be used with self-hosted, internal EdgeMAX devices.
Types ¶
type Client ¶
type Client struct { UserAgent string // 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 ¶
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.
If working with a self-hosted EdgeMAX device which does not have a valid TLS certificate, InsecureHTTPClient can be used.
Client.Login must be called and return a nil error before any additional actions can be performed with a Client.
type DPIStat ¶
type DPIStat struct { IP net.IP Type string Category string ReceiveBytes int ReceiveRate int TransmitBytes int TransmitRate int }
A DPIStat contains Deep Packet Inspection stats from an EdgeMAX device, for an individual client and traffic type.
type DPIStats ¶
type DPIStats []*DPIStat
DPIStats is a slice of DPIStat values, and contains Deep Packet Inspection stats from an EdgeMAX device.
func (*DPIStats) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON into a DPIStats.
type Interface ¶
type Interface struct { Name string Up bool Autonegotiation bool Duplex string Speed int MAC net.HardwareAddr MTU int Addresses []net.IP Stats InterfaceStats }
An Interface is an EdgeMAX network interface.
type InterfaceStats ¶
type InterfaceStats struct { ReceivePackets int TransmitPackets int ReceiveBytes int TransmitBytes int ReceiveErrors int TransmitErrors int ReceiveDropped int TransmitDropped int Multicast int ReceiveBPS int TransmitBPS int }
InterfaceStats contains network interface data transmission statistics.
type Interfaces ¶
type Interfaces []*Interface
Interfaces is a slice of Interface values, which contains information about network interfaces for EdgeMAX devices.
func (Interfaces) StatType ¶
func (i Interfaces) StatType() StatType
StatType implements the Stats interface.
func (*Interfaces) UnmarshalJSON ¶
func (i *Interfaces) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSON into an Interfaces.
type Stat ¶
type Stat interface {
StatType() StatType
}
A Stat is a statistic provided by an EdgeMAX device. Type assertions can be used to determine the specific type of a Stat, and to access a Stat's fields.
type StatType ¶
type StatType string
A StatType is a type of Stat. StatType values can be used to retrieve certain types of Stats from Client.Stats
const ( // StatTypeDPIStats retrieves EdgeMAX deep packet inspection statistics. StatTypeDPIStats StatType = "export" // StatTypeSystemStats retrieves EdgeMAX system statistics, including // system uptime, CPU utilization, and memory utilization. StatTypeSystemStats StatType = "system-stats" // StatTypeInterfaces retrieves EdgeMAX network interface statistics. StatTypeInterfaces StatType = "interfaces" )
type SystemStats ¶
SystemStats is a Stat which contains system statistics for an EdgeMAX device.
func (*SystemStats) StatType ¶
func (ss *SystemStats) StatType() StatType
StatType implements the Stats interface.
func (*SystemStats) UnmarshalJSON ¶
func (ss *SystemStats) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals JSON into a SystemStats.