CLI examples:
$ curl ifconfig.co
{{ .IP }}
$ http -b ifconfig.co
{{ .IP }}
$ wget -qO- ifconfig.co
{{ .IP }}
$ fetch -qo- http://ifconfig.co
{{ .IP }}
{{ if .IsLookupCountryEnabled }}
Country lookup:
$ http ifconfig.co/country
{{ .Country }}
{{ end }}
{{ if .IsLookupCityEnabled }}
City lookup:
$ http ifconfig.co/city
{{ .City }}
{{ end }}
JSON output:
$ http ifconfig.co/json
{ {{ if .IsLookupCountryEnabled }}
"country": "{{ .Country }}",{{ end }}{{ if .IsLookupCityEnabled }}
"city": "{{ .City }}",{{ end }}{{ if .IsLookupAddrEnabled }}
"hostname": "{{ .Hostname }}",{{ end }}
"ip": "{{ .IP }}"
}
# or set Accept header:
# http ifconfig.co Accept:application/json
{{ if .IsLookupPortEnabled }}
Testing port connectivity:
$ http ifconfig.co/port/8080
{
"ip": "{{ .IP }}",
"port": 8080,
"reachable": false
}
{{ end }}