Skip to content

Support upgrades on libp2p_quic::GenTransport #5818

@kayabaNerve

Description

@kayabaNerve

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions