diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 4b2eb9674fa..d7dd3a716ec 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -545,6 +545,11 @@ pub enum NetAddress { /// The port on which the node is listening. port: u16, }, + /// A websocket address/port on which the peer is listening. + Websocket { + /// The port on which the node is listening. + port: u16, + }, } impl NetAddress { /// Gets the ID of this address type. Addresses in [`NodeAnnouncement`] messages should be sorted @@ -556,6 +561,7 @@ impl NetAddress { &NetAddress::OnionV2(_) => { 3 }, &NetAddress::OnionV3 {..} => { 4 }, &NetAddress::Hostname {..} => { 5 }, + &NetAddress::Websocket {..} => { 6 }, } } @@ -568,6 +574,7 @@ impl NetAddress { &NetAddress::OnionV3 { .. } => { 37 }, // Consists of 1-byte hostname length, hostname bytes, and 2-byte port. &NetAddress::Hostname { ref hostname, .. } => { u16::from(hostname.len()) + 3 }, + &NetAddress::Websocket { .. } => { 2 }, } } @@ -606,6 +613,9 @@ impl Writeable for NetAddress { hostname.write(writer)?; port.write(writer)?; }, + &NetAddress::Websocket { ref port } => { + port.write(writer)?; + }, } Ok(()) } @@ -642,6 +652,11 @@ impl Readable for Result { port: Readable::read(reader)?, })) }, + 6 => { + Ok(Ok(NetAddress::Websocket { + port: Readable::read(reader)?, + })) + }, _ => return Ok(Err(byte)), } }