Public IP Service ip.renfei.net: Announcing New Geolocation Fields

My site's public IP service, ip.renfei.net, is used by many people. On May 10, 2022 a user named Qin Yi'nan left a message asking for geolocation support — and here it is.

My site’s public IP service, ip.renfei.net, is used by many people. On May 10, 2022 a user named Qin Yi’nan left a message asking for geolocation support — and here it is.

Advance Notice Period

Since most users consume it programmatically, adding fields could break their programs. I’m announcing it one month ahead so you can prepare for compatibility and avoid outages caused by the new fields.

The upgrade goes live at 12:00 noon on Friday, January 6, 2023.

What’s Changing

Requests without headers and requests for JSON gain a location field. JSON format:

{
    "clientIP": "123.123.123.123",
    "location": {
        "countryCode": "CN",
        "countryName": "China",
        "region": "Beijing",
        "city": "Beijing"
    },
    "readme": "https://github.com/renfei/feedback/discussions/3"
}

Requests for XML gain a location node. XML format:

<ip>
    <clientIP>123.123.123.123</clientIP>
    <location>
        <countryCode>CN</countryCode>
        <countryName>China</countryName>
        <region>Beijing</region>
        <city>Beijing</city>
    </location>
    <readme>https://github.com/renfei/feedback/discussions/3</readme>
</ip>

Requests for text keep the existing plain-text format unchanged.

Field Definitions

  • countryCode: two-letter country code per ISO 3166
  • countryName: country name per ISO 3166
  • region: province/region or state name
  • city: city name

Manual Overrides

To stay compliant with laws and regulations, some location data is manually overridden — for example, Taiwan Province is set to China’s country code.