Google Gears is an interesting bit of functionality you can add to your browser. One bit of it includes the ability for a site to ask where you are located.
Now, you might wonder how it's possible to turn an IP address into a geographical location. There are databases that try and do this in a fairly inaccurate way by figuring out which ISP you're using and putting a big peg in the middle of their service area. But a much better way is to use DNS LOC records, when they've been provided by the domain owner.
Well, I have provided an accurate LOC record for kfu.com.
The algorithm for turning an IP into a location is a 3 step one with DNS:
1. Get the name of the IP address by doing a reverse lookup on the IP. In the case of the machines here in the house, for IPv6, you'd get the individual machine's name, and for IPv4, you'd get "nat.kfu.com."
2. Do a LOC lookup for the name. In most cases, this won't get you a match, since the LOC records are generally applied at the domain or subdomain level.
3. Start lopping words off the left side of the name, looking for LOC records at each step until you get to "."
If you do this, you'll get the right answer almost instantly for the machines in the house.
Alas, if you ask Google Gears, the answer you get is "Hayward, CA" and a lon/lat a block east of the Hayward BART station.
Um, no.
Thursday, May 28, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment