Open matheus23 opened 6 hours ago
why do we need this, instead of doing
builder
.accept("version0", my_protocol.clone())
.accept("version1", my_protocol.clone())
which we should test, but ideally already works today
Sorry, I understood now, you are talking about the connect
part..
When implementing a backwards-compatible protocol, one wants to assign different ALPNs to different protocol versions. Examples:
http/0.9
,http/1.0
,http/1.1
,h2
andh3
iroh-blobs/4
, eventuallyiroh-blobs/5
It's important to indicate which versions you support, and often is the case that you indicate multiple versions simultaneously. E.g. sending an HTTP request using
["http/1.1", "h2", "h3"]
as the ALPNs.We currently don't have a way of specifying multiple ALPNs when doing an
Endpoint::connect
.On the server side, you usually configure an ordered list of ALPNs and it chooses the first matching one. This is described in RFC 7301:
This manifests itself in APIs like that of rustls, its docs write:
The docs for
ServerConfig::alpn_protocols
say: