-
Notifications
You must be signed in to change notification settings - Fork 2
/
api.go
36 lines (32 loc) · 901 Bytes
/
api.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
package storeapi
import (
"encoding/json"
"time"
)
type RequestData struct {
ClientIP string
ServerIP string
EdnsNet string
TestIP string
}
type LogData struct {
ClientIP string `db:"client_ip"`
ServerIP string `db:"server_ip"`
EdnsNet string `db:"edns_net"`
ClientCC string `db:"client_cc"`
ClientRC string `db:"client_rc"`
ServerCC string `db:"server_cc"`
ServerRC string `db:"server_rc"`
EdnsCC string `db:"edns_cc"`
EdnsRC string `db:"edns_rc"`
ClientASN uint `db:"client_asn"`
ServerASN uint `db:"server_asn"`
EdnsASN uint `db:"edns_asn"`
HasEdns bool `db:"has_edns"`
TestIP string `db:"test_ip" json:"-"`
FirstSeen *time.Time `db:"first_seen" json:"-"`
LastSeen *time.Time `db:"last_seen" json:"-"`
}
func (data *RequestData) JSON() ([]byte, error) {
return json.Marshal(data)
}