2017-05-29 22:53:51 +02:00
|
|
|
package http
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2018-08-23 21:02:51 +02:00
|
|
|
// GetRemoteIP of http Request
|
2017-05-29 22:53:51 +02:00
|
|
|
func GetRemoteIP(r *http.Request) string {
|
|
|
|
ip := r.Header.Get("X-Forwarded-For")
|
|
|
|
if len(ip) <= 1 {
|
|
|
|
ip = r.RemoteAddr
|
|
|
|
}
|
|
|
|
return ip
|
|
|
|
}
|