-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket address type: allow transport over RFC6455 #891
base: master
Are you sure you want to change the base?
Changes from 2 commits
c35f10f
729d0ed
a174e0d
5f94492
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -387,3 +387,5 @@ CHECKSIGVERIFY | |
IFDUP | ||
sats | ||
anysegwit | ||
WebSocket | ||
websocket |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,6 +285,7 @@ The following `address descriptor` types are defined: | |
onion service addresses; Encodes: | ||
`[32:32_byte_ed25519_pubkey] || [2:checksum] || [1:version]`, where | ||
`checksum = sha3(".onion checksum" | pubkey || version)[:2]`. | ||
* `5`: WebSocket port; data = `[2:port]` (length 2) | ||
|
||
### Requirements | ||
|
||
|
@@ -306,12 +307,16 @@ The origin node: | |
- MUST place address descriptors in ascending order. | ||
- SHOULD NOT place any zero-typed address descriptors anywhere. | ||
- SHOULD use placement only for aligning fields that follow `addresses`. | ||
- MUST NOT create a `type 1` OR `type 2` address descriptor with `port` equal | ||
- MUST NOT create a `type 1`, `type 2` or `type 5` address descriptor with `port` equal | ||
to 0. | ||
- SHOULD ensure `ipv4_addr` AND `ipv6_addr` are routable addresses. | ||
- MUST set `features` according to [BOLT #9](09-features.md#assigned-features-flags) | ||
- SHOULD set `flen` to the minimum length required to hold the `features` | ||
bits it sets. | ||
- MUST NOT add a `type 5` address unless there is also at least one address of different type. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the rationale here? To ensure a node is able to serve the "greater" network w/ a normal TCP (or w/e) transport? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, there's already a js library which talks WS to this: https://github.com/rustyrussell/bolt12/ It's kinda cute... |
||
- if it adds a type 5 address: | ||
- MUST allow unencrypted RFC6455<sup>[3](#reference-3)</sup> as a transport when a connection is made to at least one of the other addresses, with the type 5 `port` substituted for that address's `port` | ||
- SHOULD allow this on ALL of the other addresses. | ||
|
||
The receiving node: | ||
- if `node_id` is NOT a valid compressed public key: | ||
|
@@ -359,6 +364,12 @@ to be ordered in ascending order, unknown ones can be safely ignored. | |
Additional fields beyond `addresses` may also be added in the future—with | ||
optional padding within `addresses`, if they require certain alignment. | ||
|
||
Websockets generally are run on adjacent ports (or even overloaded on | ||
the same port) as existing "raw" transports, so including just the | ||
port is a compromise which avoids replacating all the addresses. It's | ||
ideal if all addresses support this, but it's not a hard requirement: | ||
at least one must. | ||
|
||
### Security Considerations for Node Aliases | ||
|
||
Node aliases are user-defined and provide a potential avenue for injection | ||
|
@@ -1123,6 +1134,7 @@ above. | |
|
||
1. <a id="reference-1">[RFC 1950 "ZLIB Compressed Data Format Specification version 3.3](https://www.ietf.org/rfc/rfc1950.txt)</a> | ||
2. <a id="reference-2">[Maximum Compression Factor](https://zlib.net/zlib_tech.html)</a> | ||
3. <a id="reference-3">[RFC 6455 "The WebSocket Protocol"](https://datatracker.ietf.org/doc/html/rfc6455) | ||
|
||
![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png "License CC-BY") | ||
<br> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this also need an interface/IP? Or it's meant to be a sort of modifier?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative is to duplicate all the entries, so this is simply a modifier.