-
Notifications
You must be signed in to change notification settings - Fork 19
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
Peers won't discover neighbors topics subscriptions when relayed #27
Comments
By default the Circuit Relay protocol only allows a small amount of data to be transferred over a relayed connection - if the limit is breached the relay will close the connection - this is to ensure relays can be run to help other nodes create direct connections but not be an open relay which is ripe for abuse. By default there are only a few protocols that will run over relayed connections - Identify is one of them but Gossipsub is not. Your peers should use the relay to establish a direct connection, over which Gossipsub should run as expected. |
@achingbrain thanks for helping out! It seems that enabling |
Since it works on a LAN and it works via a relay it sounds like the two nodes are failing to make a direct connection. Have you configured any STUN servers? If not can you please try updating the config of the two NATed nodes to something like: const node = await createLibp2p({
//... other config
transports: [
//... other transports
webRTC({
rtcConfiguration: {
iceServers: [{
urls: ['stun:stun.l.google.com:19302']
}, {
urls: ['stun:global.stun.twilio.com:3478']
}]
}
})
]
}) There will be something like this as default config in the next release so it shouldn't be necessary forever. |
Yep. The initial tests we made didn't have the STUN servers configured and the ones that followed had both STUN and relaying enabled, so the results were unclear. Currently, it's working, we still need to debug some scenarios where there is a connection, the messaging is working, but the handler is failing (high probability is on our side). We still found some edge cases where STUN is insufficient to make a direct connection (w/ VPNs in the mix). This is out-of-scope for now. Thank you so much for taking the time to help out fixing our issues! |
Great stuff, glad you got it sorted out.
This shipped in Also if you like, please feel free to PR your logo into the js-libp2p README - https://github.com/libp2p/js-libp2p#used-by |
We are currently having an issue where peers are not aware of their neighbors topics when they use a relay. Everything works perfectly when both peers are in the same network (either localhost or LAN), we assume it would also work if both peers weren't behind NATs and had a direct connection (we didn't tested this).
Things we tested:
identify
initial message and fetch the relevantmeshsub
in the available protocolsThings to check:
Base pubsub abstract class exchanging topics (not being extended by chainsafe's gossipsub impl)
https://github.com/libp2p/js-libp2p/blob/0b55625d146940994a306101650a55ee58e32f6c/packages/pubsub/src/index.ts#L253
Chainsafe's gossipsub impl on connected workflow
https://github.com/ChainSafe/js-libp2p-gossipsub/blob/bd5460c6c0fba63b27d8671b438cb0495d232773/src/index.ts#L770
Things to test around:
The text was updated successfully, but these errors were encountered: