logs in use; new audit log panel!

This commit is contained in:
ari melody 2025-02-07 16:40:58 +00:00
parent 1397274967
commit d9b71381b0
Signed by: ari
GPG key ID: CF99829C92678188
16 changed files with 418 additions and 75 deletions

19
controller/ip.go Normal file
View 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
}