Fix check and use 256 bit

This commit is contained in:
Bolke de Bruin 2020-07-25 21:27:03 +02:00
parent 0b299619ff
commit 263312dc7b
4 changed files with 9 additions and 7 deletions

View file

@ -2,6 +2,7 @@ package client
import (
"context"
"net"
"net/http"
"strings"
)
@ -31,10 +32,10 @@ func EnrichContext(next http.Handler) http.Handler {
ctx = context.WithValue(ctx, ProxyAddressesCtx, proxies)
}
remote := r.Header.Get("REMOTE_ADDR")
ctx = context.WithValue(ctx, RemoteAddressCtx, remote)
ctx = context.WithValue(ctx, RemoteAddressCtx, r.RemoteAddr)
if h == "" {
ctx = context.WithValue(ctx, ClientIPCtx, remote)
clientIp, _, _ := net.SplitHostPort(r.RemoteAddr)
ctx = context.WithValue(ctx, ClientIPCtx, clientIp)
}
next.ServeHTTP(w, r.WithContext(ctx))
})