Refactor lookup methods

This commit is contained in:
Martin Polden
2016-04-17 11:09:56 +02:00
parent 7d23fe9853
commit 8027c55fdf
5 changed files with 130 additions and 90 deletions

View File

@ -60,7 +60,7 @@ $ wget -qO- ifconfig.co
$ fetch -qo- http://ifconfig.co
{{ .IP }}
</pre>
{{ if .CountryLookup }}
{{ if .IsLookupCountryEnabled }}
<p>Country lookup:</p>
<pre>
$ http ifconfig.co/country
@ -77,8 +77,8 @@ Content-Length: 61
Content-Type: application/json
Date: Fri, 15 Apr 2016 17:26:53 GMT
{ {{ if .CountryLookup }}
"country": "{{ .Country }}",{{ end }}{{ if .ReverseLookup }}
{ {{ if .IsLookupCountryEnabled }}
"country": "{{ .Country }}",{{ end }}{{ if .IsLookupAddrEnabled }}
"hostname": "{{ .Hostname }}",{{ end }}
"ip": "{{ .IP }}"
}
@ -86,7 +86,7 @@ Date: Fri, 15 Apr 2016 17:26:53 GMT
# or set Accept header to application/json:
# http --json ifconfig.co
</pre>
{{ if .PortTesting }}
{{ if .IsLookupPortEnabled }}
<p>Testing port connectivity (only supports JSON output):</p>
<pre>
http --json localhost:8080/port/8080