- Included maps

- Modified main.go to use env.PORT if set
This commit is contained in:
johannrichard 2018-10-28 12:18:41 +01:00
parent 72f121cc9d
commit 0a6efc09f4
3 changed files with 19 additions and 10 deletions

View File

@ -48,7 +48,7 @@ func main() {
log.Printf("Trusting header(s) %+v to contain correct remote IP", opts.IPHeaders)
}
log.Printf("Listening on http://%s", opts.Listen)
log.Printf("Listening on http://%s", process.env.PORT || opts.Listen)
if err := server.ListenAndServe(opts.Listen); err != nil {
log.Fatal(err)
}

View File

@ -98,15 +98,19 @@ func (s *Server) newResponse(r *http.Request) (Response, error) {
hostname, _ = s.LookupAddr(ip)
}
return Response{
IP: ip,
IPDecimal: ipDecimal,
Country: country.Name,
CountryISO: country.ISO,
CountryEU: country.IsEU,
City: city.Name,
Hostname: hostname,
Latitude: city.Latitude,
Longitude: city.Longitude,
IP: ip,
IPDecimal: ipDecimal,
Country: country.Name,
CountryISO: country.ISO,
CountryEU: country.IsEU,
City: city.Name,
Hostname: hostname,
Latitude: city.Latitude,
Longitude: city.Longitude,
BoxLatTop: city.Latitude + 0.10,
BoxLatBottom: city.Latitude - 0.10,
BoxLonLeft: city.Longitude - 0.10,
BoxLonRight: city.Longitude + 0.10,
}, nil
}

View File

@ -97,6 +97,11 @@ $ http {{ .Host }}/port/8080
}</pre>
{{ end }}
</div>
{{ if .City }}
<div class="pure-u-1 pure-u-md-1-1">
<iframe width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox={{ .BoxLonLeft }}%2C{{ .BoxLatBottom }}%2C{{ .BoxLonRight }}%2C{{ .BoxLatTop }}&amp;layer=mapnik&amp;marker={{ .Latitude }}%2C{{ .Longitude }}" style="border: 1px solid black"></iframe>
</div>
{{ end }}
<div class="pure-u-1 pure-u-md-1-2">
<h2>FAQ</h2>
<h3>How do I force IPv4 or IPv6 lookup?</h3>