turbobytes / geoipdb

GeoIP related related helper functions for TurboBytes stack
MIT License
0 stars 2 forks source link

libgeoip and ipinfo queries by LookupAsn #2

Closed coolparadox closed 7 years ago

coolparadox commented 7 years ago

Hi @sajal

I requested this early pull request so you may want to take a look on how things are being implemented.

So far I added libgeoip and ipinfo specialized methods to geoipdb, as well as updated LookupAsn to use them. There are also simple tests for these methods:

$ go test -v
=== RUN   TestInitIp
--- PASS: TestInitIp (0.04s)
    geoipdb_test.go:48: using ip 107.20.181.99 (www.turbobytes.com) for tests
=== RUN   TestCreateHandler
--- PASS: TestCreateHandler (0.01s)
=== RUN   TestLibGeoipLookup
--- PASS: TestLibGeoipLookup (0.00s)
    geoipdb_test.go:66: libgeoip results: AS14618 Amazon.com, Inc.
=== RUN   TestIpInfoLookup
--- PASS: TestIpInfoLookup (0.40s)
    geoipdb_test.go:74: ipinfo.io results: AS14618 Amazon.com, Inc.
=== RUN   TestLookupAsn
--- PASS: TestLookupAsn (0.00s)
    geoipdb_test.go:82: LookupAsn results: AS14618 Amazon.com, Inc.
PASS
ok      github.com/turbobytes/geoipdb   0.452s

Regards, Rafael

sajal commented 7 years ago

Looks good. merging