libp2p / rust-libp2p

The Rust Implementation of the libp2p networking stack.
https://libp2p.io
MIT License
4.3k stars 891 forks source link

Circuit relay v2 should return limit to dialer #5466

Open MarcoPolo opened 3 weeks ago

MarcoPolo commented 3 weeks ago

Summary

When returning the "hop" message for circuit establishment, the rust-libp2p relay server does not fill in a value for the Limit field in the protobuf. Thus the dialer does not know if the connection is limited and can only assume it's unlimited (which is likely rarely true).

Issue here: https://github.com/libp2p/rust-libp2p/blob/master/protocols/relay/src/protocol/inbound_hop.rs#L130 go-libp2p sets it here: https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/relay/relay.go#L398

Expected behavior

rust-libp2p circuitv2 server should fill in the Limit field in returned hop message.

Actual behavior

It doesn't

Relevant log output

No response

Possible Solution

Should be an easy fix. CircuitReq needs to store the resource limits so it can set the field.

Version

all released

Would you like to work on fixing this bug ?

Maybe

dariusc93 commented 3 weeks ago

A simple fix. I may do it quickly if nobody else has already done it