Document /ip path

Closes #25
This commit is contained in:
Martin Polden 2017-02-06 19:07:52 +01:00
parent 3cc33c85b6
commit 73e5d426c5
1 changed files with 17 additions and 17 deletions

View File

@ -11,11 +11,9 @@
<style> <style>
html, .pure-g [class *= "pure-u"] { html, .pure-g [class *= "pure-u"] {
font-family: "Roboto", sans-serif; font-family: "Roboto", sans-serif;
font-size: 15pt;
} }
pre { pre {
font-family: "Monaco", "Menlo", "Consolas", "Courier New", monospace; font-family: "Monaco", "Menlo", "Consolas", "Courier New", monospace;
font-size: 12pt;
} }
body { body {
margin-left: auto; margin-left: auto;
@ -28,9 +26,6 @@
font-size: 36px; font-size: 36px;
padding: 6px; padding: 6px;
} }
.footer {
font-size: 12pt;
}
</style> </style>
</head> </head>
<body> <body>
@ -46,7 +41,7 @@
</div> </div>
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-md-1-2"> <div class="pure-u-1 pure-u-md-1-2">
<p>CLI examples:</p> <h2>CLI examples:</h2>
<pre> <pre>
$ curl ifconfig.co $ curl ifconfig.co
{{ .IP }} {{ .IP }}
@ -60,20 +55,20 @@ $ wget -qO- ifconfig.co
$ fetch -qo- https://ifconfig.co $ fetch -qo- https://ifconfig.co
{{ .IP }}</pre> {{ .IP }}</pre>
{{ if .IsLookupCountryEnabled }} {{ if .IsLookupCountryEnabled }}
<p>Country lookup:</p> <h2>Country lookup:</h2>
<pre> <pre>
$ http ifconfig.co/country $ http ifconfig.co/country
{{ .Country }}</pre> {{ .Country }}</pre>
{{ end }} {{ end }}
{{ if .IsLookupCityEnabled }} {{ if .IsLookupCityEnabled }}
<p>City lookup:</p> <h2>City lookup:</h2>
<pre> <pre>
$ http ifconfig.co/city $ http ifconfig.co/city
{{ .City }}</pre> {{ .City }}</pre>
{{ end }} {{ end }}
</div> </div>
<div class="pure-u-1 pure-u-md-1-2"> <div class="pure-u-1 pure-u-md-1-2">
<p>JSON output:</p> <h2>JSON output:</h2>
<pre> <pre>
$ http ifconfig.co/json $ http ifconfig.co/json
{ {{ if .IsLookupCityEnabled }} { {{ if .IsLookupCityEnabled }}
@ -82,13 +77,16 @@ $ http ifconfig.co/json
"hostname": "{{ .Hostname }}",{{ end }} "hostname": "{{ .Hostname }}",{{ end }}
"ip": "{{ .IP }}", "ip": "{{ .IP }}",
"ip_decimal": {{ .IPDecimal }} "ip_decimal": {{ .IPDecimal }}
} }</pre>
# or set Accept header:
# http ifconfig.co Accept:application/json</pre>
<p>Setting the Accept header to application/json also works.</p>
<h2>Plain output:</h2>
<p>Always returns the IP address including a trailing newline, regardless of user agent.</p>
<pre>
$ http ifconfig.co/ip
{{ .IP }}</pre>
{{ if .IsLookupPortEnabled }} {{ if .IsLookupPortEnabled }}
<p>Testing port connectivity:</p> <h2>Testing port connectivity:</h2>
<pre> <pre>
$ http ifconfig.co/port/8080 $ http ifconfig.co/port/8080
{ {
@ -102,9 +100,11 @@ $ http ifconfig.co/port/8080
<div class="pure-g footer"> <div class="pure-g footer">
<div class="pure-u-1-1 footer"> <div class="pure-u-1-1 footer">
<p class="footer"> <p class="footer">
To force IPv4 lookup you can use <small>
the <a href="https://v4.ifconfig.co">v4 subdomain</a> To force IPv4 lookup you can use
(<a href="https://v6.ifconfig.co">or v6 for IPv6</a>). the <a href="https://v4.ifconfig.co">v4 subdomain</a>
(<a href="https://v6.ifconfig.co">or v6 for IPv6</a>).
</small>
</p> </p>
</div> </div>
</div> </div>