X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fmsgs.rs;h=d291ac8664aceec5fdaff3b0d2ce20077e727028;hb=282b52f7bd874190d3e4b311b8b2a5b870285331;hp=f0db28949ed7e4aeaf422c4b78de828c04da317c;hpb=3fd85c8cf8be08480a3959bd2b829be17bdfdaa9;p=rust-lightning diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index f0db2894..d291ac86 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -843,6 +843,16 @@ impl SocketAddress { /// This maximum length is reached by a hostname address descriptor: /// a hostname with a maximum length of 255, its 1-byte length and a 2-byte port. pub(crate) const MAX_LEN: u16 = 258; + + pub(crate) fn is_tor(&self) -> bool { + match self { + &SocketAddress::TcpIpV4 {..} => false, + &SocketAddress::TcpIpV6 {..} => false, + &SocketAddress::OnionV2(_) => true, + &SocketAddress::OnionV3 {..} => true, + &SocketAddress::Hostname {..} => false, + } + } } impl Writeable for SocketAddress {