p2p: a --public node accepts 1000 inbound connections (--max-conns), instead of libp2p's memory-scaled default
The simulator showed libp2p's default cap (about 190 on 16 GB) stranding newcomers on a bootstrap node: 12 of 200 and 212 of 400 nodes never found a peer. As shipped, the same networks now form and deliver 100% up to 600 nodes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
@@ -44,6 +44,8 @@ func cmdRun(args []string) error {
|
||||
noDHT := fs.Bool("no-dht", false, "do not look for peers through the DHT")
|
||||
public := fs.Bool("public", false,
|
||||
"this node is reachable from the internet: serve the DHT and relay for nodes behind a NAT (for bootstrap nodes)")
|
||||
maxConns := fs.Int("max-conns", 0,
|
||||
fmt.Sprintf("inbound connections to accept (0: %d for --public nodes, libp2p's default, which scales with memory, for others; -1: libp2p's default always)", p2p.DefaultPublicConns))
|
||||
var announceAddrs listFlag
|
||||
fs.Var(&announceAddrs, "announce",
|
||||
"address others should dial, when this node sits behind a router or in a container, e.g. /dns4/node.example.org/tcp/4001; repeatable")
|
||||
@@ -146,6 +148,7 @@ func cmdRun(args []string) error {
|
||||
MDNS: !*noMDNS,
|
||||
DHT: !*noDHT,
|
||||
Public: *public,
|
||||
MaxConns: *maxConns,
|
||||
Announce: announceAddrs,
|
||||
PeerCache: filepath.Join(*data, peersFile),
|
||||
Difficulty: *difficulty,
|
||||
|
||||
Reference in New Issue
Block a user