-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement circuit relay v2 #345
Conversation
but upgrading relayed stream fails ASdd java relay test
set Connection attribute call fireActive in upgradeStream
Remove the hop/stop handlers from both streams in relay before upgrade
libp2p/src/main/java/io/libp2p/protocol/circuit/crypto/pb/Crypto.java
Outdated
Show resolved
Hide resolved
@@ -61,7 +61,11 @@ data class Multiaddr(val components: List<MultiaddrComponent>) { | |||
* @throws IllegalArgumentException if existing component value doesn't match [value] | |||
*/ | |||
private fun withComponentImpl(protocol: Protocol, value: ByteArray?): Multiaddr { | |||
val existingComponent = getFirstComponent(protocol) | |||
val existingComponent = if (has(Protocol.P2PCIRCUIT)) { | |||
split { it == Protocol.P2PCIRCUIT }.get(1).getFirstComponent(protocol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think those existing withComponent
methods hit their limitations with introducing relay
protocol. I believe we would need to introduce a builder for Multiaddr
which would be able to construct/modify components in a more explicit way.
This could be addressed later in a separate PR
libp2p/src/main/java/io/libp2p/protocol/circuit/RelayTransport.java
Outdated
Show resolved
Hide resolved
Basically looks good to me! Could you also please add a 🍋 for the |
It seems like the protobuf changes have broken a peerid test. It's not clear to me why yet. |
I had a look at making RelayTransportTest a subclass of TransportTests, but it seems quite awkward, because it needs the Host in the transport via setHost and the host builder modifier. It would be nice to find a better solution to this that didn't need to use HostBuilder().builderModifier() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@StefanBratanov may be you could give another review?
I am having a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM to me as well
Specs:
https://docs.libp2p.io/concepts/nat/circuit-relay/
https://github.com/libp2p/specs/blob/master/relay/circuit-v2.md
Go source: https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/relay/relay.go
Fixes #344