mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-02-16 21:27:46 +00:00
Compare commits
7 Commits
38b920e393
...
91e064cdf1
Author | SHA1 | Date | |
---|---|---|---|
![]() |
91e064cdf1 | ||
![]() |
fb4e53f6e3 | ||
![]() |
03340ed091 | ||
![]() |
ed424fa0a2 | ||
![]() |
406ab216d1 | ||
![]() |
00d8a2064d | ||
![]() |
ec2805f357 |
@ -366,5 +366,8 @@ class AX25KISSInterface(Interface):
|
||||
|
||||
RNS.log("Reconnected serial port for "+str(self))
|
||||
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "AX25KISSInterface["+self.name+"]"
|
@ -403,5 +403,8 @@ class KISSInterface(Interface):
|
||||
|
||||
RNS.log("Reconnected serial port for "+str(self))
|
||||
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "KISSInterface["+self.name+"]"
|
@ -1234,6 +1234,9 @@ class RNodeInterface(Interface):
|
||||
self.setRadioState(KISS.RADIO_STATE_OFF)
|
||||
self.leave()
|
||||
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "RNodeInterface["+str(self.name)+"]"
|
||||
|
||||
|
@ -254,5 +254,8 @@ class SerialInterface(Interface):
|
||||
|
||||
RNS.log("Reconnected serial port for "+str(self))
|
||||
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "SerialInterface["+self.name+"]"
|
||||
|
@ -431,6 +431,11 @@ class AutoInterface(Interface):
|
||||
self.txb += len(data)
|
||||
|
||||
|
||||
# Until per-device sub-interfacing is implemented,
|
||||
# ingress limiting should be disabled on AutoInterface
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "AutoInterface["+self.name+"]"
|
||||
|
||||
|
@ -348,5 +348,8 @@ class KISSInterface(Interface):
|
||||
|
||||
RNS.log("Reconnected serial port for "+str(self))
|
||||
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "KISSInterface["+self.name+"]"
|
@ -200,5 +200,8 @@ class SerialInterface(Interface):
|
||||
|
||||
RNS.log("Reconnected serial port for "+str(self))
|
||||
|
||||
def should_ingress_limit(self):
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return "SerialInterface["+self.name+"]"
|
||||
|
@ -1077,6 +1077,9 @@ class Reticulum:
|
||||
if path == "path":
|
||||
rpc_connection.send(self.drop_path(call["destination_hash"]))
|
||||
|
||||
if path == "all_via":
|
||||
rpc_connection.send(self.drop_all_via(call["destination_hash"]))
|
||||
|
||||
if path == "announce_queues":
|
||||
rpc_connection.send(self.drop_announce_queues())
|
||||
|
||||
@ -1241,6 +1244,22 @@ class Reticulum:
|
||||
else:
|
||||
return RNS.Transport.expire_path(destination)
|
||||
|
||||
def drop_all_via(self, transport_hash):
|
||||
if self.is_connected_to_shared_instance:
|
||||
rpc_connection = multiprocessing.connection.Client(self.rpc_addr, authkey=self.rpc_key)
|
||||
rpc_connection.send({"drop": "all_via", "destination_hash": transport_hash})
|
||||
response = rpc_connection.recv()
|
||||
return response
|
||||
|
||||
else:
|
||||
dropped_count = 0
|
||||
for destination_hash in RNS.Transport.destination_table:
|
||||
if RNS.Transport.destination_table[destination_hash][1] == transport_hash:
|
||||
RNS.Transport.expire_path(destination_hash)
|
||||
dropped_count += 1
|
||||
|
||||
return dropped_count
|
||||
|
||||
def drop_announce_queues(self):
|
||||
if self.is_connected_to_shared_instance:
|
||||
rpc_connection = multiprocessing.connection.Client(self.rpc_addr, authkey=self.rpc_key)
|
||||
|
@ -30,7 +30,7 @@ import argparse
|
||||
from RNS._version import __version__
|
||||
|
||||
|
||||
def program_setup(configdir, table, rates, drop, destination_hexhash, verbosity, timeout, drop_queues):
|
||||
def program_setup(configdir, table, rates, drop, destination_hexhash, verbosity, timeout, drop_queues, drop_via):
|
||||
if table:
|
||||
destination_hash = None
|
||||
if destination_hexhash != None:
|
||||
@ -155,6 +155,29 @@ def program_setup(configdir, table, rates, drop, destination_hexhash, verbosity,
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
elif drop_via:
|
||||
try:
|
||||
dest_len = (RNS.Reticulum.TRUNCATED_HASHLENGTH//8)*2
|
||||
if len(destination_hexhash) != dest_len:
|
||||
raise ValueError("Destination length is invalid, must be {hex} hexadecimal characters ({byte} bytes).".format(hex=dest_len, byte=dest_len//2))
|
||||
try:
|
||||
destination_hash = bytes.fromhex(destination_hexhash)
|
||||
except Exception as e:
|
||||
raise ValueError("Invalid destination entered. Check your input.")
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
reticulum = RNS.Reticulum(configdir = configdir, loglevel = 3+verbosity)
|
||||
|
||||
if reticulum.drop_all_via(destination_hash):
|
||||
print("Dropped all paths via "+RNS.prettyhexrep(destination_hash))
|
||||
else:
|
||||
print("Unable to drop paths via "+RNS.prettyhexrep(destination_hash)+". Does the transport instance exist?")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
else:
|
||||
try:
|
||||
dest_len = (RNS.Reticulum.TRUNCATED_HASHLENGTH//8)*2
|
||||
@ -256,6 +279,13 @@ def main():
|
||||
default=False
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-x", "--drop-via",
|
||||
action="store_true",
|
||||
help="drop all paths via specified transport instance",
|
||||
default=False
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-w",
|
||||
action="store",
|
||||
@ -282,7 +312,7 @@ def main():
|
||||
else:
|
||||
configarg = None
|
||||
|
||||
if not args.drop_announces and not args.table and not args.rates and not args.destination:
|
||||
if not args.drop_announces and not args.table and not args.rates and not args.destination and not args.drop_via:
|
||||
print("")
|
||||
parser.print_help()
|
||||
print("")
|
||||
@ -296,6 +326,7 @@ def main():
|
||||
verbosity = args.verbose,
|
||||
timeout = args.w,
|
||||
drop_queues = args.drop_announces,
|
||||
drop_via = args.drop_via,
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -763,18 +763,32 @@ that a large span of network types can seamlessly *co-exist* and interconnect.
|
||||
|
||||
.. _interfaces-ingress-control:
|
||||
|
||||
Ingress Announce Control
|
||||
========================
|
||||
New Destination Rate Limiting
|
||||
=============================
|
||||
|
||||
On public interfaces, where anyone may connect and announce new destinations,
|
||||
it can be useful to control the rate at which new announces ingress.
|
||||
it can be useful to control the rate at which announces for *new* destinations are
|
||||
processed.
|
||||
|
||||
If a large influx of annonuces for newly created or previously unknown destinations
|
||||
occur, Reticulum will place these announces on hold, so that announce traffic
|
||||
for known and previously established destinations can continue to be processed
|
||||
without interruptions.
|
||||
If a large influx of announces for newly created or previously unknown destinations
|
||||
occur within a short amount of time, Reticulum will place these announces on hold,
|
||||
so that announce traffic for known and previously established destinations can
|
||||
continue to be processed without interruptions.
|
||||
|
||||
By default, Reticulum will handle this automatically, and ingress annonuce
|
||||
After the burst subsides, and an additional waiting period has passed, the held
|
||||
announces will be released at a slow rate, until the hold queue is cleared. This
|
||||
also means, that should a node decide to connect to a public interface, announce
|
||||
a large amount of bogus destinations, and then disconnect, these destination will
|
||||
never make it into path tables and waste network bandwidth on retransmitted
|
||||
announces.
|
||||
|
||||
**It's important to note** that the ingress control works at the level of *individual
|
||||
sub-interfaces*. As an example, this means that one client on a :ref:`TCP Server Interface<interfaces-tcps>`
|
||||
cannot disrupt processing of incoming announces for other connected clients on the same
|
||||
:ref:`TCP Server Interface<interfaces-tcps>`. All other clients on the same interface will still have new announces
|
||||
processed without interruption.
|
||||
|
||||
By default, Reticulum will handle this automatically, and ingress announce
|
||||
control will be enabled on interface where it is sensible to do so. It should
|
||||
generally not be neccessary to modify the ingress control configuration,
|
||||
but all the parameters are exposed for configuration if needed.
|
||||
@ -788,11 +802,11 @@ but all the parameters are exposed for configuration if needed.
|
||||
option is useful on publicly accessible interfaces that spawn new
|
||||
sub-interfaces when a new client connects.
|
||||
|
||||
* | The ``ic_burst_freq_new`` option sets the maximum annonuce ingress
|
||||
* | The ``ic_burst_freq_new`` option sets the maximum announce ingress
|
||||
frequency for newly spawned interfaces. Defaults to ``3.5``
|
||||
announces per second.
|
||||
|
||||
* | The ``ic_burst_freq`` option sets the maximum annonuce ingress
|
||||
* | The ``ic_burst_freq`` option sets the maximum announce ingress
|
||||
frequency for other interfaces. Defaults to ``12`` announces
|
||||
per second.
|
||||
|
||||
|
@ -258,7 +258,7 @@ program.</p>
|
||||
<span class="c1"># Destinations are endpoints in Reticulum, that can be addressed</span>
|
||||
<span class="c1"># and communicated with. Destinations can also announce their</span>
|
||||
<span class="c1"># existence, which will let the network know they are reachable</span>
|
||||
<span class="c1"># and autoomatically create paths to them, from anywhere else</span>
|
||||
<span class="c1"># and automatically create paths to them, from anywhere else</span>
|
||||
<span class="c1"># in the network.</span>
|
||||
<span class="n">destination</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Destination</span><span class="p">(</span>
|
||||
<span class="n">identity</span><span class="p">,</span>
|
||||
@ -269,7 +269,7 @@ program.</p>
|
||||
<span class="p">)</span>
|
||||
|
||||
<span class="c1"># We configure the destination to automatically prove all</span>
|
||||
<span class="c1"># packets adressed to it. By doing this, RNS will automatically</span>
|
||||
<span class="c1"># packets addressed to it. By doing this, RNS will automatically</span>
|
||||
<span class="c1"># generate a proof for each incoming packet and transmit it</span>
|
||||
<span class="c1"># back to the sender of that packet. This will let anyone that</span>
|
||||
<span class="c1"># tries to communicate with the destination know whether their</span>
|
||||
@ -375,7 +375,7 @@ notifications about announces from relevant destinations.</p>
|
||||
<span class="c1"># Destinations are endpoints in Reticulum, that can be addressed</span>
|
||||
<span class="c1"># and communicated with. Destinations can also announce their</span>
|
||||
<span class="c1"># existence, which will let the network know they are reachable</span>
|
||||
<span class="c1"># and autoomatically create paths to them, from anywhere else</span>
|
||||
<span class="c1"># and automatically create paths to them, from anywhere else</span>
|
||||
<span class="c1"># in the network.</span>
|
||||
<span class="n">destination_1</span> <span class="o">=</span> <span class="n">RNS</span><span class="o">.</span><span class="n">Destination</span><span class="p">(</span>
|
||||
<span class="n">identity</span><span class="p">,</span>
|
||||
@ -3329,4 +3329,4 @@ interface to efficiently pass files of any size over a Reticulum <a class="refer
|
||||
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
|
||||
<script src="_static/copybutton.js?v=f281be69"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
@ -344,7 +344,7 @@ to participate in the development of Reticulum itself.</p>
|
||||
<li class="toctree-l2"><a class="reference internal" href="interfaces.html#common-interface-options">Common Interface Options</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="interfaces.html#interface-modes">Interface Modes</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="interfaces.html#announce-rate-control">Announce Rate Control</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="interfaces.html#ingress-announce-control">Ingress Announce Control</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="interfaces.html#new-destination-rate-limiting">New Destination Rate Limiting</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="networks.html">Building Networks</a><ul>
|
||||
|
@ -937,15 +937,27 @@ conserve bandwidth, while very fast networks can support applications that
|
||||
need very frequent announces. Reticulum implements these mechanisms to ensure
|
||||
that a large span of network types can seamlessly <em>co-exist</em> and interconnect.</p>
|
||||
</section>
|
||||
<section id="ingress-announce-control">
|
||||
<span id="interfaces-ingress-control"></span><h2>Ingress Announce Control<a class="headerlink" href="#ingress-announce-control" title="Permalink to this heading">#</a></h2>
|
||||
<section id="new-destination-rate-limiting">
|
||||
<span id="interfaces-ingress-control"></span><h2>New Destination Rate Limiting<a class="headerlink" href="#new-destination-rate-limiting" title="Permalink to this heading">#</a></h2>
|
||||
<p>On public interfaces, where anyone may connect and announce new destinations,
|
||||
it can be useful to control the rate at which new announces ingress.</p>
|
||||
<p>If a large influx of annonuces for newly created or previously unknown destinations
|
||||
occur, Reticulum will place these announces on hold, so that announce traffic
|
||||
for known and previously established destinations can continue to be processed
|
||||
without interruptions.</p>
|
||||
<p>By default, Reticulum will handle this automatically, and ingress annonuce
|
||||
it can be useful to control the rate at which announces for <em>new</em> destinations are
|
||||
processed.</p>
|
||||
<p>If a large influx of announces for newly created or previously unknown destinations
|
||||
occur within a short amount of time, Reticulum will place these announces on hold,
|
||||
so that announce traffic for known and previously established destinations can
|
||||
continue to be processed without interruptions.</p>
|
||||
<p>After the burst subsides, and an additional waiting period has passed, the held
|
||||
announces will be released at a slow rate, until the hold queue is cleared. This
|
||||
also means, that should a node decide to connect to a public interface, announce
|
||||
a large amount of bogus destinations, and then disconnect, these destination will
|
||||
never make it into path tables and waste network bandwidth on retransmitted
|
||||
announces.</p>
|
||||
<p><strong>It’s important to note</strong> that the ingress control works at the level of <em>individual
|
||||
sub-interfaces</em>. As an example, this means that one client on a <a class="reference internal" href="#interfaces-tcps"><span class="std std-ref">TCP Server Interface</span></a>
|
||||
cannot disrupt processing of incoming announces for other connected clients on the same
|
||||
<a class="reference internal" href="#interfaces-tcps"><span class="std std-ref">TCP Server Interface</span></a>. All other clients on the same interface will still have new announces
|
||||
processed without interruption.</p>
|
||||
<p>By default, Reticulum will handle this automatically, and ingress announce
|
||||
control will be enabled on interface where it is sensible to do so. It should
|
||||
generally not be neccessary to modify the ingress control configuration,
|
||||
but all the parameters are exposed for configuration if needed.</p>
|
||||
@ -965,13 +977,13 @@ sub-interfaces when a new client connects.</div>
|
||||
</div>
|
||||
</li>
|
||||
<li><div class="line-block">
|
||||
<div class="line">The <code class="docutils literal notranslate"><span class="pre">ic_burst_freq_new</span></code> option sets the maximum annonuce ingress
|
||||
<div class="line">The <code class="docutils literal notranslate"><span class="pre">ic_burst_freq_new</span></code> option sets the maximum announce ingress
|
||||
frequency for newly spawned interfaces. Defaults to <code class="docutils literal notranslate"><span class="pre">3.5</span></code>
|
||||
announces per second.</div>
|
||||
</div>
|
||||
</li>
|
||||
<li><div class="line-block">
|
||||
<div class="line">The <code class="docutils literal notranslate"><span class="pre">ic_burst_freq</span></code> option sets the maximum annonuce ingress
|
||||
<div class="line">The <code class="docutils literal notranslate"><span class="pre">ic_burst_freq</span></code> option sets the maximum announce ingress
|
||||
frequency for other interfaces. Defaults to <code class="docutils literal notranslate"><span class="pre">12</span></code> announces
|
||||
per second.</div>
|
||||
</div>
|
||||
@ -1082,7 +1094,7 @@ to <code class="docutils literal notranslate"><span class="pre">30</span></code>
|
||||
<li><a class="reference internal" href="#common-interface-options">Common Interface Options</a></li>
|
||||
<li><a class="reference internal" href="#interface-modes">Interface Modes</a></li>
|
||||
<li><a class="reference internal" href="#announce-rate-control">Announce Rate Control</a></li>
|
||||
<li><a class="reference internal" href="#ingress-announce-control">Ingress Announce Control</a></li>
|
||||
<li><a class="reference internal" href="#new-destination-rate-limiting">New Destination Rate Limiting</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -763,18 +763,32 @@ that a large span of network types can seamlessly *co-exist* and interconnect.
|
||||
|
||||
.. _interfaces-ingress-control:
|
||||
|
||||
Ingress Announce Control
|
||||
========================
|
||||
New Destination Rate Limiting
|
||||
=============================
|
||||
|
||||
On public interfaces, where anyone may connect and announce new destinations,
|
||||
it can be useful to control the rate at which new announces ingress.
|
||||
it can be useful to control the rate at which announces for *new* destinations are
|
||||
processed.
|
||||
|
||||
If a large influx of annonuces for newly created or previously unknown destinations
|
||||
occur, Reticulum will place these announces on hold, so that announce traffic
|
||||
for known and previously established destinations can continue to be processed
|
||||
without interruptions.
|
||||
If a large influx of announces for newly created or previously unknown destinations
|
||||
occur within a short amount of time, Reticulum will place these announces on hold,
|
||||
so that announce traffic for known and previously established destinations can
|
||||
continue to be processed without interruptions.
|
||||
|
||||
By default, Reticulum will handle this automatically, and ingress annonuce
|
||||
After the burst subsides, and an additional waiting period has passed, the held
|
||||
announces will be released at a slow rate, until the hold queue is cleared. This
|
||||
also means, that should a node decide to connect to a public interface, announce
|
||||
a large amount of bogus destinations, and then disconnect, these destination will
|
||||
never make it into path tables and waste network bandwidth on retransmitted
|
||||
announces.
|
||||
|
||||
**It's important to note** that the ingress control works at the level of *individual
|
||||
sub-interfaces*. As an example, this means that one client on a :ref:`TCP Server Interface<interfaces-tcps>`
|
||||
cannot disrupt processing of incoming announces for other connected clients on the same
|
||||
:ref:`TCP Server Interface<interfaces-tcps>`. All other clients on the same interface will still have new announces
|
||||
processed without interruption.
|
||||
|
||||
By default, Reticulum will handle this automatically, and ingress announce
|
||||
control will be enabled on interface where it is sensible to do so. It should
|
||||
generally not be neccessary to modify the ingress control configuration,
|
||||
but all the parameters are exposed for configuration if needed.
|
||||
@ -788,11 +802,11 @@ but all the parameters are exposed for configuration if needed.
|
||||
option is useful on publicly accessible interfaces that spawn new
|
||||
sub-interfaces when a new client connects.
|
||||
|
||||
* | The ``ic_burst_freq_new`` option sets the maximum annonuce ingress
|
||||
* | The ``ic_burst_freq_new`` option sets the maximum announce ingress
|
||||
frequency for newly spawned interfaces. Defaults to ``3.5``
|
||||
announces per second.
|
||||
|
||||
* | The ``ic_burst_freq`` option sets the maximum annonuce ingress
|
||||
* | The ``ic_burst_freq`` option sets the maximum announce ingress
|
||||
frequency for other interfaces. Defaults to ``12`` announces
|
||||
per second.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user