1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-15 01:34:53 +02:00

Moved code around

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-10-21 15:11:01 -07:00
parent a507447135
commit 143f563734
2 changed files with 2 additions and 3 deletions

View File

@ -15,13 +15,12 @@ func Logger() echo.MiddlewareFunc {
req := c.Request()
res := c.Response()
var remoteAddr string
remoteAddr := req.RemoteAddr
if ip := req.Header.Get(echo.XRealIP); ip != "" {
remoteAddr = ip
} else if ip = req.Header.Get(echo.XForwardedFor); ip != "" {
remoteAddr = ip
} else {
remoteAddr = req.RemoteAddr
remoteAddr, _, _ = net.SplitHostPort(remoteAddr)
}