Rendezvous: self registration? #2876
-
Hello, I'm improving a network of P2P nodes by moving the P2P stack to rust-libp2p. We have a relatively small number of nodes (~80). These nodes can be considered as always up (99%+). They currently discover each other by using a few bootstrap nodes and then advertising their existence through gossipsub. I'm thinking of moving that logic to rendezvous. Here is my design so far:
I've been struggling with the last point, as it requires the node to, well, self-register (otherwise it won't appear during discovery, despite being a perfectly valid node). I've successfully implemented a network behaviour which composes
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I think what is happening here is that you effectively try to dial yourself which doesn't work. In principle though, there is nothing wrong with the idea but the current implementation doesn't support it :) What we'd have to do is expose a function on Index: protocols/rendezvous/src/server.rs
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/protocols/rendezvous/src/server.rs b/protocols/rendezvous/src/server.rs
--- a/protocols/rendezvous/src/server.rs (revision 864237fa1855eb48859f9b9d7af1c68f660308a9)
+++ b/protocols/rendezvous/src/server.rs (date 1662626496907)
@@ -79,6 +79,10 @@
registrations: Registrations::with_config(config),
}
}
+
+ pub fn registrations_mut(&mut self) -> &mut Registrations {
+ &mut self.registrations
+ }
}
#[derive(Debug)] This would allow you to call Allow me to add a more general note regarding discovery: I don't know what your threat-model is but a common one in discovery protocols is censorship-resistence. It is not bullet-proof but the current design of the rendezvous protocol allows you to run a standalone rendezvous node that works across domains, i.e. it is not just useful for your network but in principle for any network that runs on top of libp2p. As such, an entity completely unrelated to you could operate this rendezvous node and offer it is a public service. This makes it difficult to censor / take down your network because the attacker first needs to take down the completely unrelated rendezvous node. If your application has support for multiple rendezvous nodes, this gets even more difficult because they have to repeat the process N times. Having every node be a rendezvous server doesn't make a whole lot of sense in my opinion because it doesn't solve the problem of "how do I make the first connection?". Additionally, if the discovery protocol should be an integral part of your and only your nodes, you don't really need the rendezvous protocol because you will only have one namespace anyway. Thus, you could effectively replace it with a request-response protocol that just returns a list of all currently connected nodes. The question is how are you going to establish the connection to your first node? Perhaps take a look at |
Beta Was this translation helpful? Give feedback.
I think what is happening here is that you effectively try to dial yourself which doesn't work. In principle though, there is nothing wrong with the idea but the current implementation doesn't support it :)
What we'd have to do is expose a function on
rendezvous::Behaviour::server
to manually add entries to the underlyingRegistrations
struct. Probably all that is necessary is that we add: