use fallback if not x-forwarded-for is present
This commit is contained in:
@@ -815,3 +815,11 @@ func PlayerFromSteam(players []*ent.Player, db *ent.Client, apiKey string, rl *r
|
||||
|
||||
return nPlayers, nil
|
||||
}
|
||||
|
||||
func RealIP(header *http.Header, fallback string) string {
|
||||
if header.Get("X-Forwarded-For") != "" {
|
||||
return header.Get("X-Forwarded-For")
|
||||
} else {
|
||||
return fallback
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user