Skip to content
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

Identify/Advertise Plugins used by peers #2

Open
DougAnderson444 opened this issue Jun 1, 2023 · 1 comment
Open

Identify/Advertise Plugins used by peers #2

DougAnderson444 opened this issue Jun 1, 2023 · 1 comment

Comments

@DougAnderson444
Copy link
Owner

Associated with #1, there needs to be a consistent ways for peers to identify the plugins they are using. Couple of options:

  1. Use the identify protocol system
  2. Use the CID of the interface or code itself

There seems to be some challenges and differences with 1) here and here which make it not as straightforward as it might seem. Also we would have to verify that a "layer 2" protocol can interoperate at the "identify" layer. In other words, Plugins operate as Apps on Pubsub messages, like Ping operates on Request Response. If I have a chat program running on Pubsub, can I advertize it as libp2p/plugin/postr/1.0.0?

But for 2) we would have to determine where to advertise the CID, which is nicely taken care of at 1)

@DougAnderson444
Copy link
Owner Author

  1. Request-Response has a ProtocolName system as well

https://docs.rs/libp2p/latest/libp2p/request_response/codec/trait.ProtocolName.html

Example

use libp2p_core::ProtocolName;

enum MyProtocolName {
    Version1,
    Version2,
    Version3,
}

impl ProtocolName for MyProtocolName {
    fn protocol_name(&self) -> &[u8] {
        match *self {
            MyProtocolName::Version1 => b"/myproto/1.0",
            MyProtocolName::Version2 => b"/myproto/2.0",
            MyProtocolName::Version3 => b"/myproto/3.0",
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant