Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

190.4.67.219 runtime error: index out of range #7

Open
vanbroup opened this issue Aug 20, 2013 · 6 comments
Open

190.4.67.219 runtime error: index out of range #7

vanbroup opened this issue Aug 20, 2013 · 6 comments

Comments

@vanbroup
Copy link

I'm getting the following error with some IP addresses:

190.4.67.219 runtime error: index out of range

/opt/_/src/ip/ip2country.go:32 (0x535a1e)
func.001: debug.PrintStack()
/usr/local/go/src/pkg/runtime/panic.c:229 (0x413581)
/usr/local/go/src/pkg/runtime/panic.c:487 (0x413d23)
/usr/local/go/src/pkg/runtime/panic.c:442 (0x413b55)
/opt/gopkg/src/github.com/nranchev/go-libGeoIP/libgeo.go:223 (0x5a1be1)
com/nranchev/go-libGeoIP.(_GeoIP).GetLocationByIPNum: location.CountryCode = countryCode[offset-countryBegin]
/opt/gopkg/src/github.com/nranchev/go-libGeoIP/libgeo.go:204 (0x5a1a85)
com/nranchev/go-libGeoIP.(GeoIP).GetLocationByIP: return gi.GetLocationByIPNum(AddrToNum(ip))
/opt/
_/src/ip/ip2country.go:37 (0x5354a3)
Ip2country: loc := gi.GetLocationByIP(ip.String())
/opt/
__/src/***/program.go:171 (0x4617ec)
saveCert: ipcountry := ip.Ip2country(conn.RemoteAddr().(net.TCPAddr).IP)
/opt/******
/src/**_****/program.go:142 (0x461622)
queue: doSomething(next)
/usr/local/go/src/pkg/runtime/proc.c:1223 (0x4170e0)

@aurelienb
Copy link

I dont know if this is similar, but I also have an index out of range error, what ever is the IP I test

goroutine 15 [running]:
github.com/nranchev/libgeo.(_GeoIP).lookupByIPNum(0xc20018b540, 0x1010
101, 0x0)
/my_path/src/github.com/nranchev/libgeo/libgeo.go:29
4 +0x2c1
github.com/nranchev/libgeo.(_GeoIP).GetLocationByIPNum(0xc20018b540, 0
x1010101, 0x1010101)
/my_path/src/github.com/nranchev/libgeo/libgeo.go:21
0 +0x3b
github.com/nranchev/libgeo.(*GeoIP).GetLocationByIP(0xc20018b540, 0xc2
00189f48, 0x7, 0x0)
/my_path/src/github.com/nranchev/libgeo/libgeo.go:20
4 +0x45

@vanbroup
Copy link
Author

@aurellenb Have you downloaded an loaded the correct MaxMind GeoIP database?

@aurelienb
Copy link

Yes, and we use it in production.
And when I use another lib (abh/geoip, forked in SoCloz/geoip) it works.

@nranchev
Copy link
Owner

Which DB are you using? I need to reproduce the error before fixing the bug.

@vanbroup
Copy link
Author

GeoLite Country (Binary)
http://dev.maxmind.com/geoip/legacy/geolite/

@ThomasRooney
Copy link

As somebody who ran into this issue, this is fixed by using the legacy database as opposed to the newest format. (as above)

For an example of using this take a quick look at my repo: https://github.com/ThomasRooney/GeoIP-echo. It grabs and unzips the relevant database itself using wget and gz.

Thanks @vanbroup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants