diff --git a/api/api.go b/api/api.go index 996baa8..ca3ce19 100644 --- a/api/api.go +++ b/api/api.go @@ -187,9 +187,10 @@ func (a *API) DefaultHandler(w http.ResponseWriter, r *http.Request) *appError { return internalServerError(err) } var data = struct { + Host string Response Oracle - }{response, a.oracle} + }{r.Host, response, a.oracle} if err := t.Execute(w, &data); err != nil { return internalServerError(err) } diff --git a/index.html b/index.html index 346f804..b70c7f0 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@
--$ curl ifconfig.co +$ curl {{ .Host }} {{ .IP }} -$ http -b ifconfig.co +$ http -b {{ .Host }} {{ .IP }} -$ wget -qO- ifconfig.co +$ wget -qO- {{ .Host }} {{ .IP }} -$ fetch -qo- https://ifconfig.co +$ fetch -qo- https://{{ .Host }} {{ .IP }} -$ bat -print=b ifconfig.co/ip +$ bat -print=b {{ .Host }}/ip {{ .IP }}{{ if .IsLookupCountryEnabled }}
-$ http ifconfig.co/country +$ http {{ .Host }}/country {{ .Country }}{{ end }} {{ if .IsLookupCityEnabled }}
-$ http ifconfig.co/city +$ http {{ .Host }}/city {{ .City }}{{ end }}
-$ http ifconfig.co/json +$ http {{ .Host }}/json { {{ if .IsLookupCityEnabled }} "city": "{{ .City }}",{{ end }}{{ if .IsLookupCountryEnabled }} "country": "{{ .Country }}",{{ end }}{{ if .IsLookupAddrEnabled }} @@ -87,12 +87,12 @@ $ http ifconfig.co/jsonPlain output:
Always returns the IP address including a trailing newline, regardless of user agent.
-$ http ifconfig.co/ip +$ http {{ .Host }}/ip {{ .IP }}{{ if .IsLookupPortEnabled }}Testing port connectivity:
-$ http ifconfig.co/port/8080 +$ http {{ .Host }}/port/8080 { "ip": "{{ .IP }}", "port": 8080,