c73b648451
Signed-off-by: Odyssey346 <odyssey346@disroot.org>
16 lines
252 B
Go
16 lines
252 B
Go
package utils
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// Thanks random StackOverflow answerer
|
|
|
|
func GetUserIP(r *http.Request) string {
|
|
IPAddress := r.Header.Get("X-REAL-IP")
|
|
if IPAddress == "" {
|
|
IPAddress = r.Header.Get("X-FORWARDED-FOR")
|
|
}
|
|
return IPAddress
|
|
}
|