-
Notifications
You must be signed in to change notification settings - Fork 89
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
update: fundamentals protocols doc #201
Conversation
Thanks @p-shahi! Table has been updated. What should we include for QUIC? Also, not too sure about the protocol IDs for QUIC, WebTransport, and GossipSub. |
I couldn't find the protocol ID for QUIC or WebTransport either but it seems for GossipSub v1.1 peers advertise |
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.
libp2p has been moving away from using versions in protocol IDs. It's not really clear how semver applies to protocols. In most cases, it just makes more sense to just define a new protocol ID, and test if the peer supports that one.
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
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.
Do we have a separate doc describing multistream? If so, it would be helpful to link to that document. If not, we should probably add a section explaining how multistream works. We use a lot of multistream concepts here without even mentioning multistream, which can be confusing.
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
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.
We don't have a specific doc for multistream, it is planned in this issue. But there is a protocol negotiation section on this doc which I added mention of multistream too
ProtocolsThis article is concerned with protocols that compose libp2p using core libp2p abstractions like the transport, peer identity, addressing abstractions to name a few. What is a libp2p protocol?A libp2p protocol is a network protocol that includes the key features mentioned below. Protocol IDslibp2p protocols have unique string identifiers, which are used in the protocol negotiation process when streams are first opened. Historically, the IDs of many protocols in use by libp2p have a path-like structure, with a version number as the final component: Breaking changes to a protocol’s wire format or semantics should result in a new version number. See the protocol negotiation section for more information about how version selection works during the dialing and listening. Handler functionsA libp2p application will define a stream handler that takes over the stream after protocol negotiation. Everything sent and received after the negotiation phase is then defined by the application protocol. The handler function is invoked when an incoming stream is received with the registered protocol ID. If you register a handler with a match function, you can choose whether to accept non-exact string matches for protocol ids, for example, to match on semantic major versions. Binary streamsThe “medium” over which a libp2p protocol transpires is a bi-directional binary stream with the following properties:
Behind the scenes, libp2p will also ensure that the stream is secure and efficiently multiplexed. This is transparent to the protocol handler, which reads and writes unencrypted binary data over the stream. The protocol determines the binary data format and the transport mechanics. For inspiration, some common patterns that are used in libp2p’s internal protocols are outlined below. Life cycle of a streamLibp2p streams are an abstraction Libp2p protocols can have sub-protocols or protocol-suites. It isn’t easy to select and route protocols, or even know which protocols are available. Multistream-select
is a protocol multiplexer that negotiates the application-layer protocol. When
a new stream is created, it is run through When dialing out to initiate a new stream, libp2p sends the protocol ID of the protocol you want to use. The listening peer on the other end checks the incoming protocol ID against the registered protocol handlers. If the listening peer does not support the requested protocol, it will send “na” on the stream, and the dialing peer can try again with a different protocol or possibly a fallback version of the initially requested protocol. If the protocol is supported, the listening peer will echo back the protocol ID as a signal that future data sent over the stream will use the agreed protocol semantics. This process of reaching an agreement about what protocol to use for a given stream or connection is called protocol negotiation. Not to be mistaken with stream multiplexers, which are solely responsible for the internal streams on a connection and aren’t concerned with underlying protocol being used. Core libp2p protocolsIn addition to the protocols written when developing a libp2p application, libp2p defines several foundational protocols used for core features. Check out the libp2p implementations page for updates on all the libp2p implementations.
|
New reference replaces this PR. |
Context
Latest preview
Please view the latest Fleek preview here.