The rate limits id pushes from peers to one every five second with an allowed burst of 10 pushes. This should be enough for all but malfunctioning and malicious peers.
We can use the exact same code for autonat, autonatv2, circuit v2, etc.
Introducing limits to identify separately to get some feedback for #3265. For this PR, I'd like to ignore issues regarding where should this piece of code go, and focus on how specifically it should behave. See the long comment in rateLimiter.allow for example.
Part of: #3265
In experiments with js we've found that increasing the message size
increases throughput. See: libp2p/specs#628 (comment)
for details.
This changes the protobuf reader for the stream to read 256kB messages.
This also forces a change to the connection SCTP read buffer to be
increased to about 2.5 MB, to support 1 message being buffered for 10
streams.
This isn't enough to support larger messages. We most likely need to
change the inferred SDP of the server to use 256kB maxMessageSize, and
need some backwards compatible mechanism in the handshake to opt in to
large messages. See: libp2p/specs#628 for
details
This also removes the go-leveldb-datastore dependency. There's no
reason to test with levelDB. This code should work with any compliant
go-datastore.
Bumps go-datastore to latest as it removes the go-process dependency.
Fixes: #3250
We were testing with both badger and LevelDB. Removing badger as just testing with LevelDB should be enough. Not sure if we need LevelDB either, but for now just removing badger as it is any way unused.
See: #3250
This introduces a new GatedMaListener type which gates conns
accepted from a manet.Listener with a gater and creates the rcmgr
scope for it. Explicitly passing the scope allows for many guardrails
that the previous interface assertion didn't.
This breaks the previous responsibility of the upgradeListener method
into two, one gating the connection initially, and the other upgrading
the connection with a security and muxer selection.
This split makes it easy to gate the connection with the resource
manager as early as possible. This is especially true for websocket
because we want to gate the connection just after the TCP connection is
established, and not after the tls handshake + websocket upgrade is
completed.
This option, `WithEmergencyTrim`, intended to trim connections where there
was a memory emergency. The API was very confusing. To use it correctly
you had to use the `WithEmergencyTrim` option and then do
`watchdog.HeapDriven(...)` to run the goroutine that would trigger this
in time of a memory emergency.
As there's no correct usage of this
API(https://github.com/search?q=WithEmergencyTrim&type=code&p=1),
I'm removing this and exporting a ForceTrim method that users can call
using any watchdog style memory tracking implementation.
reuse port didn't work for the second transport, either QUIC or
WebTransport, that was used for listening. This change fixes
it by calling associate on all paths.
This impacted hole punching for some users since you cannot hole
punch without reuse port. There's a test in holepunch package
to prevent regressions.
Fixes#3165
Co-authored-by: Marco Munizaga <git@marcopolo.io>
This context wasn't being cancelled on all code paths. In particular,
contexts for connections that didn't complete negotiation were not being
cancelled.
The change arranges for either `udpmux.muxedConnection.Close` or
`RemoveConnByUfrag` to call the other.
Fixes: #3223