Obtain IP address of the client.
(req *http.Request)
| 366 | |
| 367 | // Obtain IP address of the client. |
| 368 | func getRemoteAddr(req *http.Request) string { |
| 369 | var addr string |
| 370 | if globals.useXForwardedFor { |
| 371 | addr = req.Header.Get("X-Forwarded-For") |
| 372 | if !isRoutableIP(addr) { |
| 373 | addr = "" |
| 374 | } |
| 375 | } |
| 376 | if addr != "" { |
| 377 | return addr |
| 378 | } |
| 379 | return req.RemoteAddr |
| 380 | } |
| 381 | |
| 382 | // debugSession is session debug info. |
| 383 | type debugSession struct { |
no test coverage detected
searching dependent graphs…