Merge pull request #2942 from benthecarman/node-id-slice
[rust-lightning] / lightning / src / ln / msgs.rs
index f0db28949ed7e4aeaf422c4b78de828c04da317c..d291ac8664aceec5fdaff3b0d2ce20077e727028 100644 (file)
@@ -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 {