[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-talk] GeoIP



On 2011-10-22 09:27 , kamyar kamyar wrote:
> Hi all,
> 
> What's GeoIP file in TOR directory? what's it used for?

The file contains IPv4 address ranges to Country mappings.

It is used for determining the country that an IP address is in.
This as several configuration commands allow avoiding/requesting a
specific country.

(Yes, these kind of mappings are not 100% accurate and due to the
dynamics of the Internet might be wrong too, but it is 'good enough')

> what are the
> numbers beside each line inside the file?related to fingerprints?

The numbers decimal representations of an IP address.

From the comment above src/or/geoip.c's geop_load_file():

[..]
 * Recognized line formats are:
 *   INTIPLOW,INTIPHIGH,CC
 * and
 *   "INTIPLOW","INTIPHIGH","CC","CC3","COUNTRY NAME"
 * where INTIPLOW and INTIPHIGH are IPv4 addresses encoded as 4-byte
unsigned
 * integers, and CC is a country code.
[..]

Thus for instance 123.45.67.0 becomes:

$ printf "%02x %02x %02x %02x\n" 123 45 67 0
7b 2d 43 00

Thus 0x7b2d4300 which is in decimal:

$ printf "%d\n" 0x7b2d4300
2066563840

Thus to convert them back:

$ printf "%x\n" 2066563840
7b2d4300

$ printf "%d.%d.%d.%d\n" 0x7b 0x2d 0x43 0x00
123.45.67.0

That is, if you actually wanted to look inside them ;)

Greets,
 Jeroen
_______________________________________________
tor-talk mailing list
tor-talk@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-talk