echoip/index.html

127 lines
3.5 KiB
HTML
Raw Normal View History

2012-11-19 19:50:32 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
2014-01-26 21:58:16 +01:00
<title>What is my IP address? &mdash; ifconfig.co</title>
2012-11-19 19:50:32 +01:00
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2014-01-26 21:58:16 +01:00
<meta name="description" content="What is my IP address?">
2016-04-15 20:22:14 +02:00
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
2015-09-17 20:57:27 +02:00
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css">
2016-04-16 10:15:17 +02:00
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css">
2012-11-21 14:04:43 +01:00
<style>
2016-04-15 20:14:16 +02:00
html, .pure-g [class *= "pure-u"] {
2016-04-15 20:22:14 +02:00
font-family: "Roboto", sans-serif;
2016-04-15 20:14:16 +02:00
font-size: 15pt;
2012-11-21 14:04:43 +01:00
}
2016-04-15 20:14:16 +02:00
pre {
2012-11-25 13:30:39 +01:00
font-family: "Monaco", "Menlo", "Consolas", "Courier New", monospace;
2016-04-15 20:14:16 +02:00
font-size: 12pt;
2014-01-26 21:58:16 +01:00
}
2016-04-15 20:14:16 +02:00
body {
2014-01-26 21:58:16 +01:00
margin-left: auto;
margin-right: auto;
2016-04-15 20:14:16 +02:00
max-width: 80%;
2016-03-08 23:55:41 +01:00
}
2014-01-26 21:58:16 +01:00
.ip {
border: 1px solid #cbcbcb;
background: #f2f2f2;
font-size: 36px;
2016-04-16 10:15:00 +02:00
padding: 6px;
2014-01-26 21:58:16 +01:00
}
2016-04-16 10:15:00 +02:00
.footer {
2016-04-15 20:14:16 +02:00
font-size: 12pt;
}
2012-11-21 14:04:43 +01:00
</style>
2012-11-19 19:50:32 +01:00
</head>
<body>
2016-04-15 20:14:16 +02:00
<div class="pure-g">
<div class="pure-u-1-1">
2014-01-26 21:58:16 +01:00
<h1>What is my IP address?</h1>
<p><code class="ip">{{ .IP }}</code></p>
2016-04-15 20:14:16 +02:00
<p>Multiple command line HTTP clients are supported,
2016-04-15 20:19:14 +02:00
including <a href="https://curl.haxx.se/">curl</a>, <a href="https://github.com/jkbrzt/httpie">httpie</a>, <a href="https://www.gnu.org/software/wget/">GNU
2016-04-15 20:14:16 +02:00
Wget</a>
and <a href="https://www.freebsd.org/cgi/man.cgi?fetch(1)">fetch</a>.</p>
</div>
</div>
<div class="pure-g">
2016-04-16 10:15:17 +02:00
<div class="pure-u-1 pure-u-md-1-2">
2016-04-15 20:14:16 +02:00
<p>CLI examples:</p>
<pre>
$ curl ifconfig.co
{{ .IP }}
2016-04-16 10:29:23 +02:00
$ http -b ifconfig.co
2016-04-15 20:19:14 +02:00
{{ .IP }}
2016-04-15 20:14:16 +02:00
$ wget -qO- ifconfig.co
{{ .IP }}
$ fetch -qo- http://ifconfig.co
{{ .IP }}
</pre>
2016-04-17 11:09:56 +02:00
{{ if .IsLookupCountryEnabled }}
2016-04-15 20:14:16 +02:00
<p>Country lookup:</p>
<pre>
$ http ifconfig.co/country
{{ .Country }}
</pre>
2016-04-17 11:28:47 +02:00
{{ end }}
{{ if .IsLookupCityEnabled }}
<p>City lookup:</p>
<pre>
$ http ifconfig.co/city
{{ .City }}
</pre>
{{ end }}
2016-04-15 20:14:16 +02:00
</div>
2016-04-16 10:15:17 +02:00
<div class="pure-u-1 pure-u-md-1-2">
2016-04-15 20:14:16 +02:00
<p>JSON output:</p>
<pre>
2016-04-17 09:31:33 +02:00
$ http ifconfig.co/json
2016-04-15 20:14:16 +02:00
HTTP/1.1 200 OK
Content-Length: 61
Content-Type: application/json
Date: Fri, 15 Apr 2016 17:26:53 GMT
2016-04-17 11:09:56 +02:00
{ {{ if .IsLookupCountryEnabled }}
2016-04-17 11:28:47 +02:00
"country": "{{ .Country }}",{{ end }}{{ if .IsLookupCityEnabled }}
"city": "{{ .City }}",{{ end }}{{ if .IsLookupAddrEnabled }}
"hostname": "{{ .Hostname }}",{{ end }}
2016-04-15 20:14:16 +02:00
"ip": "{{ .IP }}"
2016-04-17 09:31:33 +02:00
}
# or set Accept header to application/json:
# http --json ifconfig.co
2016-04-15 20:14:16 +02:00
</pre>
2016-04-17 11:09:56 +02:00
{{ if .IsLookupPortEnabled }}
2016-04-15 20:52:15 +02:00
<p>Testing port connectivity (only supports JSON output):</p>
<pre>
http --json localhost:8080/port/8080
HTTP/1.1 200 OK
Content-Length: 47
Content-Type: application/json
Date: Fri, 15 Apr 2016 18:47:20 GMT
{
"ip": "127.0.0.1",
"port": 8080,
"reachable": true
}
</pre>
{{ end }}
2012-11-25 13:30:39 +01:00
</div>
2012-11-21 14:04:43 +01:00
</div>
2016-04-16 10:15:00 +02:00
<div class="pure-g footer">
<div class="pure-u-1-1 footer">
<p class="footer">
To force IPv4 lookup you can use
the <a href="http://v4.ifconfig.co">v4 subdomain</a>
(<a href="http://v6.ifconfig.co">or v6 for IPv6</a>).
</p>
2016-04-15 20:14:16 +02:00
</div>
2016-03-06 07:10:58 +01:00
</div>
2016-04-15 20:14:16 +02:00
<a href="https://github.com/martinp/ipd"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
2012-11-19 19:50:32 +01:00
</body>
</html>