This repository has been archived on 2022-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
|
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
|
|
}
|