210 lines
8.0 KiB
Go
210 lines
8.0 KiB
Go
package model
|
|
|
|
import "encoding/json"
|
|
|
|
type Client struct {
|
|
ID string `json:"id"`
|
|
MacAddress string `json:"mac"`
|
|
Name string `json:"name"`
|
|
Hostname string `json:"hostName"`
|
|
Vendor string `json:"vendor"`
|
|
DeviceType string `json:"deviceType"`
|
|
DeviceCategory string `json:"deviceCategory"`
|
|
OsName string `json:"osName"`
|
|
IP string `json:"ip"`
|
|
IPv6List []string `json:"ipv6List"`
|
|
ConnectionType ConnectionType `json:"connectType"`
|
|
ConnectionDevType ConnectionDeviceType `json:"connectDevType"`
|
|
ConnectedToWirelessRouter bool `json:"connectedToWirelessRouter"`
|
|
Wireless bool `json:"wireless"`
|
|
SSID string `json:"ssid"`
|
|
SignalLevel int `json:"signalLevel"`
|
|
HealthScore int `json:"healthScore"`
|
|
SignalRank int `json:"signalRank"`
|
|
WifiMode WifiMode `json:"wifiMode"`
|
|
ApName string `json:"apName"`
|
|
ApMac string `json:"apMac"`
|
|
RadioID RadioID `json:"radioId"`
|
|
Channel int `json:"channel"`
|
|
ReceiveRateKbits int `json:"rxRate"`
|
|
TransferRateKbits int `json:"txRate"`
|
|
PowerSave bool `json:"powerSave"`
|
|
SignalStrengh int `json:"rssi"`
|
|
SignalNoiseRatio int `json:"snr"`
|
|
SwitchMac string `json:"switchMac"`
|
|
SwitchName string `json:"switchName"`
|
|
GatewayMac string `json:"gatewayMac"`
|
|
GatewayName string `json:"gatewayName"`
|
|
VLanID int `json:"vid"`
|
|
NetworkName string `json:"networkName"`
|
|
Dot1xIdentity string `json:"dot1xIdentity"`
|
|
Dot1xVlan int `json:"dot1xVlan"`
|
|
Port int `json:"port"`
|
|
LagID int `json:"lagId"`
|
|
Activity int `json:"activity"`
|
|
TrafficDownBytes int `json:"trafficDown"`
|
|
TrafficUpBytes int `json:"trafficUp"`
|
|
UptimeSeconds int `json:"uptime"`
|
|
LastSeen int `json:"lastSeen"`
|
|
AuthStatus AuthStatus `json:"authStatus"`
|
|
Blocked bool `json:"blocked"`
|
|
Guest bool `json:"guest"`
|
|
Active bool `json:"active"`
|
|
Manager bool `json:"manager"`
|
|
IpSetting *ClientIpSetting `json:"ipSetting"`
|
|
DownPacket int `json:"downPacket"`
|
|
UpPacket int `json:"upPacket"`
|
|
RateLimit *ClientRateLimit `json:"rateLimit"`
|
|
ClientLockToApSetting *ClientLockToApSetting `json:"clientLockToApSetting"`
|
|
MultiLink []*ClientMultiFrequencyInfo `json:"multiLink"`
|
|
Unit int `json:"unit"`
|
|
StandardPort string `json:"standardPort"`
|
|
BlockDisable bool `json:"blockDisable"`
|
|
DhcpLeaseTimeSeconds int `json:"dhcpLeaseTime"`
|
|
SystemName string `json:"systemName"`
|
|
Description string `json:"description"`
|
|
Capabilities []string `json:"capabilities"`
|
|
ClientStat *ClientStat `json:"clientStat"`
|
|
}
|
|
|
|
func (c Client) String() string {
|
|
data, _ := json.MarshalIndent(c, "", "\t")
|
|
return string(data)
|
|
}
|
|
|
|
type ConnectionType int
|
|
|
|
const (
|
|
ConnectionTypeWirelessGuest ConnectionType = iota
|
|
ConnectionTypeWirelessUser
|
|
ConnectionTypeWiredUser
|
|
)
|
|
|
|
type ConnectionDeviceType string
|
|
|
|
const (
|
|
ConnectionDeviceTypeAP ConnectionDeviceType = "ap"
|
|
ConnectionDeviceTypeSwitch ConnectionDeviceType = "switch"
|
|
ConnectionDeviceTypeGateway ConnectionDeviceType = "gateway"
|
|
)
|
|
|
|
type WifiMode int
|
|
|
|
const (
|
|
WifiMode11a WifiMode = iota
|
|
WifiMode11b
|
|
WifiMode11g
|
|
WifiMode11na
|
|
WifiMode11ng
|
|
WifiMode11ac
|
|
WifiMode11axa
|
|
WifiMode11axg
|
|
WifiMode11beg
|
|
WifiMode11bea
|
|
)
|
|
|
|
type RadioID int
|
|
|
|
const (
|
|
RadioID_2_4G RadioID = iota
|
|
RadioID_5G RadioID = iota
|
|
RadioID_5G2 RadioID = iota
|
|
RadioID_6G RadioID = iota
|
|
)
|
|
|
|
type AuthStatus int
|
|
|
|
const (
|
|
AuthStatusConnected AuthStatus = iota
|
|
AuthStatusPending
|
|
AuthStatusAuthorized
|
|
AuthStatusAuthFree
|
|
)
|
|
|
|
type ClientIpSetting struct {
|
|
UseFixedAddr bool `json:"useFixedAddr"`
|
|
NetID string `json:"netId"`
|
|
IP string `json:"ip"`
|
|
}
|
|
|
|
type ClientRateLimit struct {
|
|
Mode RateLimitMode `json:"mode"`
|
|
RateLimitProfileID string `json:"rateLimitProfileId"`
|
|
CustomRateLimit *CustomRateLimit `json:"customRateLimit"`
|
|
}
|
|
|
|
type RateLimitMode int
|
|
|
|
const (
|
|
RateLimitModeCustom RateLimitMode = iota
|
|
RateLimitModeProfile
|
|
)
|
|
|
|
type CustomRateLimit struct {
|
|
UpEnable bool `json:"upEnable"`
|
|
UpUnit SpeedUnit `json:"upUnit"`
|
|
UpLimit int `json:"upLimit"`
|
|
DownEnable bool `json:"downEnable"`
|
|
DownUnit SpeedUnit `json:"downUnit"`
|
|
DownLimit int `json:"downLimit"`
|
|
}
|
|
|
|
type SpeedUnit int
|
|
|
|
const (
|
|
SpeedUnitKbps SpeedUnit = iota
|
|
SpeedUnitMbps
|
|
)
|
|
|
|
type ClientLockToApSetting struct {
|
|
Enable bool `json:"enable"`
|
|
APs []*ApBriefInfo `json:"aps"`
|
|
}
|
|
|
|
type ApBriefInfo struct {
|
|
Name string `json:"name"`
|
|
MacAddress string `json:"mac"`
|
|
}
|
|
|
|
type ClientMultiFrequencyInfo struct {
|
|
RadioID int `json:"radioId"`
|
|
WifiMode WifiMode `json:"wifiMode"`
|
|
Channel int `json:"channel"`
|
|
ReceiveRateKbits int `json:"rxRate"`
|
|
TransferRateKbits int `json:"txRate"`
|
|
PowerSave bool `json:"powerSave"`
|
|
SignalStrengh int `json:"rssi"`
|
|
SignalNoiseRatio int `json:"snr"`
|
|
SignalLevel int `json:"signalLevel"`
|
|
SignalRank int `json:"signalRank"`
|
|
UpPacket int `json:"upPacket"`
|
|
DownPacket int `json:"downPacket"`
|
|
TrafficDownBytes int `json:"trafficDown"`
|
|
TrafficUpBytes int `json:"trafficUp"`
|
|
Activity int `json:"activity"`
|
|
SignalLevelAndRank int `json:"signalLevelAndRank"`
|
|
}
|
|
|
|
type ClientStat struct {
|
|
Total int `json:"total"`
|
|
Wireless int `json:"wireless"`
|
|
Wired int `json:"wired"`
|
|
Num2G int `json:"num2g"`
|
|
Num5G int `json:"num5g"`
|
|
Num6G int `json:"num6g"`
|
|
NumUser int `json:"numUser"`
|
|
NumGuest int `json:"numGuest"`
|
|
NumWirelessUser int `json:"numWirelessUser"`
|
|
NumWirelessGuest int `json:"numWirelessGuest"`
|
|
Num2gUser int `json:"num2gUser"`
|
|
Num5gUser int `json:"num5gUser"`
|
|
Num6gUser int `json:"num6gUser"`
|
|
Num2gGuest int `json:"num2gGuest"`
|
|
Num5gGuest int `json:"num5gGuest"`
|
|
Num6gGuest int `json:"num6gGuest"`
|
|
Poor int `json:"poor"`
|
|
Fair int `json:"fair"`
|
|
NoData int `json:"noData"`
|
|
Good int `json:"good"`
|
|
}
|