A self-hosted, non-tracking, and ad-free solution to reveal client-side IP info like IP address, conuntry, AS number/description, and additionally, user agent.
This project is also hosted publicly on https://ipinfo.tw, feel free to give it a try!
Please note that for privacy concerns, this demo is behind an reverse proxy with https enabled, which is not part of this project. http traffic will be redirected to use https to establish the connection, in case the plaintext data being snifferred/intercepted.
Run the server daemon via docker:
docker run -d --name ipinfo.tw -p 80:80 peterdavehello/ipinfo.tw:latest
If you want to put this container behind reverse proxy, set up an X-Real-IP
header and pass the it to the container, so that it can use the header as the IP of the client.
Use any http(s) client to explore the server, e.g. https://ipinfo.tw,
wget -qO- https://ipinfo.tw
curl https://ipinfo.tw
Without any specified URI, the server will return IP address, country, AS, and user agent.
If you prefer to receive a machine-readable result, use path /json
, e.g. https://ipinfo.tw/json
, the result will look like:
{"ip":"3.115.123.234","country_code":"JP","country_name":"Japan","asn":"16509","as_desc":"Amazon.com, Inc.","user_agent":"curl/7.58.0"}
You can also specify the following URI to retrieve certain info:
ip
: IP addresscountry
: Country code and namecountry_code
: Country codecountry_name
: Country nameas
: AS number and descriptionasn
: AS numberas_desc
: AS descriptionuser_agent
: User agent string
Examples:
$ wget -qO- https://ipinfo.tw
157.230.195.167
SG / Singapore
AS14061 / DigitalOcean, LLC
Wget/1.17.1 (linux-gnu)
$ curl https://ipinfo.tw/ip
18.179.200.1
$ curl https://ipinfo.tw/country
TW / Taiwan
$ curl https://ipinfo.tw/country_code
HK
$ curl https://ipinfo.tw/country_name
South Korea
$ curl https://ipinfo.tw/as
AS16509 / Amazon.com, Inc.
$ curl https://ipinfo.tw/as
AS8075 / Microsoft Corporation
$ curl https://ipinfo.tw/asn
15169
$ curl https://ipinfo.tw/as_desc
Google LLC
$ wget -qO- https://ipinfo.tw/user_agent
Wget
As mentioned above, if https://
is not specified, connection will be redirected from http to https, in this case, curl
will need an additional parameter: -L
/--location
to follow location redirection.
This project is released under the GPL-3.0 license. It uses GeoLite2 data created by MaxMind.