+ {{ end }} {{ if .UserAgent }} {{ if .UserAgent.Comment }}
+
+
User Agent
+
{{ .UserAgent.Product }}/{{ .UserAgent.Version }}
+
+ {{ end }} {{ if .UserAgent.Comment }}
+
+
Comment
+
{{ .UserAgent.Comment }}
+
+ {{ end }} {{ if .UserAgent.RawValue }}
+
+
Raw Value
+
{{ .UserAgent.RawValue }}
+
+ {{ end }} {{ end }}
+
+ {{ if .Country }}
+
+ This information is provided from the GeoLite2 database created by
+ MaxMind, available from
+ www.maxmind.com
+
+ {{ end }} {{ if .Latitude }}
+
+
Map
+
+
+ {{ end }}
+
+
+
+
+
+
How do I get this programmatically?
+
+ With the widget below you can build your query, and see what the
+ result will look like.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
FAQ
+
How do I force IPv4 or IPv6 lookup?
+
+ As of 2018-07-25 it's no longer possible to force protocol using
+ the
+ v4 and v6 subdomains. IPv4 or IPv6 still can be
+ forced by passing the appropiate flag to your client, e.g
+ curl -4 or curl -6.
+
+
Can I force getting JSON?
+
+ Setting the Accept: application/json header works
+ as expected.
+
+
+
Is automated use of this service permitted?
+
+ Yes, as long as the rate limit is respected. The rate limit is
+ in place to ensure a fair service for all.
+
+
+ Please limit automated requests to 1 request per minute. No guarantee is made for requests that exceed this limit.
+ They may be rate-limited, with a 429 status code, or dropped
+ entirely.
+
+
+
Can I run my own service?
+
+ Yes, the source code and documentation is available on
+ GitHub.
+
+
+
+
+
+
+
+
diff --git a/html/leafcloud-logo.svg b/html/leafcloud-logo.svg
new file mode 100644
index 0000000..9e9f4a7
--- /dev/null
+++ b/html/leafcloud-logo.svg
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/html/script.html b/html/script.html
new file mode 100644
index 0000000..1e4b7f8
--- /dev/null
+++ b/html/script.html
@@ -0,0 +1,89 @@
+
diff --git a/html/styles.html b/html/styles.html
new file mode 100644
index 0000000..c2e0b4b
--- /dev/null
+++ b/html/styles.html
@@ -0,0 +1,185 @@
+
diff --git a/http/http.go b/http/http.go
index d7ed8a0..9a56953 100644
--- a/http/http.go
+++ b/http/http.go
@@ -34,6 +34,7 @@ type Server struct {
cache *Cache
gr geo.Reader
profile bool
+ Sponsor bool
}
type Response struct {
@@ -322,7 +323,7 @@ func (s *Server) DefaultHandler(w http.ResponseWriter, r *http.Request) *appErro
if err != nil {
return badRequest(err).WithMessage(err.Error())
}
- t, err := template.ParseFiles(s.Template)
+ t, err := template.ParseGlob(s.Template + "/*")
if err != nil {
return internalServerError(err)
}
@@ -330,6 +331,7 @@ func (s *Server) DefaultHandler(w http.ResponseWriter, r *http.Request) *appErro
if err != nil {
return internalServerError(err)
}
+
var data = struct {
Response
Host string
@@ -339,6 +341,7 @@ func (s *Server) DefaultHandler(w http.ResponseWriter, r *http.Request) *appErro
BoxLonRight float64
JSON string
Port bool
+ Sponsor bool
}{
response,
r.Host,
@@ -348,6 +351,7 @@ func (s *Server) DefaultHandler(w http.ResponseWriter, r *http.Request) *appErro
response.Longitude + 0.05,
string(json),
s.LookupPort != nil,
+ s.Sponsor,
}
if err := t.Execute(w, &data); err != nil {
return internalServerError(err)
diff --git a/index.html b/index.html
deleted file mode 100644
index 8256fcd..0000000
--- a/index.html
+++ /dev/null
@@ -1,197 +0,0 @@
-
-
-
-
- What is my IP address? — {{ .Host }}
-
-
-
-
-
-
-
-
-
As of 2018-07-25 it's no longer possible to force protocol using
- the v4 and v6 subdomains. IPv4 or IPv6 still can be forced
- by passing the appropiate flag to your client, e.g curl -4
- or curl -6.
-
-
Is automated use of this service permitted?
-
- Yes, as long as the rate limit is respected. The rate limit is in
- place to ensure a fair service for all.
-
-
- Please limit automated requests to 1 request per minute. No
- guarantee is made for requests that exceed this limit. They may be
- rate-limited, with a 429 status code, or dropped entirely.
-
-
-
Can I run my own service?
-
Yes, the source code and documentation is available on GitHub.