Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package geoip2

import (
"github.com/oschwald/maxminddb-golang"
"github.com/oxtoacart/maxminddb-golang"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once oschwald/maxminddb-golang#1 is processed, this should continue to point at oschwald.

"net"
)

Expand All @@ -29,7 +29,7 @@ type City struct {
Location struct {
Latitude float64
Longitude float64
MetroCode int `maxminddb:"metro_code"`
MetroCode string `maxminddb:"metro_code"`
TimeZone string `maxminddb:"time_zone"`
}
Postal struct {
Expand Down Expand Up @@ -101,6 +101,14 @@ func Open(file string) (*Reader, error) {
return &Reader{mmdbReader: reader}, err
}

// OpenBytes takes a string path to a file and returns a Reader structure or an
// error. The database file opened using a memory map. Use the Close method
// on the Reader object to return the resources to the system.
func OpenBytes(bytes []byte) (*Reader, error) {
reader, err := maxminddb.OpenBytes(bytes)
return &Reader{mmdbReader: reader}, err
}

// City takes an IP address as a net.IP struct and returns a City struct
// and/or an error. Although this can be used with other databases, this
// method generally should be used with the GeoIP2 or GeoLite2 City databases.
Expand Down