rename ngin to rest
This commit is contained in:
14
rest/internal/util.go
Normal file
14
rest/internal/util.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package internal
|
||||
|
||||
import "net/http"
|
||||
|
||||
const xForwardFor = "X-Forward-For"
|
||||
|
||||
// Returns the peer address, supports X-Forward-For
|
||||
func GetRemoteAddr(r *http.Request) string {
|
||||
v := r.Header.Get(xForwardFor)
|
||||
if len(v) > 0 {
|
||||
return v
|
||||
}
|
||||
return r.RemoteAddr
|
||||
}
|
||||
Reference in New Issue
Block a user