Per-connection protocol list
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 13d 21h
- Merged PRs (30d)
- 1
Description
Currently, identify operates at a _peer_ level. However, this doesn't match up with reality. In practice, there are some protocols we only want to speak over connections with specific properties. Mostly with respect to transient connections, but we may end up having, e.g., network, interface, or even IP-based restrictions.
To solve this, we should:
1. Run identify on all connections (we already do this).
2. Associate the protocol list with the connection itself (see https://github.com/libp2p/go-libp2p/issues/2355).
3. When creating a new stream, find the best connection that supports the given protocol.
4. Whenever a connection is created/destroyed, emit a "protocol change" event describing the connection-specific protocols lost/gained.
5. Provide a way to set a protocol handler with some set of constraints. Ideally an arbitrary function that's called on each new connection (during identify) and on a stream's connection before the handler is invoked. That shouldn't be that slow and it's _really_ flexible.
Why? Bitswap, for example only wants non-transient connections and it doesn't even want to hear about peers with transient-only connections. Honestly, this applies to pretty much all of our protocols except the DHT and hole-punching protocols.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing identify flow and stream-creation path, then review the related issue #2355 for connection-level protocol association. Trace how connections are created and destroyed and how protocol handlers are registered. Done means protocols can be selected per connection, connection-specific protocol changes are emitted, and handlers can apply connection constraints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100