Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork30
🐳 A self-host 🙅 non-tracking, AD-🆓 ➕ 🍪-🆓 solution to show your IP ℹ️ Super small (🤏10MB)
License
PeterDaveHello/ipinfo.tw
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A self-hosted, non-tracking, and ad-free solution to reveal client-side IP info like IP address, country,AS number/description, and additionally,user agent.
This project is also hosted publicly onhttps://ipinfo.tw, feel free to give it a try!
Please note that for response integrity and 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 sniffed/intercepted.
You can now directly deploy ipinfo.tw project onDigitalOcean App Platform using the deploy button:
On DigitalOcean App Platform, we use the HTTP headerDO-Connecting-IP as client's IP address, for more technical details, check theDigitalOceanAppPlatform branch.
Run the server daemon via docker:
docker run -d --name ipinfo.tw -p 80:8080 peterdavehello/ipinfo.tw:latest
If you want to put this container behind reverse proxy, set up anX-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.twcurl 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 (without trailing slash), 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.tw157.230.195.167SG / SingaporeAS14061 / DigitalOcean, LLCWget/1.17.1 (linux-gnu)$ curl https://ipinfo.tw/ip18.179.200.1$ curl https://ipinfo.tw/countryTW / Taiwan$ curl https://ipinfo.tw/country_codeHK$ curl https://ipinfo.tw/country_nameSouth Korea$ curl https://ipinfo.tw/asAS16509 / Amazon.com, Inc.$ curl https://ipinfo.tw/asAS8075 / Microsoft Corporation$ curl https://ipinfo.tw/asn15169$ curl https://ipinfo.tw/as_descGoogle LLC$ wget -qO- https://ipinfo.tw/user_agentWget
There is a special endpoint -/build_epoch, which will return a json object that contains two unsigned 64-bit integers of the database build timestamp as the Unix epoch value.
The response of/build_epoch will be look like:
{"GeoLite2-Country":"1655395486","GeoLite2-ASN":"1655730848"}As mentioned above, on the demo domain -ipinfo.tw, ifhttps:// is not specified in the URL, connection will be redirected from http to https, in this case,curl will need an additional parameter:-L/--location to follow location redirection.
If you want to build your own image, instead of directly pull the pre-built one, clone this repository, and rundocker build command, with build-argMAXMIND_LICENSE_KEY, you need to provide your own MaxMind license key fromhttps://www.maxmind.com/en/account, it'sfree.
$ git clone --depth 1 https://github.com/PeterDaveHello/ipinfo.tw$cd ipinfo.tw$ docker build --build-arg MAXMIND_LICENSE_KEY="$MY_MAXMIND_KEY" -t ipinfo.tw:custom-build.
Preferdocker-compose? Replace the existingipinfo.tw service to build locally:
services:ipinfo.tw:build:context:.args:MAXMIND_LICENSE_KEY:${MAXMIND_LICENSE_KEY}image:ipinfo.tw:localports: -"127.0.0.1:8080:8080"
AddMAXMIND_LICENSE_KEY=your-license-key to a local.env sodocker compose build picks it up without leaving the secret in your shell history.
This project uses works from projects below, and fully appreciates contributors behind these projects:
This project is now sponsored by DigitalOcean with the hosting since Feb 2023.
If you're looking for cloud VPS hosting, you can use my DigitalOcean referral link to get $200 credit:https://m.do.co/c/1fdd0a1d695a
This project is released under the GPL-3.0 license.
About
🐳 A self-host 🙅 non-tracking, AD-🆓 ➕ 🍪-🆓 solution to show your IP ℹ️ Super small (🤏10MB)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.