Hacker News new | ask | show | jobs
by mike-cardwell 5590 days ago
Some suggestions:

Make jsonip.com dual stack IPv4/IPv6 and work for IPv6 addresses too. Return some other useful IP information, such as the PTR, the domain name part of the PTR, and the country code and name.

Example: https://grepular.com/ipinfo

EDIT: Don't use that URL for your own stuff or I'll block it. I only put it there as an example of how the JSON should be returned.

EDIT2: Might be useful if it included the IP addresses from any X-Forwarded-For HTTP header too.

4 comments

This brings up something I'm waffling on. Whats the correct content type for JSON?

in your example returning "Content-Type: text/plain; charset=UTF-8" which is nice because FF knows to render it in the browser (good for debugging atleast).

But votes on SO seem to indicate it should be "application/json"

http://stackoverflow.com/questions/477816/the-right-json-con...

The correct content-type (MIME type) is indeed "application/json" (edit: downcased JSON, not sure why I made that typo). http://tools.ietf.org/html/rfc4627

Additionally, if no encoding is specified, UTF-8 should be assumed when dealing with JSON.

Use application/json plus the JSONView Firefox plugin to get nice pretty printed json output.
application/json
Thanks Mike. I'll start working some of these in over the next few days
Some of this is already available elsewhere: I've been using http://ipinfodb.com/ to decide whether to show a region-specific alert on the front page of http://mappin.es
IPv6 is silly to support. There are no IPv6 NATs, so you should know your IPv6 address.
There are two scenarios where such a site has been useful to me:

1) Making sure I deprecated the right addresses in the Linux kernel, and that the kernel was using the outgoing address I wanted instead of the one it would pick via RFC 3484, and

2) Making sure IPv6 browsing is working since turning off v4 is a pain in the ass (in the setups I've had to troubleshoot v6 on, not my home network, where it's much easier).

There shouldn't be IPv6 NATs, but I expect there will be once it actually gets deployed.