Go to file
Ethan Knowlton 9217488362 better empty threatthypes handling 2023-10-05 12:20:30 -04:00
.github/workflows renamed workflow 2023-10-05 12:15:49 -04:00
cmd/echoip refactor module name to levelsoftware 2023-10-05 11:43:02 -04:00
html Merge branch 'master' of github.com:levelsoftware/echoip into adding-extra-ipstack-fields 2023-10-05 11:03:03 -04:00
http refactor module name to levelsoftware 2023-10-05 11:43:02 -04:00
iputil better empty threatthypes handling 2023-10-05 12:20:30 -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 refactor module name to levelsoftware 2023-10-05 11:43:02 -04: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 updated readme 2023-10-04 12:01:46 -04:00
go.mod refactor module name to levelsoftware 2023-10-05 11:43:02 -04:00
go.sum refactor module name to levelsoftware 2023-10-05 11:43:02 -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

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