From d2b2fa09e3cf3cccf73f988db460be6c8ada5d6f Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 11 Mar 2024 16:08:47 -0400 Subject: [PATCH] fix: set forwarded ip before checking for a blocked connection --- service/default/http.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/default/http.go b/service/default/http.go index b2fa8ab..b09e70c 100644 --- a/service/default/http.go +++ b/service/default/http.go @@ -115,6 +115,10 @@ func (h *HTTPServiceDefault) p2pHandler(ctx jape.Context) { } } + if clientIP != nil { + peer.SetIP(&net.IPAddr{IP: clientIP}) + } + if blockConnection(peer.GetIP()) { err := peer.End() if err != nil { @@ -123,10 +127,6 @@ func (h *HTTPServiceDefault) p2pHandler(ctx jape.Context) { return } - if clientIP != nil { - peer.SetIP(&net.IPAddr{IP: clientIP}) - } - h.Services().P2P().ConnectionTracker().Add(1) go func() {