x-forward header handling
This commit is contained in:
parent
cb493ff1fe
commit
1f0997054e
|
@ -15,6 +15,10 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
HeaderForward = "X-Forwarded-For"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrorServerNotSet = errors.New("Server not set")
|
||||
ErrorConnectionNotFound = errors.New("Connection not found")
|
||||
|
@ -41,6 +45,10 @@ type Server struct {
|
|||
Get ip of socket client
|
||||
*/
|
||||
func (c *Channel) Ip() string {
|
||||
forward := c.RequestHeader().Get(HeaderForward)
|
||||
if forward != "" {
|
||||
return forward
|
||||
}
|
||||
return c.ip
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue