WithRemoteAddrHeader adds a new request header name that can be used to validate the client's real IP.
(header ...string)
| 407 | // WithRemoteAddrHeader adds a new request header name |
| 408 | // that can be used to validate the client's real IP. |
| 409 | func WithRemoteAddrHeader(header ...string) Configurator { |
| 410 | return func(app *Application) { |
| 411 | for _, h := range header { |
| 412 | exists := false |
| 413 | for _, v := range app.config.RemoteAddrHeaders { |
| 414 | if v == h { |
| 415 | exists = true |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | if !exists { |
| 420 | app.config.RemoteAddrHeaders = append(app.config.RemoteAddrHeaders, h) |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | // WithoutRemoteAddrHeader removes an existing request header name |
| 427 | // that can be used to validate and parse the client's real IP. |
no outgoing calls
no test coverage detected
searching dependent graphs…