/ipinfo.tw

:whale: A self-hosted, non-tracking & ad-free solution to show your IP info. Super small (< 10MB)

Primary LanguageDockerfileGNU General Public License v3.0GPL-3.0

ipinfo.tw

license Build Status Docker Hub pulls Docker image layers Docker image version

Docker Hub badge

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.

Demo

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.

Usage

Server side

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.

Client side

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 address
  • country: Country code and name
  • country_code: Country code
  • country_name: Country name
  • as: AS number and description
  • asn: AS number
  • as_desc: AS description
  • user_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.

License

This project is released under the GPL-3.0 license. It uses GeoLite2 data created by MaxMind.