From 088ac9dc8bef5bd16390eed5b59f35974c5a840b Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Mon, 13 Sep 2021 11:06:16 +0200 Subject: [PATCH] BOLT 7: add gossip address descriptor type DNS hostname This introduces a new gossip address descriptor type used for DNS hostnames. This is particular useful for dynamic DNS users that want to use their home ISP connection with changing IP addresses without relying only on TOR. The `len` field is deliberately encoded with just a byte (u8) since POSIX hostnames do not exceed 255 bytes in total. --- 07-routing-gossip.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/07-routing-gossip.md b/07-routing-gossip.md index d89287e..49dd7a8 100644 --- a/07-routing-gossip.md +++ b/07-routing-gossip.md @@ -286,6 +286,10 @@ 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`: DNS hostname; data = `[1:hostname_len][hostname_len:hostname][2:port]` (length up to 258) + * `hostname` bytes MUST be ASCII characters. + * Non-ASCII characters MUST be encoded using Punycode: + https://en.wikipedia.org/wiki/Punycode ### Requirements @@ -307,13 +311,14 @@ 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 - to 0. + - 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. - SHOULD not announce a Tor v2 onion service. + - MUST NOT announce more than one `type 5` DNS hostname. The receiving node: - if `node_id` is NOT a valid compressed public key: @@ -338,7 +343,7 @@ any future fields appended to the end): - SHOULD send a `warning`. - MAY close the connection. - if `port` is equal to 0: - - SHOULD ignore `ipv6_addr` OR `ipv4_addr`. + - SHOULD ignore `ipv6_addr` OR `ipv4_addr` OR `hostname`. - if `node_id` is NOT previously known from a `channel_announcement` message, OR if `timestamp` is NOT greater than the last-received `node_announcement` from this `node_id`: @@ -351,6 +356,9 @@ any future fields appended to the end): - MAY use `rgb_color` AND `alias` to reference nodes in interfaces. - SHOULD insinuate their self-signed origins. - SHOULD ignore Tor v2 onion services. + - if more than one `type 5` address is announced: + - SHOULD ignore the additional data. + - MUST not forward the `node_announcement`. ### Rationale