Skip to content

Commit

Permalink
Merge pull request #19 from multiformats/fix/ls-specification
Browse files Browse the repository at this point in the history
fix: update ls spec to match implementation(s)
  • Loading branch information
Stebalien committed Sep 4, 2019
2 parents be1b9b0 + 6ea76d7 commit cf5469b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ So a remote side asking for a protocol listing would look like this:
ls\n

# response
<varint-total-response-size-in-bytes><varint-number-of-protocols>
<multicodec-of-available-protocol>
<multicodec-of-available-protocol>
<multicodec-of-available-protocol>
...
<varint-total-response-size-in-bytes>
<varint-protocol-length><multicodec-of-available-protocol>\n
<varint-protocol-length><multicodec-of-available-protocol>\n
<varint-protocol-length><multicodec-of-available-protocol>\n
# ...more protocols
\n
```

For example
Expand Down Expand Up @@ -166,14 +167,16 @@ For example
### ls example in detail

```
> <varint-length>ls<newline>
< <varint-length><varint-of-list-of-protos-size-in-bytes><varint-number-of-protocols><newline>
< <varint-length><protocol><newline>
# ...
< <varint-length><protocol><newline>
> <varint-ls-length>ls\n
< <varint-ls-response-length><varint-protocol-length><protocol>\n
< <varint-protocol-length><protocol>\n
# ...more protocols
< \n
```

Note: Each `varint-length` contains the size of the rest of the line, including the newline bytes
`varint-ls-response-length` is the total size of the response message including _all_ the protocols and the `\n` at the end.

Each protocol is an embedded multistream message (it has a length prefix and a new line suffix). So, unless there are 0 protocols the response will end with `\n\n`.

## Implementations

Expand Down

0 comments on commit cf5469b

Please sign in to comment.