Update readme

This commit is contained in:
Martin Polden 2018-03-21 22:04:53 +01:00
parent 184676ba29
commit 2b22328c8c

View File

@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/mpolden/ipd.svg)](https://travis-ci.org/mpolden/ipd) [![Build Status](https://travis-ci.org/mpolden/ipd.svg)](https://travis-ci.org/mpolden/ipd)
A simple service for looking up your IP address. This is the code that powers A simple service for looking up your IP address. This is the code that powers
https://ifconfig.co https://ifconfig.co.
## Usage ## Usage
@ -19,7 +19,7 @@ $ http ifconfig.co
$ wget -qO- ifconfig.co $ wget -qO- ifconfig.co
127.0.0.1 127.0.0.1
$ fetch -qo- http://ifconfig.co $ fetch -qo- https://ifconfig.co
127.0.0.1 127.0.0.1
$ bat -print=b ifconfig.co/ip $ bat -print=b ifconfig.co/ip
@ -29,20 +29,20 @@ $ bat -print=b ifconfig.co/ip
Country and city lookup: Country and city lookup:
``` ```
$ http ifconfig.co/country $ curl ifconfig.co/country
Elbonia Elbonia
$ http ifconfig.co/country-iso $ curl ifconfig.co/country-iso
EB EB
$ http ifconfig.co/city $ curl ifconfig.co/city
Bornyasherk Bornyasherk
``` ```
As JSON: As JSON:
``` ```
$ http --json ifconfig.co $ curl -H 'Accept: application/json' ifconfig.co # or curl ifconfig.co/json
{ {
"city": "Bornyasherk", "city": "Bornyasherk",
"country": "Elbonia", "country": "Elbonia",
@ -52,8 +52,19 @@ $ http --json ifconfig.co
} }
``` ```
Pass the appropriate flag (usually `-4` and `-6`) to your tool to switch between Port testing:
IPv4 and IPv6 lookup.
```
$ curl ifconfig.co/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.
The subdomains https://v4.ifconfig.co and https://v6.ifconfig.co can be used to The subdomains https://v4.ifconfig.co and https://v6.ifconfig.co can be used to
force IPv4 or IPv6 lookup. force IPv4 or IPv6 lookup.
@ -61,13 +72,14 @@ force IPv4 or IPv6 lookup.
## Features ## Features
* Easy to remember domain name * Easy to remember domain name
* Supports IPv4 and IPv6
* Supports HTTPS
* Open source under the [BSD 3-Clause license](https://opensource.org/licenses/BSD-3-Clause)
* Fast * Fast
* Supports typical CLI tools (`curl`, `httpie`, `wget` and `fetch`) * Supports IPv6
* JSON output (optional) * Supports HTTPS
* Country and city lookup through the MaxMind GeoIP database * Supports common command-line clients (e.g. `curl`, `httpie`, `wget` and `fetch`)
* JSON output
* Country and city lookup using the MaxMind GeoIP database
* Port testing
* Open source under the [BSD 3-Clause license](https://opensource.org/licenses/BSD-3-Clause)
## Why? ## Why?
@ -78,7 +90,7 @@ force IPv4 or IPv6 lookup.
## Building ## Building
Compiling requires the [Golang compiler](https://golang.org/) to be installed. Compiling requires the [Golang compiler](https://golang.org/) to be installed.
This application can be installed by using `go get`: This package can be installed with `go get`:
`go get github.com/mpolden/ipd/...` `go get github.com/mpolden/ipd/...`
@ -93,15 +105,14 @@ Usage:
ipd [OPTIONS] ipd [OPTIONS]
Application Options: Application Options:
-f, --country-db=FILE Path to GeoIP country database -f, --country-db=FILE Path to GeoIP country database
-c, --city-db=FILE Path to GeoIP city database -c, --city-db=FILE Path to GeoIP city database
-l, --listen=ADDR Listening address (default: :8080) -l, --listen=ADDR Listening address (default: :8080)
-r, --reverse-lookup Perform reverse hostname lookups -r, --reverse-lookup Perform reverse hostname lookups
-p, --port-lookup Enable port lookup -p, --port-lookup Enable port lookup
-t, --template=FILE Path to template (default: index.html) -t, --template=FILE Path to template (default: index.html)
-H, --trusted-header=NAME Header to trust for remote IP, if present (e.g. X-Real-IP) -H, --trusted-header=NAME Header to trust for remote IP, if present (e.g. X-Real-IP)
-L, --log-level=[debug|info|warn|error|fatal|panic] Log level to use (default: info)
Help Options: Help Options:
-h, --help Show this help message -h, --help Show this help message
``` ```