mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-06-08 06:01:55 -07:00
Added option to configure blackhole update interval
This commit is contained in:
+1
-1
@@ -746,7 +746,7 @@ class BlackholeUpdater():
|
||||
if identity_hash in self.last_updates: last_update = self.last_updates[identity_hash]
|
||||
else: last_update = 0
|
||||
|
||||
if now > last_update+self.UPDATE_INTERVAL:
|
||||
if now > last_update+RNS.Reticulum.blackhole_update_interval():
|
||||
try:
|
||||
destination_hash = RNS.Destination.hash_from_name_and_identity("rnstransport.info.blackhole", identity_hash)
|
||||
RNS.log(f"Attempting blackhole list update from {RNS.prettyhexrep(identity_hash)}...", RNS.LOG_DEBUG)
|
||||
|
||||
+13
-6
@@ -260,6 +260,7 @@ class Reticulum:
|
||||
Reticulum.__autoconnect_discovered_interfaces = False
|
||||
Reticulum.__required_discovery_value = None
|
||||
Reticulum.__publish_blackhole = False
|
||||
Reticulum.__blackhole_update_interval = RNS.Discovery.BlackholeUpdater.UPDATE_INTERVAL
|
||||
Reticulum.__blackhole_sources = []
|
||||
Reticulum.__interface_sources = []
|
||||
Reticulum.__default_ar_target = None
|
||||
@@ -452,12 +453,9 @@ class Reticulum:
|
||||
value = self.config["logging"][option]
|
||||
if option == "loglevel" and self.requested_loglevel == None:
|
||||
RNS.loglevel = int(value)
|
||||
if self.requested_verbosity != None:
|
||||
RNS.loglevel += self.requested_verbosity
|
||||
if RNS.loglevel < 0:
|
||||
RNS.loglevel = 0
|
||||
if RNS.loglevel > 7:
|
||||
RNS.loglevel = 7
|
||||
if self.requested_verbosity != None: RNS.loglevel += self.requested_verbosity
|
||||
if RNS.loglevel < 0: RNS.loglevel = 0
|
||||
if RNS.loglevel > 7: RNS.loglevel = 7
|
||||
elif option == "logtimestamps":
|
||||
value = self.config["logging"].as_bool(option)
|
||||
RNS.logtimestamps = bool(value)
|
||||
@@ -584,6 +582,11 @@ class Reticulum:
|
||||
except Exception as e: raise ValueError(f"Invalid identity hash for remote blackhole source: {hexhash}")
|
||||
if not source_identity_hash in Reticulum.__blackhole_sources: Reticulum.__blackhole_sources.append(source_identity_hash)
|
||||
|
||||
if option == "blackhole_update_interval":
|
||||
v = self.config["reticulum"].as_float(option)
|
||||
if v < 2: v = 2
|
||||
Reticulum.__blackhole_update_interval = v*60
|
||||
|
||||
if option == "interface_discovery_sources":
|
||||
v = self.config["reticulum"].as_list(option)
|
||||
for hexhash in v:
|
||||
@@ -1797,6 +1800,10 @@ class Reticulum:
|
||||
"""
|
||||
return Reticulum.__blackhole_sources
|
||||
|
||||
@staticmethod
|
||||
def blackhole_update_interval():
|
||||
return Reticulum.__blackhole_update_interval
|
||||
|
||||
@staticmethod
|
||||
def discovered_interfaces():
|
||||
"""
|
||||
|
||||
@@ -248,6 +248,11 @@ instance_name = default
|
||||
|
||||
# blackhole_sources = 521c87a83afb8f29e4455e77930b973b
|
||||
|
||||
# You can set the interval in minutes at which remote
|
||||
# blackhole sources are updated. Defaults to one hour.
|
||||
|
||||
# blackhole_update_interval = 60
|
||||
|
||||
|
||||
[logging]
|
||||
# Valid log levels are 0 through 7:
|
||||
|
||||
@@ -1316,7 +1316,7 @@ To see all identities currently blackholed on your local instance, use the ``-b`
|
||||
Automated List Sourcing
|
||||
=======================
|
||||
|
||||
Manually blocking identities is effective for immediate threats, but maintaining an up-to-date blocklist for a large network is impractical. Reticulum supports **automated list sourcing**, allowing your node to subscribe to blackhole lists maintained by trusted peers, or a central authority you manage yourself.
|
||||
Manually blocking identities is effective for immediate threats and annoyances, but maintaining an up-to-date blocklist across many nodes on a large network is impractical. Reticulum supports **automated list sourcing**, allowing your node to subscribe to blackhole lists maintained by trusted peers, or a central authority you manage yourself.
|
||||
|
||||
.. warning::
|
||||
**Verify Before Subscribing!** Subscribing to a blackhole source is a powerful action that grants that source the ability to dictate who you can communicate with. Before adding a source to your configuration, verify that the maintainer aligns with your usage policy and values. Blindly subscribing to untrusted lists could inadvertently block legitimate peers or essential services.
|
||||
@@ -1333,6 +1333,9 @@ To enable automated sourcing, add the ``blackhole_sources`` option to the ``[ret
|
||||
...
|
||||
# Automatically fetch blackhole lists from these trusted sources
|
||||
blackhole_sources = 521c87a83afb8f29e4455e77930b973b, 68a4aa91ac350c4087564e8a69f84e86
|
||||
|
||||
# Optional update interval, defaults to one hour
|
||||
blackhole_update_interval = 60
|
||||
...
|
||||
|
||||
**How It Works**
|
||||
|
||||
Reference in New Issue
Block a user