Skip to content

noise: implement inlined stream-muxer negotiation via NoiseExtensions #251

Description

@adust09

Spec

specs/connections/inlined-muxer-negotiation.md, Multiplexer Negotiation over Noise (1A Working Draft).

Noise handshake messages 2 and 3 may carry NoiseExtensions listing supported stream multiplexers. The selected muxer is the first initiator preference supported by both peers; if the optimization is used and there is no overlap, the handshake must fail.

Current state

The Noise payload decoder intentionally skips protobuf field 4 (extensions) as an unknown field. The upgrade pipeline always performs a separate multistream-select negotiation for /yamux/1.0.0 after Noise, costing an additional round trip.

This is a backwards-compatible optimization rather than a defect in the existing Noise + Yamux path.

Scope

  • Add the NoiseExtensions protobuf representation and codec.
  • Send supported muxers in the appropriate XX handshake payloads.
  • Select the muxer using initiator preference order.
  • Surface the selected muxer from the Noise handshake to Switch.Upgrade.
  • Skip post-handshake muxer multistream-select only when inlined negotiation succeeds.
  • Preserve fallback interoperability with peers that omit extensions.
  • Fail the optimized negotiation when both sides send extensions but have no common muxer, as specified.

Acceptance tests

  • Byte-level codec vectors for NoiseExtensions.
  • Initiator preference determines the selected common muxer.
  • Successful inline selection avoids the extra multistream-select exchange.
  • A peer without extensions follows the existing post-handshake negotiation path.
  • No-overlap behavior matches the working-draft requirement.

Priority

Low: the specification is a Working Draft and the existing path is interoperable; this primarily removes one connection-setup RTT.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions