iroh icon indicating copy to clipboard operation
iroh copied to clipboard

feat(iroh): allow custom protocols with optional manual accept

Open Frando opened this issue 1 year ago • 2 comments

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.

Frando avatar May 13 '24 11:05 Frando

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.

Frando avatar May 13 '24 11:05 Frando

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.

rklaehn avatar May 13 '24 12:05 rklaehn

Closing in favor of #2357

Frando avatar Jun 11 '24 17:06 Frando