Commit f317ec9d authored by Dennis Suermann's avatar Dennis Suermann
Browse files

Add docs

parent e1c8fe32
This diff is collapsed.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.10.0" />
<title>RelayModel.ConceptChange API documentation</title>
<meta name="description" content="" />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>RelayModel.ConceptChange</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">import math
import statistics
def calculate_windows(window_a, window_b):
&#34;&#34;&#34;Calculates a change rate of two given windows provided as lists.
The two lists should be of same size.
Args:
window_a (list): Holds the first window
window_b (list): Holds the second window
Returns:
int: A change rate of the both windows
&#34;&#34;&#34;
mean_a = statistics.mean(window_a)
mean_b = statistics.mean(window_b)
var_a = statistics.variance(window_a, mean_a)
var_b = statistics.variance(window_b, mean_b)
frac_a = 1.0/len(window_a)
frac_b = 1.0/len(window_b)
divider = math.sqrt(frac_a*var_a + frac_b*var_b)
if divider != 0:
result = mean_a - mean_b
result = result / divider
else:
result = 0
return result</code></pre>
</details>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="RelayModel.ConceptChange.calculate_windows"><code class="name flex">
<span>def <span class="ident">calculate_windows</span></span>(<span>window_a, window_b)</span>
</code></dt>
<dd>
<div class="desc"><p>Calculates a change rate of two given windows provided as lists.</p>
<p>The two lists should be of same size.</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>window_a</code></strong> :&ensp;<code>list</code></dt>
<dd>Holds the first window</dd>
<dt><strong><code>window_b</code></strong> :&ensp;<code>list</code></dt>
<dd>Holds the second window</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><code>int</code></dt>
<dd>A change rate of the both windows</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def calculate_windows(window_a, window_b):
&#34;&#34;&#34;Calculates a change rate of two given windows provided as lists.
The two lists should be of same size.
Args:
window_a (list): Holds the first window
window_b (list): Holds the second window
Returns:
int: A change rate of the both windows
&#34;&#34;&#34;
mean_a = statistics.mean(window_a)
mean_b = statistics.mean(window_b)
var_a = statistics.variance(window_a, mean_a)
var_b = statistics.variance(window_b, mean_b)
frac_a = 1.0/len(window_a)
frac_b = 1.0/len(window_b)
divider = math.sqrt(frac_a*var_a + frac_b*var_b)
if divider != 0:
result = mean_a - mean_b
result = result / divider
else:
result = 0
return result</code></pre>
</details>
</dd>
</dl>
</section>
<section>
</section>
</article>
<nav id="sidebar">
<h1>Index</h1>
<div class="toc">
<ul></ul>
</div>
<ul id="index">
<li><h3>Super-module</h3>
<ul>
<li><code><a title="RelayModel" href="index.html">RelayModel</a></code></li>
</ul>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="RelayModel.ConceptChange.calculate_windows" href="#RelayModel.ConceptChange.calculate_windows">calculate_windows</a></code></li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
</footer>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.10.0" />
<title>RelayModel.KeyGeneration API documentation</title>
<meta name="description" content="" />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>RelayModel.KeyGeneration</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">import hashlib
import uuid
def generate_prefix(layer_id):
&#34;&#34;&#34;Generates a prefix for a authentication key. It contains the given RelayLayerId to check the origin of a key.
Args:
layer_id (RelayLayerId): The RelayLayerId of the RelayLayer that generates the key
Returns:
str: The key prefix as a string
&#34;&#34;&#34;
sha1 = hashlib.sha1()
sha1.update(str(layer_id).encode())
return sha1.hexdigest()
def generate_key(layer_id):
&#34;&#34;&#34;Generates a key for a given RelayLayerId
Args:
layer_id (RelayLayerId): Holds the RelayLayerId of the RelayLayer that generates the key
Returns:
str: The generated key as a string in the format &#34;prefix#uniqueId&#34;
&#34;&#34;&#34;
prefix = generate_prefix(layer_id)
base = uuid.uuid4()
key = prefix + &#34;#&#34; + str(base)
return key
def check_key_origin(key: str, layer_id):
&#34;&#34;&#34;Checks if the given key contains the given RelayLayerId.
Args:
key (str): Holds the key that should be checked.
layer_id (RelayLayerId): Holds the RelayLayerId of the RelayLayer that should be checked.
Returns:
bool: True if prefix of key matches given layer id, False otherwise.
&#34;&#34;&#34;
prefix = generate_prefix(layer_id)
if &#34;#&#34; in key:
key_prefix = key.split(&#34;#&#34;)[0]
if key_prefix == prefix:
return True
return False</code></pre>
</details>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="RelayModel.KeyGeneration.check_key_origin"><code class="name flex">
<span>def <span class="ident">check_key_origin</span></span>(<span>key: str, layer_id)</span>
</code></dt>
<dd>
<div class="desc"><p>Checks if the given key contains the given RelayLayerId.</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>key</code></strong> :&ensp;<code>str</code></dt>
<dd>Holds the key that should be checked.</dd>
<dt><strong><code>layer_id</code></strong> :&ensp;<code>RelayLayerId</code></dt>
<dd>Holds the RelayLayerId of the RelayLayer that should be checked.</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><code>bool</code></dt>
<dd>True if prefix of key matches given layer id, False otherwise.</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def check_key_origin(key: str, layer_id):
&#34;&#34;&#34;Checks if the given key contains the given RelayLayerId.
Args:
key (str): Holds the key that should be checked.
layer_id (RelayLayerId): Holds the RelayLayerId of the RelayLayer that should be checked.
Returns:
bool: True if prefix of key matches given layer id, False otherwise.
&#34;&#34;&#34;
prefix = generate_prefix(layer_id)
if &#34;#&#34; in key:
key_prefix = key.split(&#34;#&#34;)[0]
if key_prefix == prefix:
return True
return False</code></pre>
</details>
</dd>
<dt id="RelayModel.KeyGeneration.generate_key"><code class="name flex">
<span>def <span class="ident">generate_key</span></span>(<span>layer_id)</span>
</code></dt>
<dd>
<div class="desc"><p>Generates a key for a given RelayLayerId</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>layer_id</code></strong> :&ensp;<code>RelayLayerId</code></dt>
<dd>Holds the RelayLayerId of the RelayLayer that generates the key</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><code>str</code></dt>
<dd>The generated key as a string in the format "prefix#uniqueId"</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def generate_key(layer_id):
&#34;&#34;&#34;Generates a key for a given RelayLayerId
Args:
layer_id (RelayLayerId): Holds the RelayLayerId of the RelayLayer that generates the key
Returns:
str: The generated key as a string in the format &#34;prefix#uniqueId&#34;
&#34;&#34;&#34;
prefix = generate_prefix(layer_id)
base = uuid.uuid4()
key = prefix + &#34;#&#34; + str(base)
return key</code></pre>
</details>
</dd>
<dt id="RelayModel.KeyGeneration.generate_prefix"><code class="name flex">
<span>def <span class="ident">generate_prefix</span></span>(<span>layer_id)</span>
</code></dt>
<dd>
<div class="desc"><p>Generates a prefix for a authentication key. It contains the given RelayLayerId to check the origin of a key.</p>
<h2 id="args">Args</h2>
<dl>
<dt><strong><code>layer_id</code></strong> :&ensp;<code>RelayLayerId</code></dt>
<dd>The RelayLayerId of the RelayLayer that generates the key</dd>
</dl>
<h2 id="returns">Returns</h2>
<dl>
<dt><code>str</code></dt>
<dd>The key prefix as a string</dd>
</dl></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def generate_prefix(layer_id):
&#34;&#34;&#34;Generates a prefix for a authentication key. It contains the given RelayLayerId to check the origin of a key.
Args:
layer_id (RelayLayerId): The RelayLayerId of the RelayLayer that generates the key
Returns:
str: The key prefix as a string
&#34;&#34;&#34;
sha1 = hashlib.sha1()
sha1.update(str(layer_id).encode())
return sha1.hexdigest()</code></pre>
</details>
</dd>
</dl>
</section>
<section>
</section>
</article>
<nav id="sidebar">
<h1>Index</h1>
<div class="toc">
<ul></ul>
</div>
<ul id="index">
<li><h3>Super-module</h3>
<ul>
<li><code><a title="RelayModel" href="index.html">RelayModel</a></code></li>
</ul>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="RelayModel.KeyGeneration.check_key_origin" href="#RelayModel.KeyGeneration.check_key_origin">check_key_origin</a></code></li>
<li><code><a title="RelayModel.KeyGeneration.generate_key" href="#RelayModel.KeyGeneration.generate_key">generate_key</a></code></li>
<li><code><a title="RelayModel.KeyGeneration.generate_prefix" href="#RelayModel.KeyGeneration.generate_prefix">generate_prefix</a></code></li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
</footer>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.10.0" />
<title>RelayModel.ModuleConfig API documentation</title>
<meta name="description" content="" />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>RelayModel.ModuleConfig</code></h1>
</header>
<section id="section-intro">
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">import logging
# Defines the level of the logger
RELAY_LOG_LEVEL = logging.WARNING
&#34;&#34;&#34;int: Holds the logging level of all loggers in this module.
Normally this is set to logging.WARNING
&#34;&#34;&#34;
# Defines the timeout period of a relay layer
RELAY_LAYER_TIMEOUT_PERIOD = 1
&#34;&#34;&#34;float: Defines the timeout period of a relay layer.
Normally this is set to 1 second.
&#34;&#34;&#34;
# Defines the timeout period of a node
NODE_TIMEOUT_PERIOD = 1
&#34;&#34;&#34;float: Defines the timeout period of a node.
Normally this is set to 1 second.
&#34;&#34;&#34;
# Timeout for polling receiving messages when sending in link layer
POLL_TIMEOUT = 300
&#34;&#34;&#34;int: Timeout in milliseconds for polling receiving messages when sending in link layer.
Normally this is set to 300 ms.
&#34;&#34;&#34;
# Tries until the receiving sockets is considered as closed
POLL_TRIES = 3
&#34;&#34;&#34;int: Tries until the receiving socket is considered as closed.
Normally this is set to 3 tries.
&#34;&#34;&#34;
# Consider link layer as closed if message discarded
CONSIDER_AS_CLOSED = False
&#34;&#34;&#34;bool: Stores the flag if the link layer should send closed messages if one link layer is not reachable.
If this is set to False it will only discard the messages after the retries. Otherwise it will send In- and
OutRelayClosed Actions.
Normally this is set to False.
&#34;&#34;&#34;
# Analyse statemonitor address
STATE_MONITOR_PORT = 1999
&#34;&#34;&#34;Defines the port of the StateMonitor
Normally this is set to port 1999.
&#34;&#34;&#34;
STATE_MONITOR_ADDRESS = &#34;localhost:&#34; + str(STATE_MONITOR_PORT)
&#34;&#34;&#34;Defines the full address of the StateMonitor including ip and port.
Normally the ip of the address is localhost.
&#34;&#34;&#34;
# Activate DoS detection
DOS_DETECTION_ACTIVATED = True
&#34;&#34;&#34;Stores the flag if the dos detection should be used.
If this is set to True the RelayLayer is watching transmit rates and try to detect dos attacks.
Normally this is set to True.
&#34;&#34;&#34;
# DoS Window Size
WINDOW_SIZE = 20
&#34;&#34;&#34;Defines the window size for the dos detection.
This should be a value that is dividable by 2.
Normally this is set to 20.
&#34;&#34;&#34;
# DoS change detection alpha
CHANGE_ALPHA = -10
&#34;&#34;&#34;Defines the change rate threshold for a dos attack detection.
This value should always be lower than 0. Otherwise falling transmit rates get detected as dos attacks.
Normally this is set to -10.
&#34;&#34;&#34;
# Actions that are not tracked and should only be used for relay layer messages
NO_MONITOR_ACTIONS = [&#39;Probe&#39;, &#39;ProbeFail&#39;, &#39;NotAuthorized&#39;, &#39;Ping&#39;, &#39;InRelayClosed&#39;, &#39;OutRelayClosed&#39;]
&#34;&#34;&#34;Stores the actions that are standard actions from the RelayLayer.
This actions are not monitored on transmission because a node should not have access to this actions.
It is stored in a list where each entry has the action name set.
Normally this is set to [&#39;Probe&#39;, &#39;ProbeFail&#39;, &#39;NotAuthorized&#39;, &#39;Ping&#39;, &#39;InRelayClosed&#39;, &#39;OutRelayClosed&#39;]
&#34;&#34;&#34;
# Results folder
RESULTS_FOLDER = &#34;results/&#34;
&#34;&#34;&#34;Defines the folder where the StateMonitor should write result files to.
Normally this is set to the folder named &#34;results/&#34;.
&#34;&#34;&#34;</code></pre>
</details>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-variables">Global variables</h2>
<dl>
<dt id="RelayModel.ModuleConfig.CHANGE_ALPHA"><code class="name">var <span class="ident">CHANGE_ALPHA</span></code></dt>
<dd>
<div class="desc"><p>Defines the change rate threshold for a dos attack detection.</p>
<p>This value should always be lower than 0. Otherwise falling transmit rates get detected as dos attacks.
Normally this is set to -10.</p></div>
</dd>
<dt id="RelayModel.ModuleConfig.CONSIDER_AS_CLOSED"><code class="name">var <span class="ident">CONSIDER_AS_CLOSED</span></code></dt>
<dd>
<div class="desc"><p>bool: Stores the flag if the link layer should send closed messages if one link layer is not reachable.</p>
<p>If this is set to False it will only discard the messages after the retries. Otherwise it will send In- and
OutRelayClosed Actions.
Normally this is set to False.</p></div>
</dd>
<dt id="RelayModel.ModuleConfig.DOS_DETECTION_ACTIVATED"><code class="name">var <span class="ident">DOS_DETECTION_ACTIVATED</span></code></dt>
<dd>
<div class="desc"><p>Stores the flag if the dos detection should be used.</p>
<p>If this is set to True the RelayLayer is watching transmit rates and try to detect dos attacks.
Normally this is set to True.</p></div>
</dd>
<dt id="RelayModel.ModuleConfig.NODE_TIMEOUT_PERIOD"><code class="name">var <span class="ident">NODE_TIMEOUT_PERIOD</span></code></dt>
<dd>
<div class="desc"><p>float: Defines the timeout period of a node.</p>
<p>Normally this is set to 1 second.</p></div>
</dd>
<dt id="RelayModel.ModuleConfig.NO_MONITOR_ACTIONS"><code class="name">var <span class="ident">NO_MONITOR_ACTIONS</span></code></dt>
<dd>
<div class="desc"><p>Stores the actions that are standard actions from the RelayLayer.</p>
<p>This actions are not monitored on transmission because a node should not have access to this actions.
It is stored in a list where each entry has the action name set.
Normally this is set to ['Probe', 'ProbeFail', 'NotAuthorized', 'Ping', 'InRelayClosed', 'OutRelayClosed']</p></div>
</dd>
<dt id="RelayModel.ModuleConfig.POLL_TIMEOUT"><code class="name">var <span class="ident">POLL_TIMEOUT</span></code></dt>
<dd>
<div class="desc"><p>int: Timeout in milliseconds for polling receiving messages when sending in link layer.</p>
<p>Normally this is set to 300 ms.</p></div>
</dd>
<dt id="RelayModel.ModuleConfig.POLL_TRIES"