2016-04-15 20:57:35 +02:00
|
|
|
# ipd
|
2012-11-19 19:11:03 +01:00
|
|
|
|
2017-03-14 18:27:36 +01:00
|
|
|
[![Build Status](https://travis-ci.org/mpolden/ipd.svg)](https://travis-ci.org/mpolden/ipd)
|
2015-09-17 21:31:14 +02:00
|
|
|
|
2012-11-19 19:11:03 +01:00
|
|
|
A simple service for looking up your IP address. This is the code that powers
|
2016-04-17 11:52:37 +02:00
|
|
|
https://ifconfig.co
|
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
|
|
|
```
|
|
|
|
$ curl ifconfig.co
|
|
|
|
127.0.0.1
|
|
|
|
|
2016-04-15 20:57:35 +02:00
|
|
|
$ http ifconfig.co
|
2015-09-17 21:14:09 +02:00
|
|
|
127.0.0.1
|
|
|
|
|
2016-04-15 20:57:35 +02:00
|
|
|
$ wget -qO- ifconfig.co
|
|
|
|
127.0.0.1
|
|
|
|
|
|
|
|
$ fetch -qo- http://ifconfig.co
|
2015-09-17 21:14:09 +02:00
|
|
|
127.0.0.1
|
|
|
|
```
|
|
|
|
|
2016-04-17 11:52:37 +02:00
|
|
|
Country and city lookup:
|
2015-09-17 21:14:09 +02:00
|
|
|
|
|
|
|
```
|
2016-04-15 20:57:35 +02:00
|
|
|
$ http ifconfig.co/country
|
2016-04-17 11:52:37 +02:00
|
|
|
Elbonia
|
|
|
|
|
|
|
|
$ http ifconfig.co/city
|
|
|
|
Bornyasherk
|
2015-09-17 21:14:09 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
As JSON:
|
|
|
|
|
|
|
|
```
|
2016-04-15 20:57:35 +02:00
|
|
|
$ http --json ifconfig.co
|
2015-09-17 21:14:09 +02:00
|
|
|
{
|
2016-04-17 11:52:37 +02:00
|
|
|
"city": "Bornyasherk",
|
|
|
|
"country": "Elbonia",
|
2016-07-06 23:44:33 +02:00
|
|
|
"ip": "127.0.0.1",
|
|
|
|
"ip_decimal": 2130706433
|
2015-09-17 21:14:09 +02:00
|
|
|
}
|
|
|
|
```
|
2012-11-19 19:11:03 +01:00
|
|
|
|
2015-09-17 21:14:09 +02:00
|
|
|
## Features
|
|
|
|
|
2012-11-19 19:11:03 +01:00
|
|
|
* Easy to remember domain name
|
2016-04-15 20:57:35 +02:00
|
|
|
* Supports HTTPS
|
|
|
|
* Open source under the [BSD 3-Clause license](https://opensource.org/licenses/BSD-3-Clause)
|
2012-11-19 19:11:03 +01:00
|
|
|
* Fast
|
2016-04-17 11:52:37 +02:00
|
|
|
* Supports typical CLI tools (`curl`, `httpie`, `wget` and `fetch`)
|
2014-12-22 00:19:29 +01:00
|
|
|
* JSON output (optional)
|
2016-04-17 11:52:37 +02:00
|
|
|
* Country and city lookup through the MaxMind GeoIP database
|
2015-09-17 21:14:09 +02:00
|
|
|
|
|
|
|
## Why?
|
2012-11-19 19:11:03 +01:00
|
|
|
|
|
|
|
* To scratch an itch
|
|
|
|
* An excuse to use Go for something
|
2017-03-30 22:23:48 +02:00
|
|
|
* Faster than ifconfig.me
|
2015-09-17 21:14:09 +02:00
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
Compiling requires the [Golang compiler](https://golang.org/) to be installed.
|
|
|
|
This application can be installed by using `go get`:
|
|
|
|
|
2017-05-18 18:58:27 +02:00
|
|
|
`go get github.com/mpolden/ipd`
|
2015-09-17 21:14:09 +02:00
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
```
|
2016-04-15 20:57:35 +02:00
|
|
|
$ ipd -h
|
2015-09-17 21:14:09 +02:00
|
|
|
Usage:
|
2016-04-15 20:57:35 +02:00
|
|
|
ipd [OPTIONS]
|
2015-09-17 21:14:09 +02:00
|
|
|
|
|
|
|
Application Options:
|
2016-10-09 16:21:07 +02:00
|
|
|
-f, --country-db=FILE Path to GeoIP country database
|
|
|
|
-c, --city-db=FILE Path to GeoIP city database
|
|
|
|
-l, --listen=ADDR Listening address (default: :8080)
|
|
|
|
-r, --reverse-lookup Perform reverse hostname lookups
|
|
|
|
-p, --port-lookup Enable port lookup
|
|
|
|
-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)
|
|
|
|
-L, --log-level=[debug|info|warn|error|fatal|panic] Log level to use (default: info)
|
2015-09-17 21:14:09 +02:00
|
|
|
|
|
|
|
Help Options:
|
2016-10-09 16:21:07 +02:00
|
|
|
-h, --help Show this help message
|
2015-09-17 21:14:09 +02:00
|
|
|
```
|