0.3.49
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -237,28 +236,3 @@ func isPlaybackItemPath(path string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// requestClientIP is the viewer-facing address recorded for trailer playback. The first
|
||||
// Forwarded address is the original client when the gateway is behind its normal reverse
|
||||
// proxy; direct deployments fall back to RemoteAddr. This value is for operational logs,
|
||||
// never authentication or access control.
|
||||
func requestClientIP(r *http.Request) string {
|
||||
for _, value := range strings.Split(r.Header.Get("X-Forwarded-For"), ",") {
|
||||
if ip := net.ParseIP(strings.TrimSpace(value)); ip != nil {
|
||||
return ip.String()
|
||||
}
|
||||
}
|
||||
if ip := net.ParseIP(strings.TrimSpace(r.Header.Get("X-Real-IP"))); ip != nil {
|
||||
return ip.String()
|
||||
}
|
||||
host, _, err := net.SplitHostPort(strings.TrimSpace(r.RemoteAddr))
|
||||
if err == nil {
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
return ip.String()
|
||||
}
|
||||
}
|
||||
if ip := net.ParseIP(strings.TrimSpace(r.RemoteAddr)); ip != nil {
|
||||
return ip.String()
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user