File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed
Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ func (e InvalidDatabaseError) Error() string {
2626// UnmarshalTypeError is returned when the value in the database cannot be
2727// assigned to the specified data type.
2828type UnmarshalTypeError struct {
29- Value string // stringified copy of the database value that caused the error
30- Type reflect. Type // type of the value that could not be assign to
29+ Type reflect. Type
30+ Value string
3131}
3232
3333func newUnmarshalTypeError (value interface {}, rType reflect.Type ) UnmarshalTypeError {
Original file line number Diff line number Diff line change @@ -25,28 +25,28 @@ var metadataStartMarker = []byte("\xAB\xCD\xEFMaxMind.com")
2525// All of the methods on Reader are thread-safe. The struct may be safely
2626// shared across goroutines.
2727type Reader struct {
28- hasMappedFile bool
29- buffer []byte
3028 nodeReader nodeReader
29+ buffer []byte
3130 decoder decoder
3231 Metadata Metadata
3332 ipv4Start uint
3433 ipv4StartBitDepth int
3534 nodeOffsetMult uint
35+ hasMappedFile bool
3636}
3737
3838// Metadata holds the metadata decoded from the MaxMind DB file. In particular
3939// it has the format version, the build time as Unix epoch time, the database
4040// type and description, the IP version supported, and a slice of the natural
4141// languages included.
4242type Metadata struct {
43+ Description map [string ]string `maxminddb:"description"`
44+ DatabaseType string `maxminddb:"database_type"`
45+ Languages []string `maxminddb:"languages"`
4346 BinaryFormatMajorVersion uint `maxminddb:"binary_format_major_version"`
4447 BinaryFormatMinorVersion uint `maxminddb:"binary_format_minor_version"`
4548 BuildEpoch uint `maxminddb:"build_epoch"`
46- DatabaseType string `maxminddb:"database_type"`
47- Description map [string ]string `maxminddb:"description"`
4849 IPVersion uint `maxminddb:"ip_version"`
49- Languages []string `maxminddb:"languages"`
5050 NodeCount uint `maxminddb:"node_count"`
5151 RecordSize uint `maxminddb:"record_size"`
5252}
Original file line number Diff line number Diff line change @@ -14,11 +14,10 @@ type netNode struct {
1414
1515// Networks represents a set of subnets that we are iterating over.
1616type Networks struct {
17- reader * Reader
18- nodes []netNode // Nodes we still have to visit.
19- lastNode netNode
20- err error
21-
17+ err error
18+ reader * Reader
19+ nodes []netNode
20+ lastNode netNode
2221 skipAliasedNetworks bool
2322}
2423
You can’t perform that action at this time.
0 commit comments