mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-05 08:16:55 +08:00
Add support X-Forwarded-For
This commit is contained in:
12
pkg/tcp/helpers.go
Normal file
12
pkg/tcp/helpers.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package tcp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func RemoteAddr(r *http.Request) string {
|
||||
if remote := r.Header.Get("X-Forwarded-For"); remote != "" {
|
||||
return remote + ", " + r.RemoteAddr
|
||||
}
|
||||
return r.RemoteAddr
|
||||
}
|
Reference in New Issue
Block a user