Go to file
Jacob Haug d60343d31c
updating readme
2023-10-04 12:01:09 -04:00
.github/workflows build: Merge jobs as data is not shared between them 2021-08-03 23:28:13 +02:00
cmd/echoip upadted template, added https option for ipstack 2023-10-04 09:43:37 -04:00
html updating styles 2023-10-04 11:47:06 -04:00
http upadted template, added https option for ipstack 2023-10-04 09:43:37 -04:00
iputil upadted template, added https option for ipstack 2023-10-04 09:43:37 -04:00
useragent return parsed and raw user agent 2019-07-13 22:50:31 +00:00
.dockerignore New template (#121) 2020-12-14 19:02:35 +01:00
.gitignore Download GeoIP databases on startup 2019-12-25 19:41:35 +01:00
Dockerfile build: Bump build image 2021-01-24 15:09:56 +01:00
LICENSE Update copyright year 2020-04-07 17:59:23 +02:00
Makefile build: Build and publish image once 2021-01-24 15:11:44 +01:00
README.md updating readme 2023-10-04 12:01:09 -04:00
go.mod seperate parser from code, verify this is working -- then to add ipstack 2023-09-22 14:22:48 -04:00
go.sum seperate parser from code, verify this is working -- then to add ipstack 2023-09-22 14:22:48 -04:00

README.md

echoip

A simple service for looking up your IP address. This is the code that powers https://ip.level.io.

Usage

Just the business, please:

$ curl ip.level.io
127.0.0.1

$ http ip.level.io
127.0.0.1

$ wget -qO- ip.level.io
127.0.0.1

$ fetch -qo- https://ip.level.io
127.0.0.1

$ bat -print=b ip.level.io/ip
127.0.0.1

Country and city lookup:

$ curl ip.level.io/country
Elbonia

$ curl ip.level.io/country-iso
EB

$ curl ip.level.io/city
Bornyasherk

$ curl ip.level.io/asn
AS59795

$ curl ip.level.io/asn-org
Hosting4Real

As JSON:

$ curl -H 'Accept: application/json' ip.level.io  # or curl ip.level.io/json
{
  "city": "Bornyasherk",
  "country": "Elbonia",
  "country_iso": "EB",
  "ip": "127.0.0.1",
  "ip_decimal": 2130706433,
  "asn": "AS59795",
  "asn_org": "Hosting4Real"
}

Port testing:

$ curl ip.level.io/port/80
{
  "ip": "127.0.0.1",
  "port": 80,
  "reachable": false
}

Pass the appropriate flag (usually -4 and -6) to your client to switch between IPv4 and IPv6 lookup.

Features

  • Easy to remember domain name
  • Fast
  • Supports IPv6
  • Supports HTTPS
  • Supports common command-line clients (e.g. curl, httpie, ht, wget and fetch)
  • JSON output
  • ASN, country and city lookup using the MaxMind GeoIP database
  • Port testing
  • All endpoints (except /port) can return information about a custom IP address specified via ?ip= query parameter
  • Open source under the BSD 3-Clause license

Why?

  • To scratch an itch
  • An excuse to use Go for something
  • Faster than ifconfig.me and has IPv6 support

Usage

$ echoip -h
Usage of echoip:
  -C int
    	Size of response cache. Set to 0 to disable
  -H value
    	Header to trust for remote IP, if present (e.g. X-Real-IP)
  -P	Enables profiling handlers
  -S string
    	IP Stack API Key
  -a string
    	Path to GeoIP ASN database
  -c string
    	Path to GeoIP city database
  -d string
    	Which database to use, 'ipstack' or 'geoip' (default "geoip")
  -f string
    	Path to GeoIP country database
  -h	Use HTTPS for IP Stack ( only non-free accounts )
  -l string
    	Listening address (default ":8080")
  -p	Enable port lookup
  -r	Perform reverse hostname lookups
  -s	Show sponsor logo
  -t string
    	Path to template dir (default "html")
  -x	Enable security module for IP Stack ( must have security module, aka. non-free account. )