logs in use; new audit log panel!
This commit is contained in:
parent
1397274967
commit
d9b71381b0
16 changed files with 418 additions and 75 deletions
19
controller/ip.go
Normal file
19
controller/ip.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package controller
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"slices"
|
||||
)
|
||||
|
||||
// Returns the request's original IP address, resolving the `x-forwarded-for`
|
||||
// header if the request originates from a trusted proxy.
|
||||
func ResolveIP(r *http.Request) string {
|
||||
trustedProxies := []string{ "10.4.20.69" }
|
||||
if slices.Contains(trustedProxies, r.RemoteAddr) {
|
||||
forwardedFor := r.Header.Get("x-forwarded-for")
|
||||
if len(forwardedFor) > 0 {
|
||||
return forwardedFor
|
||||
}
|
||||
}
|
||||
return r.RemoteAddr
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue