<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Reticulum</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">configdir</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">loglevel</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">MTU</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">500</span></em><aclass="headerlink"href="#RNS.Reticulum.MTU"title="Permalink to this definition">¶</a></dt>
<dd><p>The MTU that Reticulum adheres to, and will expect other peers to
<spanclass="sig-name descname"><spanclass="pre">ANNOUNCE_CAP</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">2</span></em><aclass="headerlink"href="#RNS.Reticulum.ANNOUNCE_CAP"title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum percentage of interface bandwidth that, at any given time,
may be used to propagate announces. If an announce was scheduled for
broadcasting on an interface, but doing so would exceed the allowed
bandwidth allocation, the announce will be queued for transmission
when there is bandwidth available.</p>
<p>Reticulum will always prioritise propagating announces with fewer
hops, ensuring that distant, large networks with many peers on fast
links don’t overwhelm the capacity of smaller networks on slower
mediums. If an announce remains queued for an extended amount of time,
it will eventually be dropped.</p>
<p>This value will be applied by default to all created interfaces,
but it can be configured individually on a per-interface basis.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">should_use_implicit_proof</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum.should_use_implicit_proof"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether proofs sent are explicit or implicit.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>True if the current running configuration specifies to use implicit proofs. False if not.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">transport_enabled</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Reticulum.transport_enabled"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns whether Transport is enabled for the running
instance.</p>
<p>When Transport is enabled, Reticulum will
route traffic for other peers, respond to path requests
and pass announces over the network.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>True if Transport is enabled, False if not.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="api-identity">
<spanid="identity"></span><h3>Identity<aclass="headerlink"href="#api-identity"title="Permalink to this headline">¶</a></h3>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Identity</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">create_keys</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">CURVE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">'Curve25519'</span></em><aclass="headerlink"href="#RNS.Identity.CURVE"title="Permalink to this definition">¶</a></dt>
<dd><p>The curve used for Elliptic Curve DH key exchanges</p>
<spanclass="sig-name descname"><spanclass="pre">KEYSIZE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">512</span></em><aclass="headerlink"href="#RNS.Identity.KEYSIZE"title="Permalink to this definition">¶</a></dt>
<dd><p>X25519 key size in bits. A complete key is the concatenation of a 256 bit encryption key, and a 256 bit signing key.</p>
<spanclass="sig-name descname"><spanclass="pre">TRUNCATED_HASHLENGTH</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">80</span></em><aclass="headerlink"href="#RNS.Identity.TRUNCATED_HASHLENGTH"title="Permalink to this definition">¶</a></dt>
<dd><p>Constant specifying the truncated hash length (in bits) used by Reticulum
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">recall</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.recall"title="Permalink to this definition">¶</a></dt>
<dd><p>Recall identity for a destination hash.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– Destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>An <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance that can be used to create an outgoing <aclass="reference internal"href="#api-destination"><spanclass="std std-ref">RNS.Destination</span></a>, or <em>None</em> if the destination is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">recall_app_data</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.recall_app_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Recall last heard app_data for a destination hash.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– Destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>Bytes</em> containing app_data, or <em>None</em> if the destination is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">full_hash</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.full_hash"title="Permalink to this definition">¶</a></dt>
<dd><p>Get a SHA-256 hash of passed data.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– Data to be hashed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>SHA-256 hash as <em>bytes</em></p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">truncated_hash</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.truncated_hash"title="Permalink to this definition">¶</a></dt>
<dd><p>Get a truncated SHA-256 hash of passed data.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– Data to be hashed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Truncated SHA-256 hash as <em>bytes</em></p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">get_random_hash</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.get_random_hash"title="Permalink to this definition">¶</a></dt>
<dd><p>Get a random SHA-256 hash.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data</strong>– Data to be hashed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Truncated SHA-256 hash of random data as <em>bytes</em></p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">from_bytes</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">prv_bytes</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.from_bytes"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance from <em>bytes</em> of private key.
Can be used to load previously created and saved identities into Reticulum.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>prv_bytes</strong>– The <em>bytes</em> of private a saved private key. <strong>HAZARD!</strong> Never use this to generate a new key by feeding random data in prv_bytes.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the <em>bytes</em> data was invalid.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">from_file</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.from_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance from a file.
Can be used to load previously created and saved identities into Reticulum.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>path</strong>– The full path to the saved <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> data</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the loaded data was invalid.</p>
<spanclass="sig-name descname"><spanclass="pre">to_file</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.to_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Saves the identity to a file. This will write the private key to disk,
and anyone with access to this file will be able to decrypt all
communication for the identity. Be very careful with this method.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>path</strong>– The full path specifying where to save the identity.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the file was saved, otherwise False.</p>
<spanclass="sig-name descname"><spanclass="pre">get_private_key</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.get_private_key"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The private key as <em>bytes</em></p>
<spanclass="sig-name descname"><spanclass="pre">get_public_key</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.get_public_key"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The public key as <em>bytes</em></p>
<spanclass="sig-name descname"><spanclass="pre">load_private_key</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">prv_bytes</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.load_private_key"title="Permalink to this definition">¶</a></dt>
<dd><p>Load a private key into the instance.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>prv_bytes</strong>– The private key as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the key was loaded, otherwise False.</p>
<spanclass="sig-name descname"><spanclass="pre">load_public_key</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">pub_bytes</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.load_public_key"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">encrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">plaintext</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.encrypt"title="Permalink to this definition">¶</a></dt>
<dd><p>Encrypts information for the identity.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>plaintext</strong>– The plaintext to be encrypted as <em>bytes</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">decrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">ciphertext_token</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.decrypt"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">sign</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">message</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.sign"title="Permalink to this definition">¶</a></dt>
<dd><p>Signs information by the identity.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>message</strong>– The message to be signed as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>Signature as <em>bytes</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">validate</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">signature</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">message</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Identity.validate"title="Permalink to this definition">¶</a></dt>
<dd><p>Validates the signature of a signed message.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>signature</strong>– The signature to be validated as <em>bytes</em>.</p></li>
<li><p><strong>message</strong>– The message to be validated as <em>bytes</em>.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the signature is valid, otherwise False.</p>
<spanid="api-destination"></span><h3>Destination<aclass="headerlink"href="#destination"title="Permalink to this headline">¶</a></h3>
<dlclass="py class">
<dtclass="sig sig-object py"id="RNS.Destination">
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Destination</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">identity</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">direction</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">type</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">app_name</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span><spanclass="n"><spanclass="pre">aspects</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination"title="Permalink to this definition">¶</a></dt>
<dd><p>A class used to describe endpoints in a Reticulum Network. Destination
instances are used both to create outgoing and incoming endpoints. The
destination type will decide if encryption, and what type, is used in
communication with the endpoint. A destination can also announce its
presence on the network, which will also distribute necessary keys for
encrypted communication with it.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>identity</strong>– An instance of <aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a>. Can hold only public keys for an outgoing destination, or holding private keys for an ingoing.</p></li>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">full_name</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_name</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span><spanclass="n"><spanclass="pre">aspects</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.full_name"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A string containing the full human-readable name of the destination, for an app_name and a number of aspects.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">app_and_aspects_from_name</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">full_name</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.app_and_aspects_from_name"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A tuple containing the app name and a list of aspects, for a full-name string.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">hash_from_name_and_identity</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">full_name</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">identity</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.hash_from_name_and_identity"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A destination name in adressable hash form, for a full name string and Identity instance.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">hash</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_name</span></span></em>, <emclass="sig-param"><spanclass="o"><spanclass="pre">*</span></span><spanclass="n"><spanclass="pre">aspects</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.hash"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A destination name in adressable hash form, for an app_name and a number of aspects.</p>
<spanclass="sig-name descname"><spanclass="pre">announce</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_data</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">path_response</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">False</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.announce"title="Permalink to this definition">¶</a></dt>
<li><p><strong>app_data</strong>–<em>bytes</em> containing the app_data.</p></li>
<li><p><strong>path_response</strong>– Internal flag used by <aclass="reference internal"href="#api-transport"><spanclass="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
<spanclass="sig-name descname"><spanclass="pre">accepts_links</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">accepts</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.accepts_links"title="Permalink to this definition">¶</a></dt>
<dd><p>Set or query whether the destination accepts incoming link requests.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>accepts</strong>– If <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code>, this method sets whether the destination accepts incoming link requests. If not provided or <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, the method returns whether the destination currently accepts link requests.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">True</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">False</span></code> depending on whether the destination accepts incoming link requests, if the <em>accepts</em> parameter is not provided or <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>.</p>
<spanclass="sig-name descname"><spanclass="pre">set_link_established_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_link_established_callback"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method with the signature <em>callback(link)</em> to be called when a new link is established with this destination.</p>
<spanclass="sig-name descname"><spanclass="pre">set_packet_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_packet_callback"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method with the signature <em>callback(data, packet)</em> to be called when this destination receives a packet.</p>
<spanclass="sig-name descname"><spanclass="pre">set_proof_requested_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_proof_requested_callback"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method to with the signature <em>callback(packet)</em> be called when a packet that requests a proof is received. The callback must return one of True or False. If the callback returns True, a proof will be sent. If it returns False, a proof will not be sent.</p>
<spanclass="sig-name descname"><spanclass="pre">set_proof_strategy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">proof_strategy</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_proof_strategy"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the destinations proof strategy.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>proof_strategy</strong>– One of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_NONE</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_ALL</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_APP</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.PROVE_APP</span></code> is set, the <cite>proof_requested_callback</cite> will be called to determine whether a proof should be sent or not.</p>
<spanclass="sig-name descname"><spanclass="pre">register_request_handler</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">response_generator</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">allow</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">0</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">allowed_list</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.register_request_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a request handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>path</strong>– The path for the request handler to be registered.</p></li>
<li><p><strong>response_generator</strong>– A function or method with the signature <em>response_generator(path, data, request_id, remote_identity, requested_at)</em> to be called. Whatever this funcion returns will be sent as a response to the requester. If the function returns <codeclass="docutils literal notranslate"><spanclass="pre">None</span></code>, no response will be sent.</p></li>
<li><p><strong>allow</strong>– One of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.ALLOW_NONE</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.ALLOW_ALL</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.ALLOW_LIST</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.ALLOW_LIST</span></code> is set, the request handler will only respond to requests for identified peers in the supplied list.</p></li>
<li><p><strong>allowed_list</strong>– A list of <em>bytes-like</em><aclass="reference internal"href="#api-identity"><spanclass="std std-ref">RNS.Identity</span></a> hashes.</p></li>
</ul>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> if any of the supplied arguments are invalid.</p>
<spanclass="sig-name descname"><spanclass="pre">deregister_request_handler</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.deregister_request_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Deregisters a request handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>path</strong>– The path for the request handler to be deregistered.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>True if the handler was deregistered, otherwise False.</p>
<spanclass="sig-name descname"><spanclass="pre">create_keys</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.create_keys"title="Permalink to this definition">¶</a></dt>
<dd><p>For a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination, creates a new symmetric key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
<spanclass="sig-name descname"><spanclass="pre">get_private_key</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.get_private_key"title="Permalink to this definition">¶</a></dt>
<dd><p>For a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination, returns the symmetric private key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Raises</dt>
<ddclass="field-odd"><p><codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
<spanclass="sig-name descname"><spanclass="pre">load_private_key</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">key</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.load_private_key"title="Permalink to this definition">¶</a></dt>
<dd><p>For a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination, loads a symmetric private key.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>key</strong>– A <em>bytes-like</em> containing the symmetric key.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
<spanclass="sig-name descname"><spanclass="pre">encrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">plaintext</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.encrypt"title="Permalink to this definition">¶</a></dt>
<dd><p>Encrypts information for <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>plaintext</strong>– A <em>bytes-like</em> containing the plaintext to be encrypted.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> if destination does not hold a necessary key for encryption.</p>
<spanclass="sig-name descname"><spanclass="pre">decrypt</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">ciphertext</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.decrypt"title="Permalink to this definition">¶</a></dt>
<dd><p>Decrypts information for <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> type destination.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>ciphertext</strong>–<em>Bytes</em> containing the ciphertext to be decrypted.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><codeclass="docutils literal notranslate"><spanclass="pre">ValueError</span></code> if destination does not hold a necessary key for decryption.</p>
<spanclass="sig-name descname"><spanclass="pre">sign</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">message</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.sign"title="Permalink to this definition">¶</a></dt>
<dd><p>Signs information for <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> type destination.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>message</strong>–<em>Bytes</em> containing the message to be signed.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>A <em>bytes-like</em> containing the message signature, or <em>None</em> if the destination could not sign the message.</p>
<spanclass="sig-name descname"><spanclass="pre">set_default_app_data</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">app_data</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.set_default_app_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the default app_data for the destination. If set, the default
app_data will be included in every announce sent by the destination,
unless other app_data is specified in the <em>announce</em> method.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>app_data</strong>– A <em>bytes-like</em> containing the default app_data, or a <em>callable</em> returning a <em>bytes-like</em> containing the app_data.</p>
<spanclass="sig-name descname"><spanclass="pre">clear_default_app_data</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Destination.clear_default_app_data"title="Permalink to this definition">¶</a></dt>
<dd><p>Clears default app_data previously set for the destination.</p>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="packet">
<spanid="api-packet"></span><h3>Packet<aclass="headerlink"href="#packet"title="Permalink to this headline">¶</a></h3>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Packet</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">create_receipt</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">True</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Packet"title="Permalink to this definition">¶</a></dt>
<dd><p>The Packet class is used to create packet instances that can be sent
over a Reticulum network. Packets to will automatically be encrypted if
they are adressed to a <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> destination,
<codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> destination or a <aclass="reference internal"href="#api-link"><spanclass="std std-ref">RNS.Link</span></a>.</p>
<p>For <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.GROUP</span></code> destinations, Reticulum will use the
pre-shared key configured for the destination.</p>
<p>For <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Destination.SINGLE</span></code> destinations and <aclass="reference internal"href="#api-link"><spanclass="std std-ref">RNS.Link</span></a>
destinations, reticulum will use ephemeral keys, and offers <strong>Forward Secrecy</strong>.</p>
<li><p><strong>destination</strong>– A <aclass="reference internal"href="#api-destination"><spanclass="std std-ref">RNS.Destination</span></a> instance to which the packet will be sent.</p></li>
<li><p><strong>data</strong>– The data payload to be included in the packet as <em>bytes</em>.</p></li>
<li><p><strong>create_receipt</strong>– Specifies whether a <aclass="reference internal"href="#api-packetreceipt"><spanclass="std std-ref">RNS.PacketReceipt</span></a> should be created when instantiating the packet.</p></li>
<spanclass="sig-name descname"><spanclass="pre">ENCRYPTED_MDU</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">383</span></em><aclass="headerlink"href="#RNS.Packet.ENCRYPTED_MDU"title="Permalink to this definition">¶</a></dt>
<dd><p>The maximum size of the payload data in a single encrypted packet</p>
<spanclass="sig-name descname"><spanclass="pre">PLAIN_MDU</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">476</span></em><aclass="headerlink"href="#RNS.Packet.PLAIN_MDU"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">send</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Packet.send"title="Permalink to this definition">¶</a></dt>
<dd><p>Sends the packet.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference internal"href="#api-packetreceipt"><spanclass="std std-ref">RNS.PacketReceipt</span></a> instance if <em>create_receipt</em> was set to <em>True</em> when the packet was instantiated, if not returns <em>None</em>. If the packet could not be sent <em>False</em> is returned.</p>
<spanclass="sig-name descname"><spanclass="pre">resend</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Packet.resend"title="Permalink to this definition">¶</a></dt>
<dd><p>Re-sends the packet.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A <aclass="reference internal"href="#api-packetreceipt"><spanclass="std std-ref">RNS.PacketReceipt</span></a> instance if <em>create_receipt</em> was set to <em>True</em> when the packet was instantiated, if not returns <em>None</em>. If the packet could not be sent <em>False</em> is returned.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</div>
<divclass="section"id="packet-receipt">
<spanid="api-packetreceipt"></span><h3>Packet Receipt<aclass="headerlink"href="#packet-receipt"title="Permalink to this headline">¶</a></h3>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">PacketReceipt</span></span><aclass="headerlink"href="#RNS.PacketReceipt"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p>The status of the associated <aclass="reference internal"href="#api-packet"><spanclass="std std-ref">RNS.Packet</span></a> instance. Can be one of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.SENT</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.DELIVERED</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.FAILED</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.PacketReceipt.CULLED</span></code>.</p>
<spanclass="sig-name descname"><spanclass="pre">get_rtt</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.get_rtt"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_timeout</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">timeout</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.set_timeout"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets a timeout in seconds</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>timeout</strong>– The timeout in seconds.</p>
<spanclass="sig-name descname"><spanclass="pre">set_delivery_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.set_delivery_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_timeout_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.PacketReceipt.set_timeout_callback"title="Permalink to this definition">¶</a></dt>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Link</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">established_callback</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">closed_callback</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link"title="Permalink to this definition">¶</a></dt>
<dd><p>This class is used to establish and manage links to other peers. When a
link instance is created, Reticulum will attempt to establish verified
<li><p><strong>destination</strong>– A <aclass="reference internal"href="#api-destination"><spanclass="std std-ref">RNS.Destination</span></a> instance which to establish a link to.</p></li>
<li><p><strong>established_callback</strong>– An optional function or method with the signature <em>callback(link)</em> to be called when the link has been established.</p></li>
<li><p><strong>closed_callback</strong>– An optional function or method with the signature <em>callback(link)</em> to be called when the link is closed.</p></li>
<spanclass="sig-name descname"><spanclass="pre">CURVE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">'Curve25519'</span></em><aclass="headerlink"href="#RNS.Link.CURVE"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">ESTABLISHMENT_TIMEOUT_PER_HOP</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">5</span></em><aclass="headerlink"href="#RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">KEEPALIVE_TIMEOUT_FACTOR</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">4</span></em><aclass="headerlink"href="#RNS.Link.KEEPALIVE_TIMEOUT_FACTOR"title="Permalink to this definition">¶</a></dt>
<dd><p>RTT timeout factor used in link timeout calculation.</p>
<spanclass="sig-name descname"><spanclass="pre">STALE_GRACE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">2</span></em><aclass="headerlink"href="#RNS.Link.STALE_GRACE"title="Permalink to this definition">¶</a></dt>
<dd><p>Grace period in seconds used in link timeout calculation.</p>
<spanclass="sig-name descname"><spanclass="pre">KEEPALIVE</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">360</span></em><aclass="headerlink"href="#RNS.Link.KEEPALIVE"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">STALE_TIME</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">720</span></em><aclass="headerlink"href="#RNS.Link.STALE_TIME"title="Permalink to this definition">¶</a></dt>
<dd><p>If no traffic or keep-alive packets are received within this period, the
link will be marked as stale, and a final keep-alive packet will be sent.
If after this no traffic or keep-alive packets are received within <codeclass="docutils literal notranslate"><spanclass="pre">RTT</span></code> *
<codeclass="docutils literal notranslate"><spanclass="pre">KEEPALIVE_TIMEOUT_FACTOR</span></code> + <codeclass="docutils literal notranslate"><spanclass="pre">STALE_GRACE</span></code>, the link is considered timed out,
<spanclass="sig-name descname"><spanclass="pre">identify</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">identity</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.identify"title="Permalink to this definition">¶</a></dt>
<dd><p>Identifies the initiator of the link to the remote peer. This can only happen
once the link has been established, and is carried out over the encrypted link.
The identity is only revealed to the remote peer, and initiator anonymity is
thus preserved. This method can be used for authentication.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>identity</strong>– An RNS.Identity instance to identify as.</p>
<spanclass="sig-name descname"><spanclass="pre">request</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">path</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">data</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">response_callback</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">failed_callback</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">progress_callback</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">timeout</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.request"title="Permalink to this definition">¶</a></dt>
<li><p><strong>response_callback</strong>– An optional function or method with the signature <em>response_callback(request_receipt)</em> to be called when a response is received. See the <aclass="reference internal"href="examples.html#example-request"><spanclass="std std-ref">Request Example</span></a> for more info.</p></li>
<li><p><strong>failed_callback</strong>– An optional function or method with the signature <em>failed_callback(request_receipt)</em> to be called when a request fails. See the <aclass="reference internal"href="examples.html#example-request"><spanclass="std std-ref">Request Example</span></a> for more info.</p></li>
<li><p><strong>progress_callback</strong>– An optional function or method with the signature <em>progress_callback(request_receipt)</em> to be called when progress is made receiving the response. Progress can be accessed as a float between 0.0 and 1.0 by the <em>request_receipt.progress</em> property.</p></li>
<li><p><strong>timeout</strong>– An optional timeout in seconds for the request. If <em>None</em> is supplied it will be calculated based on link RTT.</p></li>
<ddclass="field-even"><p>A <aclass="reference internal"href="#api-requestreceipt"><spanclass="std std-ref">RNS.RequestReceipt</span></a> instance if the request was sent, or <em>False</em> if it was not.</p>
<spanclass="sig-name descname"><spanclass="pre">no_inbound_for</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.no_inbound_for"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The time in seconds since last inbound packet on the link.</p>
<spanclass="sig-name descname"><spanclass="pre">no_outbound_for</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.no_outbound_for"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The time in seconds since last outbound packet on the link.</p>
<spanclass="sig-name descname"><spanclass="pre">inactive_for</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.inactive_for"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The time in seconds since activity on the link.</p>
<spanclass="sig-name descname"><spanclass="pre">get_remote_identity</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.get_remote_identity"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The identity of the remote peer, if it is known</p>
<spanclass="sig-name descname"><spanclass="pre">teardown</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.teardown"title="Permalink to this definition">¶</a></dt>
<dd><p>Closes the link and purges encryption keys. New keys will
be used if a new link to the same destination is established.</p>
<spanclass="sig-name descname"><spanclass="pre">set_link_closed_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_link_closed_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a function to be called when a link has been
torn down.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method with the signature <em>callback(link)</em> to be called.</p>
<spanclass="sig-name descname"><spanclass="pre">set_packet_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_packet_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_resource_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_callback"title="Permalink to this definition">¶</a></dt>
<ddclass="field-odd"><p><strong>callback</strong>– A function or method with the signature <em>callback(resource)</em> to be called. Please note that only the basic information of the resource is available at this time, such as <em>get_transfer_size()</em>, <em>get_data_size()</em>, <em>get_parts()</em> and <em>is_compressed()</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">set_resource_started_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_started_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_resource_concluded_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_concluded_callback"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">set_remote_identified_callback</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">callback</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_remote_identified_callback"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a function to be called when an initiating peer has
<spanclass="sig-name descname"><spanclass="pre">set_resource_strategy</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">resource_strategy</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Link.set_resource_strategy"title="Permalink to this definition">¶</a></dt>
<dd><p>Sets the resource strategy for the link.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>resource_strategy</strong>– One of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_NONE</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_ALL</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_APP</span></code>. If <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link.ACCEPT_APP</span></code> is set, the <cite>resource_callback</cite> will be called to determine whether the resource should be accepted or not.</p>
</dd>
<dtclass="field-even">Raises</dt>
<ddclass="field-even"><p><em>TypeError</em> if the resource strategy is unsupported.</p>
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">RequestReceipt</span></span><aclass="headerlink"href="#RNS.RequestReceipt"title="Permalink to this definition">¶</a></dt>
<dd><p>An instance of this class is returned by the <codeclass="docutils literal notranslate"><spanclass="pre">request</span></code> method of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Link</span></code>
instances. It should never be instantiated manually. It provides methods to
check status, response time and response data when the request concludes.</p>
<spanclass="sig-name descname"><spanclass="pre">get_request_id</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.RequestReceipt.get_request_id"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The request ID as <em>bytes</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">get_status</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.RequestReceipt.get_status"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The current status of the request, one of <codeclass="docutils literal notranslate"><spanclass="pre">RNS.RequestReceipt.FAILED</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.RequestReceipt.SENT</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.RequestReceipt.DELIVERED</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">RNS.RequestReceipt.READY</span></code>.</p>
<spanclass="sig-name descname"><spanclass="pre">get_progress</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.RequestReceipt.get_progress"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The progress of a response being received as a <em>float</em> between 0.0 and 1.0.</p>
<spanclass="sig-name descname"><spanclass="pre">get_response</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.RequestReceipt.get_response"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The response as <em>bytes</em> if it is ready, otherwise <em>None</em>.</p>
<spanclass="sig-name descname"><spanclass="pre">get_response_time</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.RequestReceipt.get_response_time"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The response time of the request in seconds.</p>
<li><p><strong>data</strong>– The data to be transferred. Can be <em>bytes</em> or an open <em>file handle</em>. See the <aclass="reference internal"href="examples.html#example-filetransfer"><spanclass="std std-ref">Filetransfer Example</span></a> for details.</p></li>
<li><p><strong>link</strong>– The <aclass="reference internal"href="#api-link"><spanclass="std std-ref">RNS.Link</span></a> instance on which to transfer the data.</p></li>
<li><p><strong>advertise</strong>– Optional. Whether to automatically advertise the resource. Can be <em>True</em> or <em>False</em>.</p></li>
<li><p><strong>auto_compress</strong>– Optional. Whether to auto-compress the resource. Can be <em>True</em> or <em>False</em>.</p></li>
<li><p><strong>callback</strong>– An optional <em>callable</em> with the signature <em>callback(resource)</em>. Will be called when the resource transfer concludes.</p></li>
<li><p><strong>progress_callback</strong>– An optional <em>callable</em> with the signature <em>callback(resource)</em>. Will be called whenever the resource transfer progress is updated.</p></li>
<spanclass="sig-name descname"><spanclass="pre">advertise</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.advertise"title="Permalink to this definition">¶</a></dt>
<dd><p>Advertise the resource. If the other end of the link accepts
the resource advertisement it will begin transferring.</p>
<spanclass="sig-name descname"><spanclass="pre">cancel</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.cancel"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">get_progress</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.get_progress"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">get_transfer_size</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.get_transfer_size"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The number of bytes needed to transfer the resource.</p>
<spanclass="sig-name descname"><spanclass="pre">get_data_size</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.get_data_size"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The total data size of the resource.</p>
<spanclass="sig-name descname"><spanclass="pre">get_parts</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.get_parts"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The number of parts the resource will be transferred in.</p>
<spanclass="sig-name descname"><spanclass="pre">get_segments</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.get_segments"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The number of segments the resource is divided into.</p>
<spanclass="sig-name descname"><spanclass="pre">get_hash</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.get_hash"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The hash of the resource.</p>
<spanclass="sig-name descname"><spanclass="pre">is_compressed</span></span><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Resource.is_compressed"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>Whether the resource is compressed.</p>
<spanid="api-transport"></span><h3>Transport<aclass="headerlink"href="#transport"title="Permalink to this headline">¶</a></h3>
<dlclass="py class">
<dtclass="sig sig-object py"id="RNS.Transport">
<emclass="property"><spanclass="pre">class</span></em><spanclass="sig-prename descclassname"><spanclass="pre">RNS.</span></span><spanclass="sig-name descname"><spanclass="pre">Transport</span></span><aclass="headerlink"href="#RNS.Transport"title="Permalink to this definition">¶</a></dt>
<spanclass="sig-name descname"><spanclass="pre">PATHFINDER_M</span></span><emclass="property"><spanclass="pre">=</span><spanclass="pre">128</span></em><aclass="headerlink"href="#RNS.Transport.PATHFINDER_M"title="Permalink to this definition">¶</a></dt>
<dd><p>Maximum amount of hops that Reticulum will transport a packet.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">register_announce_handler</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">handler</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.register_announce_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Registers an announce handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>handler</strong>– Must be an object with an <em>aspect_filter</em> attribute and a <em>received_announce(destination_hash, announced_identity, app_data)</em> callable. See the <aclass="reference internal"href="examples.html#example-announce"><spanclass="std std-ref">Announce Example</span></a> for more info.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">deregister_announce_handler</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">handler</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.deregister_announce_handler"title="Permalink to this definition">¶</a></dt>
<dd><p>Deregisters an announce handler.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>handler</strong>– The announce handler to be deregistered.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">has_path</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.has_path"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>True</em> if a path to the destination is known, otherwise <em>False</em>.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">hops_to</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.hops_to"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The number of hops to the specified destination, or <codeclass="docutils literal notranslate"><spanclass="pre">RNS.Transport.PATHFINDER_M</span></code> if the number of hops is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">next_hop</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.next_hop"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The destination hash as <em>bytes</em> for the next hop to the specified destination, or <em>None</em> if the next hop is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">next_hop_interface</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.next_hop_interface"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>The interface for the next hop to the specified destination, or <em>None</em> if the interface is unknown.</p>
<emclass="property"><spanclass="pre">static</span></em><spanclass="sig-name descname"><spanclass="pre">request_path</span></span><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n"><spanclass="pre">destination_hash</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">on_interface</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">tag</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">None</span></span></em>, <emclass="sig-param"><spanclass="n"><spanclass="pre">recursive</span></span><spanclass="o"><spanclass="pre">=</span></span><spanclass="default_value"><spanclass="pre">False</span></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#RNS.Transport.request_path"title="Permalink to this definition">¶</a></dt>
<li><p><strong>destination_hash</strong>– A destination hash as <em>bytes</em>.</p></li>
<li><p><strong>on_interface</strong>– If specified, the path request will only be sent on this interface. In normal use, Reticulum handles this automatically, and this parameter should not be used.</p></li>