move proxy option to server.

This commit is contained in:
Miroslav Šedivý
2023-11-19 14:50:23 +01:00
parent 3c4d7b9d60
commit 683b750189
5 changed files with 11 additions and 19 deletions

View File

@ -38,14 +38,3 @@ func GetIP(serverUrl string) (string, error) {
return string(bytes.TrimSpace(buf)), nil
}
func GetHttpRequestIP(r *http.Request, proxy bool) string {
IPAddress := r.Header.Get("X-Real-Ip")
if IPAddress == "" {
IPAddress = r.Header.Get("X-Forwarded-For")
}
if IPAddress == "" || !proxy {
IPAddress = r.RemoteAddr
}
return IPAddress
}