feat(iroh): allow custom protocols with optional manual accept
Description
allow to manually accept connections and use custom protocols together with iroh core
see the included example which uses both a custom protocol and core iroh protocols.
Breaking Changes
Notes & open questions
Change checklist
- [ ] Self-review.
- [ ] Documentation updates if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
One thing I was wondering: you can already get the endpoint from the node. So what would happen if somebody would just grab an endpoint and then call accept on it, in the current code? Who wins? Is it round robin?
Yes, it would be round-robin I think, same as quinn::Endpoint::accept.
You could already do this now by the way - the endpoint is already exposed (as you linked). You really shouldn't though because behavior would be unpredictable.
We could remove Node::accept in the PR, it would be identical to calling node.magic_endpoint().accept.
We could remove Node::accept in the PR, it would be identical to calling node.magic_endpoint().accept.
Yeah, with some of these APIs we really assume people know what they are doing, so we might as well let them do endpoint().accept(), then it becomes clearer that this is not some special stuff but just a good old incoming connection handler.
Closing in favor of #2357