Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🐳 A self-host 🙅 non-tracking, AD-🆓 ➕ 🍪-🆓 solution to show your IP ℹ️ Super small (🤏10MB)

License

NotificationsYou must be signed in to change notification settings

PeterDaveHello/ipinfo.tw

Repository files navigation

licenseBuild StatusDocker Hub pulls

Docker Hub badge

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.

Table of Contents

Demo

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.

Usage

Deploy to DigitalOcean

You can now directly deploy ipinfo.tw project onDigitalOcean App Platform using the deploy button:

Deploy to DO

On DigitalOcean App Platform, we use the HTTP headerDO-Connecting-IP as client's IP address, for more technical details, check theDigitalOceanAppPlatform branch.

Server side

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.

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 (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"}

Endpoints

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.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
Database build time endpoint

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.

Build

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.

Credits

This project uses works from projects below, and fully appreciates contributors behind these projects:

Sponsor

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

License

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

Stars

Watchers

Forks

Releases

No releases published

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp