You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package internal
|
|
|
|
import "net/http"
|
|
|
|
const xForwardFor = "X-Forward-For"
|
|
|
|
// Returns the peer address, supports X-Forward-For
|
|
func GetRemoteAddr(r *http.Request) string {
|
|
v := r.Header.Get(xForwardFor)
|
|
if len(v) > 0 {
|
|
return v
|
|
}
|
|
return r.RemoteAddr
|
|
}
|