Skip to content

Commit

Permalink
remove: network prefix limits
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-tra committed Nov 7, 2024
1 parent 8bee8bc commit 2cd96dc
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion libp2p/driver_crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package libp2p

import (
"fmt"
"math"
"net/netip"
"runtime"
"time"

Expand Down Expand Up @@ -184,9 +186,23 @@ func (d *CrawlDriver) Close() {}

func newLibp2pHost(userAgent string) (Host, error) {
// Configure the resource manager to not limit anything
v4PrefixLimits := []rcmgr.NetworkPrefixLimit{
{
Network: netip.MustParsePrefix("0.0.0.0/0"),
ConnCount: math.MaxInt, // Unlimited
},
}

v6PrefixLimits := []rcmgr.NetworkPrefixLimit{
{
Network: netip.MustParsePrefix("::1/0"),
ConnCount: math.MaxInt, // Unlimited
},
}

var noSubnetLimit []rcmgr.ConnLimitPerSubnet
limiter := rcmgr.NewFixedLimiter(rcmgr.InfiniteLimits)
rm, err := rcmgr.NewResourceManager(limiter, rcmgr.WithLimitPerSubnet(noSubnetLimit, noSubnetLimit))
rm, err := rcmgr.NewResourceManager(limiter, rcmgr.WithLimitPerSubnet(noSubnetLimit, noSubnetLimit), rcmgr.WithNetworkPrefixLimit(v4PrefixLimits, v6PrefixLimits))
if err != nil {
return nil, fmt.Errorf("new resource manager: %w", err)
}
Expand Down

0 comments on commit 2cd96dc

Please sign in to comment.