fix(honeypot/naive): right, we want the client IP, not the load balancer IP
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
40afc13d7f
commit
ba8a1b7caf
1 changed files with 1 additions and 3 deletions
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -154,8 +153,7 @@ func (i *Impl) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
realIP, _ := internal.RealIP(r)
|
realIP, _ := internal.RealIP(r)
|
||||||
if !realIP.IsValid() {
|
if !realIP.IsValid() {
|
||||||
host, _, _ := net.SplitHostPort(r.RemoteAddr)
|
realIP = netip.MustParseAddr(r.Header.Get("X-Real-Ip"))
|
||||||
realIP = netip.MustParseAddr(host)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
network, ok := internal.ClampIP(realIP)
|
network, ok := internal.ClampIP(realIP)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue