upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index 9f3c7e4..72e13eb 100644
--- a/src/net.h
+++ b/src/net.h
@@ -109,6 +109,23 @@ static const unsigned int MAX_PROTOCOL_MESSAGE_SIZE = MAX_SIZE;
109// 125 is Bitcoin's number and remains a conservative public-node default. 109// 125 is Bitcoin's number and remains a conservative public-node default.
110static const unsigned int MAX_CONNECTIONS = 125; 110static const unsigned int MAX_CONNECTIONS = 125;
111 111
112// Cap inbound connections from any single address. Without it one source can
113// hold every slot up to MAX_CONNECTIONS -- exactly what happened to the
114// rendezvous relays, where a single IP parked hundreds of connections and
115// starved real peers. A legitimate peer, even a relay talking to a relay,
116// needs only a handful; 32 leaves generous room while denying any one address
117// more than a quarter of the table. The firewall connlimit on the relays does
118// the same thing a layer lower; this makes every build carry the defense.
119//
120// Loopback (127.0.0.0/8) is exempt in the accept path. A managed-Tor node
121// receives every inbound onion peer over its local hidden-service listener, so
122// they all appear as 127.0.0.1 -- capping loopback would cap onion peers as a
123// group, which is exactly wrong for a network moving toward onion-only. The
124// global MAX_CONNECTIONS still bounds the total; a per-onion-identity limit,
125// applied once identity is known after accept(), is the right future tool for
126// onion floods.
127static const unsigned int MAX_CONNECTIONS_PER_IP = 32;
128
112// A node marked for disconnect is normally held until its buffers drain, so 129// A node marked for disconnect is normally held until its buffers drain, so
113// a last message still goes out. But vSend cannot drain through a socket 130// a last message still goes out. But vSend cannot drain through a socket
114// whose far end is gone, and that made such a node immortal: it stayed in 131// whose far end is gone, and that made such a node immortal: it stayed in