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

Support upgrades on libp2p_quic::GenTransport #5818

Open
kayabaNerve opened this issue Jan 17, 2025 · 1 comment
Open

Support upgrades on libp2p_quic::GenTransport #5818

kayabaNerve opened this issue Jan 17, 2025 · 1 comment

Comments

@kayabaNerve
Copy link
Contributor

kayabaNerve commented Jan 17, 2025

Description

Support InboundConnectionUpgrade, OutboundConnectionUpgrade, on libp2p_quic::GenTransport.

Motivation

I have an InboundConnectionUpgrade and OutboundConnectionUpgrade to replace the encryption layer's PeerIds with my own long-lived identity keys (unsupported by libp2p, hence the need for the custom middleware). While tcp lets me provide such upgrades, quic doesn't, with the quote:

Note that QUIC provides transport, security, and multiplexing in a single protocol. Therefore, QUIC connections do not need to be upgraded. You will get a compile-time error if you try. Instead, you must pass all needed configuration into the constructor.

I spent a few hours seeing if I could manually wrap GenTransport, or compose with and_then, to achieve the desired effects but I was unable as libp2p-quic yields Connection, not Stream to these locations. I'd have to further wrap Connection into my own which applies upgrades while manually calling poll_inbound/poll_outbound. While I am debating doing that, having just spent a notable amount of time attempting to do this and wanting to be successful, I don't feel I should have to. I should be able to just provide arbitrary connection upgrades. QUIC may be great and not need upgrades, but that doesn't mean it should be limited as to not support upgrades.

Requirements

  • Make an underlying type which accepts connection upgrades
  • Make GenTransport an alias to the underlying type with no connection upgrades (optional)

Open questions

No response

Are you planning to do it yourself in a pull request?

No, as I don't believe I have the proper expertise

@kayabaNerve
Copy link
Contributor Author

Actually, I'm unsure even Connection would be the possible place for me to do this as that's after libp2p has yielded a PeerId for this connection. While and_then lets me malleate it, I can't read/write without obtaining a stream. While I could spend the time to work on if that's valid, the fact it's a Poll-based API (not a Future-based API) reaffirms my belief this should be supported in a first-party sense.

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