pub struct Origin {
pub id: u64,
}Expand description
A relay origin, identified by a 62-bit varint on the wire.
id must be non-zero for a real origin; id == 0 is reserved as a
placeholder for Lite03-style hops where the actual value isn’t carried.
Encoding a value outside the 62-bit range (>= 2^62) will fail at the
varint layer; Origin::random picks a valid random nonzero id.
Fields§
§id: u64Non-zero 62-bit identifier. Encoded as a QUIC varint on the wire.
Implementations§
Source§impl Origin
impl Origin
Sourcepub fn random() -> Self
pub fn random() -> Self
Generate a fresh origin with a random non-zero id. Use this for any origin that does not need a stable identity across restarts.
TEMPORARY: the wire format allows 62 bits, but older @moq/lite JS
clients decode AnnounceInterest.exclude_hop as a u53 (number) and
throw on anything > 2^53-1. To keep those clients alive against
fresh relays, we cap the random id at 53 bits. Restore to 62 bits
once the JS u62 fix has propagated to deployed bundles.
Sourcepub fn produce(self) -> OriginProducer
pub fn produce(self) -> OriginProducer
Consume this Origin to create a producer that carries its id.