Skip to content

Commit db7fab4

Browse files
committed
discv5: remove network prefix limits
1 parent b8c1938 commit db7fab4

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

discv5/driver_crawler.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import (
66
crand "crypto/rand"
77
"fmt"
88
"io"
9+
"math"
910
"net"
11+
"net/netip"
1012
"runtime"
1113
"sync"
1214
"time"
@@ -331,7 +333,22 @@ func newLibp2pHost(version string) (host.Host, error) {
331333
// Configure the resource manager to not limit anything
332334
var noSubnetLimit []rcmgr.ConnLimitPerSubnet
333335
limiter := rcmgr.NewFixedLimiter(rcmgr.InfiniteLimits)
334-
rm, err := rcmgr.NewResourceManager(limiter, rcmgr.WithLimitPerSubnet(noSubnetLimit, noSubnetLimit))
336+
337+
v4PrefixLimits := []rcmgr.NetworkPrefixLimit{
338+
{
339+
Network: netip.MustParsePrefix("0.0.0.0/0"),
340+
ConnCount: math.MaxInt, // Unlimited
341+
},
342+
}
343+
344+
v6PrefixLimits := []rcmgr.NetworkPrefixLimit{
345+
{
346+
Network: netip.MustParsePrefix("::1/0"),
347+
ConnCount: math.MaxInt, // Unlimited
348+
},
349+
}
350+
351+
rm, err := rcmgr.NewResourceManager(limiter, rcmgr.WithLimitPerSubnet(noSubnetLimit, noSubnetLimit), rcmgr.WithNetworkPrefixLimit(v4PrefixLimits, v6PrefixLimits))
335352
if err != nil {
336353
return nil, fmt.Errorf("new resource manager: %w", err)
337354
}

0 commit comments

Comments
 (0)