forked from unpoller/unifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuxg.go
158 lines (151 loc) · 8.96 KB
/
uxg.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package unifi
// UXG represents all the data from the Ubiquiti Controller for a UniFi 10Gb Gateway.
// The UDM shares several structs/type-data with USW and USG.
type UXG struct {
site *Site
SourceName string `json:"-"`
SiteName string `json:"-"`
ID string `json:"_id"`
IP string `json:"ip"`
Mac string `json:"mac"`
Model string `json:"model"`
ModelInLts FlexBool `json:"model_in_lts"`
ModelInEol FlexBool `json:"model_in_eol"`
Type string `json:"type"`
Version string `json:"version"`
Adopted FlexBool `json:"adopted"`
SiteID string `json:"site_id"`
Cfgversion string `json:"cfgversion"`
SyslogKey string `json:"syslog_key"`
ConfigNetwork *ConfigNetwork `json:"config_network"`
SetupID string `json:"setup_id"`
LicenseState string `json:"license_state"`
ConfigNetworkLan *ConfigNetworkLan `json:"config_network_lan"`
InformURL string `json:"inform_url"`
InformIP string `json:"inform_ip"`
RequiredVersion string `json:"required_version"`
KernelVersion string `json:"kernel_version"`
Architecture string `json:"architecture"`
BoardRev FlexInt `json:"board_rev"`
ManufacturerID FlexInt `json:"manufacturer_id"`
Internet FlexBool `json:"internet"`
ModelIncompatible FlexBool `json:"model_incompatible"`
EthernetTable []*EthernetTable `json:"ethernet_table"`
PortTable []Port `json:"port_table"`
EthernetOverrides []*EthernetOverrides `json:"ethernet_overrides"`
UsgCaps FlexInt `json:"usg_caps"`
HasSpeaker FlexBool `json:"has_speaker"`
HasEth1 FlexBool `json:"has_eth1"`
FwCaps FlexInt `json:"fw_caps"`
HwCaps FlexInt `json:"hw_caps"`
WifiCaps FlexInt `json:"wifi_caps"`
SwitchCaps *SwitchCaps `json:"switch_caps"`
HasFan FlexBool `json:"has_fan"`
HasTemperature FlexBool `json:"has_temperature"`
Temperatures []Temperature `json:"temperatures"`
Storage []*Storage `json:"storage"`
RulesetInterfaces interface{} `json:"ruleset_interfaces"`
ConnectedAt FlexInt `json:"connected_at"`
ProvisionedAt FlexInt `json:"provisioned_at"`
LedOverride string `json:"led_override"`
LedOverrideColor string `json:"led_override_color"`
LedOverrideColorBrightness FlexInt `json:"led_override_color_brightness"`
OutdoorModeOverride string `json:"outdoor_mode_override"`
LcmBrightnessOverride FlexBool `json:"lcm_brightness_override"`
LcmIdleTimeoutOverride FlexBool `json:"lcm_idle_timeout_override"`
Name string `json:"name"`
Unsupported FlexBool `json:"unsupported"`
UnsupportedReason FlexInt `json:"unsupported_reason"`
Serial string `json:"serial"`
HashID string `json:"hash_id"`
TwoPhaseAdopt FlexBool `json:"two_phase_adopt"`
DeviceID string `json:"device_id"`
State FlexInt `json:"state"`
StartDisconnectedMillis FlexInt `json:"start_disconnected_millis"`
UpgradeState FlexInt `json:"upgrade_state"`
StartConnectedMillis FlexInt `json:"start_connected_millis"`
LastSeen FlexInt `json:"last_seen"`
Uptime FlexInt `json:"uptime"`
UnderscoreUptime FlexInt `json:"_uptime"`
Locating FlexBool `json:"locating"`
SysStats SysStats `json:"sys_stats"`
SystemStats SystemStats `json:"system-stats"`
GuestKicks FlexInt `json:"guest_kicks"`
GuestToken string `json:"guest_token"`
UptimeStats map[string]*UptimeStats `json:"uptime_stats"`
Overheating FlexBool `json:"overheating"`
GeoInfo map[string]*GeoInfo `json:"geo_info"`
LedState *LedState `json:"led_state"`
SpeedtestStatus SpeedtestStatus `json:"speedtest-status"`
SpeedtestStatusSaved FlexBool `json:"speedtest-status-saved"`
Wan1 Wan `json:"wan1"`
Wan2 Wan `json:"wan2"`
Uplink Uplink `json:"uplink"`
DownlinkTable []*DownlinkTable `json:"downlink_table"`
NetworkTable NetworkTable `json:"network_table"`
KnownCfgversion string `json:"known_cfgversion"`
ConnectRequestIP string `json:"connect_request_ip"`
ConnectRequestPort string `json:"connect_request_port"`
NextInterval FlexInt `json:"next_interval"`
NextHeartbeatAt FlexInt `json:"next_heartbeat_at"`
ConsideredLostAt FlexInt `json:"considered_lost_at"`
Stat *UXGStat `json:"stat"`
TxBytes FlexInt `json:"tx_bytes"`
RxBytes FlexInt `json:"rx_bytes"`
Bytes FlexInt `json:"bytes"`
NumSta FlexInt `json:"num_sta"`
WlanNumSta FlexInt `json:"wlan-num_sta"`
LanNumSta FlexInt `json:"lan-num_sta"`
UserWlanNumSta FlexInt `json:"user-wlan-num_sta"`
UserLanNumSta FlexInt `json:"user-lan-num_sta"`
UserNumSta FlexInt `json:"user-num_sta"`
GuestWlanNumSta FlexInt `json:"guest-wlan-num_sta"`
GuestLanNumSta FlexInt `json:"guest-lan-num_sta"`
GuestNumSta FlexInt `json:"guest-num_sta"`
NumDesktop FlexInt `json:"num_desktop"`
NumMobile FlexInt `json:"num_mobile"`
NumHandheld FlexInt `json:"num_handheld"`
}
// ConfigNetworkLan is part of a UXG, maybe others.
type ConfigNetworkLan struct {
DhcpEnabled FlexBool `json:"dhcp_enabled"`
Vlan int `json:"vlan"`
}
// DownlinkTable is part of a UXG and UDM output.
type DownlinkTable struct {
PortIdx FlexInt `json:"port_idx"`
Speed FlexInt `json:"speed"`
FullDuplex FlexBool `json:"full_duplex"`
Mac string `json:"mac"`
}
// LedState is incuded with newer devices.
type LedState struct {
Pattern string `json:"pattern"`
Tempo FlexInt `json:"tempo"`
}
// GeoInfo is incuded with certain devices.
type GeoInfo struct {
Accuracy FlexInt `json:"accuracy"`
Address string `json:"address"`
Asn FlexInt `json:"asn"`
City string `json:"city"`
ContinentCode string `json:"continent_code"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
IspName string `json:"isp_name"`
IspOrganization string `json:"isp_organization"`
Latitude FlexInt `json:"latitude"`
Longitude FlexInt `json:"longitude"`
Timezone string `json:"timezone"`
}
// UptimeStats is incuded with certain devices.
type UptimeStats struct {
Availability FlexInt `json:"availability"`
LatencyAverage FlexInt `json:"latency_average"`
TimePeriod FlexInt `json:"time_period"`
}
// UXGStat holds the "stat" data for a 10Gb gateway.
type UXGStat struct {
*Gw `json:"gw"`
*Sw `json:"sw"`
}