freifunkmanager/lib/http/main.go

12 lines
170 B
Go
Raw Normal View History

2017-05-08 19:13:29 +02:00
package http
import "net/http"
func GetRemoteIP(r *http.Request) string {
ip := r.Header.Get("X-Forwarded-For")
if len(ip) <= 1 {
ip = r.RemoteAddr
}
return ip
}