echoip/README.md

118 lines
2.3 KiB
Markdown
Raw Normal View History

2018-08-27 20:33:29 +02:00
# echoip
2012-11-19 19:11:03 +01:00
A simple service for looking up your IP address. This is the code that powers
2023-10-04 18:01:09 +02:00
https://ip.level.io.
2012-11-19 19:11:03 +01:00
2015-09-17 21:14:09 +02:00
## Usage
2012-11-21 13:58:06 +01:00
2015-09-17 21:14:09 +02:00
Just the business, please:
2012-11-21 13:58:06 +01:00
2015-09-17 21:14:09 +02:00
```
2023-10-04 18:01:09 +02:00
$ curl ip.level.io
2015-09-17 21:14:09 +02:00
127.0.0.1
2023-10-04 18:01:09 +02:00
$ http ip.level.io
2015-09-17 21:14:09 +02:00
127.0.0.1
2023-10-04 18:01:09 +02:00
$ wget -qO- ip.level.io
2016-04-15 20:57:35 +02:00
127.0.0.1
2023-10-04 18:01:09 +02:00
$ fetch -qo- https://ip.level.io
2015-09-17 21:14:09 +02:00
127.0.0.1
2023-10-04 18:01:09 +02:00
$ bat -print=b ip.level.io/ip
127.0.0.1
2015-09-17 21:14:09 +02:00
```
2016-04-17 11:52:37 +02:00
Country and city lookup:
2015-09-17 21:14:09 +02:00
```
2023-10-04 18:01:09 +02:00
$ curl ip.level.io/country
2016-04-17 11:52:37 +02:00
Elbonia
2023-10-04 18:01:09 +02:00
$ curl ip.level.io/country-iso
2018-02-09 20:41:30 +01:00
EB
2023-10-04 18:01:09 +02:00
$ curl ip.level.io/city
2016-04-17 11:52:37 +02:00
Bornyasherk
2019-07-05 15:01:45 +02:00
2023-10-04 18:01:09 +02:00
$ curl ip.level.io/asn
2019-07-05 15:01:45 +02:00
AS59795
2022-09-04 00:08:14 +02:00
2023-10-04 18:01:09 +02:00
$ curl ip.level.io/asn-org
2022-09-04 00:08:14 +02:00
Hosting4Real
2015-09-17 21:14:09 +02:00
```
As JSON:
```
2023-10-04 18:01:09 +02:00
$ curl -H 'Accept: application/json' ip.level.io # or curl ip.level.io/json
2015-09-17 21:14:09 +02:00
{
2016-04-17 11:52:37 +02:00
"city": "Bornyasherk",
"country": "Elbonia",
2018-02-09 20:41:30 +01:00
"country_iso": "EB",
2016-07-06 23:44:33 +02:00
"ip": "127.0.0.1",
2019-07-05 15:01:45 +02:00
"ip_decimal": 2130706433,
"asn": "AS59795",
"asn_org": "Hosting4Real"
2015-09-17 21:14:09 +02:00
}
```
2012-11-19 19:11:03 +01:00
2018-03-21 22:04:53 +01:00
Port testing:
```
2023-10-04 18:01:09 +02:00
$ curl ip.level.io/port/80
2018-03-21 22:04:53 +01:00
{
"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.
2015-09-17 21:14:09 +02:00
## Features
2023-10-04 18:01:09 +02:00
- 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](https://opensource.org/licenses/BSD-3-Clause)
2015-09-17 21:14:09 +02:00
### Usage
```
2018-08-27 20:33:29 +02:00
$ echoip -h
2020-09-05 11:40:26 +02:00
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)
2023-10-04 18:01:09 +02:00
-P Enables profiling handlers
-S string
IP Stack API Key
2020-09-05 11:40:26 +02:00
-a string
Path to GeoIP ASN database
-c string
Path to GeoIP city database
2023-10-04 18:01:09 +02:00
-d string
Which database to use, 'ipstack' or 'geoip' (default "geoip")
2020-09-05 11:40:26 +02:00
-f string
Path to GeoIP country database
2023-10-04 18:01:09 +02:00
-h Use HTTPS for IP Stack ( only non-free accounts )
2020-09-05 11:40:26 +02:00
-l string
Listening address (default ":8080")
-p Enable port lookup
-r Perform reverse hostname lookups
2023-10-04 18:01:09 +02:00
-s Show sponsor logo
2020-09-05 11:40:26 +02:00
-t string
2023-10-04 18:01:09 +02:00
Path to template dir (default "html")
-x Enable security module for IP Stack ( must have security module, aka. non-free account. )
2015-09-17 21:14:09 +02:00
```