-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.go
115 lines (106 loc) · 2.71 KB
/
structs.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
package main
type Download struct {
Folder string
Format string
Type string
CDN string
Licenses []string
}
type DataToLoad struct {
Download Download
Path string
Version int
}
type IpCity struct {
IpRangeStart string
IpRangeEnd string
CountryCode string
State1 string
State2 string
City string
Postcode string
Latitude float64
Longitude float64
Timezone string
IpVersion int
DbVersion int
}
type IpASN struct {
IpRangeStart string
IpRangeEnd string
AsNumber int
AsOrganisation string
IpVersion int
DbVersion int
}
type IpCountry struct {
IpRangeStart string
IpRangeEnd string
CountryCode string
IpVersion int
DbVersion int
}
type Ip struct {
IP string `json:"ip"`
IPVersion int `json:"ip_version"`
FoundCountry bool `json:"found_country"`
FoundCity bool `json:"found_city"`
FoundASN bool `json:"found_asn"`
CountryCode string `json:"country_code"`
State1 string `json:"state"`
State2 string `json:"state_2"`
City string `json:"city"`
Postcode string `json:"postcode"`
Latitude float64 `json:"lat"`
Longitude float64 `json:"lon"`
Timezone string `json:"timezone"`
OrganisationNumber int64 `json:"as_number"`
OrganisationName string `json:"as_organisation"`
Milliseconds int64 `json:"ms_taken"`
Microseconds int64 `json:"μs_taken"`
}
func NewIp(ipString string, ipVersion int) *Ip {
return &Ip{ ipString, ipVersion, false, false, false, "", "", "", "", "", 0, 0, "", 0, "", 0, 0 }
}
type MmdbCountry struct {
Country struct {
ISOCode string `maxminddb:"iso_code"`
} `maxminddb:"country"`
}
type MmdbASN struct {
AsNumber int64 `maxminddb:"autonomous_system_number"`
AsOrganisation string `maxminddb:"autonomous_system_organization"`
}
type MmdbCity struct {
City struct {
Names struct {
Value string `maxminddb:"en"`
} `maxminddb:"names"`
Postcode string `maxminddb:"postcode"`
Timezone string `maxminddb:"timezone"`
} `maxminddb:"city"`
Country struct {
ISOCode string `maxminddb:"iso_code"`
GeonameID int64 `maxminddb:"geoname_id"`
Eu bool `maxminddb:"is_in_european_union"`
Names struct {
Value string `maxminddb:"en"`
} `maxminddb:"names"`
} `maxminddb:"continent"`
Continent struct {
Code string `maxminddb:"code"`
GeonameID int64 `maxminddb:"geoname_id"`
Names struct {
Value string `maxminddb:"en"`
} `maxminddb:"names"`
} `maxminddb:"continent"`
Location struct {
Latitude float64 `maxminddb:"latitude"`
Longitude float64 `maxminddb:"longitude"`
} `maxminddb:"location"`
Subdivisions []struct {
Names struct {
Value string `maxminddb:"en"`
} `maxminddb:"names"`
} `maxminddb:"subdivisions"`
}