Reticulum/docs/manual/reference.html

2039 lines
162 KiB
HTML
Raw Normal View History

2022-09-30 16:43:04 +00:00
<!doctype html>
<html class="no-js" lang="en">
<head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
2023-06-29 14:52:06 +00:00
<meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
2022-09-30 16:43:04 +00:00
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="prev" title="Support Reticulum" href="support.html" />
2023-08-15 08:23:51 +00:00
<meta name="generator" content="sphinx-7.1.2, furo 2022.09.29.dev1"/>
2023-09-21 11:51:03 +00:00
<title>API Reference - Reticulum Network Stack 0.6.0 beta documentation</title>
2023-09-13 11:37:37 +00:00
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=a746c00c" />
2023-06-29 14:52:06 +00:00
<link rel="stylesheet" type="text/css" href="_static/styles/furo.css?digest=189ec851f9bb375a2509b67be1f64f0cf212b702" />
2023-08-15 08:23:51 +00:00
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
2022-09-30 16:43:04 +00:00
<link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" />
2023-08-15 08:23:51 +00:00
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=bb3cebc5" />
2022-09-30 16:43:04 +00:00
2021-05-16 21:40:49 +00:00
2022-09-29 22:02:15 +00:00
2022-09-30 16:43:04 +00:00
<style>
body {
--color-code-background: #f8f8f8;
--color-code-foreground: black;
}
@media not print {
body[data-theme="dark"] {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
--color-background-primary: #202b38;
--color-background-secondary: #161f27;
--color-foreground-primary: #dbdbdb;
--color-foreground-secondary: #a9b1ba;
--color-brand-primary: #41adff;
--color-background-hover: #161f27;
--color-api-name: #ffbe85;
--color-api-pre-name: #efae75;
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
--color-background-primary: #202b38;
--color-background-secondary: #161f27;
--color-foreground-primary: #dbdbdb;
--color-foreground-secondary: #a9b1ba;
--color-brand-primary: #41adff;
--color-background-hover: #161f27;
--color-api-name: #ffbe85;
--color-api-pre-name: #efae75;
}
}
}
</style></head>
<body>
2021-05-16 21:40:49 +00:00
2022-09-30 16:43:04 +00:00
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
2021-05-16 21:40:49 +00:00
2022-09-30 16:43:04 +00:00
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-toc" viewBox="0 0 24 24">
<title>Contents</title>
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
</svg>
</symbol>
<symbol id="svg-menu" viewBox="0 0 24 24">
<title>Menu</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
<title>Expand</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24">
<title>Light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24">
<title>Dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg>
</symbol>
<symbol id="svg-sun-half" viewBox="0 0 24 24">
<title>Auto light/dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<circle cx="12" cy="12" r="9" />
<path d="M13 12h5" />
<path d="M13 15h4" />
<path d="M13 18h1" />
<path d="M13 9h4" />
<path d="M13 6h1" />
</svg>
</symbol>
</svg>
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
<label class="overlay sidebar-overlay" for="__navigation">
<div class="visually-hidden">Hide navigation sidebar</div>
</label>
<label class="overlay toc-overlay" for="__toc">
<div class="visually-hidden">Hide table of contents sidebar</div>
</label>
<div class="page">
<header class="mobile-header">
<div class="header-left">
<label class="nav-overlay-icon" for="__navigation">
<div class="visually-hidden">Toggle site navigation sidebar</div>
<i class="icon"><svg><use href="#svg-menu"></use></svg></i>
</label>
</div>
<div class="header-center">
2023-09-21 11:51:03 +00:00
<a href="index.html"><div class="brand">Reticulum Network Stack 0.6.0 beta documentation</div></a>
2022-09-30 16:43:04 +00:00
</div>
<div class="header-right">
<div class="theme-toggle-container theme-toggle-header">
<button class="theme-toggle">
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-header-icon" for="__toc">
<div class="visually-hidden">Toggle table of contents sidebar</div>
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
</header>
<aside class="sidebar-drawer">
<div class="sidebar-container">
2023-08-15 08:23:51 +00:00
<div class="sidebar-sticky"><a class="sidebar-brand" href="index.html">
2022-09-30 16:43:04 +00:00
<div class="sidebar-logo-container">
<img class="sidebar-logo" src="_static/rns_logo_512.png" alt="Logo"/>
</div>
2023-09-21 11:51:03 +00:00
<span class="sidebar-brand-text">Reticulum Network Stack 0.6.0 beta documentation</span>
2022-09-30 16:43:04 +00:00
</a><form class="sidebar-search-container" method="get" action="search.html" role="search">
2023-06-29 14:52:06 +00:00
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
2022-09-30 16:43:04 +00:00
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
<ul>
<li class="toctree-l1"><a class="reference internal" href="whatis.html">What is Reticulum?</a></li>
<li class="toctree-l1"><a class="reference internal" href="gettingstartedfast.html">Getting Started Fast</a></li>
<li class="toctree-l1"><a class="reference internal" href="using.html">Using Reticulum on Your System</a></li>
<li class="toctree-l1"><a class="reference internal" href="understanding.html">Understanding Reticulum</a></li>
<li class="toctree-l1"><a class="reference internal" href="hardware.html">Communications Hardware</a></li>
<li class="toctree-l1"><a class="reference internal" href="interfaces.html">Supported Interfaces</a></li>
<li class="toctree-l1"><a class="reference internal" href="networks.html">Building Networks</a></li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Code Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="support.html">Support Reticulum</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">API Reference</a></li>
</ul>
</div>
</div>
</div>
</div>
</aside>
<div class="main">
<div class="content">
<div class="article-container">
<a href="#" class="back-to-top muted-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
</svg>
<span>Back to top</span>
</a>
<div class="content-icon-container">
<div class="theme-toggle-container theme-toggle-content">
<button class="theme-toggle">
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-content-icon" for="__toc">
<div class="visually-hidden">Toggle table of contents sidebar</div>
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
</label>
</div>
<article role="main">
<section id="api-reference">
<span id="api-main"></span><h1>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this heading">#</a></h1>
<p>Communication over Reticulum networks is achieved by using a simple set of classes exposed by the RNS API.
This chapter lists and explains all classes exposed by the Reticulum Network Stack API, along with their method signatures and usage. It can be used as a reference while writing applications that utilise Reticulum, or it can be read in entirity to gain an understanding of the complete functionality of RNS from a developers perspective.</p>
2022-09-30 11:09:10 +00:00
<p id="api-reticulum"><h3> Reticulum </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Reticulum">
2023-05-04 10:23:25 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Reticulum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">configdir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logdest</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbosity</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>This class is used to initialise access to Reticulum within a
program. You must create exactly one instance of this class before
carrying out any other RNS operations, such as creating destinations
or sending traffic. Every independently executed program must create
their own instance of the Reticulum class, but Reticulum will
automatically handle inter-program communication on the same system,
and expose all connected programs to external interfaces as well.</p>
<p>As soon as an instance of this class is created, Reticulum will start
opening and configuring any hardware devices specified in the supplied
configuration.</p>
<p>Currently the first running instance must be kept running while other
local instances are connected, as the first created instance will
act as a master instance that directly communicates with external
hardware such as modems, TNCs and radios. If a master instance is
asked to exit, it will not exit until all client processes have
terminated (unless killed forcibly).</p>
<p>If you are running Reticulum on a system with several different
programs that use RNS starting and terminating at different times,
it will be advantageous to run a master RNS instance as a daemon for
other programs to use on demand.</p>
2021-09-02 18:35:42 +00:00
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Reticulum.MTU">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">MTU</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">500</span></em><a class="headerlink" href="#RNS.Reticulum.MTU" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><p>The MTU that Reticulum adheres to, and will expect other peers to
2022-04-27 11:19:03 +00:00
adhere to. By default, the MTU is 507 bytes. In custom RNS network
2021-09-02 18:35:42 +00:00
implementations, it is possible to change this value, but doing so will
completely break compatibility with all other RNS networks. An identical
MTU is a prerequisite for peers to communicate in the same network.</p>
<p>Unless you really know what you are doing, the MTU should be left at
the default value.</p>
</dd></dl>
2022-04-17 18:12:23 +00:00
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Reticulum.ANNOUNCE_CAP">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">ANNOUNCE_CAP</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">2</span></em><a class="headerlink" href="#RNS.Reticulum.ANNOUNCE_CAP" title="Permalink to this definition">#</a></dt>
2022-04-17 18:12:23 +00:00
<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 dont 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>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Reticulum.should_use_implicit_proof">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">should_use_implicit_proof</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.should_use_implicit_proof" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Returns whether proofs sent are explicit or implicit.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>True if the current running configuration specifies to use implicit proofs. False if not.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Reticulum.transport_enabled">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">transport_enabled</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.transport_enabled" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<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>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>True if Transport is enabled, False if not.</p>
</dd>
</dl>
</dd></dl>
2023-09-21 16:32:46 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Reticulum.probe_destination_enabled">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">probe_destination_enabled</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Reticulum.probe_destination_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>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>True if Transport is enabled, False if not.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-identity"><h3> Identity </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Identity">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Identity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">create_keys</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>This class is used to manage identities in Reticulum. It provides methods
for encryption, decryption, signatures and verification, and is the basis
for all encrypted communication over Reticulum networks.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-odd"><p><strong>create_keys</strong> Specifies whether new encryption and signing keys should be generated.</p>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
2021-05-20 13:31:58 +00:00
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Identity.CURVE">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">CURVE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'Curve25519'</span></em><a class="headerlink" href="#RNS.Identity.CURVE" title="Permalink to this definition">#</a></dt>
2021-05-20 13:31:58 +00:00
<dd><p>The curve used for Elliptic Curve DH key exchanges</p>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Identity.KEYSIZE">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">KEYSIZE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">512</span></em><a class="headerlink" href="#RNS.Identity.KEYSIZE" title="Permalink to this definition">#</a></dt>
2021-05-20 13:31:58 +00:00
<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>
2021-05-16 21:40:49 +00:00
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Identity.TRUNCATED_HASHLENGTH">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">TRUNCATED_HASHLENGTH</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">128</span></em><a class="headerlink" href="#RNS.Identity.TRUNCATED_HASHLENGTH" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Constant specifying the truncated hash length (in bits) used by Reticulum
2021-05-20 13:31:58 +00:00
for addressable hashes and other purposes. Non-configurable.</p>
2021-05-16 21:40:49 +00:00
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.recall">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">recall</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.recall" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Recall identity for a destination hash.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>destination_hash</strong> Destination hash as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>An <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance that can be used to create an outgoing <a class="reference internal" href="#api-destination"><span class="std std-ref">RNS.Destination</span></a>, or <em>None</em> if the destination is unknown.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.recall_app_data">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">recall_app_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.recall_app_data" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Recall last heard app_data for a destination hash.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>destination_hash</strong> Destination hash as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p><em>Bytes</em> containing app_data, or <em>None</em> if the destination is unknown.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.full_hash">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">full_hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.full_hash" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Get a SHA-256 hash of passed data.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>data</strong> Data to be hashed as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>SHA-256 hash as <em>bytes</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.truncated_hash">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">truncated_hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.truncated_hash" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Get a truncated SHA-256 hash of passed data.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>data</strong> Data to be hashed as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>Truncated SHA-256 hash as <em>bytes</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.get_random_hash">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_random_hash</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.get_random_hash" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Get a random SHA-256 hash.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>data</strong> Data to be hashed as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>Truncated SHA-256 hash of random data as <em>bytes</em></p>
</dd>
</dl>
</dd></dl>
2021-09-02 18:35:42 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.from_bytes">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_bytes</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prv_bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.from_bytes" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><p>Create a new <a class="reference internal" href="#api-identity"><span class="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>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="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>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-even"><p>A <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the <em>bytes</em> data was invalid.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.from_file">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.from_file" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Create a new <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance from a file.
Can be used to load previously created and saved identities into Reticulum.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>path</strong> The full path to the saved <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> data</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>A <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> instance, or <em>None</em> if the loaded data was invalid.</p>
</dd>
</dl>
</dd></dl>
2021-08-29 11:13:51 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.to_file">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">to_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.to_file" title="Permalink to this definition">#</a></dt>
2021-08-29 11:13:51 +00:00
<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>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-08-29 11:13:51 +00:00
<dd class="field-odd"><p><strong>path</strong> The full path specifying where to save the identity.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-08-29 11:13:51 +00:00
<dd class="field-even"><p>True if the file was saved, otherwise False.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.get_private_key">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_private_key</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.get_private_key" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The private key as <em>bytes</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.get_public_key">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_public_key</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.get_public_key" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The public key as <em>bytes</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.load_private_key">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">load_private_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">prv_bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.load_private_key" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Load a private key into the instance.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>prv_bytes</strong> The private key as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>True if the key was loaded, otherwise False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.load_public_key">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">load_public_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pub_bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.load_public_key" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Load a public key into the instance.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-odd"><p><strong>pub_bytes</strong> The public key as <em>bytes</em>.</p>
2021-05-16 21:40:49 +00:00
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>True if the key was loaded, otherwise False.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.encrypt">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">encrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">plaintext</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.encrypt" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Encrypts information for the identity.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>plaintext</strong> The plaintext to be encrypted as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-even"><p>Ciphertext token as <em>bytes</em>.</p>
2021-05-16 21:40:49 +00:00
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Raises<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a public key.</p>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.decrypt">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">decrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ciphertext_token</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.decrypt" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Decrypts information for the identity.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>ciphertext</strong> The ciphertext to be decrypted as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>Plaintext as <em>bytes</em>, or <em>None</em> if decryption fails.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Raises<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a private key.</p>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.sign">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">sign</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.sign" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Signs information by the identity.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>message</strong> The message to be signed as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>Signature as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Raises<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a private key.</p>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Identity.validate">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">signature</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Identity.validate" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Validates the signature of a signed message.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><ul class="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>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p>True if the signature is valid, otherwise False.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Raises<span class="colon">:</span></dt>
2021-05-20 13:31:58 +00:00
<dd class="field-odd"><p><em>KeyError</em> if the instance does not hold a public key.</p>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-destination"><h3> Destination </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Destination">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Destination</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">direction</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">aspects</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<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>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>identity</strong> An instance of <a class="reference internal" href="#api-identity"><span class="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>
2021-08-28 18:10:00 +00:00
<li><p><strong>direction</strong> <code class="docutils literal notranslate"><span class="pre">RNS.Destination.IN</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.OUT</span></code>.</p></li>
2021-05-16 21:40:49 +00:00
<li><p><strong>type</strong> <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PLAIN</span></code>.</p></li>
<li><p><strong>app_name</strong> A string specifying the app name.</p></li>
<li><p><strong>*aspects</strong> Any non-zero number of string arguments.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
2022-10-04 07:06:29 +00:00
<dt class="sig sig-object py" id="RNS.Destination.expand_name">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">expand_name</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">aspects</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.expand_name" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>A string containing the full human-readable name of the destination, for an app_name and a number of aspects.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.app_and_aspects_from_name">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">app_and_aspects_from_name</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">full_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.app_and_aspects_from_name" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>A tuple containing the app name and a list of aspects, for a full-name string.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.hash_from_name_and_identity">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hash_from_name_and_identity</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">full_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">identity</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.hash_from_name_and_identity" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>A destination name in adressable hash form, for a full name string and Identity instance.</p>
</dd>
</dl>
</dd></dl>
2022-10-04 07:34:52 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.hash">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">app_name</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">aspects</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.hash" title="Permalink to this definition">#</a></dt>
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-10-04 07:34:52 +00:00
<dd class="field-odd"><p>A destination name in adressable hash form, for an app_name and a number of aspects.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.announce">
2022-12-22 14:11:53 +00:00
<span class="sig-name descname"><span class="pre">announce</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">app_data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path_response</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attached_interface</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">send</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.announce" title="Permalink to this definition">#</a></dt>
2021-05-20 13:31:58 +00:00
<dd><p>Creates an announce packet for this destination and broadcasts it on all
relevant interfaces. Application specific data can be added to the announce.</p>
2021-05-16 21:40:49 +00:00
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><ul class="simple">
<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 <a class="reference internal" href="#api-transport"><span class="std std-ref">RNS.Transport</span></a>. Ignore.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
2022-06-12 09:49:37 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.accepts_links">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">accepts_links</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">accepts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.accepts_links" title="Permalink to this definition">#</a></dt>
2022-06-12 09:49:37 +00:00
<dd><p>Set or query whether the destination accepts incoming link requests.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-06-12 09:49:37 +00:00
<dd class="field-odd"><p><strong>accepts</strong> If <code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code>, this method sets whether the destination accepts incoming link requests. If not provided or <code class="docutils literal notranslate"><span class="pre">None</span></code>, the method returns whether the destination currently accepts link requests.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2022-06-12 09:49:37 +00:00
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">True</span></code> or <code class="docutils literal notranslate"><span class="pre">False</span></code> depending on whether the destination accepts incoming link requests, if the <em>accepts</em> parameter is not provided or <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Destination.set_link_established_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_link_established_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_link_established_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a link has been established to
this destination.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="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>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Destination.set_packet_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_packet_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_packet_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a packet has been received by
this destination.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="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>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Destination.set_proof_requested_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_proof_requested_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_proof_requested_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a proof has been requested for
a packet sent to this destination. Allows control over when and if
proofs should be returned for received packets.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="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>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.set_proof_strategy">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_proof_strategy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">proof_strategy</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_proof_strategy" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Sets the destinations proof strategy.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>proof_strategy</strong> One of <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_NONE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_ALL</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.PROVE_APP</span></code>. If <code class="docutils literal notranslate"><span class="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>
</dd>
</dl>
</dd></dl>
2021-08-20 21:29:06 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.register_request_handler">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">register_request_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_generator</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allow</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">ALLOW_NONE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">allowed_list</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.register_request_handler" title="Permalink to this definition">#</a></dt>
2021-08-20 21:29:06 +00:00
<dd><p>Registers a request handler.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-08-20 21:29:06 +00:00
<dd class="field-odd"><ul class="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, link_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 <code class="docutils literal notranslate"><span class="pre">None</span></code>, no response will be sent.</p></li>
2021-08-20 21:29:06 +00:00
<li><p><strong>allow</strong> One of <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_NONE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_ALL</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.ALLOW_LIST</span></code>. If <code class="docutils literal notranslate"><span class="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> <a class="reference internal" href="#api-identity"><span class="std std-ref">RNS.Identity</span></a> hashes.</p></li>
</ul>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Raises<span class="colon">:</span></dt>
2021-08-20 21:29:06 +00:00
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code> if any of the supplied arguments are invalid.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.deregister_request_handler">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">deregister_request_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.deregister_request_handler" title="Permalink to this definition">#</a></dt>
2021-08-20 21:29:06 +00:00
<dd><p>Deregisters a request handler.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-08-20 21:29:06 +00:00
<dd class="field-odd"><p><strong>path</strong> The path for the request handler to be deregistered.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-08-20 21:29:06 +00:00
<dd class="field-even"><p>True if the handler was deregistered, otherwise False.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.create_keys">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">create_keys</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.create_keys" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>For a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination, creates a new symmetric key.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Raises<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.get_private_key">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_private_key</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.get_private_key" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>For a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination, returns the symmetric private key.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Raises<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.load_private_key">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">load_private_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.load_private_key" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>For a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination, loads a symmetric private key.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>key</strong> A <em>bytes-like</em> containing the symmetric key.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Raises<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">TypeError</span></code> if called on an incompatible type of destination.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.encrypt">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">encrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">plaintext</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.encrypt" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Encrypts information for <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>plaintext</strong> A <em>bytes-like</em> containing the plaintext to be encrypted.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Raises<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code> if destination does not hold a necessary key for encryption.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.decrypt">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">decrypt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ciphertext</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.decrypt" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Decrypts information for <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> type destination.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>ciphertext</strong> <em>Bytes</em> containing the ciphertext to be decrypted.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Raises<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">ValueError</span></code> if destination does not hold a necessary key for decryption.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.sign">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">sign</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.sign" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Signs information for <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> type destination.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>message</strong> <em>Bytes</em> containing the message to be signed.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="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>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.set_default_app_data">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_default_app_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">app_data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.set_default_app_data" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<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>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="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>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Destination.clear_default_app_data">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">clear_default_app_data</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Destination.clear_default_app_data" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Clears default app_data previously set for the destination.</p>
</dd></dl>
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-packet"><h3> Packet </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Packet">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Packet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">create_receipt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet" title="Permalink to this definition">#</a></dt>
2021-05-20 13:31:58 +00:00
<dd><p>The Packet class is used to create packet instances that can be sent
2022-09-30 09:26:51 +00:00
over a Reticulum network. Packets will automatically be encrypted if
2021-05-20 13:31:58 +00:00
they are adressed to a <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> destination,
<code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> destination or a <a class="reference internal" href="#api-link"><span class="std std-ref">RNS.Link</span></a>.</p>
<p>For <code class="docutils literal notranslate"><span class="pre">RNS.Destination.GROUP</span></code> destinations, Reticulum will use the
2022-09-30 09:15:34 +00:00
pre-shared key configured for the destination. All packets to group
destinations are encrypted with the same AES-128 key.</p>
<p>For <code class="docutils literal notranslate"><span class="pre">RNS.Destination.SINGLE</span></code> destinations, Reticulum will use a newly
derived ephemeral AES-128 key for every packet.</p>
<p>For <a class="reference internal" href="#api-link"><span class="std std-ref">RNS.Link</span></a> destinations, Reticulum will use per-link
ephemeral keys, and offers <strong>Forward Secrecy</strong>.</p>
2021-05-16 21:40:49 +00:00
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>destination</strong> A <a class="reference internal" href="#api-destination"><span class="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 <a class="reference internal" href="#api-packetreceipt"><span class="std std-ref">RNS.PacketReceipt</span></a> should be created when instantiating the packet.</p></li>
</ul>
</dd>
</dl>
2021-05-20 13:31:58 +00:00
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Packet.ENCRYPTED_MDU">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">ENCRYPTED_MDU</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">383</span></em><a class="headerlink" href="#RNS.Packet.ENCRYPTED_MDU" title="Permalink to this definition">#</a></dt>
2021-05-20 13:31:58 +00:00
<dd><p>The maximum size of the payload data in a single encrypted packet</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Packet.PLAIN_MDU">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">PLAIN_MDU</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">464</span></em><a class="headerlink" href="#RNS.Packet.PLAIN_MDU" title="Permalink to this definition">#</a></dt>
2021-05-20 13:31:58 +00:00
<dd><p>The maximum size of the payload data in a single unencrypted packet</p>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Packet.send">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">send</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.send" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Sends the packet.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>A <a class="reference internal" href="#api-packetreceipt"><span class="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>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Packet.resend">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">resend</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Packet.resend" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Re-sends the packet.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>A <a class="reference internal" href="#api-packetreceipt"><span class="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>
2022-09-30 11:09:10 +00:00
<p id="api-packetreceipt"><h3> Packet Receipt </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.PacketReceipt">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">PacketReceipt</span></span><a class="headerlink" href="#RNS.PacketReceipt" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>The PacketReceipt class is used to receive notifications about
<a class="reference internal" href="#api-packet"><span class="std std-ref">RNS.Packet</span></a> instances sent over the network. Instances
2021-09-02 18:35:42 +00:00
of this class are never created manually, but always returned from
the <em>send()</em> method of a <a class="reference internal" href="#api-packet"><span class="std std-ref">RNS.Packet</span></a> instance.</p>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.PacketReceipt.get_status">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_status</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.get_status" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The status of the associated <a class="reference internal" href="#api-packet"><span class="std std-ref">RNS.Packet</span></a> instance. Can be one of <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.SENT</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.DELIVERED</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.FAILED</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.PacketReceipt.CULLED</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.PacketReceipt.get_rtt">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_rtt</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.get_rtt" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The round-trip-time in seconds</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.PacketReceipt.set_timeout">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_timeout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timeout</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.set_timeout" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Sets a timeout in seconds</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>timeout</strong> The timeout in seconds.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.PacketReceipt.set_delivery_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_delivery_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.set_delivery_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Sets a function that gets called if a successfull delivery has been proven.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>callback</strong> A <em>callable</em> with the signature <em>callback(packet_receipt)</em></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.PacketReceipt.set_timeout_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_timeout_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.PacketReceipt.set_timeout_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Sets a function that gets called if the delivery times out.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>callback</strong> A <em>callable</em> with the signature <em>callback(packet_receipt)</em></p>
</dd>
</dl>
</dd></dl>
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-link"><h3> Link </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Link">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Link</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">established_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">closed_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<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
2022-09-30 09:26:51 +00:00
and encrypted connectivity with the specified destination.</p>
2021-05-16 21:40:49 +00:00
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>destination</strong> A <a class="reference internal" href="#api-destination"><span class="std std-ref">RNS.Destination</span></a> instance which to establish a link to.</p></li>
2021-09-02 18:35:42 +00:00
<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>
2021-05-16 21:40:49 +00:00
</ul>
</dd>
</dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Link.CURVE">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">CURVE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'Curve25519'</span></em><a class="headerlink" href="#RNS.Link.CURVE" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>The curve used for Elliptic Curve DH key exchanges</p>
</dd></dl>
<dl class="py attribute">
2021-08-28 18:10:00 +00:00
<dt class="sig sig-object py" id="RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP">
2023-03-08 11:34:09 +00:00
<span class="sig-name descname"><span class="pre">ESTABLISHMENT_TIMEOUT_PER_HOP</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">6</span></em><a class="headerlink" href="#RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP" title="Permalink to this definition">#</a></dt>
2022-05-26 14:50:35 +00:00
<dd><p>Timeout for link establishment in seconds per hop to destination.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Link.KEEPALIVE_TIMEOUT_FACTOR">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">KEEPALIVE_TIMEOUT_FACTOR</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">4</span></em><a class="headerlink" href="#RNS.Link.KEEPALIVE_TIMEOUT_FACTOR" title="Permalink to this definition">#</a></dt>
2022-05-26 14:50:35 +00:00
<dd><p>RTT timeout factor used in link timeout calculation.</p>
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Link.STALE_GRACE">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">STALE_GRACE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">2</span></em><a class="headerlink" href="#RNS.Link.STALE_GRACE" title="Permalink to this definition">#</a></dt>
2022-05-26 14:50:35 +00:00
<dd><p>Grace period in seconds used in link timeout calculation.</p>
2021-05-16 21:40:49 +00:00
</dd></dl>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Link.KEEPALIVE">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">KEEPALIVE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">360</span></em><a class="headerlink" href="#RNS.Link.KEEPALIVE" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Interval for sending keep-alive packets on established links in seconds.</p>
</dd></dl>
2022-05-26 14:50:35 +00:00
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.Link.STALE_TIME">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">STALE_TIME</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">720</span></em><a class="headerlink" href="#RNS.Link.STALE_TIME" title="Permalink to this definition">#</a></dt>
2022-05-26 14:50:35 +00:00
<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 <code class="docutils literal notranslate"><span class="pre">RTT</span></code> *
<code class="docutils literal notranslate"><span class="pre">KEEPALIVE_TIMEOUT_FACTOR</span></code> + <code class="docutils literal notranslate"><span class="pre">STALE_GRACE</span></code>, the link is considered timed out,
and will be torn down.</p>
</dd></dl>
2021-08-19 12:11:22 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.identify">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">identify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">identity</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.identify" title="Permalink to this definition">#</a></dt>
2021-08-19 12:11:22 +00:00
<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>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-08-19 12:11:22 +00:00
<dd class="field-odd"><p><strong>identity</strong> An RNS.Identity instance to identify as.</p>
</dd>
</dl>
</dd></dl>
2021-08-20 21:29:06 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.request">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">request</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">failed_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">progress_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.request" title="Permalink to this definition">#</a></dt>
2021-08-20 21:29:06 +00:00
<dd><p>Sends a request to the remote peer.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-08-20 21:29:06 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> The request path.</p></li>
2021-08-27 17:54:57 +00:00
<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 <a class="reference internal" href="examples.html#example-request"><span class="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 <a class="reference internal" href="examples.html#example-request"><span class="std std-ref">Request Example</span></a> for more info.</p></li>
2021-08-28 18:10:00 +00:00
<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>
2021-08-20 21:29:06 +00:00
</ul>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-even"><p>A <a class="reference internal" href="#api-requestreceipt"><span class="std std-ref">RNS.RequestReceipt</span></a> instance if the request was sent, or <em>False</em> if it was not.</p>
</dd>
2021-08-20 21:29:06 +00:00
</dl>
</dd></dl>
2023-02-17 08:53:27 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.get_establishment_rate">
<span class="sig-name descname"><span class="pre">get_establishment_rate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_establishment_rate" title="Permalink to this definition">#</a></dt>
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2023-02-17 08:53:27 +00:00
<dd class="field-odd"><p>The data transfer rate at which the link establishment procedure ocurred, in bits per second.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.no_inbound_for">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">no_inbound_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.no_inbound_for" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The time in seconds since last inbound packet on the link.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.no_outbound_for">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">no_outbound_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.no_outbound_for" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The time in seconds since last outbound packet on the link.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.inactive_for">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">inactive_for</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.inactive_for" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The time in seconds since activity on the link.</p>
</dd>
</dl>
</dd></dl>
2021-08-19 12:11:22 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.get_remote_identity">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_remote_identity</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_remote_identity" title="Permalink to this definition">#</a></dt>
2021-08-19 12:11:22 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-09-30 09:26:51 +00:00
<dd class="field-odd"><p>The identity of the remote peer, if it is known. Calling this method will not query the remote initiator to reveal its identity. Returns <code class="docutils literal notranslate"><span class="pre">None</span></code> if the link initiator has not already independently called the <code class="docutils literal notranslate"><span class="pre">identify(identity)</span></code> method.</p>
2021-08-19 12:11:22 +00:00
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.teardown">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">teardown</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.teardown" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<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>
</dd></dl>
2023-03-02 11:47:55 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.get_channel">
<span class="sig-name descname"><span class="pre">get_channel</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.get_channel" title="Permalink to this definition">#</a></dt>
<dd><p>Get the <code class="docutils literal notranslate"><span class="pre">Channel</span></code> for this link.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> object</p>
</dd>
</dl>
</dd></dl>
2022-05-24 18:47:45 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.set_link_closed_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_link_closed_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_link_closed_callback" title="Permalink to this definition">#</a></dt>
2022-05-24 18:47:45 +00:00
<dd><p>Registers a function to be called when a link has been
torn down.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-05-24 18:47:45 +00:00
<dd class="field-odd"><p><strong>callback</strong> A function or method with the signature <em>callback(link)</em> to be called.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Link.set_packet_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_packet_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_packet_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a packet has been
received over this link.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>callback</strong> A function or method with the signature <em>callback(message, packet)</em> to be called.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Link.set_resource_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_resource_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a resource has been
advertised over this link. If the function returns <em>True</em>
the resource will be accepted. If it returns <em>False</em> it will
be ignored.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="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>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Link.set_resource_started_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_resource_started_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_started_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a resource has begun
transferring over this link.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>callback</strong> A function or method with the signature <em>callback(resource)</em> to be called.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
2021-05-20 13:31:58 +00:00
<dt class="sig sig-object py" id="RNS.Link.set_resource_concluded_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_resource_concluded_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_concluded_callback" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers a function to be called when a resource has concluded
transferring over this link.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>callback</strong> A function or method with the signature <em>callback(resource)</em> to be called.</p>
</dd>
</dl>
</dd></dl>
2021-08-19 12:11:22 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.set_remote_identified_callback">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_remote_identified_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_remote_identified_callback" title="Permalink to this definition">#</a></dt>
2021-08-19 12:11:22 +00:00
<dd><p>Registers a function to be called when an initiating peer has
identified over this link.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p><strong>callback</strong> A function or method with the signature <em>callback(link, identity)</em> to be called.</p>
2021-08-19 12:11:22 +00:00
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Link.set_resource_strategy">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">set_resource_strategy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">resource_strategy</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Link.set_resource_strategy" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Sets the resource strategy for the link.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>resource_strategy</strong> One of <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_NONE</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_ALL</span></code> or <code class="docutils literal notranslate"><span class="pre">RNS.Link.ACCEPT_APP</span></code>. If <code class="docutils literal notranslate"><span class="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>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Raises<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p><em>TypeError</em> if the resource strategy is unsupported.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-requestreceipt"><h3> Request Receipt </h3></p>
2021-09-02 18:35:42 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.RequestReceipt">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">RequestReceipt</span></span><a class="headerlink" href="#RNS.RequestReceipt" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><p>An instance of this class is returned by the <code class="docutils literal notranslate"><span class="pre">request</span></code> method of <code class="docutils literal notranslate"><span class="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>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RequestReceipt.get_request_id">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_request_id</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_request_id" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-odd"><p>The request ID as <em>bytes</em>.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RequestReceipt.get_status">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_status</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_status" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-odd"><p>The current status of the request, one of <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.FAILED</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.SENT</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.DELIVERED</span></code>, <code class="docutils literal notranslate"><span class="pre">RNS.RequestReceipt.READY</span></code>.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RequestReceipt.get_progress">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_progress</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_progress" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-odd"><p>The progress of a response being received as a <em>float</em> between 0.0 and 1.0.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RequestReceipt.get_response">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_response</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_response" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-odd"><p>The response as <em>bytes</em> if it is ready, otherwise <em>None</em>.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RequestReceipt.get_response_time">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_response_time</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RequestReceipt.get_response_time" title="Permalink to this definition">#</a></dt>
2021-09-02 18:35:42 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-09-02 18:35:42 +00:00
<dd class="field-odd"><p>The response time of the request in seconds.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-resource"><h3> Resource </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Resource">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Resource</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">link</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">advertise</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">auto_compress</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">progress_callback</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>The Resource class allows transferring arbitrary amounts
of data over a link. It will automatically handle sequencing,
compression, coordination and checksumming.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><ul class="simple">
2021-08-20 21:29:06 +00:00
<li><p><strong>data</strong> The data to be transferred. Can be <em>bytes</em> or an open <em>file handle</em>. See the <a class="reference internal" href="examples.html#example-filetransfer"><span class="std std-ref">Filetransfer Example</span></a> for details.</p></li>
2021-05-16 21:40:49 +00:00
<li><p><strong>link</strong> The <a class="reference internal" href="#api-link"><span class="std std-ref">RNS.Link</span></a> instance on which to transfer the data.</p></li>
2021-09-02 18:35:42 +00:00
<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>
2021-05-16 21:40:49 +00:00
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.advertise">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">advertise</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.advertise" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Advertise the resource. If the other end of the link accepts
the resource advertisement it will begin transferring.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.cancel">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">cancel</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.cancel" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Cancels transferring the resource.</p>
</dd></dl>
<dl class="py method">
2021-09-02 18:35:42 +00:00
<dt class="sig sig-object py" id="RNS.Resource.get_progress">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_progress</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_progress" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p>The current progress of the resource transfer as a <em>float</em> between 0.0 and 1.0.</p>
</dd>
</dl>
</dd></dl>
2022-05-22 17:08:32 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.get_transfer_size">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_transfer_size</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_transfer_size" title="Permalink to this definition">#</a></dt>
2022-05-22 17:08:32 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p>The number of bytes needed to transfer the resource.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.get_data_size">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_data_size</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_data_size" title="Permalink to this definition">#</a></dt>
2022-05-22 17:08:32 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p>The total data size of the resource.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.get_parts">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_parts</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_parts" title="Permalink to this definition">#</a></dt>
2022-05-22 17:08:32 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p>The number of parts the resource will be transferred in.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.get_segments">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_segments</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_segments" title="Permalink to this definition">#</a></dt>
2022-05-22 17:08:32 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p>The number of segments the resource is divided into.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.get_hash">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">get_hash</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.get_hash" title="Permalink to this definition">#</a></dt>
2022-05-22 17:08:32 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p>The hash of the resource.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Resource.is_compressed">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">is_compressed</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Resource.is_compressed" title="Permalink to this definition">#</a></dt>
2022-05-22 17:08:32 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2022-05-22 17:08:32 +00:00
<dd class="field-odd"><p>Whether the resource is compressed.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
</dd></dl>
2023-03-02 11:47:55 +00:00
<p id="api-channel"><h3> Channel </h3></p>
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Channel.Channel">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.Channel.</span></span><span class="sig-name descname"><span class="pre">Channel</span></span><a class="headerlink" href="#RNS.Channel.Channel" title="Permalink to this definition">#</a></dt>
<dd><p>Provides reliable delivery of messages over
a link.</p>
<p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> differs from <code class="docutils literal notranslate"><span class="pre">Request</span></code> and
<code class="docutils literal notranslate"><span class="pre">Resource</span></code> in some important ways:</p>
<blockquote>
<div><dl class="simple">
<dt><strong>Continuous</strong></dt><dd><p>Messages can be sent or received as long as
the <code class="docutils literal notranslate"><span class="pre">Link</span></code> is open.</p>
</dd>
<dt><strong>Bi-directional</strong></dt><dd><p>Messages can be sent in either direction on
the <code class="docutils literal notranslate"><span class="pre">Link</span></code>; neither end is the client or
server.</p>
</dd>
<dt><strong>Size-constrained</strong></dt><dd><p>Messages must be encoded into a single packet.</p>
</dd>
</dl>
</div></blockquote>
<p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> is similar to <code class="docutils literal notranslate"><span class="pre">Packet</span></code>, except that it
provides reliable delivery (automatic retries) as well
as a structure for exchanging several types of
messages over the <code class="docutils literal notranslate"><span class="pre">Link</span></code>.</p>
<p><code class="docutils literal notranslate"><span class="pre">Channel</span></code> is not instantiated directly, but rather
obtained from a <code class="docutils literal notranslate"><span class="pre">Link</span></code> with <code class="docutils literal notranslate"><span class="pre">get_channel()</span></code>.</p>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Channel.Channel.register_message_type">
<span class="sig-name descname"><span class="pre">register_message_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message_class</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Type</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#RNS.MessageBase" title="RNS.Channel.MessageBase"><span class="pre">MessageBase</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Channel.Channel.register_message_type" title="Permalink to this definition">#</a></dt>
<dd><p>Register a message class for reception over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p>
<p>Message classes must extend <code class="docutils literal notranslate"><span class="pre">MessageBase</span></code>.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p><strong>message_class</strong> Class to register</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Channel.Channel.add_message_handler">
<span class="sig-name descname"><span class="pre">add_message_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">MessageCallbackType</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Channel.Channel.add_message_handler" title="Permalink to this definition">#</a></dt>
<dd><p>Add a handler for incoming messages. A handler
has the following signature:</p>
<p><code class="docutils literal notranslate"><span class="pre">(message:</span> <span class="pre">MessageBase)</span> <span class="pre">-&gt;</span> <span class="pre">bool</span></code></p>
<p>Handlers are processed in the order they are
added. If any handler returns True, processing
of the message stops; handlers after the
returning handler will not be called.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p><strong>callback</strong> Function to call</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Channel.Channel.remove_message_handler">
<span class="sig-name descname"><span class="pre">remove_message_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">MessageCallbackType</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Channel.Channel.remove_message_handler" title="Permalink to this definition">#</a></dt>
<dd><p>Remove a handler added with <code class="docutils literal notranslate"><span class="pre">add_message_handler</span></code>.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p><strong>callback</strong> handler to remove</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Channel.Channel.is_ready_to_send">
<span class="sig-name descname"><span class="pre">is_ready_to_send</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="headerlink" href="#RNS.Channel.Channel.is_ready_to_send" title="Permalink to this definition">#</a></dt>
<dd><p>Check if <code class="docutils literal notranslate"><span class="pre">Channel</span></code> is ready to send.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p>True if ready</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Channel.Channel.send">
<span class="sig-name descname"><span class="pre">send</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">message</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.MessageBase" title="RNS.Channel.MessageBase"><span class="pre">MessageBase</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Envelope</span></span></span><a class="headerlink" href="#RNS.Channel.Channel.send" title="Permalink to this definition">#</a></dt>
<dd><p>Send a message. If a message send is attempted and
<code class="docutils literal notranslate"><span class="pre">Channel</span></code> is not ready, an exception is thrown.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p><strong>message</strong> an instance of a <code class="docutils literal notranslate"><span class="pre">MessageBase</span></code> subclass</p>
</dd>
</dl>
</dd></dl>
<dl class="py property">
<dt class="sig sig-object py" id="RNS.Channel.Channel.MDU">
<em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">MDU</span></span><a class="headerlink" href="#RNS.Channel.Channel.MDU" title="Permalink to this definition">#</a></dt>
<dd><p>Maximum Data Unit: the number of bytes available
for a message to consume in a single send. This
value is adjusted from the <code class="docutils literal notranslate"><span class="pre">Link</span></code> MDU to accommodate
message header information.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p>number of bytes available</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<p id="api-messsagebase"><h3> MessageBase </h3></p>
<dl class="py class">
<dt class="sig sig-object py" id="RNS.MessageBase">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">MessageBase</span></span><a class="headerlink" href="#RNS.MessageBase" title="Permalink to this definition">#</a></dt>
<dd><p>Base type for any messages sent or received on a Channel.
Subclasses must define the two abstract methods as well as
the <code class="docutils literal notranslate"><span class="pre">MSGTYPE</span></code> class variable.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="RNS.MessageBase.MSGTYPE">
<span class="sig-name descname"><span class="pre">MSGTYPE</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#RNS.MessageBase.MSGTYPE" title="Permalink to this definition">#</a></dt>
<dd><p>Defines a unique identifier for a message class.</p>
<ul class="simple">
<li><p>Must be unique within all classes registered with a <code class="docutils literal notranslate"><span class="pre">Channel</span></code></p></li>
<li><p>Must be less than <code class="docutils literal notranslate"><span class="pre">0xf000</span></code>. Values greater than or equal to <code class="docutils literal notranslate"><span class="pre">0xf000</span></code> are reserved.</p></li>
</ul>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.MessageBase.pack">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">pack</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bytes</span></span></span><a class="headerlink" href="#RNS.MessageBase.pack" title="Permalink to this definition">#</a></dt>
<dd><p>Create and return the binary representation of the message</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Returns<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p>binary representation of message</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.MessageBase.unpack">
<em class="property"><span class="pre">abstract</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">unpack</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">raw</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.MessageBase.unpack" title="Permalink to this definition">#</a></dt>
<dd><p>Populate message from binary representation</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-02 11:47:55 +00:00
<dd class="field-odd"><p><strong>raw</strong> binary representation</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
2023-03-03 21:16:13 +00:00
<p id="api-buffer"><h3> Buffer </h3></p>
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Buffer">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Buffer</span></span><a class="headerlink" href="#RNS.Buffer" title="Permalink to this definition">#</a></dt>
<dd><p>Static functions for creating buffered streams that send
and receive over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p>
<p>These functions use <code class="docutils literal notranslate"><span class="pre">BufferedReader</span></code>, <code class="docutils literal notranslate"><span class="pre">BufferedWriter</span></code>,
and <code class="docutils literal notranslate"><span class="pre">BufferedRWPair</span></code> to add buffering to
<code class="docutils literal notranslate"><span class="pre">RawChannelReader</span></code> and <code class="docutils literal notranslate"><span class="pre">RawChannelWriter</span></code>.</p>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Buffer.create_reader">
2023-08-15 08:23:51 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_reader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ready_callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">BufferedReader</span></span></span><a class="headerlink" href="#RNS.Buffer.create_reader" title="Permalink to this definition">#</a></dt>
2023-03-03 21:16:13 +00:00
<dd><p>Create a buffered reader that reads binary data sent
over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>, with an optional callback when
new data is available.</p>
<p>Callback signature: <code class="docutils literal notranslate"><span class="pre">(ready_bytes:</span> <span class="pre">int)</span> <span class="pre">-&gt;</span> <span class="pre">None</span></code></p>
<p>For more information on the reader-specific functions
of this object, see the Python documentation for
<code class="docutils literal notranslate"><span class="pre">BufferedReader</span></code></p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>stream_id</strong> the local stream id to receive from</p></li>
<li><p><strong>channel</strong> the channel to receive on</p></li>
<li><p><strong>ready_callback</strong> function to call when new data is available</p></li>
</ul>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-even"><p>a BufferedReader object</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Buffer.create_writer">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_writer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">BufferedWriter</span></span></span><a class="headerlink" href="#RNS.Buffer.create_writer" title="Permalink to this definition">#</a></dt>
<dd><p>Create a buffered writer that writes binary data over
a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p>
<p>For more information on the writer-specific functions
of this object, see the Python documentation for
<code class="docutils literal notranslate"><span class="pre">BufferedWriter</span></code></p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>stream_id</strong> the remote stream id to send to</p></li>
<li><p><strong>channel</strong> the channel to send on</p></li>
</ul>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-even"><p>a BufferedWriter object</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Buffer.create_bidirectional_buffer">
2023-08-15 08:23:51 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">create_bidirectional_buffer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">receive_stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">send_stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ready_callback</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">BufferedRWPair</span></span></span><a class="headerlink" href="#RNS.Buffer.create_bidirectional_buffer" title="Permalink to this definition">#</a></dt>
2023-03-03 21:16:13 +00:00
<dd><p>Create a buffered reader/writer pair that reads and
writes binary data over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>, with an
optional callback when new data is available.</p>
<p>Callback signature: <code class="docutils literal notranslate"><span class="pre">(ready_bytes:</span> <span class="pre">int)</span> <span class="pre">-&gt;</span> <span class="pre">None</span></code></p>
<p>For more information on the reader-specific functions
of this object, see the Python documentation for
<code class="docutils literal notranslate"><span class="pre">BufferedRWPair</span></code></p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>receive_stream_id</strong> the local stream id to receive at</p></li>
<li><p><strong>send_stream_id</strong> the remote stream id to send to</p></li>
<li><p><strong>channel</strong> the channel to send and receive on</p></li>
<li><p><strong>ready_callback</strong> function to call when new data is available</p></li>
</ul>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-even"><p>a BufferedRWPair object</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<p id="api-rawchannelreader"><h3> RawChannelReader </h3></p>
<dl class="py class">
<dt class="sig sig-object py" id="RNS.RawChannelReader">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">RawChannelReader</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader" title="Permalink to this definition">#</a></dt>
<dd><p>An implementation of RawIOBase that receives
binary stream data sent over a <code class="docutils literal notranslate"><span class="pre">Channel</span></code>.</p>
<blockquote>
<div><p>This class generally need not be instantiated directly.
Use <a class="reference internal" href="#RNS.Buffer.create_reader" title="RNS.Buffer.create_reader"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_reader()</span></code></a>,
<a class="reference internal" href="#RNS.Buffer.create_writer" title="RNS.Buffer.create_writer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_writer()</span></code></a>, and
<a class="reference internal" href="#RNS.Buffer.create_bidirectional_buffer" title="RNS.Buffer.create_bidirectional_buffer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_bidirectional_buffer()</span></code></a> functions
to create buffered streams with optional callbacks.</p>
<p>For additional information on the API of this
object, see the Python documentation for
<code class="docutils literal notranslate"><span class="pre">RawIOBase</span></code>.</p>
</div></blockquote>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RawChannelReader.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader.__init__" title="Permalink to this definition">#</a></dt>
<dd><p>Create a raw channel reader.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>stream_id</strong> local stream id to receive at</p></li>
<li><p><strong>channel</strong> <code class="docutils literal notranslate"><span class="pre">Channel</span></code> object to receive from</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RawChannelReader.add_ready_callback">
<span class="sig-name descname"><span class="pre">add_ready_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cb</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader.add_ready_callback" title="Permalink to this definition">#</a></dt>
<dd><p>Add a function to be called when new data is available.
The function should have the signature <code class="docutils literal notranslate"><span class="pre">(ready_bytes:</span> <span class="pre">int)</span> <span class="pre">-&gt;</span> <span class="pre">None</span></code></p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><p><strong>cb</strong> function to call</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RawChannelReader.remove_ready_callback">
<span class="sig-name descname"><span class="pre">remove_ready_callback</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cb</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span><span class="p"><span class="pre">[</span></span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">None</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelReader.remove_ready_callback" title="Permalink to this definition">#</a></dt>
<dd><p>Remove a function added with <a class="reference internal" href="#RNS.RawChannelReader.add_ready_callback" title="RNS.RawChannelReader.add_ready_callback"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.RawChannelReader.add_ready_callback()</span></code></a></p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><p><strong>cb</strong> function to remove</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
<p id="api-rawchannelwriter"><h3> RawChannelWriter </h3></p>
<dl class="py class">
<dt class="sig sig-object py" id="RNS.RawChannelWriter">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">RawChannelWriter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelWriter" title="Permalink to this definition">#</a></dt>
<dd><p>An implementation of RawIOBase that receives
binary stream data sent over a channel.</p>
<blockquote>
<div><p>This class generally need not be instantiated directly.
Use <a class="reference internal" href="#RNS.Buffer.create_reader" title="RNS.Buffer.create_reader"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_reader()</span></code></a>,
<a class="reference internal" href="#RNS.Buffer.create_writer" title="RNS.Buffer.create_writer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_writer()</span></code></a>, and
<a class="reference internal" href="#RNS.Buffer.create_bidirectional_buffer" title="RNS.Buffer.create_bidirectional_buffer"><code class="xref py py-func docutils literal notranslate"><span class="pre">RNS.Buffer.create_bidirectional_buffer()</span></code></a> functions
to create buffered streams with optional callbacks.</p>
<p>For additional information on the API of this
object, see the Python documentation for
<code class="docutils literal notranslate"><span class="pre">RawIOBase</span></code>.</p>
</div></blockquote>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.RawChannelWriter.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stream_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#RNS.Channel.Channel" title="RNS.Channel.Channel"><span class="pre">Channel</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.RawChannelWriter.__init__" title="Permalink to this definition">#</a></dt>
<dd><p>Create a raw channel writer.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2023-03-03 21:16:13 +00:00
<dd class="field-odd"><ul class="simple">
<li><p><strong>stream_id</strong> remote stream id to sent do</p></li>
<li><p><strong>channel</strong> <code class="docutils literal notranslate"><span class="pre">Channel</span></code> object to send on</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
2022-09-30 11:09:10 +00:00
<p id="api-transport"><h3> Transport </h3></p>
2021-05-16 21:40:49 +00:00
<dl class="py class">
<dt class="sig sig-object py" id="RNS.Transport">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">RNS.</span></span><span class="sig-name descname"><span class="pre">Transport</span></span><a class="headerlink" href="#RNS.Transport" title="Permalink to this definition">#</a></dt>
2021-09-18 21:13:36 +00:00
<dd><p>Through static methods of this class you can interact with the
Transport system of Reticulum.</p>
2021-09-02 18:35:42 +00:00
<dl class="py attribute">
2021-08-28 18:10:00 +00:00
<dt class="sig sig-object py" id="RNS.Transport.PATHFINDER_M">
2022-09-30 16:43:04 +00:00
<span class="sig-name descname"><span class="pre">PATHFINDER_M</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">128</span></em><a class="headerlink" href="#RNS.Transport.PATHFINDER_M" title="Permalink to this definition">#</a></dt>
2021-08-28 18:10:00 +00:00
<dd><p>Maximum amount of hops that Reticulum will transport a packet.</p>
</dd></dl>
<dl class="py method">
2021-05-16 21:40:49 +00:00
<dt class="sig sig-object py" id="RNS.Transport.register_announce_handler">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">register_announce_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">handler</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.register_announce_handler" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Registers an announce handler.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="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 <a class="reference internal" href="examples.html#example-announce"><span class="std std-ref">Announce Example</span></a> for more info.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Transport.deregister_announce_handler">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">deregister_announce_handler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">handler</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.deregister_announce_handler" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Deregisters an announce handler.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>handler</strong> The announce handler to be deregistered.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Transport.has_path">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">has_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.has_path" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-odd"><p><strong>destination_hash</strong> A destination hash as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-05-16 21:40:49 +00:00
<dd class="field-even"><p><em>True</em> if a path to the destination is known, otherwise <em>False</em>.</p>
</dd>
</dl>
</dd></dl>
2021-08-28 18:10:00 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Transport.hops_to">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hops_to</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.hops_to" title="Permalink to this definition">#</a></dt>
2021-08-28 18:10:00 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-08-28 18:10:00 +00:00
<dd class="field-odd"><p><strong>destination_hash</strong> A destination hash as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-08-28 18:10:00 +00:00
<dd class="field-even"><p>The number of hops to the specified destination, or <code class="docutils literal notranslate"><span class="pre">RNS.Transport.PATHFINDER_M</span></code> if the number of hops is unknown.</p>
</dd>
</dl>
</dd></dl>
2021-09-25 19:39:31 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Transport.next_hop">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">next_hop</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.next_hop" title="Permalink to this definition">#</a></dt>
2021-09-25 19:39:31 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-09-25 19:39:31 +00:00
<dd class="field-odd"><p><strong>destination_hash</strong> A destination hash as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-09-25 19:39:31 +00:00
<dd class="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>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Transport.next_hop_interface">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">next_hop_interface</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.next_hop_interface" title="Permalink to this definition">#</a></dt>
2021-09-25 19:39:31 +00:00
<dd><dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2021-09-25 19:39:31 +00:00
<dd class="field-odd"><p><strong>destination_hash</strong> A destination hash as <em>bytes</em>.</p>
</dd>
2023-06-29 14:52:06 +00:00
<dt class="field-even">Returns<span class="colon">:</span></dt>
2021-09-25 19:39:31 +00:00
<dd class="field-even"><p>The interface for the next hop to the specified destination, or <em>None</em> if the interface is unknown.</p>
</dd>
</dl>
</dd></dl>
2021-05-16 21:40:49 +00:00
<dl class="py method">
<dt class="sig sig-object py" id="RNS.Transport.request_path">
2022-09-30 16:43:04 +00:00
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">request_path</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">destination_hash</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">on_interface</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tag</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">recursive</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#RNS.Transport.request_path" title="Permalink to this definition">#</a></dt>
2021-05-16 21:40:49 +00:00
<dd><p>Requests a path to the destination from the network. If
another reachable peer on the network knows a path, it
will announce it.</p>
<dl class="field-list simple">
2023-06-29 14:52:06 +00:00
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
2022-04-20 19:24:01 +00:00
<dd class="field-odd"><ul class="simple">
<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>
</ul>
2021-05-16 21:40:49 +00:00
</dd>
</dl>
</dd></dl>
</dd></dl>
2022-09-29 22:02:15 +00:00
</section>
2021-05-16 21:40:49 +00:00
2022-09-30 16:43:04 +00:00
</article>
</div>
<footer>
<div class="related-pages">
<a class="prev-page" href="support.html">
<svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
<div class="page-info">
<div class="context">
<span>Previous</span>
</div>
<div class="title">Support Reticulum</div>
</div>
</a>
</div>
<div class="bottom-of-page">
<div class="left-details">
<div class="copyright">
Copyright &#169; 2023, Mark Qvist
2022-09-30 16:43:04 +00:00
</div>
Generated with <a href="https://www.sphinx-doc.org/">Sphinx</a> and
<a href="https://github.com/pradyunsg/furo">Furo</a>
</div>
<div class="right-details">
<div class="icons">
</div>
2021-05-16 21:40:49 +00:00
</div>
</div>
2022-09-30 16:43:04 +00:00
</footer>
</div>
<aside class="toc-drawer">
<div class="toc-sticky toc-scroll">
<div class="toc-title-container">
<span class="toc-title">
On this page
</span>
</div>
<div class="toc-tree-container">
<div class="toc-tree">
<ul>
2021-05-16 21:40:49 +00:00
<li><a class="reference internal" href="#">API Reference</a><ul>
2022-09-29 22:02:15 +00:00
<li><a class="reference internal" href="#RNS.Reticulum"><code class="docutils literal notranslate"><span class="pre">Reticulum</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Reticulum.MTU"><code class="docutils literal notranslate"><span class="pre">MTU</span></code></a></li>
<li><a class="reference internal" href="#RNS.Reticulum.ANNOUNCE_CAP"><code class="docutils literal notranslate"><span class="pre">ANNOUNCE_CAP</span></code></a></li>
<li><a class="reference internal" href="#RNS.Reticulum.should_use_implicit_proof"><code class="docutils literal notranslate"><span class="pre">should_use_implicit_proof()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Reticulum.transport_enabled"><code class="docutils literal notranslate"><span class="pre">transport_enabled()</span></code></a></li>
2023-09-21 16:32:46 +00:00
<li><a class="reference internal" href="#RNS.Reticulum.probe_destination_enabled"><code class="docutils literal notranslate"><span class="pre">probe_destination_enabled()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.Identity"><code class="docutils literal notranslate"><span class="pre">Identity</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Identity.CURVE"><code class="docutils literal notranslate"><span class="pre">CURVE</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.KEYSIZE"><code class="docutils literal notranslate"><span class="pre">KEYSIZE</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.TRUNCATED_HASHLENGTH"><code class="docutils literal notranslate"><span class="pre">TRUNCATED_HASHLENGTH</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.recall"><code class="docutils literal notranslate"><span class="pre">recall()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.recall_app_data"><code class="docutils literal notranslate"><span class="pre">recall_app_data()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.full_hash"><code class="docutils literal notranslate"><span class="pre">full_hash()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.truncated_hash"><code class="docutils literal notranslate"><span class="pre">truncated_hash()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.get_random_hash"><code class="docutils literal notranslate"><span class="pre">get_random_hash()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.from_bytes"><code class="docutils literal notranslate"><span class="pre">from_bytes()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.from_file"><code class="docutils literal notranslate"><span class="pre">from_file()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.to_file"><code class="docutils literal notranslate"><span class="pre">to_file()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.get_private_key"><code class="docutils literal notranslate"><span class="pre">get_private_key()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.get_public_key"><code class="docutils literal notranslate"><span class="pre">get_public_key()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.load_private_key"><code class="docutils literal notranslate"><span class="pre">load_private_key()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.load_public_key"><code class="docutils literal notranslate"><span class="pre">load_public_key()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.encrypt"><code class="docutils literal notranslate"><span class="pre">encrypt()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.decrypt"><code class="docutils literal notranslate"><span class="pre">decrypt()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.sign"><code class="docutils literal notranslate"><span class="pre">sign()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Identity.validate"><code class="docutils literal notranslate"><span class="pre">validate()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.Destination"><code class="docutils literal notranslate"><span class="pre">Destination</span></code></a><ul>
2022-10-04 07:06:29 +00:00
<li><a class="reference internal" href="#RNS.Destination.expand_name"><code class="docutils literal notranslate"><span class="pre">expand_name()</span></code></a></li>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Destination.app_and_aspects_from_name"><code class="docutils literal notranslate"><span class="pre">app_and_aspects_from_name()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.hash_from_name_and_identity"><code class="docutils literal notranslate"><span class="pre">hash_from_name_and_identity()</span></code></a></li>
2022-10-04 07:34:52 +00:00
<li><a class="reference internal" href="#RNS.Destination.hash"><code class="docutils literal notranslate"><span class="pre">hash()</span></code></a></li>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Destination.announce"><code class="docutils literal notranslate"><span class="pre">announce()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.accepts_links"><code class="docutils literal notranslate"><span class="pre">accepts_links()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.set_link_established_callback"><code class="docutils literal notranslate"><span class="pre">set_link_established_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.set_packet_callback"><code class="docutils literal notranslate"><span class="pre">set_packet_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.set_proof_requested_callback"><code class="docutils literal notranslate"><span class="pre">set_proof_requested_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.set_proof_strategy"><code class="docutils literal notranslate"><span class="pre">set_proof_strategy()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.register_request_handler"><code class="docutils literal notranslate"><span class="pre">register_request_handler()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.deregister_request_handler"><code class="docutils literal notranslate"><span class="pre">deregister_request_handler()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.create_keys"><code class="docutils literal notranslate"><span class="pre">create_keys()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.get_private_key"><code class="docutils literal notranslate"><span class="pre">get_private_key()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.load_private_key"><code class="docutils literal notranslate"><span class="pre">load_private_key()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.encrypt"><code class="docutils literal notranslate"><span class="pre">encrypt()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.decrypt"><code class="docutils literal notranslate"><span class="pre">decrypt()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.sign"><code class="docutils literal notranslate"><span class="pre">sign()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.set_default_app_data"><code class="docutils literal notranslate"><span class="pre">set_default_app_data()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Destination.clear_default_app_data"><code class="docutils literal notranslate"><span class="pre">clear_default_app_data()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.Packet"><code class="docutils literal notranslate"><span class="pre">Packet</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Packet.ENCRYPTED_MDU"><code class="docutils literal notranslate"><span class="pre">ENCRYPTED_MDU</span></code></a></li>
<li><a class="reference internal" href="#RNS.Packet.PLAIN_MDU"><code class="docutils literal notranslate"><span class="pre">PLAIN_MDU</span></code></a></li>
<li><a class="reference internal" href="#RNS.Packet.send"><code class="docutils literal notranslate"><span class="pre">send()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Packet.resend"><code class="docutils literal notranslate"><span class="pre">resend()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.PacketReceipt"><code class="docutils literal notranslate"><span class="pre">PacketReceipt</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.PacketReceipt.get_status"><code class="docutils literal notranslate"><span class="pre">get_status()</span></code></a></li>
<li><a class="reference internal" href="#RNS.PacketReceipt.get_rtt"><code class="docutils literal notranslate"><span class="pre">get_rtt()</span></code></a></li>
<li><a class="reference internal" href="#RNS.PacketReceipt.set_timeout"><code class="docutils literal notranslate"><span class="pre">set_timeout()</span></code></a></li>
<li><a class="reference internal" href="#RNS.PacketReceipt.set_delivery_callback"><code class="docutils literal notranslate"><span class="pre">set_delivery_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.PacketReceipt.set_timeout_callback"><code class="docutils literal notranslate"><span class="pre">set_timeout_callback()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.Link"><code class="docutils literal notranslate"><span class="pre">Link</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Link.CURVE"><code class="docutils literal notranslate"><span class="pre">CURVE</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.ESTABLISHMENT_TIMEOUT_PER_HOP"><code class="docutils literal notranslate"><span class="pre">ESTABLISHMENT_TIMEOUT_PER_HOP</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.KEEPALIVE_TIMEOUT_FACTOR"><code class="docutils literal notranslate"><span class="pre">KEEPALIVE_TIMEOUT_FACTOR</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.STALE_GRACE"><code class="docutils literal notranslate"><span class="pre">STALE_GRACE</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.KEEPALIVE"><code class="docutils literal notranslate"><span class="pre">KEEPALIVE</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.STALE_TIME"><code class="docutils literal notranslate"><span class="pre">STALE_TIME</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.identify"><code class="docutils literal notranslate"><span class="pre">identify()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.request"><code class="docutils literal notranslate"><span class="pre">request()</span></code></a></li>
2023-02-17 08:53:27 +00:00
<li><a class="reference internal" href="#RNS.Link.get_establishment_rate"><code class="docutils literal notranslate"><span class="pre">get_establishment_rate()</span></code></a></li>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Link.no_inbound_for"><code class="docutils literal notranslate"><span class="pre">no_inbound_for()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.no_outbound_for"><code class="docutils literal notranslate"><span class="pre">no_outbound_for()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.inactive_for"><code class="docutils literal notranslate"><span class="pre">inactive_for()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.get_remote_identity"><code class="docutils literal notranslate"><span class="pre">get_remote_identity()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.teardown"><code class="docutils literal notranslate"><span class="pre">teardown()</span></code></a></li>
2023-03-02 11:47:55 +00:00
<li><a class="reference internal" href="#RNS.Link.get_channel"><code class="docutils literal notranslate"><span class="pre">get_channel()</span></code></a></li>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Link.set_link_closed_callback"><code class="docutils literal notranslate"><span class="pre">set_link_closed_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.set_packet_callback"><code class="docutils literal notranslate"><span class="pre">set_packet_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.set_resource_callback"><code class="docutils literal notranslate"><span class="pre">set_resource_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.set_resource_started_callback"><code class="docutils literal notranslate"><span class="pre">set_resource_started_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.set_resource_concluded_callback"><code class="docutils literal notranslate"><span class="pre">set_resource_concluded_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.set_remote_identified_callback"><code class="docutils literal notranslate"><span class="pre">set_remote_identified_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Link.set_resource_strategy"><code class="docutils literal notranslate"><span class="pre">set_resource_strategy()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.RequestReceipt"><code class="docutils literal notranslate"><span class="pre">RequestReceipt</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.RequestReceipt.get_request_id"><code class="docutils literal notranslate"><span class="pre">get_request_id()</span></code></a></li>
<li><a class="reference internal" href="#RNS.RequestReceipt.get_status"><code class="docutils literal notranslate"><span class="pre">get_status()</span></code></a></li>
<li><a class="reference internal" href="#RNS.RequestReceipt.get_progress"><code class="docutils literal notranslate"><span class="pre">get_progress()</span></code></a></li>
<li><a class="reference internal" href="#RNS.RequestReceipt.get_response"><code class="docutils literal notranslate"><span class="pre">get_response()</span></code></a></li>
<li><a class="reference internal" href="#RNS.RequestReceipt.get_response_time"><code class="docutils literal notranslate"><span class="pre">get_response_time()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
<li><a class="reference internal" href="#RNS.Resource"><code class="docutils literal notranslate"><span class="pre">Resource</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Resource.advertise"><code class="docutils literal notranslate"><span class="pre">advertise()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.cancel"><code class="docutils literal notranslate"><span class="pre">cancel()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.get_progress"><code class="docutils literal notranslate"><span class="pre">get_progress()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.get_transfer_size"><code class="docutils literal notranslate"><span class="pre">get_transfer_size()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.get_data_size"><code class="docutils literal notranslate"><span class="pre">get_data_size()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.get_parts"><code class="docutils literal notranslate"><span class="pre">get_parts()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.get_segments"><code class="docutils literal notranslate"><span class="pre">get_segments()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.get_hash"><code class="docutils literal notranslate"><span class="pre">get_hash()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Resource.is_compressed"><code class="docutils literal notranslate"><span class="pre">is_compressed()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
2023-03-02 11:47:55 +00:00
<li><a class="reference internal" href="#RNS.Channel.Channel"><code class="docutils literal notranslate"><span class="pre">Channel</span></code></a><ul>
<li><a class="reference internal" href="#RNS.Channel.Channel.register_message_type"><code class="docutils literal notranslate"><span class="pre">register_message_type()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Channel.Channel.add_message_handler"><code class="docutils literal notranslate"><span class="pre">add_message_handler()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Channel.Channel.remove_message_handler"><code class="docutils literal notranslate"><span class="pre">remove_message_handler()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Channel.Channel.is_ready_to_send"><code class="docutils literal notranslate"><span class="pre">is_ready_to_send()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Channel.Channel.send"><code class="docutils literal notranslate"><span class="pre">send()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Channel.Channel.MDU"><code class="docutils literal notranslate"><span class="pre">MDU</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#RNS.MessageBase"><code class="docutils literal notranslate"><span class="pre">MessageBase</span></code></a><ul>
<li><a class="reference internal" href="#RNS.MessageBase.MSGTYPE"><code class="docutils literal notranslate"><span class="pre">MSGTYPE</span></code></a></li>
<li><a class="reference internal" href="#RNS.MessageBase.pack"><code class="docutils literal notranslate"><span class="pre">pack()</span></code></a></li>
<li><a class="reference internal" href="#RNS.MessageBase.unpack"><code class="docutils literal notranslate"><span class="pre">unpack()</span></code></a></li>
</ul>
</li>
2023-03-03 21:16:13 +00:00
<li><a class="reference internal" href="#RNS.Buffer"><code class="docutils literal notranslate"><span class="pre">Buffer</span></code></a><ul>
<li><a class="reference internal" href="#RNS.Buffer.create_reader"><code class="docutils literal notranslate"><span class="pre">create_reader()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Buffer.create_writer"><code class="docutils literal notranslate"><span class="pre">create_writer()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Buffer.create_bidirectional_buffer"><code class="docutils literal notranslate"><span class="pre">create_bidirectional_buffer()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#RNS.RawChannelReader"><code class="docutils literal notranslate"><span class="pre">RawChannelReader</span></code></a><ul>
<li><a class="reference internal" href="#RNS.RawChannelReader.__init__"><code class="docutils literal notranslate"><span class="pre">__init__()</span></code></a></li>
<li><a class="reference internal" href="#RNS.RawChannelReader.add_ready_callback"><code class="docutils literal notranslate"><span class="pre">add_ready_callback()</span></code></a></li>
<li><a class="reference internal" href="#RNS.RawChannelReader.remove_ready_callback"><code class="docutils literal notranslate"><span class="pre">remove_ready_callback()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#RNS.RawChannelWriter"><code class="docutils literal notranslate"><span class="pre">RawChannelWriter</span></code></a><ul>
<li><a class="reference internal" href="#RNS.RawChannelWriter.__init__"><code class="docutils literal notranslate"><span class="pre">__init__()</span></code></a></li>
</ul>
</li>
2022-09-29 22:02:15 +00:00
<li><a class="reference internal" href="#RNS.Transport"><code class="docutils literal notranslate"><span class="pre">Transport</span></code></a><ul>
2022-09-30 11:09:10 +00:00
<li><a class="reference internal" href="#RNS.Transport.PATHFINDER_M"><code class="docutils literal notranslate"><span class="pre">PATHFINDER_M</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.register_announce_handler"><code class="docutils literal notranslate"><span class="pre">register_announce_handler()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.deregister_announce_handler"><code class="docutils literal notranslate"><span class="pre">deregister_announce_handler()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.has_path"><code class="docutils literal notranslate"><span class="pre">has_path()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.hops_to"><code class="docutils literal notranslate"><span class="pre">hops_to()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.next_hop"><code class="docutils literal notranslate"><span class="pre">next_hop()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.next_hop_interface"><code class="docutils literal notranslate"><span class="pre">next_hop_interface()</span></code></a></li>
<li><a class="reference internal" href="#RNS.Transport.request_path"><code class="docutils literal notranslate"><span class="pre">request_path()</span></code></a></li>
2022-09-29 22:02:15 +00:00
</ul>
</li>
2021-05-16 21:40:49 +00:00
</ul>
</li>
</ul>
2022-09-30 16:43:04 +00:00
</div>
2021-05-16 21:40:49 +00:00
</div>
</div>
2022-09-30 16:43:04 +00:00
</aside>
</div>
2023-09-21 11:51:03 +00:00
</div><script data-url_root="./" id="documentation_options" src="_static/documentation_options.js?v=c96a9f3e"></script>
2023-08-15 08:23:51 +00:00
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=4825356b"></script>
<script src="_static/scripts/furo.js?v=2c7c1115"></script>
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
<script src="_static/copybutton.js?v=f281be69"></script>
2022-09-30 16:43:04 +00:00
</body>
2021-05-16 21:40:49 +00:00
</html>