Code Monkey home page Code Monkey logo

ipinfo.tw's Introduction

ipinfo.tw

license Build Status Docker 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 on https://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 on DigitalOcean App Platform using the deploy button:

Deploy to DO

On DigitalOcean App Platform, we use the HTTP header DO-Connecting-IP as client's IP address, for more technical details, check the DigitalOceanAppPlatform 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 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 (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.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
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, if https:// 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 run docker build command, with build-arg MAXMIND_LICENSE_KEY, you need to provide your own MaxMind license key from https://www.maxmind.com/en/account, it's free.

$ 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 .

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.

ipinfo.tw's People

Contributors

bl-ue avatar cleanmachine1 avatar peterdavehello avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ipinfo.tw's Issues

Publish image on GitHub Packages

Reasons:

  1. Decentralize the image registry, provide more options to the users.
  2. Docker Hub now has the image pull limit policy, though not every one will face the issue, as long as you don't need to share IP address with the others, and won't pull too many images in a limited time. The easy approach to mitigate the issue seem to authenticate the identity when pulling an image, but may not be a very good choice for privacy concerned users.

Reference:

Name of docker-compose service intended?

Hello, thanks for the great work!
I wondered why the name of the docker compose service is called tor-socks-proxy.
Of course, it's no real problem and could easily be user changed (like ports listening on 0.0.0.0 too etc.) but I still wondered, since I thought it might be unintended :).

Network connectivity issue

$ geoiplookup ipinfo.tw
GeoIP Country Edition: SG, Singapore
GeoIP City Edition, Rev 1: SG, 00, N/A, Singapore, 62, 1.307700, 103.681801, 0, 0
GeoIP ASNum Edition: AS14061 DIGITALOCEAN-ASN


$ nslookup ipinfo.tw
Server:		127.0.0.1
Address:	127.0.0.1#53

Non-authoritative answer:
Name:	ipinfo.tw
Address: 188.166.199.140
Name:	ipinfo.tw
Address: 2400:6180:0:d1::4fc:4001

https://status.digitalocean.com/incidents/kcnsscw1cmsz

ipinfo.tw is hosted on DigitalOcean Singapore region that are facing network connectivity issue more than 3 weeks now, there is no simple solution to this, but maybe need to move the droplet instance to another region, or switch to another VPS.

Feature Request: Separate Endpoints for IPv4 and IPv6 Information

Feature Request: Separate Endpoints for IPv4 and IPv6 Information

Description

This feature request proposes the addition of separate endpoints to retrieve information specifically for IPv4 and IPv6 addresses.

Proposed Endpoints

  • IPv4 Endpoint: https://ipinfo.tw/ipv4
  • IPv6 Endpoint: https://ipinfo.tw/ipv6

Motivation

Having dedicated endpoints for IPv4 and IPv6 addresses would offer more flexibility for users who specifically require information about a particular IP version. This separation would enhance the usability and granularity of the service.

Feature Request - IP Lookup

Throwing out a feature request to add an endpoint that would take an IP and get the information about it. Additionally, it would be great if it supported the other endpoints.

Example

$ wget -qO- https://ipinfo.tw/lookup/1.1.1.1
1.1.1.1
AU / Australia
AS13335 / Cloudflare, Inc.

Important Update on Our Uptime(Service Availability) Concerns

Hi everyone,

I've noticed some uptime challenges during peak periods recently. Given the current resource constraints, scaling up or out to meet high-demand moments is a bit of a stretch, which might impact those relying on this service for critical production environments.

The service remains a valuable resource for non-critical uses. Yet, for those with production-level needs, setting up your own instance or seeking professional assistance for a seamless self-hosted service is encouraged. Please don't worry. Guidance is available to help you navigate this setup in the README.

Your support and understanding are deeply appreciated as we work through these limitations. Let's also be mindful of how we use the service - a small step, like spacing out requests, can make a big difference. Together, we can ensure a positive environment for all users.

Warm regards,
Peter

Running on local network gives empty result

Running it in local network gives empty result:
image

192.168.1.1
 / 
AS / 

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36

Probably same thing for other IP classes: 10.x.x.x 172.x.x.x,
Also running it locally - 127.0.x.x

Of course address/location for this service is unknown, but this looks empty and even '?' would be better :)

Automatically log rotate

All the logs should be existed for only debug purpose, there is no reason to keep them in long-term, an automatically log rotate for about 24 hours log lifetime would be good enough.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
  • alpine 3.19
  • alpine 3.19

  • Check this box to trigger a request for Renovate to run again on this repository

Specify alternative ports to 80:80

Hi

As Iโ€™d like to run this docker in host mode , port 80 is already taken, is it possible for me to just change the ports in the Docker compose ?

many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.