mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-08 11:10:27 +01:00
Merged.
This commit is contained in:
commit
0f01065fdf
|
@ -96,15 +96,16 @@ func (tu *tileUpdater) checkIP(r *http.Request) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
var host []string
|
idx := strings.LastIndex(r.RemoteAddr, ":")
|
||||||
if host = strings.SplitN(r.RemoteAddr, ":", 2); len(host) < 1 {
|
if idx < 0 {
|
||||||
log.Printf("WARN: cannot extract host from '%s'.\n", r.RemoteAddr)
|
log.Printf("WARN: cannot extract host from '%s'.\n", r.RemoteAddr)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var ip net.IP
|
host := strings.Trim(r.RemoteAddr[:idx], "[]")
|
||||||
if ip = net.ParseIP(host[0]); ip == nil {
|
ip := net.ParseIP(host)
|
||||||
log.Printf("WARN: cannot get IP for host '%s'.\n", host[0])
|
if ip == nil {
|
||||||
|
log.Printf("WARN: cannot get IP for host '%s'.\n", host)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user