@@ -545,6 +545,11 @@ pub enum NetAddress {
545545 /// The port on which the node is listening.
546546 port : u16 ,
547547 } ,
548+ /// A websocket address/port on which the peer is listening.
549+ Websocket {
550+ /// The port on which the node is listening.
551+ port : u16 ,
552+ } ,
548553}
549554impl NetAddress {
550555 /// Gets the ID of this address type. Addresses in [`NodeAnnouncement`] messages should be sorted
@@ -556,6 +561,7 @@ impl NetAddress {
556561 & NetAddress :: OnionV2 ( _) => { 3 } ,
557562 & NetAddress :: OnionV3 { ..} => { 4 } ,
558563 & NetAddress :: Hostname { ..} => { 5 } ,
564+ & NetAddress :: Websocket { ..} => { 6 } ,
559565 }
560566 }
561567
@@ -568,6 +574,7 @@ impl NetAddress {
568574 & NetAddress :: OnionV3 { .. } => { 37 } ,
569575 // Consists of 1-byte hostname length, hostname bytes, and 2-byte port.
570576 & NetAddress :: Hostname { ref hostname, .. } => { u16:: from ( hostname. len ( ) ) + 3 } ,
577+ & NetAddress :: Websocket { .. } => { 2 } ,
571578 }
572579 }
573580
@@ -606,6 +613,9 @@ impl Writeable for NetAddress {
606613 hostname. write ( writer) ?;
607614 port. write ( writer) ?;
608615 } ,
616+ & NetAddress :: Websocket { ref port } => {
617+ port. write ( writer) ?;
618+ } ,
609619 }
610620 Ok ( ( ) )
611621 }
@@ -642,6 +652,11 @@ impl Readable for Result<NetAddress, u8> {
642652 port : Readable :: read ( reader) ?,
643653 } ) )
644654 } ,
655+ 6 => {
656+ Ok ( Ok ( NetAddress :: Websocket {
657+ port : Readable :: read ( reader) ?,
658+ } ) )
659+ } ,
645660 _ => return Ok ( Err ( byte) ) ,
646661 }
647662 }
0 commit comments