I'm limiting concurrent quic connections from the same IP in go-libp2p. The way we implement the limiting is to create a resource manager scope that tracks all the connection resource usage throughout the lifetime of the connection.
I want to:
- On receiving ClientHello, create a scope and reject the connection without handshaking if there are too many connections from the same IP.
- On accepting a ClientHello, when I eventually get the quic connection from
Server.Accept retrieve the scope created in 1.
I can use Config.GetConfigForClient to rate limit based on IP, but there's no way to set store the scope that I can later get back after the handshake.
I can use Server.ConnContext to store the scope in the context, but the ConnContext callback has no info about remote IP.
If we add the connection context to ClientHelloInfo it'll be enough for my usecase. This change is also backwards compatible. See #5014
I'm limiting concurrent quic connections from the same IP in go-libp2p. The way we implement the limiting is to create a resource manager scope that tracks all the connection resource usage throughout the lifetime of the connection.
I want to:
Server.Acceptretrieve the scope created in 1.I can use
Config.GetConfigForClientto rate limit based on IP, but there's no way to set store the scope that I can later get back after the handshake.I can use
Server.ConnContextto store the scope in the context, but theConnContextcallback has no info about remote IP.If we add the connection context to
ClientHelloInfoit'll be enough for my usecase. This change is also backwards compatible. See #5014