mirror of https://github.com/mpolden/echoip
- Included maps
- Modified main.go to use env.PORT if set
This commit is contained in:
parent
72f121cc9d
commit
0a6efc09f4
|
@ -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)
|
||||
}
|
||||
|
|
22
http/http.go
22
http/http.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 }}&layer=mapnik&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>
|
||||
|
|
Loading…
Reference in New Issue