fix: specify max mplex stream ID size

fixes #259
This commit is contained in:
Steven Allen
2021-04-21 16:46:52 -07:00
parent c05edce42a
commit 076eec5532

View File

@@ -54,7 +54,7 @@ Implementations in:
Every communication in mplex consists of a header, and a length prefixed data segment.
The header is an unsigned base128 varint, as defined in the [protocol buffers spec](https://developers.google.com/protocol-buffers/docs/encoding#varints). The lower three bits are the message flags, and the rest of the bits (shifted down by three bits) are the stream ID this message pertains to:
The header is an [unsigned base128 varint](https://github.com/multiformats/unsigned-varint). The lower three bits are the message flags, and the rest of the bits (shifted down by three bits) are the stream ID this message pertains to:
```
header = readUvarint()
@@ -62,6 +62,8 @@ flag = header & 0x07
id = header >> 3
```
The maximum length is 9 bytes (per the unsigned-varint spec) and the maximum stream ID is 60 bytes (`2^60 - 1`).
### Flag Values
```