8
8
"reflect"
9
9
"time"
10
10
11
- "github.com/m-lab/annotation-service/api"
12
11
"github.com/m-lab/go/cloud/bqx"
13
12
)
14
13
@@ -28,17 +27,17 @@ type ServerInfo struct {
28
27
Port uint16
29
28
IATA string
30
29
31
- Geo * api. GeolocationIP
32
- Network * api. ASData // NOTE: dominant ASN is available at top level.
30
+ Geo * LegacyGeolocationIP
31
+ Network * LegacyASData // NOTE: dominant ASN is available at top level.
33
32
}
34
33
35
34
// ClientInfo details various kinds of information about the client.
36
35
type ClientInfo struct {
37
36
IP string
38
37
Port uint16
39
38
40
- Geo * api. GeolocationIP
41
- Network * api. ASData // NOTE: dominant ASN is available at top level.
39
+ Geo * LegacyGeolocationIP
40
+ Network * LegacyASData // NOTE: dominant ASN is available at top level.
42
41
}
43
42
44
43
// ParseInfoV0 provides details about the parsing of this row.
@@ -49,6 +48,54 @@ type ParseInfoV0 struct {
49
48
Filename string
50
49
}
51
50
51
+ /*************************************************************************
52
+ * DEPRECATED: Annotation Structs *
53
+ *************************************************************************/
54
+
55
+ // LegacyGeolocationIP preserves the schema for existing v1 datatype schemas. It should not be used for new datatypes.
56
+ // Deprecated: v1 annotation-service schema, preserved for backward compatibility. Do not reuse.
57
+ type LegacyGeolocationIP struct {
58
+ ContinentCode string `json:"continent_code,,omitempty" bigquery:"continent_code"` // Gives a shorthand for the continent
59
+ CountryCode string `json:"country_code,,omitempty" bigquery:"country_code"` // Gives a shorthand for the country
60
+ CountryCode3 string `json:"country_code3,,omitempty" bigquery:"country_code3"` // Gives a shorthand for the country
61
+ CountryName string `json:"country_name,,omitempty" bigquery:"country_name"` // Name of the country
62
+ Region string `json:"region,,omitempty" bigquery:"region"` // Region or State within the country
63
+ Subdivision1ISOCode string `json:",omitempty"` // ISO3166-2 first-level country subdivision ISO code
64
+ Subdivision1Name string `json:",omitempty"` // ISO3166-2 first-level country subdivision name
65
+ Subdivision2ISOCode string `json:",omitempty"` // ISO3166-2 second-level country subdivision ISO code
66
+ Subdivision2Name string `json:",omitempty"` // ISO3166-2 second-level country subdivision name
67
+ MetroCode int64 `json:"metro_code,,omitempty" bigquery:"metro_code"` // Metro code within the country
68
+ City string `json:"city,,omitempty" bigquery:"city"` // City within the region
69
+ AreaCode int64 `json:"area_code,,omitempty" bigquery:"area_code"` // Area code, similar to metro code
70
+ PostalCode string `json:"postal_code,,omitempty" bigquery:"postal_code"` // Postal code, again similar to metro
71
+ Latitude float64 `json:"latitude,,omitempty" bigquery:"latitude"` // Latitude
72
+ Longitude float64 `json:"longitude,,omitempty" bigquery:"longitude"` // Longitude
73
+ AccuracyRadiusKm int64 `json:"radius,,omitempty" bigquery:"radius"` // Accuracy Radius (geolite2 from 2018)
74
+
75
+ Missing bool `json:",omitempty"` // True when the Geolocation data is missing from MaxMind.
76
+ }
77
+
78
+ type LegacySystem struct {
79
+ // ASNs contains a single ASN, or AS set. There must always be at least one ASN.
80
+ // If there are more than one ASN, they are (arbitrarily) listed in increasing numerical order.
81
+ ASNs []uint32
82
+ }
83
+
84
+ // LegacyASData preserves the schema for existing v1 datatype schemas. It should not be used for new datatypes.
85
+ // Deprecated: v1 annotation-service schema, preserved for backward compatibility. Do not reuse.
86
+ type LegacyASData struct {
87
+ IPPrefix string `json:",omitempty"` // the IP prefix found in the table.
88
+ CIDR string `json:",omitempty"` // The IP prefix found in the RouteViews data.
89
+ ASNumber uint32 `json:",omitempty"` // First AS number.
90
+ ASName string `json:",omitempty"` // AS name for that number, data from IPinfo.io
91
+ Missing bool `json:",omitempty"` // True when the ASN data is missing from RouteViews.
92
+
93
+ // One or more "Systems". There must always be at least one System. If there are more than one,
94
+ // then this is a Multi-Origin AS, and the component Systems are in order of frequency in routing tables,
95
+ // most common first.
96
+ Systems []LegacySystem `json:",omitempty"`
97
+ }
98
+
52
99
// FindSchemaDocsFor should be used by parser row types to associate bigquery
53
100
// field descriptions with a schema generated from a row type.
54
101
func FindSchemaDocsFor (value interface {}) []bqx.SchemaDoc {
0 commit comments