etix / mirrorbits

Mirrorbits is a geographical download redirector written in Go for distributing files efficiently across a set of mirrors.
MIT License
503 stars 91 forks source link

Doesn't perform GeoIP lookup on mirror with 1 IPv4 + 1 IPv6 address #80

Closed wjt closed 6 years ago

wjt commented 6 years ago

If I add a new mirror which has 1 IPv4 and 1 IPv6 address, I am told:

Warning: the hostname returned more than one address! This is highly unreliable.                                       
Warning: unable to guess the geographic location of willthompson.co.uk                                                 
Mirror added successfully                                                                                              

This server is in a data centre in central Manchester. It's true that the v4 and v6 databases contain different information; the v4 information is almost correct whereas the v6 information puts it somewhere in a field 40km north:

$ geoiplookup willthompson.co.uk
GeoIP Country Edition: GB, United Kingdom
GeoIP City Edition, Rev 1: GB, I2, Manchester, Manchester, M40, 53.466301, -2.134200, 0, 0
GeoIP ASNum Edition: AS35425 Bytemark Limited
$ geoiplookup6 willthompson.co.uk
GeoIP Country V6 Edition: GB, United Kingdom
GeoIP ASNum V6 Edition: AS35425 Bytemark Limited
GeoIP City Edition V6, Rev 1: GB, N/A, N/A, N/A, 54.000000, -2.000000, 0, 0

In my brief testing this seems to be true in general: IPv4 geoip results are pretty accurate, whereas IPv6 results are just "middle of the country".

I think it would be kinder to treat this case specially, something like this:

wjt commented 6 years ago

Never mind. I see now that the 0th address is already used. I was confusing this error message with the problem fixed by 03a4e02214bdb7bb60240ddf25b887ccac5fb118.