a fe wmore tweaks to align outputs.a
This commit is contained in:
parent
068ee31dfa
commit
8d9af25d47
|
|
@ -30,9 +30,11 @@ func TestUniReq(t *testing.T) {
|
||||||
a := assert.New(t)
|
a := assert.New(t)
|
||||||
p := "/test/path"
|
p := "/test/path"
|
||||||
u := "http://some.url:8443"
|
u := "http://some.url:8443"
|
||||||
|
|
||||||
// Test empty parameters.
|
// Test empty parameters.
|
||||||
authReq := &Unifi{Client: &http.Client{}, Config: &Config{URL: u, DebugLog: discardLogs}}
|
authReq := &Unifi{Client: &http.Client{}, Config: &Config{URL: u, DebugLog: discardLogs}}
|
||||||
r, err := authReq.UniReq(p, "")
|
r, err := authReq.UniReq(p, "")
|
||||||
|
|
||||||
a.Nil(err, "newrequest must not produce an error")
|
a.Nil(err, "newrequest must not produce an error")
|
||||||
a.EqualValues(p, r.URL.Path,
|
a.EqualValues(p, r.URL.Path,
|
||||||
"the provided apiPath was not added to http request")
|
"the provided apiPath was not added to http request")
|
||||||
|
|
@ -45,11 +47,13 @@ func TestUniReq(t *testing.T) {
|
||||||
authReq = &Unifi{Client: &http.Client{}, Config: &Config{URL: "http://some.url:8443", DebugLog: discardLogs}}
|
authReq = &Unifi{Client: &http.Client{}, Config: &Config{URL: "http://some.url:8443", DebugLog: discardLogs}}
|
||||||
r, err = authReq.UniReq(p, k)
|
r, err = authReq.UniReq(p, k)
|
||||||
a.Nil(err, "newrequest must not produce an error")
|
a.Nil(err, "newrequest must not produce an error")
|
||||||
|
|
||||||
a.EqualValues(p, r.URL.Path,
|
a.EqualValues(p, r.URL.Path,
|
||||||
"the provided apiPath was not added to http request")
|
"the provided apiPath was not added to http request")
|
||||||
a.EqualValues(u, r.URL.Scheme+"://"+r.URL.Host, "URL improperly encoded")
|
a.EqualValues(u, r.URL.Scheme+"://"+r.URL.Host, "URL improperly encoded")
|
||||||
a.EqualValues("POST", r.Method, "with parameters the method must be POST")
|
a.EqualValues("POST", r.Method, "with parameters the method must be POST")
|
||||||
a.EqualValues("application/json", r.Header.Get("Accept"), "Accept header must be set to application/json")
|
a.EqualValues("application/json", r.Header.Get("Accept"), "Accept header must be set to application/json")
|
||||||
|
|
||||||
// Check the parameters.
|
// Check the parameters.
|
||||||
d, err := ioutil.ReadAll(r.Body)
|
d, err := ioutil.ReadAll(r.Body)
|
||||||
a.Nil(err, "problem reading request body, POST parameters may be malformed")
|
a.Nil(err, "problem reading request body, POST parameters may be malformed")
|
||||||
|
|
@ -61,28 +65,31 @@ func TestUniReqPut(t *testing.T) {
|
||||||
a := assert.New(t)
|
a := assert.New(t)
|
||||||
p := "/test/path"
|
p := "/test/path"
|
||||||
u := "http://some.url:8443"
|
u := "http://some.url:8443"
|
||||||
|
|
||||||
// Test empty parameters.
|
// Test empty parameters.
|
||||||
authReq := &Unifi{Client: &http.Client{}, Config: &Config{URL: u, DebugLog: discardLogs}}
|
authReq := &Unifi{Client: &http.Client{}, Config: &Config{URL: u, DebugLog: discardLogs}}
|
||||||
r, err := authReq.UniReqPut(p, "")
|
_, err := authReq.UniReqPut(p, "")
|
||||||
a.NotNil(err, "empty params must produce an error")
|
a.NotNil(err, "empty params must produce an error")
|
||||||
|
|
||||||
// Test with parameters
|
// Test with parameters
|
||||||
k := "key1=value9&key2=value7"
|
k := "key1=value9&key2=value7"
|
||||||
authReq = &Unifi{Client: &http.Client{}, Config: &Config{URL: "http://some.url:8443", DebugLog: discardLogs}}
|
authReq = &Unifi{Client: &http.Client{}, Config: &Config{URL: "http://some.url:8443", DebugLog: discardLogs}}
|
||||||
r, err = authReq.UniReqPut(p, k)
|
r, err := authReq.UniReqPut(p, k)
|
||||||
a.Nil(err, "newrequest must not produce an error")
|
a.Nil(err, "newrequest must not produce an error")
|
||||||
|
|
||||||
a.EqualValues(p, r.URL.Path,
|
a.EqualValues(p, r.URL.Path,
|
||||||
"the provided apiPath was not added to http request")
|
"the provided apiPath was not added to http request")
|
||||||
a.EqualValues(u, r.URL.Scheme+"://"+r.URL.Host, "URL improperly encoded")
|
a.EqualValues(u, r.URL.Scheme+"://"+r.URL.Host, "URL improperly encoded")
|
||||||
a.EqualValues("PUT", r.Method, "with parameters the method must be POST")
|
a.EqualValues("PUT", r.Method, "with parameters the method must be POST")
|
||||||
a.EqualValues("application/json", r.Header.Get("Accept"), "Accept header must be set to application/json")
|
a.EqualValues("application/json", r.Header.Get("Accept"), "Accept header must be set to application/json")
|
||||||
|
|
||||||
// Check the parameters.
|
// Check the parameters.
|
||||||
d, err := ioutil.ReadAll(r.Body)
|
d, err := ioutil.ReadAll(r.Body)
|
||||||
a.Nil(err, "problem reading request body, PUT parameters may be malformed")
|
a.Nil(err, "problem reading request body, PUT parameters may be malformed")
|
||||||
a.EqualValues(k, string(d), "PUT parameters improperly encoded")
|
a.EqualValues(k, string(d), "PUT parameters improperly encoded")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOT DONE: OPEN web server, check parameters posted, more. This test is incomplete.
|
/* NOT DONE: OPEN web server, check parameters posted, more. These tests are incomplete.
|
||||||
a.EqualValues(`{"username": "user1","password": "pass2"}`, string(post_params),
|
a.EqualValues(`{"username": "user1","password": "pass2"}`, string(post_params),
|
||||||
"user/pass json parameters improperly encoded")
|
"user/pass json parameters improperly encoded")
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -53,40 +53,19 @@ type USG struct {
|
||||||
SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"`
|
SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"`
|
||||||
Wan1 Wan `json:"wan1"`
|
Wan1 Wan `json:"wan1"`
|
||||||
Wan2 Wan `json:"wan2"`
|
Wan2 Wan `json:"wan2"`
|
||||||
PortTable []struct {
|
PortTable []*Port `json:"port_table"`
|
||||||
Name string `json:"name"`
|
NetworkTable NetworkTable `json:"network_table"`
|
||||||
Ifname string `json:"ifname"`
|
Uplink Uplink `json:"uplink"`
|
||||||
IP string `json:"ip"`
|
Stat USGStat `json:"stat"`
|
||||||
Netmask string `json:"netmask"`
|
TxBytes FlexInt `json:"tx_bytes"`
|
||||||
Mac string `json:"mac"`
|
RxBytes FlexInt `json:"rx_bytes"`
|
||||||
Up FlexBool `json:"up"`
|
Bytes FlexInt `json:"bytes"`
|
||||||
Speed FlexInt `json:"speed"`
|
NumSta FlexInt `json:"num_sta"`
|
||||||
FullDuplex FlexBool `json:"full_duplex"`
|
UserNumSta FlexInt `json:"user-num_sta"`
|
||||||
RxBytes FlexInt `json:"rx_bytes"`
|
GuestNumSta FlexInt `json:"guest-num_sta"`
|
||||||
RxDropped FlexInt `json:"rx_dropped"`
|
NumDesktop FlexInt `json:"num_desktop"`
|
||||||
RxErrors FlexInt `json:"rx_errors"`
|
NumMobile FlexInt `json:"num_mobile"`
|
||||||
RxPackets FlexInt `json:"rx_packets"`
|
NumHandheld FlexInt `json:"num_handheld"`
|
||||||
TxBytes FlexInt `json:"tx_bytes"`
|
|
||||||
TxDropped FlexInt `json:"tx_dropped"`
|
|
||||||
TxErrors FlexInt `json:"tx_errors"`
|
|
||||||
TxPackets FlexInt `json:"tx_packets"`
|
|
||||||
RxMulticast FlexInt `json:"rx_multicast"`
|
|
||||||
Enable FlexBool `json:"enable"`
|
|
||||||
DNS []string `json:"dns,omitempty"`
|
|
||||||
Gateway string `json:"gateway,omitempty"`
|
|
||||||
} `json:"port_table"`
|
|
||||||
NetworkTable NetworkTable `json:"network_table"`
|
|
||||||
Uplink Uplink `json:"uplink"`
|
|
||||||
Stat USGStat `json:"stat"`
|
|
||||||
TxBytes FlexInt `json:"tx_bytes"`
|
|
||||||
RxBytes FlexInt `json:"rx_bytes"`
|
|
||||||
Bytes FlexInt `json:"bytes"`
|
|
||||||
NumSta FlexInt `json:"num_sta"`
|
|
||||||
UserNumSta FlexInt `json:"user-num_sta"`
|
|
||||||
GuestNumSta FlexInt `json:"guest-num_sta"`
|
|
||||||
NumDesktop FlexInt `json:"num_desktop"`
|
|
||||||
NumMobile FlexInt `json:"num_mobile"`
|
|
||||||
NumHandheld FlexInt `json:"num_handheld"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uplink is the Internet connection (or uplink) on a UniFi device.
|
// Uplink is the Internet connection (or uplink) on a UniFi device.
|
||||||
|
|
@ -175,17 +154,18 @@ type Wan struct {
|
||||||
|
|
||||||
// SpeedtestStatus is the speed test info on a USG or UDM.
|
// SpeedtestStatus is the speed test info on a USG or UDM.
|
||||||
type SpeedtestStatus struct {
|
type SpeedtestStatus struct {
|
||||||
Latency FlexInt `json:"latency"`
|
Latency FlexInt `json:"latency"`
|
||||||
Rundate FlexInt `json:"rundate"`
|
Rundate FlexInt `json:"rundate"`
|
||||||
Runtime FlexInt `json:"runtime"`
|
Runtime FlexInt `json:"runtime"`
|
||||||
ServerDesc string `json:"server_desc,omitempty"`
|
ServerDesc string `json:"server_desc,omitempty"`
|
||||||
Server *SpeedtestServer `json:"server"`
|
Server *SpeedtestServer `json:"server"`
|
||||||
StatusDownload FlexInt `json:"status_download"`
|
SourceInterface string `json:"source_interface"`
|
||||||
StatusPing FlexInt `json:"status_ping"`
|
StatusDownload FlexInt `json:"status_download"`
|
||||||
StatusSummary FlexInt `json:"status_summary"`
|
StatusPing FlexInt `json:"status_ping"`
|
||||||
StatusUpload FlexInt `json:"status_upload"`
|
StatusSummary FlexInt `json:"status_summary"`
|
||||||
XputDownload FlexInt `json:"xput_download"`
|
StatusUpload FlexInt `json:"status_upload"`
|
||||||
XputUpload FlexInt `json:"xput_upload"`
|
XputDownload FlexInt `json:"xput_download"`
|
||||||
|
XputUpload FlexInt `json:"xput_upload"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SpeedtestServer struct {
|
type SpeedtestServer struct {
|
||||||
|
|
|
||||||
|
|
@ -7,80 +7,68 @@ import (
|
||||||
|
|
||||||
// USW represents all the data from the Ubiquiti Controller for a Unifi Switch.
|
// USW represents all the data from the Ubiquiti Controller for a Unifi Switch.
|
||||||
type USW struct {
|
type USW struct {
|
||||||
SourceName string `json:"-"`
|
SourceName string `json:"-"`
|
||||||
SiteName string `json:"-"`
|
SiteName string `json:"-"`
|
||||||
ID string `json:"_id"`
|
ID string `json:"_id"`
|
||||||
Adopted FlexBool `json:"adopted"`
|
Adopted FlexBool `json:"adopted"`
|
||||||
BoardRev FlexInt `json:"board_rev"`
|
BoardRev FlexInt `json:"board_rev"`
|
||||||
Cfgversion string `json:"cfgversion"`
|
Cfgversion string `json:"cfgversion"`
|
||||||
ConfigNetwork struct {
|
ConfigNetwork *ConfigNetwork `json:"config_network"`
|
||||||
Type string `json:"type"`
|
Dot1XPortctrlEnabled FlexBool `json:"dot1x_portctrl_enabled"`
|
||||||
IP string `json:"ip"`
|
EthernetTable []*EthernetTable `json:"ethernet_table"`
|
||||||
} `json:"config_network"`
|
FlowctrlEnabled FlexBool `json:"flowctrl_enabled"`
|
||||||
Dot1XPortctrlEnabled FlexBool `json:"dot1x_portctrl_enabled"`
|
FwCaps FlexInt `json:"fw_caps"`
|
||||||
EthernetTable []struct {
|
HasFan FlexBool `json:"has_fan"`
|
||||||
Mac string `json:"mac"`
|
HasTemperature FlexBool `json:"has_temperature"`
|
||||||
NumPort FlexInt `json:"num_port,omitempty"`
|
InformIP string `json:"inform_ip"`
|
||||||
Name string `json:"name"`
|
InformURL string `json:"inform_url"`
|
||||||
} `json:"ethernet_table"`
|
IP string `json:"ip"`
|
||||||
FlowctrlEnabled FlexBool `json:"flowctrl_enabled"`
|
JumboframeEnabled FlexBool `json:"jumboframe_enabled"`
|
||||||
FwCaps FlexInt `json:"fw_caps"`
|
LedOverride string `json:"led_override"`
|
||||||
HasFan FlexBool `json:"has_fan"`
|
LicenseState string `json:"license_state"`
|
||||||
HasTemperature FlexBool `json:"has_temperature"`
|
Mac string `json:"mac"`
|
||||||
InformIP string `json:"inform_ip"`
|
Model string `json:"model"`
|
||||||
InformURL string `json:"inform_url"`
|
Name string `json:"name"`
|
||||||
IP string `json:"ip"`
|
OutdoorModeOverride string `json:"outdoor_mode_override"`
|
||||||
JumboframeEnabled FlexBool `json:"jumboframe_enabled"`
|
PortOverrides []struct {
|
||||||
LedOverride string `json:"led_override"`
|
|
||||||
LicenseState string `json:"license_state"`
|
|
||||||
Mac string `json:"mac"`
|
|
||||||
Model string `json:"model"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
OutdoorModeOverride string `json:"outdoor_mode_override"`
|
|
||||||
PortOverrides []struct {
|
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
PoeMode string `json:"poe_mode,omitempty"`
|
PoeMode string `json:"poe_mode,omitempty"`
|
||||||
PortIdx FlexInt `json:"port_idx"`
|
PortIdx FlexInt `json:"port_idx"`
|
||||||
PortconfID string `json:"portconf_id"`
|
PortconfID string `json:"portconf_id"`
|
||||||
} `json:"port_overrides"`
|
} `json:"port_overrides"`
|
||||||
PortTable []Port `json:"port_table"`
|
PortTable []Port `json:"port_table"`
|
||||||
Serial string `json:"serial"`
|
Serial string `json:"serial"`
|
||||||
SiteID string `json:"site_id"`
|
SiteID string `json:"site_id"`
|
||||||
StpPriority FlexInt `json:"stp_priority"`
|
StpPriority FlexInt `json:"stp_priority"`
|
||||||
StpVersion string `json:"stp_version"`
|
StpVersion string `json:"stp_version"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
RequiredVersion string `json:"required_version"`
|
RequiredVersion string `json:"required_version"`
|
||||||
SwitchCaps *SwitchCaps `json:"switch_caps"`
|
SwitchCaps *SwitchCaps `json:"switch_caps"`
|
||||||
HwCaps FlexInt `json:"hw_caps"`
|
HwCaps FlexInt `json:"hw_caps"`
|
||||||
Unsupported FlexBool `json:"unsupported"`
|
Unsupported FlexBool `json:"unsupported"`
|
||||||
UnsupportedReason FlexInt `json:"unsupported_reason"`
|
UnsupportedReason FlexInt `json:"unsupported_reason"`
|
||||||
SysErrorCaps FlexInt `json:"sys_error_caps"`
|
SysErrorCaps FlexInt `json:"sys_error_caps"`
|
||||||
DeviceID string `json:"device_id"`
|
DeviceID string `json:"device_id"`
|
||||||
State FlexInt `json:"state"`
|
State FlexInt `json:"state"`
|
||||||
LastSeen FlexInt `json:"last_seen"`
|
LastSeen FlexInt `json:"last_seen"`
|
||||||
Upgradable FlexBool `json:"upgradable,omitempty"`
|
Upgradable FlexBool `json:"upgradable,omitempty"`
|
||||||
AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded,omitempty"`
|
AdoptableWhenUpgraded FlexBool `json:"adoptable_when_upgraded,omitempty"`
|
||||||
Rollupgrade FlexBool `json:"rollupgrade,omitempty"`
|
Rollupgrade FlexBool `json:"rollupgrade,omitempty"`
|
||||||
KnownCfgversion string `json:"known_cfgversion"`
|
KnownCfgversion string `json:"known_cfgversion"`
|
||||||
Uptime FlexInt `json:"uptime"`
|
Uptime FlexInt `json:"uptime"`
|
||||||
Locating FlexBool `json:"locating"`
|
Locating FlexBool `json:"locating"`
|
||||||
ConnectRequestIP string `json:"connect_request_ip"`
|
ConnectRequestIP string `json:"connect_request_ip"`
|
||||||
ConnectRequestPort string `json:"connect_request_port"`
|
ConnectRequestPort string `json:"connect_request_port"`
|
||||||
SysStats SysStats `json:"sys_stats"`
|
SysStats SysStats `json:"sys_stats"`
|
||||||
SystemStats SystemStats `json:"system-stats"`
|
SystemStats SystemStats `json:"system-stats"`
|
||||||
FanLevel FlexInt `json:"fan_level"`
|
FanLevel FlexInt `json:"fan_level"`
|
||||||
GeneralTemperature FlexInt `json:"general_temperature"`
|
GeneralTemperature FlexInt `json:"general_temperature"`
|
||||||
Overheating FlexBool `json:"overheating"`
|
Overheating FlexBool `json:"overheating"`
|
||||||
TotalMaxPower FlexInt `json:"total_max_power"`
|
TotalMaxPower FlexInt `json:"total_max_power"`
|
||||||
DownlinkTable []struct {
|
DownlinkTable []*DownlinkTable `json:"downlink_table"`
|
||||||
PortIdx FlexInt `json:"port_idx"`
|
Uplink Uplink `json:"uplink"`
|
||||||
Speed FlexInt `json:"speed"`
|
LastUplink struct {
|
||||||
FullDuplex FlexBool `json:"full_duplex"`
|
|
||||||
Mac string `json:"mac"`
|
|
||||||
} `json:"downlink_table"`
|
|
||||||
Uplink Uplink `json:"uplink"`
|
|
||||||
LastUplink struct {
|
|
||||||
UplinkMac string `json:"uplink_mac"`
|
UplinkMac string `json:"uplink_mac"`
|
||||||
} `json:"last_uplink"`
|
} `json:"last_uplink"`
|
||||||
UplinkDepth FlexInt `json:"uplink_depth"`
|
UplinkDepth FlexInt `json:"uplink_depth"`
|
||||||
|
|
@ -109,7 +97,8 @@ type MacTable struct {
|
||||||
Mac string `json:"mac"`
|
Mac string `json:"mac"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port is a physical connection on a USW or UDM.
|
// Port is a physical connection on a USW or Gateway.
|
||||||
|
// Not every port has the same capabilities.
|
||||||
type Port struct {
|
type Port struct {
|
||||||
AggregatedBy FlexBool `json:"aggregated_by"`
|
AggregatedBy FlexBool `json:"aggregated_by"`
|
||||||
Autoneg FlexBool `json:"autoneg,omitempty"`
|
Autoneg FlexBool `json:"autoneg,omitempty"`
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,15 @@ type UXG struct {
|
||||||
IP string `json:"ip"`
|
IP string `json:"ip"`
|
||||||
Mac string `json:"mac"`
|
Mac string `json:"mac"`
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
ModelInLts bool `json:"model_in_lts"`
|
ModelInLts FlexBool `json:"model_in_lts"`
|
||||||
ModelInEol bool `json:"model_in_eol"`
|
ModelInEol FlexBool `json:"model_in_eol"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
Adopted bool `json:"adopted"`
|
Adopted FlexBool `json:"adopted"`
|
||||||
SiteID string `json:"site_id"`
|
SiteID string `json:"site_id"`
|
||||||
Cfgversion string `json:"cfgversion"`
|
Cfgversion string `json:"cfgversion"`
|
||||||
SyslogKey string `json:"syslog_key"`
|
SyslogKey string `json:"syslog_key"`
|
||||||
ConfigNetwork ConfigNetwork `json:"config_network"`
|
ConfigNetwork *ConfigNetwork `json:"config_network"`
|
||||||
SetupID string `json:"setup_id"`
|
SetupID string `json:"setup_id"`
|
||||||
LicenseState string `json:"license_state"`
|
LicenseState string `json:"license_state"`
|
||||||
ConfigNetworkLan *ConfigNetworkLan `json:"config_network_lan"`
|
ConfigNetworkLan *ConfigNetworkLan `json:"config_network_lan"`
|
||||||
|
|
@ -28,22 +28,22 @@ type UXG struct {
|
||||||
Architecture string `json:"architecture"`
|
Architecture string `json:"architecture"`
|
||||||
BoardRev FlexInt `json:"board_rev"`
|
BoardRev FlexInt `json:"board_rev"`
|
||||||
ManufacturerID FlexInt `json:"manufacturer_id"`
|
ManufacturerID FlexInt `json:"manufacturer_id"`
|
||||||
Internet bool `json:"internet"`
|
Internet FlexBool `json:"internet"`
|
||||||
ModelIncompatible bool `json:"model_incompatible"`
|
ModelIncompatible FlexBool `json:"model_incompatible"`
|
||||||
EthernetTable []*EthernetTable `json:"ethernet_table"`
|
EthernetTable []*EthernetTable `json:"ethernet_table"`
|
||||||
PortTable []*Port `json:"port_table"`
|
PortTable []*Port `json:"port_table"`
|
||||||
EthernetOverrides []*EthernetOverrides `json:"ethernet_overrides"`
|
EthernetOverrides []*EthernetOverrides `json:"ethernet_overrides"`
|
||||||
UsgCaps FlexInt `json:"usg_caps"`
|
UsgCaps FlexInt `json:"usg_caps"`
|
||||||
HasSpeaker bool `json:"has_speaker"`
|
HasSpeaker FlexBool `json:"has_speaker"`
|
||||||
HasEth1 bool `json:"has_eth1"`
|
HasEth1 FlexBool `json:"has_eth1"`
|
||||||
FwCaps FlexInt `json:"fw_caps"`
|
FwCaps FlexInt `json:"fw_caps"`
|
||||||
HwCaps FlexInt `json:"hw_caps"`
|
HwCaps FlexInt `json:"hw_caps"`
|
||||||
WifiCaps FlexInt `json:"wifi_caps"`
|
WifiCaps FlexInt `json:"wifi_caps"`
|
||||||
SwitchCaps *SwitchCaps `json:"switch_caps"`
|
SwitchCaps *SwitchCaps `json:"switch_caps"`
|
||||||
HasFan bool `json:"has_fan"`
|
HasFan FlexBool `json:"has_fan"`
|
||||||
HasTemperature bool `json:"has_temperature"`
|
HasTemperature FlexBool `json:"has_temperature"`
|
||||||
Temperatures []*Temperature `json:"temperatures"`
|
Temperatures []*Temperature `json:"temperatures"`
|
||||||
Storage []Storage `json:"storage"`
|
Storage []*Storage `json:"storage"`
|
||||||
RulesetInterfaces interface{} `json:"ruleset_interfaces"`
|
RulesetInterfaces interface{} `json:"ruleset_interfaces"`
|
||||||
ConnectedAt FlexInt `json:"connected_at"`
|
ConnectedAt FlexInt `json:"connected_at"`
|
||||||
ProvisionedAt FlexInt `json:"provisioned_at"`
|
ProvisionedAt FlexInt `json:"provisioned_at"`
|
||||||
|
|
@ -51,36 +51,36 @@ type UXG struct {
|
||||||
LedOverrideColor string `json:"led_override_color"`
|
LedOverrideColor string `json:"led_override_color"`
|
||||||
LedOverrideColorBrightness FlexInt `json:"led_override_color_brightness"`
|
LedOverrideColorBrightness FlexInt `json:"led_override_color_brightness"`
|
||||||
OutdoorModeOverride string `json:"outdoor_mode_override"`
|
OutdoorModeOverride string `json:"outdoor_mode_override"`
|
||||||
LcmBrightnessOverride bool `json:"lcm_brightness_override"`
|
LcmBrightnessOverride FlexBool `json:"lcm_brightness_override"`
|
||||||
LcmIdleTimeoutOverride bool `json:"lcm_idle_timeout_override"`
|
LcmIdleTimeoutOverride FlexBool `json:"lcm_idle_timeout_override"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Unsupported bool `json:"unsupported"`
|
Unsupported FlexBool `json:"unsupported"`
|
||||||
UnsupportedReason FlexInt `json:"unsupported_reason"`
|
UnsupportedReason FlexInt `json:"unsupported_reason"`
|
||||||
Serial string `json:"serial"`
|
Serial string `json:"serial"`
|
||||||
HashID string `json:"hash_id"`
|
HashID string `json:"hash_id"`
|
||||||
TwoPhaseAdopt bool `json:"two_phase_adopt"`
|
TwoPhaseAdopt FlexBool `json:"two_phase_adopt"`
|
||||||
DeviceID string `json:"device_id"`
|
DeviceID string `json:"device_id"`
|
||||||
State FlexInt `json:"state"`
|
State FlexInt `json:"state"`
|
||||||
StartDisconnectedMillis int64 `json:"start_disconnected_millis"`
|
StartDisconnectedMillis FlexInt `json:"start_disconnected_millis"`
|
||||||
UpgradeState FlexInt `json:"upgrade_state"`
|
UpgradeState FlexInt `json:"upgrade_state"`
|
||||||
StartConnectedMillis int64 `json:"start_connected_millis"`
|
StartConnectedMillis FlexInt `json:"start_connected_millis"`
|
||||||
LastSeen FlexInt `json:"last_seen"`
|
LastSeen FlexInt `json:"last_seen"`
|
||||||
Uptime FlexInt `json:"uptime"`
|
Uptime FlexInt `json:"uptime"`
|
||||||
UnderscoreUptime FlexInt `json:"_uptime"`
|
UnderscoreUptime FlexInt `json:"_uptime"`
|
||||||
Locating bool `json:"locating"`
|
Locating FlexBool `json:"locating"`
|
||||||
SysStats *SysStats `json:"sys_stats"`
|
SysStats *SysStats `json:"sys_stats"`
|
||||||
SystemStats *SystemStats `json:"system-stats"`
|
SystemStats *SystemStats `json:"system-stats"`
|
||||||
GuestKicks FlexInt `json:"guest_kicks"`
|
GuestKicks FlexInt `json:"guest_kicks"`
|
||||||
GuestToken string `json:"guest_token"`
|
GuestToken string `json:"guest_token"`
|
||||||
UptimeStats map[string]*UptimeStats `json:"uptime_stats"`
|
UptimeStats map[string]*UptimeStats `json:"uptime_stats"`
|
||||||
Overheating bool `json:"overheating"`
|
Overheating FlexBool `json:"overheating"`
|
||||||
GeoInfo map[string]*GeoInfo `json:"geo_info"`
|
GeoInfo map[string]*GeoInfo `json:"geo_info"`
|
||||||
LedState *LedState `json:"led_state"`
|
LedState *LedState `json:"led_state"`
|
||||||
SpeedtestStatus *SpeedtestStatus `json:"speedtest-status"`
|
SpeedtestStatus *SpeedtestStatus `json:"speedtest-status"`
|
||||||
SpeedtestStatusSaved bool `json:"speedtest-status-saved"`
|
SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"`
|
||||||
Wan1 *Wan `json:"wan1"`
|
Wan1 *Wan `json:"wan1"`
|
||||||
Wan2 *Wan `json:"wan2"`
|
Wan2 *Wan `json:"wan2"`
|
||||||
Uplink Uplink `json:"uplink"`
|
Uplink *Uplink `json:"uplink"`
|
||||||
DownlinkTable []*DownlinkTable `json:"downlink_table"`
|
DownlinkTable []*DownlinkTable `json:"downlink_table"`
|
||||||
NetworkTable []*NetworkTable `json:"network_table"`
|
NetworkTable []*NetworkTable `json:"network_table"`
|
||||||
KnownCfgversion string `json:"known_cfgversion"`
|
KnownCfgversion string `json:"known_cfgversion"`
|
||||||
|
|
@ -91,8 +91,8 @@ type UXG struct {
|
||||||
ConsideredLostAt FlexInt `json:"considered_lost_at"`
|
ConsideredLostAt FlexInt `json:"considered_lost_at"`
|
||||||
Stat *UXGStat `json:"stat"`
|
Stat *UXGStat `json:"stat"`
|
||||||
TxBytes FlexInt `json:"tx_bytes"`
|
TxBytes FlexInt `json:"tx_bytes"`
|
||||||
RxBytes int64 `json:"rx_bytes"`
|
RxBytes FlexInt `json:"rx_bytes"`
|
||||||
Bytes int64 `json:"bytes"`
|
Bytes FlexInt `json:"bytes"`
|
||||||
NumSta FlexInt `json:"num_sta"`
|
NumSta FlexInt `json:"num_sta"`
|
||||||
WlanNumSta FlexInt `json:"wlan-num_sta"`
|
WlanNumSta FlexInt `json:"wlan-num_sta"`
|
||||||
LanNumSta FlexInt `json:"lan-num_sta"`
|
LanNumSta FlexInt `json:"lan-num_sta"`
|
||||||
|
|
@ -121,11 +121,13 @@ type DownlinkTable struct {
|
||||||
Mac string `json:"mac"`
|
Mac string `json:"mac"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LedState is incuded with newer devices.
|
||||||
type LedState struct {
|
type LedState struct {
|
||||||
Pattern string `json:"pattern"`
|
Pattern string `json:"pattern"`
|
||||||
Tempo FlexInt `json:"tempo"`
|
Tempo FlexInt `json:"tempo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GeoInfo is incuded with certain devices.
|
||||||
type GeoInfo struct {
|
type GeoInfo struct {
|
||||||
Accuracy FlexInt `json:"accuracy"`
|
Accuracy FlexInt `json:"accuracy"`
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
|
|
@ -141,14 +143,14 @@ type GeoInfo struct {
|
||||||
Timezone string `json:"timezone"`
|
Timezone string `json:"timezone"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UptimeStats is incuded with certain devices.
|
||||||
type UptimeStats struct {
|
type UptimeStats struct {
|
||||||
Availability FlexInt `json:"availability"`
|
Availability FlexInt `json:"availability"`
|
||||||
LatencyAverage FlexInt `json:"latency_average"`
|
LatencyAverage FlexInt `json:"latency_average"`
|
||||||
TimePeriod FlexInt `json:"time_period"`
|
TimePeriod FlexInt `json:"time_period"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UDMStat holds the "stat" data for a dream machine.
|
// UXGStat holds the "stat" data for a 10Gb gateway.
|
||||||
// A dream machine is a USG + USW + Controller.
|
|
||||||
type UXGStat struct {
|
type UXGStat struct {
|
||||||
*Gw `json:"gw"`
|
*Gw `json:"gw"`
|
||||||
*Sw `json:"sw"`
|
*Sw `json:"sw"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue