Skip to content

Commit

Permalink
Add geoip command line tool
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Mar 23, 2018
1 parent 7fe1551 commit 4bbffa9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions cmd/ooni/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
// commands
"github.com/apex/log"

_ "github.com/openobservatory/gooni/internal/cli/geoip"
_ "github.com/openobservatory/gooni/internal/cli/info"
_ "github.com/openobservatory/gooni/internal/cli/list"
_ "github.com/openobservatory/gooni/internal/cli/nettest"
Expand Down
4 changes: 1 addition & 3 deletions utils/geoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"archive/tar"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"math/rand"
Expand Down Expand Up @@ -97,8 +96,7 @@ func DownloadGeoIPDatabaseFiles(dir string) error {

// LookupLocation resolves an IP to a location according to the Maxmind DB
func LookupLocation(dbPath string, ipStr string) (LocationInfo, error) {
loc := LocationInfo{}
fmt.Printf("Opening %s", filepath.Join(dbPath, "GeoLite2-ASN.mmdb"))
loc := LocationInfo{IP: ipStr}

asnDB, err := geoip2.Open(filepath.Join(dbPath, "GeoLite2-ASN.mmdb"))
if err != nil {
Expand Down

0 comments on commit 4bbffa9

Please sign in to comment.