echoip/README.md

90 lines
1.8 KiB
Markdown
Raw Normal View History

2016-04-15 20:57:35 +02:00
# ipd
2012-11-19 19:11:03 +01:00
2016-04-15 17:59:56 +02:00
[![Build Status](https://travis-ci.org/martinp/ipd.svg)](https://travis-ci.org/martinp/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
http://ifconfig.co
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-15 20:57:35 +02:00
Country lookup:
2015-09-17 21:14:09 +02:00
```
2016-04-15 20:57:35 +02:00
$ http ifconfig.co/country
Home, Sweet Home
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-15 20:57:35 +02:00
"ip": "127.0.0.1",
"country": "Home, Sweet Home"
2015-09-17 21:14:09 +02:00
}
```
2012-11-19 19:11:03 +01:00
2014-01-26 20:39:04 +01:00
Pass the appropriate flag (usually -4 and -6) to your tool to switch between
2012-11-19 19:11:03 +01:00
IPv4 and IPv6 lookup.
2015-09-17 21:14:09 +02:00
The subdomain http://v4.ifconfig.co can be used to force IPv4 lookup.
## Features
2012-11-19 19:11:03 +01:00
* Easy to remember domain name
* Supports IPv4 and IPv6
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-15 20:57:35 +02:00
* Supports typical CLI tools (curl, httpie, wget and fetch)
2014-12-22 00:19:29 +01:00
* JSON output (optional)
2015-09-17 21:14:09 +02:00
* Country lookup for IP address through the MaxMind GeoIP2 database
## Why?
2012-11-19 19:11:03 +01:00
* To scratch an itch
* An excuse to use Go for something
* Faster than ifconfig.me and has IPv6 support
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`:
2016-04-15 17:59:56 +02:00
`go get github.com/martinp/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-04-15 20:57:35 +02:00
-f, --file=FILE Path to GeoIP database
-l, --listen=ADDR Listening address (default: :8080)
-x, --cors Allow requests from other domains
-r, --reverse-lookup Perform reverse hostname lookups
-p, --port-testing Enable port testing
-t, --template= Path to template (default: index.html)
2015-09-17 21:14:09 +02:00
Help Options:
2016-04-15 20:57:35 +02:00
-h, --help Show this help message
2015-09-17 21:14:09 +02:00
```