@@ -72,32 +72,25 @@ func (u *Unifi) GetSiteEvents(site *Site, hours time.Duration) ([]*Event, error)
72
72
// Event describes a UniFi Event.
73
73
// API Path: /api/s/default/stat/event.
74
74
type Event struct {
75
- IsAdmin FlexBool `json:"is_admin"`
76
- DestPort int `fake:"{port}" json:"dest_port"`
77
- SrcPort int `fake:"{port}" json:"src_port"`
78
- Bytes FlexInt `json:"bytes"`
79
- Duration FlexInt `json:"duration"`
80
- FlowID FlexInt `json:"flow_id"`
81
- InnerAlertGID FlexInt `json:"inner_alert_gid"`
82
- InnerAlertRev FlexInt `json:"inner_alert_rev"`
83
- InnerAlertSeverity FlexInt `json:"inner_alert_severity"`
84
- InnerAlertSignatureID FlexInt `json:"inner_alert_signature_id"`
85
- Channel FlexInt `json:"channel"`
86
- ChannelFrom FlexInt `json:"channel_from"`
87
- ChannelTo FlexInt `json:"channel_to"`
88
- Time int64 `fake:"{timestamp}" json:"time"`
89
- Timestamp int64 `fake:"{timestamp}" json:"timestamp"`
90
- Datetime time.Time `json:"datetime"`
91
75
Admin string `json:"admin"`
92
76
Ap string `json:"ap"`
93
77
ApFrom string `json:"ap_from"`
94
78
ApName string `json:"ap_name"`
95
79
ApTo string `json:"ap_to"`
96
80
AppProto string `json:"app_proto"`
81
+ Bytes FlexInt `json:"bytes"`
97
82
Catname string `json:"catname"`
83
+ Channel FlexInt `json:"channel"`
84
+ ChannelFrom FlexInt `json:"channel_from"`
85
+ ChannelTo FlexInt `json:"channel_to"`
86
+ Datetime time.Time `fake:"{recent_time}" json:"datetime"`
98
87
DestIP string `fake:"{ipv4address}" json:"dest_ip"`
88
+ DestIPGeo IPGeo `json:"dstipGeo"`
89
+ DestPort int `fake:"{port}" json:"dest_port"`
99
90
DstMAC string `fake:"{macaddress}" json:"dst_mac"`
91
+ Duration FlexInt `json:"duration"`
100
92
EventType string `json:"event_type"`
93
+ FlowID FlexInt `json:"flow_id"`
101
94
Guest string `json:"guest"`
102
95
Gw string `json:"gw"`
103
96
GwName string `json:"gw_name"`
@@ -108,45 +101,52 @@ type Event struct {
108
101
InIface string `json:"in_iface"`
109
102
InnerAlertAction string `json:"inner_alert_action"`
110
103
InnerAlertCategory string `json:"inner_alert_category"`
104
+ InnerAlertGID FlexInt `json:"inner_alert_gid"`
105
+ InnerAlertRev FlexInt `json:"inner_alert_rev"`
106
+ InnerAlertSeverity FlexInt `json:"inner_alert_severity"`
111
107
InnerAlertSignature string `json:"inner_alert_signature"`
108
+ InnerAlertSignatureID FlexInt `json:"inner_alert_signature_id"`
109
+ IsAdmin FlexBool `json:"is_admin"`
112
110
Key string `fake:"{uuid}" json:"key"`
113
111
Msg string `fake:"{buzzword}" json:"msg"`
114
112
Network string `json:"network"`
115
113
Proto string `json:"proto"`
116
114
Radio string `json:"radio"`
117
115
RadioFrom string `json:"radio_from"`
118
116
RadioTo string `json:"radio_to"`
117
+ SSID string `fake:"{macaddress}" json:"ssid"`
119
118
SiteID string `fake:"{}" json:"site_id"`
120
119
SiteName string `json:"-"`
120
+ SourceIPGeo IPGeo `json:"srcipGeo"`
121
121
SourceName string `json:"-"`
122
122
SrcIP string `fake:"{ipv4address}" json:"src_ip"`
123
- SrcMAC string `fake:"{macaddress}" json:"src_mac"`
124
123
SrcIPASN string `fake:"{address}" json:"srcipASN"`
125
124
SrcIPCountry string `fake:"{country}" json:"srcipCountry"`
126
- SSID string `fake:"{macaddress}" json:"ssid"`
125
+ SrcMAC string `fake:"{macaddress}" json:"src_mac"`
126
+ SrcPort int `fake:"{port}" json:"src_port"`
127
127
Subsystem string `json:"subsystem"`
128
128
Sw string `json:"sw"`
129
129
SwName string `json:"sw_name"`
130
- UniqueAlertID string ` json:"unique_alertid "`
131
- User string ` json:"user "`
130
+ Time int64 `fake:"{timestamp}" json:"time "`
131
+ Timestamp int64 `fake:"{timestamp}" json:"timestamp "`
132
132
USGIP string `fake:"{ipv4address}" json:"usgip"`
133
133
USGIPASN string `fake:"{address}" json:"usgipASN"`
134
134
USGIPCountry string `fake:"{country}" json:"usgipCountry"`
135
- DestIPGeo IPGeo `json:"dstipGeo"`
136
- SourceIPGeo IPGeo `json:"srcipGeo"`
137
135
USGIPGeo IPGeo `json:"usgipGeo"`
136
+ UniqueAlertID string `json:"unique_alertid"`
137
+ User string `json:"user"`
138
138
}
139
139
140
140
// IPGeo is part of the UniFi Event data. Each event may have up to three of these.
141
141
// One for source, one for dest and one for the USG location.
142
142
type IPGeo struct {
143
143
Asn int64 `json:"asn"`
144
- Latitude float64 `fake:"{latitude}" json:"latitude"`
145
- Longitude float64 `fake:"{longitude}" json:"longitude"`
146
144
City string `fake:"{city}" json:"city"`
147
145
ContinentCode string `json:"continent_code"`
148
146
CountryCode string `fake:"{countryabr}" json:"country_code"`
149
147
CountryName string `fake:"{country}" json:"country_name"`
148
+ Latitude float64 `fake:"{latitude}" json:"latitude"`
149
+ Longitude float64 `fake:"{longitude}" json:"longitude"`
150
150
Organization string `fake:"{company}" json:"organization"`
151
151
}
152
152
@@ -177,12 +177,12 @@ func (v *IPGeo) UnmarshalJSON(data []byte) error {
177
177
178
178
g := struct {
179
179
Asn int64 `json:"asn"`
180
- Latitude float64 `json:"latitude"`
181
- Longitude float64 `json:"longitude"`
182
180
City string `json:"city"`
183
181
ContinentCode string `json:"continent_code"`
184
182
CountryCode string `json:"country_code"`
185
183
CountryName string `json:"country_name"`
184
+ Latitude float64 `json:"latitude"`
185
+ Longitude float64 `json:"longitude"`
186
186
Organization string `json:"organization"`
187
187
}{}
188
188
0 commit comments