From 1f74990752e3ed455c36c8ee89c9a44d2cd663ea Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 29 Sep 2026 20:53:11 +0200 Subject: [PATCH] Added auto-connect filtering criteria --- RNS/Discovery.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/RNS/Discovery.py b/RNS/Discovery.py index 20aaa262..7dbf09c6 100644 --- a/RNS/Discovery.py +++ b/RNS/Discovery.py @@ -779,6 +779,16 @@ class InterfaceDiscovery(): return seq_name + def autoconnect_qualified(self, info): + if RNS.Reticulum.should_autoconnect_unverified_implementations(): return True + if not "impl_name" in info: return False + if not info["impl_name"] in self.AUTOCONNECT_IMPLS: return False + if not "version" in info or not info["version"]: return False + + version = version_tuple(info["version"]) + if version == None: return False + return version >= version_tuple(self.AUTOCONNECT_MIN_V) + def autoconnect(self, info): try: if RNS.Reticulum.should_autoconnect_discovered_interfaces(): @@ -786,6 +796,11 @@ class InterfaceDiscovery(): if autoconnected_count < RNS.Reticulum.max_autoconnected_interfaces(): interface_type = info["type"] if interface_type in self.AUTOCONNECT_TYPES: + if not self.autoconnect_qualified(info): + impl = f"{info['impl_name']} {info['version']}" if ("impl_name" in info and "version" in info and info["impl_name"] and info["version"]) else "unknown implementation" + RNS.log(f"Not auto-connecting discovered {interface_type} {info['name']} ({impl}), auto-connect criteria not satisfied", RNS.LOG_DEBUG) + return + endpoint_hash = self.endpoint_hash(info) exists = self.interface_exists(info) @@ -977,6 +992,18 @@ def is_hostname(hostname): allowed = re.compile(r"(?!-)[a-z0-9-]{1,63}(?