echoip/index.html

127 lines
3.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>What is my IP address? &mdash; ifconfig.co</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="What is my IP address?">
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css">
<style>
html, .pure-g [class *= "pure-u"] {
font-family: "Roboto", sans-serif;
font-size: 15pt;
}
pre {
font-family: "Monaco", "Menlo", "Consolas", "Courier New", monospace;
font-size: 12pt;
}
body {
margin-left: auto;
margin-right: auto;
max-width: 80%;
}
.ip {
border: 1px solid #cbcbcb;
background: #f2f2f2;
font-size: 36px;
padding: 6px;
}
.footer {
font-size: 12pt;
}
</style>
</head>
<body>
<div class="pure-g">
<div class="pure-u-1-1">
<h1>What is my IP address?</h1>
<p><code class="ip">{{ .IP }}</code></p>
<p>Multiple command line HTTP clients are supported,
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
Wget</a>
and <a href="https://www.freebsd.org/cgi/man.cgi?fetch(1)">fetch</a>.</p>
</div>
</div>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2">
<p>CLI examples:</p>
<pre>
$ curl ifconfig.co
{{ .IP }}
$ http -b ifconfig.co
{{ .IP }}
$ wget -qO- ifconfig.co
{{ .IP }}
$ fetch -qo- http://ifconfig.co
{{ .IP }}
</pre>
{{ if .IsLookupCountryEnabled }}
<p>Country lookup:</p>
<pre>
$ http ifconfig.co/country
{{ .Country }}
</pre>
{{ end }}
{{ if .IsLookupCityEnabled }}
<p>City lookup:</p>
<pre>
$ http ifconfig.co/city
{{ .City }}
</pre>
{{ end }}
</div>
<div class="pure-u-1 pure-u-md-1-2">
<p>JSON output:</p>
<pre>
$ http ifconfig.co/json
HTTP/1.1 200 OK
Content-Length: 61
Content-Type: application/json
Date: Fri, 15 Apr 2016 17:26:53 GMT
{ {{ if .IsLookupCountryEnabled }}
"country": "{{ .Country }}",{{ end }}{{ if .IsLookupCityEnabled }}
"city": "{{ .City }}",{{ end }}{{ if .IsLookupAddrEnabled }}
"hostname": "{{ .Hostname }}",{{ end }}
"ip": "{{ .IP }}"
}
# or set Accept header to application/json:
# http --json ifconfig.co
</pre>
{{ if .IsLookupPortEnabled }}
<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 }}
</div>
</div>
<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>
</div>
</div>
<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>
</body>
</html>