update docs for bumplibp2p

This commit is contained in:
= 2023-10-04 16:04:54 +00:00
parent ecbe07d1b8
commit 39717fc371
48 changed files with 28590 additions and 0 deletions

1607
bumplibp2p/dochack.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/connmanager</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/connmanager</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/connmanager.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/connmanager.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,817 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/crypto/ed25519/ed25519</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/crypto/ed25519/ed25519</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#EdError" title="EdError = enum
EdIncorrectError">EdError</a></li>
<li><a class="reference" href="#EdKeyPair" title="EdKeyPair = object
seckey*: EdPrivateKey
pubkey*: EdPublicKey">EdKeyPair</a></li>
<li><a class="reference" href="#EdPrivateKey" title="EdPrivateKey = object
data*: array[EdPrivateKeySize, byte]">EdPrivateKey</a></li>
<li><a class="reference" href="#EdPublicKey" title="EdPublicKey = object
data*: array[EdPublicKeySize, byte]">EdPublicKey</a></li>
<li><a class="reference" href="#EdSignature" title="EdSignature = object
data*: array[EdSignatureSize, byte]">EdSignature</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#EdPrivateKeySize" title="EdPrivateKeySize = 64">EdPrivateKeySize</a></li>
<li><a class="reference" href="#EdPublicKeySize" title="EdPublicKeySize = 32">EdPublicKeySize</a></li>
<li><a class="reference" href="#EdSignatureSize" title="EdSignatureSize = 64">EdSignatureSize</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CEdPrivateKey" title="`$`(key: EdPrivateKey): string">`$`(key: EdPrivateKey): string</a></li>
<li><a class="reference" href="#%24%2CEdPublicKey" title="`$`(key: EdPublicKey): string">`$`(key: EdPublicKey): string</a></li>
<li><a class="reference" href="#%24%2CEdSignature" title="`$`(sig: EdSignature): string">`$`(sig: EdSignature): string</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D%2CEdPrivateKey%2CEdPrivateKey" title="`==`(eda, edb: EdPrivateKey): bool">`==`(eda, edb: EdPrivateKey): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CEdPublicKey%2CEdPublicKey" title="`==`(eda, edb: EdPublicKey): bool">`==`(eda, edb: EdPublicKey): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CEdSignature%2CEdSignature" title="`==`(eda, edb: EdSignature): bool">`==`(eda, edb: EdSignature): bool</a></li>
</ul>
<ul class="simple nested-toc-section">checkScalar
<li><a class="reference" href="#checkScalar%2CopenArray%5Bbyte%5D" title="checkScalar(scalar: openArray[byte]): uint32">checkScalar(scalar: openArray[byte]): uint32</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CEdPrivateKey" title="clear(key: var EdPrivateKey)">clear(key: var EdPrivateKey)</a></li>
<li><a class="reference" href="#clear%2CEdPublicKey" title="clear(key: var EdPublicKey)">clear(key: var EdPublicKey)</a></li>
<li><a class="reference" href="#clear%2CEdKeyPair" title="clear(pair: var EdKeyPair)">clear(pair: var EdKeyPair)</a></li>
<li><a class="reference" href="#clear%2CEdSignature" title="clear(sig: var EdSignature)">clear(sig: var EdSignature)</a></li>
</ul>
<ul class="simple nested-toc-section">getBytes
<li><a class="reference" href="#getBytes%2CEdPrivateKey" title="getBytes(key: EdPrivateKey): seq[byte]">getBytes(key: EdPrivateKey): seq[byte]</a></li>
<li><a class="reference" href="#getBytes%2CEdPublicKey" title="getBytes(key: EdPublicKey): seq[byte]">getBytes(key: EdPublicKey): seq[byte]</a></li>
<li><a class="reference" href="#getBytes%2CEdSignature" title="getBytes(sig: EdSignature): seq[byte]">getBytes(sig: EdSignature): seq[byte]</a></li>
</ul>
<ul class="simple nested-toc-section">getPublicKey
<li><a class="reference" href="#getPublicKey%2CEdPrivateKey" title="getPublicKey(key: EdPrivateKey): EdPublicKey">getPublicKey(key: EdPrivateKey): EdPublicKey</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2CEdPrivateKey%2CopenArray%5Bbyte%5D" title="init(key: var EdPrivateKey; data: openArray[byte]): bool">init(key: var EdPrivateKey; data: openArray[byte]): bool</a></li>
<li><a class="reference" href="#init%2CEdPrivateKey%2Cstring" title="init(key: var EdPrivateKey; data: string): bool">init(key: var EdPrivateKey; data: string): bool</a></li>
<li><a class="reference" href="#init%2CEdPublicKey%2CopenArray%5Bbyte%5D" title="init(key: var EdPublicKey; data: openArray[byte]): bool">init(key: var EdPublicKey; data: openArray[byte]): bool</a></li>
<li><a class="reference" href="#init%2CEdPublicKey%2Cstring" title="init(key: var EdPublicKey; data: string): bool">init(key: var EdPublicKey; data: string): bool</a></li>
<li><a class="reference" href="#init%2CEdSignature%2CopenArray%5Bbyte%5D" title="init(sig: var EdSignature; data: openArray[byte]): bool">init(sig: var EdSignature; data: openArray[byte]): bool</a></li>
<li><a class="reference" href="#init%2CEdSignature%2Cstring" title="init(sig: var EdSignature; data: string): bool">init(sig: var EdSignature; data: string): bool</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BEdPrivateKey%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[EdPrivateKey]; data: openArray[byte]): Result[EdPrivateKey,
EdError]">init(t: typedesc[EdPrivateKey]; data: openArray[byte]): Result[EdPrivateKey,
EdError]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BEdPrivateKey%5D%2Cstring" title="init(t: typedesc[EdPrivateKey]; data: string): Result[EdPrivateKey, EdError]">init(t: typedesc[EdPrivateKey]; data: string): Result[EdPrivateKey, EdError]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BEdPublicKey%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[EdPublicKey]; data: openArray[byte]): Result[EdPublicKey,
EdError]">init(t: typedesc[EdPublicKey]; data: openArray[byte]): Result[EdPublicKey,
EdError]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BEdPublicKey%5D%2Cstring" title="init(t: typedesc[EdPublicKey]; data: string): Result[EdPublicKey, EdError]">init(t: typedesc[EdPublicKey]; data: string): Result[EdPublicKey, EdError]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BEdSignature%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[EdSignature]; data: openArray[byte]): Result[EdSignature,
EdError]">init(t: typedesc[EdSignature]; data: openArray[byte]): Result[EdSignature,
EdError]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BEdSignature%5D%2Cstring" title="init(t: typedesc[EdSignature]; data: string): Result[EdSignature, EdError]">init(t: typedesc[EdSignature]; data: string): Result[EdSignature, EdError]</a></li>
</ul>
<ul class="simple nested-toc-section">random
<li><a class="reference" href="#random%2Ctypedesc%5BEdKeyPair%5D%2CHmacDrbgContext" title="random(t: typedesc[EdKeyPair]; rng: var HmacDrbgContext): EdKeyPair">random(t: typedesc[EdKeyPair]; rng: var HmacDrbgContext): EdKeyPair</a></li>
<li><a class="reference" href="#random%2Ctypedesc%5BEdPrivateKey%5D%2CHmacDrbgContext" title="random(t: typedesc[EdPrivateKey]; rng: var HmacDrbgContext): EdPrivateKey">random(t: typedesc[EdPrivateKey]; rng: var HmacDrbgContext): EdPrivateKey</a></li>
</ul>
<ul class="simple nested-toc-section">sign
<li><a class="reference" href="#sign%2CEdPrivateKey%2CopenArray%5BT%5D" title="sign[T: byte | char](key: EdPrivateKey; message: openArray[T]): EdSignature">sign[T: byte | char](key: EdPrivateKey; message: openArray[T]): EdSignature</a></li>
</ul>
<ul class="simple nested-toc-section">toBytes
<li><a class="reference" href="#toBytes%2CEdPrivateKey%2CopenArray%5Bbyte%5D" title="toBytes(key: EdPrivateKey; data: var openArray[byte]): int">toBytes(key: EdPrivateKey; data: var openArray[byte]): int</a></li>
<li><a class="reference" href="#toBytes%2CEdPublicKey%2CopenArray%5Bbyte%5D" title="toBytes(key: EdPublicKey; data: var openArray[byte]): int">toBytes(key: EdPublicKey; data: var openArray[byte]): int</a></li>
<li><a class="reference" href="#toBytes%2CEdSignature%2CopenArray%5Bbyte%5D" title="toBytes(sig: EdSignature; data: var openArray[byte]): int">toBytes(sig: EdSignature; data: var openArray[byte]): int</a></li>
</ul>
<ul class="simple nested-toc-section">verify
<li><a class="reference" href="#verify%2CEdSignature%2CopenArray%5BT%5D%2CEdPublicKey" title="verify[T: byte | char](sig: EdSignature; message: openArray[T]; key: EdPublicKey): bool">verify[T: byte | char](sig: EdSignature; message: openArray[T]; key: EdPublicKey): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements ED25519. This code is a port of the public domain, &quot;ref10&quot; implementation of ed25519 from SUPERCOP.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="constants.html">constants</a>, <a class="reference external" href="../../utility.html">../../utility</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="EdError" class="tohide">
<dt><pre><a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">EdIncorrectError</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="EdKeyPair" class="tohide">
<dt><pre><a href="ed25519.html#EdKeyPair"><span class="Identifier">EdKeyPair</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">seckey</span><span class="Operator">*</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a>
<span class="Identifier">pubkey</span><span class="Operator">*</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L48" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L48" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="EdPrivateKey" class="tohide">
<dt><pre><a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">EdPrivateKeySize</span><span class="Other">,</span> <span class="Identifier">byte</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="EdPublicKey" class="tohide">
<dt><pre><a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">EdPublicKeySize</span><span class="Other">,</span> <span class="Identifier">byte</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="EdSignature" class="tohide">
<dt><pre><a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">EdSignatureSize</span><span class="Other">,</span> <span class="Identifier">byte</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="EdPrivateKeySize" class="tohide">
<dt><pre><a href="ed25519.html#EdPrivateKeySize"><span class="Identifier">EdPrivateKeySize</span></a> <span class="Other">=</span> <span class="DecNumber">64</span></pre></dt>
<dd>
Size in octets (bytes) of serialized ED25519 private key.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="EdPublicKeySize" class="tohide">
<dt><pre><a href="ed25519.html#EdPublicKeySize"><span class="Identifier">EdPublicKeySize</span></a> <span class="Other">=</span> <span class="DecNumber">32</span></pre></dt>
<dd>
Size in octets (bytes) of serialized ED25519 public key.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="EdSignatureSize" class="tohide">
<dt><pre><a href="ed25519.html#EdSignatureSize"><span class="Identifier">EdSignatureSize</span></a> <span class="Other">=</span> <span class="DecNumber">64</span></pre></dt>
<dd>
Size in octets (bytes) of serialized ED25519 signature.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,EdPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CEdPrivateKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1744" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1744" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,EdPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CEdPublicKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1748" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1748" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,EdSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CEdSignature"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1752" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1752" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-procs-all">
<div id="==,EdPrivateKey,EdPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CEdPrivateKey%2CEdPrivateKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">eda</span><span class="Other">,</span> <span class="Identifier">edb</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compare ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> objects for equality.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1732" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1732" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,EdPublicKey,EdPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CEdPublicKey%2CEdPublicKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">eda</span><span class="Other">,</span> <span class="Identifier">edb</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compare ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> objects for equality.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1736" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1736" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,EdSignature,EdSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CEdSignature%2CEdSignature"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">eda</span><span class="Other">,</span> <span class="Identifier">edb</span><span class="Other">:</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compare ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> objects for equality.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1740" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1740" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="checkScalar-procs-all">
<div id="checkScalar,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#checkScalar%2CopenArray%5Bbyte%5D"><span class="Identifier">checkScalar</span></a><span class="Other">(</span><span class="Identifier">scalar</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint32</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1639" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1639" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clear-procs-all">
<div id="clear,EdPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CEdPrivateKey"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wipe and clear memory of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1867" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1867" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="clear,EdPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CEdPublicKey"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wipe and clear memory of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1871" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1871" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="clear,EdKeyPair" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CEdKeyPair"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">pair</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdKeyPair"><span class="Identifier">EdKeyPair</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wipe and clear memory of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span> <span class="Identifier">pair</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1879" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1879" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="clear,EdSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CEdSignature"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wipe and clear memory of ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1875" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1875" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getBytes-procs-all">
<div id="getBytes,EdPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CEdPrivateKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1723" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1723" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getBytes,EdPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CEdPublicKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1726" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1726" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getBytes,EdSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CEdSignature"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1729" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1729" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPublicKey-procs-all">
<div id="getPublicKey,EdPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getPublicKey%2CEdPrivateKey"><span class="Identifier">getPublicKey</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Calculate and return ED25519 public key from private key <tt class="docutils literal"><span class="pre">key</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1689" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1689" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init-procs-all">
<div id="init,EdPrivateKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEdPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1756" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1756" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,EdPrivateKey,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEdPrivateKey%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1786" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1786" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,EdPublicKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEdPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1766" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1766" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,EdPublicKey,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEdPublicKey%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1793" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1793" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,EdSignature,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEdSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sig</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1776" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1776" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,EdSignature,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CEdSignature%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sig</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">true</span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1800" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1800" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[EdPrivateKey],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEdPrivateKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span>
<a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">,</span> <a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1807" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1807" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[EdPrivateKey],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEdPrivateKey%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">,</span> <a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1837" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1837" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[EdPublicKey],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEdPublicKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">,</span>
<a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1817" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1817" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[EdPublicKey],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEdPublicKey%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">,</span> <a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1847" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1847" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[EdSignature],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEdSignature%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">,</span>
<a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1827" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1827" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[EdSignature],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BEdSignature%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">,</span> <a href="ed25519.html#EdError"><span class="Identifier">EdError</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1857" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1857" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="random-procs-all">
<div id="random,typedesc[EdKeyPair],HmacDrbgContext" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BEdKeyPair%5D%2CHmacDrbgContext"><span class="Identifier">random</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdKeyPair"><span class="Identifier">EdKeyPair</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="ed25519.html#EdKeyPair"><span class="Identifier">EdKeyPair</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Generate new random ED25519 private and public keypair using OS specific CSPRNG.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1670" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1670" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="random,typedesc[EdPrivateKey],HmacDrbgContext" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BEdPrivateKey%5D%2CHmacDrbgContext"><span class="Identifier">random</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Generate new random ED25519 private key using the given random number generator
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1651" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1651" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sign-procs-all">
<div id="sign,EdPrivateKey,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#sign%2CEdPrivateKey%2CopenArray%5BT%5D"><span class="Identifier">sign</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> </span><span class="Identifier">noinit</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create ED25519 signature of data <tt class="docutils literal"><span class="pre">message</span></tt> using private key <tt class="docutils literal"><span class="pre">key</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1884" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1884" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toBytes-procs-all">
<div id="toBytes,EdPrivateKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CEdPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPrivateKey"><span class="Identifier">EdPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store ED25519 private key.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1693" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1693" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toBytes,EdPublicKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CEdPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store ED25519 public key.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1703" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1703" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toBytes,EdSignature,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CEdSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize ED25519 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sig</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store ED25519 signature.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1713" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1713" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="verify-procs-all">
<div id="verify,EdSignature,openArray[T],EdPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#verify%2CEdSignature%2CopenArray%5BT%5D%2CEdPublicKey"><span class="Identifier">verify</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="ed25519.html#EdSignature"><span class="Identifier">EdSignature</span></a><span class="Other">;</span> <span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">key</span><span class="Other">:</span> <a href="ed25519.html#EdPublicKey"><span class="Identifier">EdPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Verify ED25519 signature <tt class="docutils literal"><span class="pre">sig</span></tt> using public key <tt class="docutils literal"><span class="pre">key</span></tt> and data <tt class="docutils literal"><span class="pre">message</span></tt>.</p>
<p>Return <tt class="docutils literal"><span class="pre">true</span></tt> if message verification succeeded, <tt class="docutils literal"><span class="pre">false</span></tt> if verification failed.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/ed25519/ed25519.nim#L1918" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/ed25519/ed25519.nim#L1918" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:49 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,908 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/crypto/rsa</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/crypto/rsa</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#RsaError" title="RsaError = enum
RsaGenError, RsaKeyIncorrectError, RsaSignatureError, RsaLowSecurityError">RsaError</a></li>
<li><a class="reference" href="#RsaKeyPair" title="RsaKeyPair = RsaPrivateKey">RsaKeyPair</a></li>
<li><a class="reference" href="#RsaKP" title="RsaKP = RsaPrivateKey | RsaKeyPair">RsaKP</a></li>
<li><a class="reference" href="#RsaPKI" title="RsaPKI = RsaPrivateKey | RsaPublicKey | RsaSignature">RsaPKI</a></li>
<li><a class="reference" href="#RsaPrivateKey" title="RsaPrivateKey = ref object
buffer*: seq[byte]
seck*: rsa.RsaPrivateKey
pubk*: rsa.RsaPublicKey
pexp*: ptr byte
pexplen*: uint">RsaPrivateKey</a></li>
<li><a class="reference" href="#RsaPublicKey" title="RsaPublicKey = ref object
buffer*: seq[byte]
key*: rsa.RsaPublicKey">RsaPublicKey</a></li>
<li><a class="reference" href="#RsaResult" title="RsaResult[T] = Result[T, RsaError]">RsaResult</a></li>
<li><a class="reference" href="#RsaSignature" title="RsaSignature = ref object
buffer*: seq[byte]">RsaSignature</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#DefaultKeySize" title="DefaultKeySize = 3072">DefaultKeySize</a></li>
<li><a class="reference" href="#DefaultPublicExponent" title="DefaultPublicExponent = 65537'u32">DefaultPublicExponent</a></li>
<li><a class="reference" href="#MinKeySize" title="MinKeySize = 2048">MinKeySize</a></li>
<li><a class="reference" href="#RsaOidSha1" title="RsaOidSha1 = [5'u, 0x0000002B, 0x0000000E, 0x00000003, 0x00000002, 0x0000001A]">RsaOidSha1</a></li>
<li><a class="reference" href="#RsaOidSha224" title="RsaOidSha224 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
0x00000003, 0x00000004, 0x00000002, 0x00000004]">RsaOidSha224</a></li>
<li><a class="reference" href="#RsaOidSha256" title="RsaOidSha256 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
0x00000003, 0x00000004, 0x00000002, 0x00000001]">RsaOidSha256</a></li>
<li><a class="reference" href="#RsaOidSha384" title="RsaOidSha384 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
0x00000003, 0x00000004, 0x00000002, 0x00000002]">RsaOidSha384</a></li>
<li><a class="reference" href="#RsaOidSha512" title="RsaOidSha512 = [9'u, 0x00000060, 0x00000086, 0x00000048, 0x00000001, 0x00000065,
0x00000003, 0x00000004, 0x00000002, 0x00000003]">RsaOidSha512</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CRsaPrivateKey" title="`$`(key: RsaPrivateKey): string">`$`(key: RsaPrivateKey): string</a></li>
<li><a class="reference" href="#%24%2CRsaPublicKey" title="`$`(key: RsaPublicKey): string">`$`(key: RsaPublicKey): string</a></li>
<li><a class="reference" href="#%24%2CRsaSignature" title="`$`(sig: RsaSignature): string">`$`(sig: RsaSignature): string</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D%2CRsaPrivateKey%2CRsaPrivateKey" title="`==`(a, b: RsaPrivateKey): bool">`==`(a, b: RsaPrivateKey): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CRsaPublicKey%2CRsaPublicKey" title="`==`(a, b: RsaPublicKey): bool">`==`(a, b: RsaPublicKey): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CRsaSignature%2CRsaSignature" title="`==`(a, b: RsaSignature): bool">`==`(a, b: RsaSignature): bool</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CT" title="clear[T: RsaPKI | RsaKeyPair](pki: var T)">clear[T: RsaPKI | RsaKeyPair](pki: var T)</a></li>
</ul>
<ul class="simple nested-toc-section">copy
<li><a class="reference" href="#copy%2CT" title="copy[T: RsaPKI](key: T): T">copy[T: RsaPKI](key: T): T</a></li>
</ul>
<ul class="simple nested-toc-section">getBytes
<li><a class="reference" href="#getBytes%2CRsaPrivateKey" title="getBytes(key: RsaPrivateKey): RsaResult[seq[byte]]">getBytes(key: RsaPrivateKey): RsaResult[seq[byte]]</a></li>
<li><a class="reference" href="#getBytes%2CRsaPublicKey" title="getBytes(key: RsaPublicKey): RsaResult[seq[byte]]">getBytes(key: RsaPublicKey): RsaResult[seq[byte]]</a></li>
<li><a class="reference" href="#getBytes%2CRsaSignature" title="getBytes(sig: RsaSignature): RsaResult[seq[byte]]">getBytes(sig: RsaSignature): RsaResult[seq[byte]]</a></li>
</ul>
<ul class="simple nested-toc-section">getPublicKey
<li><a class="reference" href="#getPublicKey%2CRsaPrivateKey" title="getPublicKey(key: RsaPrivateKey): RsaPublicKey">getPublicKey(key: RsaPrivateKey): RsaPublicKey</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2CRsaPrivateKey%2CopenArray%5Bbyte%5D" title="init(key: var RsaPrivateKey; data: openArray[byte]): Result[void, Asn1Error]">init(key: var RsaPrivateKey; data: openArray[byte]): Result[void, Asn1Error]</a></li>
<li><a class="reference" href="#init%2CRsaPublicKey%2CopenArray%5Bbyte%5D" title="init(key: var RsaPublicKey; data: openArray[byte]): Result[void, Asn1Error]">init(key: var RsaPublicKey; data: openArray[byte]): Result[void, Asn1Error]</a></li>
<li><a class="reference" href="#init%2CRsaSignature%2CopenArray%5Bbyte%5D" title="init(sig: var RsaSignature; data: openArray[byte]): Result[void, Asn1Error]">init(sig: var RsaSignature; data: openArray[byte]): Result[void, Asn1Error]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BRsaPrivateKey%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[RsaPrivateKey]; data: openArray[byte]): RsaResult[RsaPrivateKey]">init(t: typedesc[RsaPrivateKey]; data: openArray[byte]): RsaResult[RsaPrivateKey]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BRsaPublicKey%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[RsaPublicKey]; data: openArray[byte]): RsaResult[RsaPublicKey]">init(t: typedesc[RsaPublicKey]; data: openArray[byte]): RsaResult[RsaPublicKey]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BRsaSignature%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[RsaSignature]; data: openArray[byte]): RsaResult[RsaSignature]">init(t: typedesc[RsaSignature]; data: openArray[byte]): RsaResult[RsaSignature]</a></li>
<li><a class="reference" href="#init%2CT%2Cstring" title="init[T: RsaPKI](sospk: var T; data: string): Result[void, Asn1Error]">init[T: RsaPKI](sospk: var T; data: string): Result[void, Asn1Error]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BT%5D%2Cstring" title="init[T: RsaPKI](t: typedesc[T]; data: string): T">init[T: RsaPKI](t: typedesc[T]; data: string): T</a></li>
</ul>
<ul class="simple nested-toc-section">pubkey
<li><a class="reference" href="#pubkey%2CRsaKeyPair" title="pubkey(pair: RsaKeyPair): RsaPublicKey">pubkey(pair: RsaKeyPair): RsaPublicKey</a></li>
</ul>
<ul class="simple nested-toc-section">random
<li><a class="reference" href="#random%2Ctypedesc%5BT%5D%2CHmacDrbgContext" title="random[T: RsaKP](t: typedesc[T]; rng: var HmacDrbgContext;
bits = DefaultKeySize; pubexp = DefaultPublicExponent): RsaResult[
T]">random[T: RsaKP](t: typedesc[T]; rng: var HmacDrbgContext;
bits = DefaultKeySize; pubexp = DefaultPublicExponent): RsaResult[
T]</a></li>
</ul>
<ul class="simple nested-toc-section">seckey
<li><a class="reference" href="#seckey%2CRsaKeyPair" title="seckey(pair: RsaKeyPair): RsaPrivateKey">seckey(pair: RsaKeyPair): RsaPrivateKey</a></li>
</ul>
<ul class="simple nested-toc-section">sign
<li><a class="reference" href="#sign%2CRsaPrivateKey%2CopenArray%5BT%5D" title="sign[T: byte | char](key: RsaPrivateKey; message: openArray[T]): RsaResult[
RsaSignature]">sign[T: byte | char](key: RsaPrivateKey; message: openArray[T]): RsaResult[
RsaSignature]</a></li>
</ul>
<ul class="simple nested-toc-section">toBytes
<li><a class="reference" href="#toBytes%2CRsaPrivateKey%2CopenArray%5Bbyte%5D" title="toBytes(key: RsaPrivateKey; data: var openArray[byte]): RsaResult[int]">toBytes(key: RsaPrivateKey; data: var openArray[byte]): RsaResult[int]</a></li>
<li><a class="reference" href="#toBytes%2CRsaPublicKey%2CopenArray%5Bbyte%5D" title="toBytes(key: RsaPublicKey; data: var openArray[byte]): RsaResult[int]">toBytes(key: RsaPublicKey; data: var openArray[byte]): RsaResult[int]</a></li>
<li><a class="reference" href="#toBytes%2CRsaSignature%2CopenArray%5Bbyte%5D" title="toBytes(sig: RsaSignature; data: var openArray[byte]): RsaResult[int]">toBytes(sig: RsaSignature; data: var openArray[byte]): RsaResult[int]</a></li>
</ul>
<ul class="simple nested-toc-section">verify
<li><a class="reference" href="#verify%2CRsaSignature%2CopenArray%5BT%5D%2CRsaPublicKey" title="verify[T: byte | char](sig: RsaSignature; message: openArray[T];
pubkey: RsaPublicKey): bool">verify[T: byte | char](sig: RsaSignature; message: openArray[T];
pubkey: RsaPublicKey): bool</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">getArray
<li><a class="reference" href="#getArray.t%2Cuntyped%2Cuntyped%2Cuntyped" title="getArray(bs, os, ls: untyped): untyped">getArray(bs, os, ls: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements constant-time RSA PKCS#1.5 DSA.</p>
<p>This module uses unmodified parts of code from BearSSL library &lt;<a class="reference external" href="https://bearssl.org/">https://bearssl.org/</a>&gt; Copyright(C) 2018 Thomas Pornin &lt;pornin@bolet.org&gt;.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="minasn1.html">minasn1</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="RsaError" class="tohide">
<dt><pre><a href="rsa.html#RsaError"><span class="Identifier">RsaError</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">RsaGenError</span><span class="Other">,</span> <span class="Identifier">RsaKeyIncorrectError</span><span class="Other">,</span> <span class="Identifier">RsaSignatureError</span><span class="Other">,</span> <span class="Identifier">RsaLowSecurityError</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L81" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L81" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaKeyPair" class="tohide">
<dt><pre><a href="rsa.html#RsaKeyPair"><span class="Identifier">RsaKeyPair</span></a> <span class="Other">=</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaKP" class="tohide">
<dt><pre><a href="rsa.html#RsaKP"><span class="Identifier">RsaKP</span></a> <span class="Other">=</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a> <span class="Operator">|</span> <a href="rsa.html#RsaKeyPair"><span class="Identifier">RsaKeyPair</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaPKI" class="tohide">
<dt><pre><a href="rsa.html#RsaPKI"><span class="Identifier">RsaPKI</span></a> <span class="Other">=</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a> <span class="Operator">|</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a> <span class="Operator">|</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L78" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L78" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaPrivateKey" class="tohide">
<dt><pre><a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
<span class="Identifier">seck</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">rsa</span><span class="Other">.</span><span class="Identifier">RsaPrivateKey</span>
<span class="Identifier">pubk</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">rsa</span><span class="Other">.</span><span class="Identifier">RsaPublicKey</span>
<span class="Identifier">pexp</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">byte</span>
<span class="Identifier">pexplen</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaPublicKey" class="tohide">
<dt><pre><a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
<span class="Identifier">key</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">rsa</span><span class="Other">.</span><span class="Identifier">RsaPublicKey</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L69" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L69" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaResult" class="tohide">
<dt><pre><a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <a href="rsa.html#RsaError"><span class="Identifier">RsaError</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L87" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L87" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaSignature" class="tohide">
<dt><pre><a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L75" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L75" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="DefaultKeySize" class="tohide">
<dt><pre><a href="rsa.html#DefaultKeySize"><span class="Identifier">DefaultKeySize</span></a> <span class="Other">=</span> <span class="DecNumber">3072</span></pre></dt>
<dd>
Default RSA key size in bits.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="DefaultPublicExponent" class="tohide">
<dt><pre><a href="rsa.html#DefaultPublicExponent"><span class="Identifier">DefaultPublicExponent</span></a> <span class="Other">=</span> <span class="DecNumber">65537'u32</span></pre></dt>
<dd>
Default value for RSA public exponent. <a class="reference external" href="https://golang.org/src/crypto/rsa/rsa.go#226">https://golang.org/src/crypto/rsa/rsa.go#226</a>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MinKeySize" class="tohide">
<dt><pre><a href="rsa.html#MinKeySize"><span class="Identifier">MinKeySize</span></a> <span class="Other">=</span> <span class="DecNumber">2048</span></pre></dt>
<dd>
Minimal allowed RSA key size in bits. <a class="reference external" href="https://github.com/libp2p/go-libp2p-core/blob/master/crypto/rsa_common.go#L13">https://github.com/libp2p/go-libp2p-core/blob/master/crypto/rsa_common.go#L13</a>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaOidSha1" class="tohide">
<dt><pre><a href="rsa.html#RsaOidSha1"><span class="Identifier">RsaOidSha1</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">5'u</span><span class="Other">,</span> <span class="DecNumber">0x0000002B</span><span class="Other">,</span> <span class="DecNumber">0x0000000E</span><span class="Other">,</span> <span class="DecNumber">0x00000003</span><span class="Other">,</span> <span class="DecNumber">0x00000002</span><span class="Other">,</span> <span class="DecNumber">0x0000001A</span><span class="Other">]</span></pre></dt>
<dd>
RSA PKCS#1.5 SHA-1 hash object identifier.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaOidSha224" class="tohide">
<dt><pre><a href="rsa.html#RsaOidSha224"><span class="Identifier">RsaOidSha224</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">9'u</span><span class="Other">,</span> <span class="DecNumber">0x00000060</span><span class="Other">,</span> <span class="DecNumber">0x00000086</span><span class="Other">,</span> <span class="DecNumber">0x00000048</span><span class="Other">,</span> <span class="DecNumber">0x00000001</span><span class="Other">,</span> <span class="DecNumber">0x00000065</span><span class="Other">,</span>
<span class="DecNumber">0x00000003</span><span class="Other">,</span> <span class="DecNumber">0x00000004</span><span class="Other">,</span> <span class="DecNumber">0x00000002</span><span class="Other">,</span> <span class="DecNumber">0x00000004</span><span class="Other">]</span></pre></dt>
<dd>
RSA PKCS#1.5 SHA-224 hash object identifier.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaOidSha256" class="tohide">
<dt><pre><a href="rsa.html#RsaOidSha256"><span class="Identifier">RsaOidSha256</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">9'u</span><span class="Other">,</span> <span class="DecNumber">0x00000060</span><span class="Other">,</span> <span class="DecNumber">0x00000086</span><span class="Other">,</span> <span class="DecNumber">0x00000048</span><span class="Other">,</span> <span class="DecNumber">0x00000001</span><span class="Other">,</span> <span class="DecNumber">0x00000065</span><span class="Other">,</span>
<span class="DecNumber">0x00000003</span><span class="Other">,</span> <span class="DecNumber">0x00000004</span><span class="Other">,</span> <span class="DecNumber">0x00000002</span><span class="Other">,</span> <span class="DecNumber">0x00000001</span><span class="Other">]</span></pre></dt>
<dd>
RSA PKCS#1.5 SHA-256 hash object identifier.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaOidSha384" class="tohide">
<dt><pre><a href="rsa.html#RsaOidSha384"><span class="Identifier">RsaOidSha384</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">9'u</span><span class="Other">,</span> <span class="DecNumber">0x00000060</span><span class="Other">,</span> <span class="DecNumber">0x00000086</span><span class="Other">,</span> <span class="DecNumber">0x00000048</span><span class="Other">,</span> <span class="DecNumber">0x00000001</span><span class="Other">,</span> <span class="DecNumber">0x00000065</span><span class="Other">,</span>
<span class="DecNumber">0x00000003</span><span class="Other">,</span> <span class="DecNumber">0x00000004</span><span class="Other">,</span> <span class="DecNumber">0x00000002</span><span class="Other">,</span> <span class="DecNumber">0x00000002</span><span class="Other">]</span></pre></dt>
<dd>
RSA PKCS#1.5 SHA-384 hash object identifier.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="RsaOidSha512" class="tohide">
<dt><pre><a href="rsa.html#RsaOidSha512"><span class="Identifier">RsaOidSha512</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">9'u</span><span class="Other">,</span> <span class="DecNumber">0x00000060</span><span class="Other">,</span> <span class="DecNumber">0x00000086</span><span class="Other">,</span> <span class="DecNumber">0x00000048</span><span class="Other">,</span> <span class="DecNumber">0x00000001</span><span class="Other">,</span> <span class="DecNumber">0x00000065</span><span class="Other">,</span>
<span class="DecNumber">0x00000003</span><span class="Other">,</span> <span class="DecNumber">0x00000004</span><span class="Other">,</span> <span class="DecNumber">0x00000002</span><span class="Other">,</span> <span class="DecNumber">0x00000003</span><span class="Other">]</span></pre></dt>
<dd>
RSA PKCS#1.5 SHA-512 hash object identifier.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,RsaPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CRsaPrivateKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of RSA private key.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L621" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L621" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,RsaPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CRsaPublicKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of RSA public key.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L650" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L650" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,RsaSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CRsaSignature"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of RSA signature.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L664" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L664" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-procs-all">
<div id="==,RsaPrivateKey,RsaPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CRsaPrivateKey%2CRsaPrivateKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Compare two RSA private keys for equality.</p>
<p>Result is true if <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt> are both <tt class="docutils literal"><span class="pre">nil</span></tt> or <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt> are equal by value.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L673" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L673" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,RsaPublicKey,RsaPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CRsaPublicKey%2CRsaPublicKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compare two RSA public keys for equality.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L731" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L731" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,RsaSignature,RsaSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CRsaSignature%2CRsaSignature"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compare two RSA signatures for equality.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L709" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L709" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clear-procs-all">
<div id="clear,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#clear%2CT"><span class="Identifier">clear</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="rsa.html#RsaPKI"><span class="Identifier">RsaPKI</span></a> <span class="Operator">|</span> <a href="rsa.html#RsaKeyPair"><span class="Identifier">RsaKeyPair</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pki</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wipe and clear EC private key, public key or scalar object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L251" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L251" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="copy-procs-all">
<div id="copy,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#copy%2CT"><span class="Identifier">copy</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="rsa.html#RsaPKI"><span class="Identifier">RsaPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create copy of RSA private key, public key or signature.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L168" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L168" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getBytes-procs-all">
<div id="getBytes,RsaPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CRsaPrivateKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize RSA private key <tt class="docutils literal"><span class="pre">key</span></tt> to ASN.1 DER binary form and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L368" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L368" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getBytes,RsaPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CRsaPublicKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize RSA public key <tt class="docutils literal"><span class="pre">key</span></tt> to ASN.1 DER binary form and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L381" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L381" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getBytes,RsaSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CRsaSignature"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize RSA signature <tt class="docutils literal"><span class="pre">sig</span></tt> to raw binary form and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L394" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L394" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPublicKey-procs-all">
<div id="getPublicKey,RsaPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getPublicKey%2CRsaPrivateKey"><span class="Identifier">getPublicKey</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get RSA public key from RSA private key.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L229" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L229" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init-procs-all">
<div id="init,RsaPrivateKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CRsaPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize RSA private key <tt class="docutils literal"><span class="pre">key</span></tt> from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">Asn1Status</span></tt>.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L406" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L406" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,RsaPublicKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CRsaPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize RSA public key <tt class="docutils literal"><span class="pre">key</span></tt> from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">Asn1Status</span></tt>.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L497" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L497" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,RsaSignature,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CRsaSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize RSA signature <tt class="docutils literal"><span class="pre">sig</span></tt> from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">Result[void, Asn1Status]</span></tt>.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L566" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L566" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[RsaPrivateKey],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BRsaPrivateKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span>
<a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize RSA private key from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L586" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L586" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[RsaPublicKey],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BRsaPublicKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span>
<a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize RSA public key from ASN.1 DER binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L596" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L596" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[RsaSignature],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BRsaSignature%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span>
<a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize RSA signature from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L606" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L606" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,T,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CT%2Cstring"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="rsa.html#RsaPKI"><span class="Identifier">RsaPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sospk</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a><span class="Other">]</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize EC <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">scalar</span></span></tt> <tt class="docutils literal"><span class="pre">sospk</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">Result[void, Asn1Status]</span></tt>.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L578" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L578" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[T],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BT%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="rsa.html#RsaPKI"><span class="Identifier">RsaPKI</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize RSA <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt> and return constructed object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L616" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L616" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="pubkey-procs-all">
<div id="pubkey,RsaKeyPair" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#pubkey%2CRsaKeyPair"><span class="Identifier">pubkey</span></a><span class="Other">(</span><span class="Identifier">pair</span><span class="Other">:</span> <a href="rsa.html#RsaKeyPair"><span class="Identifier">RsaKeyPair</span></a><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get RSA public key from pair <tt class="docutils literal"><span class="pre">pair</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L247" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L247" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="random-procs-all">
<div id="random,typedesc[T],HmacDrbgContext" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BT%5D%2CHmacDrbgContext"><span class="Identifier">random</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="rsa.html#RsaKP"><span class="Identifier">RsaKP</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">;</span>
<span class="Identifier">bits</span> <span class="Other">=</span> <span class="Identifier">DefaultKeySize</span><span class="Other">;</span> <span class="Identifier">pubexp</span> <span class="Other">=</span> <span class="Identifier">DefaultPublicExponent</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span>
<span class="Identifier">T</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Generate new random RSA private key using BearSSL's HMAC-SHA256-DRBG algorithm.</p>
<p><tt class="docutils literal"><span class="pre">bits</span></tt> number of bits in RSA key, must be in range <a class="reference internal" href="#2048, 4096">2048, 4096</a> (default = 3072).</p>
<p><tt class="docutils literal"><span class="pre">pubexp</span></tt> is RSA public exponent, which must be prime (default = 3).</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L118" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L118" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="seckey-procs-all">
<div id="seckey,RsaKeyPair" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#seckey%2CRsaKeyPair"><span class="Identifier">seckey</span></a><span class="Other">(</span><span class="Identifier">pair</span><span class="Other">:</span> <a href="rsa.html#RsaKeyPair"><span class="Identifier">RsaKeyPair</span></a><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get RSA private key from pair <tt class="docutils literal"><span class="pre">pair</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L243" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L243" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sign-procs-all">
<div id="sign,RsaPrivateKey,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#sign%2CRsaPrivateKey%2CopenArray%5BT%5D"><span class="Identifier">sign</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span>
<a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get RSA PKCS1.5 signature of data <tt class="docutils literal"><span class="pre">message</span></tt> using SHA256 and private key <tt class="docutils literal"><span class="pre">key</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L746" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L746" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toBytes-procs-all">
<div id="toBytes,RsaPrivateKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CRsaPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPrivateKey"><span class="Identifier">RsaPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize RSA private key <tt class="docutils literal"><span class="pre">key</span></tt> to ASN.1 DER binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store RSA private key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if private key is is incorrect.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L283" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L283" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toBytes,RsaPublicKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CRsaPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize RSA public key <tt class="docutils literal"><span class="pre">key</span></tt> to ASN.1 DER binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store RSA public key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if public key is incorrect.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L320" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L320" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toBytes,RsaSignature,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CRsaSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="rsa.html#RsaResult"><span class="Identifier">RsaResult</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize RSA signature <tt class="docutils literal"><span class="pre">sig</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store RSA public key, or <tt class="docutils literal"><span class="pre"><span class="DecNumber">0</span></span></tt> if public key is incorrect.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L354" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L354" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="verify-procs-all">
<div id="verify,RsaSignature,openArray[T],RsaPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#verify%2CRsaSignature%2CopenArray%5BT%5D%2CRsaPublicKey"><span class="Identifier">verify</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="rsa.html#RsaSignature"><span class="Identifier">RsaSignature</span></a><span class="Other">;</span> <span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">pubkey</span><span class="Other">:</span> <a href="rsa.html#RsaPublicKey"><span class="Identifier">RsaPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Verify RSA signature <tt class="docutils literal"><span class="pre">sig</span></tt> using public key <tt class="docutils literal"><span class="pre">pubkey</span></tt> and data <tt class="docutils literal"><span class="pre">message</span></tt>.</p>
<p>Return <tt class="docutils literal"><span class="pre">true</span></tt> if message verification succeeded, <tt class="docutils literal"><span class="pre">false</span></tt> if verification failed.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L774" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L774" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="getArray-templates-all">
<div id="getArray.t,untyped,untyped,untyped" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#getArray.t%2Cuntyped%2Cuntyped%2Cuntyped"><span class="Identifier">getArray</span></a><span class="Other">(</span><span class="Identifier">bs</span><span class="Other">,</span> <span class="Identifier">os</span><span class="Other">,</span> <span class="Identifier">ls</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/rsa.nim#L107" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/rsa.nim#L107" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="minasn1.html#Asn1Error"><span class="Identifier">Asn1Error</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:49 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,795 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/crypto/secp</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/crypto/secp</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SkKeyPair" title="SkKeyPair = distinct secp256k1.SkKeyPair">SkKeyPair</a></li>
<li><a class="reference" href="#SkPrivateKey" title="SkPrivateKey = distinct secp256k1.SkSecretKey">SkPrivateKey</a></li>
<li><a class="reference" href="#SkPublicKey" title="SkPublicKey = distinct secp256k1.SkPublicKey">SkPublicKey</a></li>
<li><a class="reference" href="#SkSignature" title="SkSignature = distinct secp256k1.SkSignature">SkSignature</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SkRawPrivateKeySize" title="SkRawPrivateKeySize = 32">SkRawPrivateKeySize</a></li>
<li><a class="reference" href="#SkRawPublicKeySize" title="SkRawPublicKeySize = 33">SkRawPublicKeySize</a></li>
<li><a class="reference" href="#SkRawSignatureSize" title="SkRawSignatureSize = 65">SkRawSignatureSize</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CSkKeyPair" title="`$`(key: SkKeyPair): string">`$`(key: SkKeyPair): string</a></li>
<li><a class="reference" href="#%24%2CSkPrivateKey" title="`$`(key: SkPrivateKey): string">`$`(key: SkPrivateKey): string</a></li>
<li><a class="reference" href="#%24%2CSkPublicKey" title="`$`(key: SkPublicKey): string">`$`(key: SkPublicKey): string</a></li>
<li><a class="reference" href="#%24%2CSkSignature" title="`$`(key: SkSignature): string">`$`(key: SkSignature): string</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D%2CSkKeyPair%2CSkKeyPair" title="`==`(a, b: SkKeyPair): bool">`==`(a, b: SkKeyPair): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CSkPrivateKey%2CSkPrivateKey" title="`==`(a, b: SkPrivateKey): bool">`==`(a, b: SkPrivateKey): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CSkPublicKey%2CSkPublicKey" title="`==`(a, b: SkPublicKey): bool">`==`(a, b: SkPublicKey): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CSkSignature%2CSkSignature" title="`==`(a, b: SkSignature): bool">`==`(a, b: SkSignature): bool</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CSkPrivateKey" title="clear(key: var SkPrivateKey)">clear(key: var SkPrivateKey)</a></li>
</ul>
<ul class="simple nested-toc-section">getBytes
<li><a class="reference" href="#getBytes%2CSkPrivateKey" title="getBytes(key: SkPrivateKey): seq[byte]">getBytes(key: SkPrivateKey): seq[byte]</a></li>
<li><a class="reference" href="#getBytes%2CSkPublicKey" title="getBytes(key: SkPublicKey): seq[byte]">getBytes(key: SkPublicKey): seq[byte]</a></li>
<li><a class="reference" href="#getBytes%2CSkSignature" title="getBytes(sig: SkSignature): seq[byte]">getBytes(sig: SkSignature): seq[byte]</a></li>
</ul>
<ul class="simple nested-toc-section">getPublicKey
<li><a class="reference" href="#getPublicKey%2CSkPrivateKey" title="getPublicKey(key: SkPrivateKey): SkPublicKey">getPublicKey(key: SkPrivateKey): SkPublicKey</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2CSkPrivateKey%2CopenArray%5Bbyte%5D" title="init(key: var SkPrivateKey; data: openArray[byte]): SkResult[void]">init(key: var SkPrivateKey; data: openArray[byte]): SkResult[void]</a></li>
<li><a class="reference" href="#init%2CSkPrivateKey%2Cstring" title="init(key: var SkPrivateKey; data: string): SkResult[void]">init(key: var SkPrivateKey; data: string): SkResult[void]</a></li>
<li><a class="reference" href="#init%2CSkPublicKey%2CopenArray%5Bbyte%5D" title="init(key: var SkPublicKey; data: openArray[byte]): SkResult[void]">init(key: var SkPublicKey; data: openArray[byte]): SkResult[void]</a></li>
<li><a class="reference" href="#init%2CSkPublicKey%2Cstring" title="init(key: var SkPublicKey; data: string): SkResult[void]">init(key: var SkPublicKey; data: string): SkResult[void]</a></li>
<li><a class="reference" href="#init%2CSkSignature%2CopenArray%5Bbyte%5D" title="init(sig: var SkSignature; data: openArray[byte]): SkResult[void]">init(sig: var SkSignature; data: openArray[byte]): SkResult[void]</a></li>
<li><a class="reference" href="#init%2CSkSignature%2Cstring" title="init(sig: var SkSignature; data: string): SkResult[void]">init(sig: var SkSignature; data: string): SkResult[void]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BSkPrivateKey%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[SkPrivateKey]; data: openArray[byte]): SkResult[SkPrivateKey]">init(t: typedesc[SkPrivateKey]; data: openArray[byte]): SkResult[SkPrivateKey]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BSkPrivateKey%5D%2Cstring" title="init(t: typedesc[SkPrivateKey]; data: string): SkResult[SkPrivateKey]">init(t: typedesc[SkPrivateKey]; data: string): SkResult[SkPrivateKey]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BSkPublicKey%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[SkPublicKey]; data: openArray[byte]): SkResult[SkPublicKey]">init(t: typedesc[SkPublicKey]; data: openArray[byte]): SkResult[SkPublicKey]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BSkPublicKey%5D%2Cstring" title="init(t: typedesc[SkPublicKey]; data: string): SkResult[SkPublicKey]">init(t: typedesc[SkPublicKey]; data: string): SkResult[SkPublicKey]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BSkSignature%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[SkSignature]; data: openArray[byte]): SkResult[SkSignature]">init(t: typedesc[SkSignature]; data: openArray[byte]): SkResult[SkSignature]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BSkSignature%5D%2Cstring" title="init(t: typedesc[SkSignature]; data: string): SkResult[SkSignature]">init(t: typedesc[SkSignature]; data: string): SkResult[SkSignature]</a></li>
</ul>
<ul class="simple nested-toc-section">random
<li><a class="reference" href="#random%2Ctypedesc%5BSkKeyPair%5D%2CHmacDrbgContext" title="random(t: typedesc[SkKeyPair]; rng: var HmacDrbgContext): SkKeyPair">random(t: typedesc[SkKeyPair]; rng: var HmacDrbgContext): SkKeyPair</a></li>
<li><a class="reference" href="#random%2Ctypedesc%5BSkPrivateKey%5D%2CHmacDrbgContext" title="random(t: typedesc[SkPrivateKey]; rng: var HmacDrbgContext): SkPrivateKey">random(t: typedesc[SkPrivateKey]; rng: var HmacDrbgContext): SkPrivateKey</a></li>
</ul>
<ul class="simple nested-toc-section">sign
<li><a class="reference" href="#sign%2CSkPrivateKey%2CopenArray%5BT%5D" title="sign[T: byte | char](key: SkPrivateKey; msg: openArray[T]): SkSignature">sign[T: byte | char](key: SkPrivateKey; msg: openArray[T]): SkSignature</a></li>
</ul>
<ul class="simple nested-toc-section">toBytes
<li><a class="reference" href="#toBytes%2CSkPrivateKey%2CopenArray%5Bbyte%5D" title="toBytes(key: SkPrivateKey; data: var openArray[byte]): SkResult[int]">toBytes(key: SkPrivateKey; data: var openArray[byte]): SkResult[int]</a></li>
<li><a class="reference" href="#toBytes%2CSkPublicKey%2CopenArray%5Bbyte%5D" title="toBytes(key: SkPublicKey; data: var openArray[byte]): SkResult[int]">toBytes(key: SkPublicKey; data: var openArray[byte]): SkResult[int]</a></li>
<li><a class="reference" href="#toBytes%2CSkSignature%2CopenArray%5Bbyte%5D" title="toBytes(sig: SkSignature; data: var openArray[byte]): int">toBytes(sig: SkSignature; data: var openArray[byte]): int</a></li>
</ul>
<ul class="simple nested-toc-section">verify
<li><a class="reference" href="#verify%2CSkSignature%2CopenArray%5BT%5D%2CSkPublicKey" title="verify[T: byte | char](sig: SkSignature; msg: openArray[T]; key: SkPublicKey): bool">verify[T: byte | char](sig: SkSignature; msg: openArray[T]; key: SkPublicKey): bool</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">pubkey
<li><a class="reference" href="#pubkey.t%2CSkKeyPair" title="pubkey(v: SkKeyPair): SkPublicKey">pubkey(v: SkKeyPair): SkPublicKey</a></li>
</ul>
<ul class="simple nested-toc-section">seckey
<li><a class="reference" href="#seckey.t%2CSkKeyPair" title="seckey(v: SkKeyPair): SkPrivateKey">seckey(v: SkKeyPair): SkPrivateKey</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="SkKeyPair" class="tohide">
<dt><pre><a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">secp256k1</span><span class="Other">.</span><span class="Identifier">SkKeyPair</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SkPrivateKey" class="tohide">
<dt><pre><a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">secp256k1</span><span class="Other">.</span><span class="Identifier">SkSecretKey</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SkPublicKey" class="tohide">
<dt><pre><a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">secp256k1</span><span class="Other">.</span><span class="Identifier">SkPublicKey</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SkSignature" class="tohide">
<dt><pre><a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">secp256k1</span><span class="Other">.</span><span class="Identifier">SkSignature</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="SkRawPrivateKeySize" class="tohide">
<dt><pre><a href="secp.html#SkRawPrivateKeySize"><span class="Identifier">SkRawPrivateKeySize</span></a> <span class="Other">=</span> <span class="DecNumber">32</span></pre></dt>
<dd>
Size of private key in octets (bytes)
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SkRawPublicKeySize" class="tohide">
<dt><pre><a href="secp.html#SkRawPublicKeySize"><span class="Identifier">SkRawPublicKeySize</span></a> <span class="Other">=</span> <span class="DecNumber">33</span></pre></dt>
<dd>
Size of public key in octets (bytes)
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SkRawSignatureSize" class="tohide">
<dt><pre><a href="secp.html#SkRawSignatureSize"><span class="Identifier">SkRawSignatureSize</span></a> <span class="Other">=</span> <span class="DecNumber">65</span></pre></dt>
<dd>
Size of signature in octets (bytes)
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,SkKeyPair" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%24%2CSkKeyPair"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L208" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L208" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,SkPrivateKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%24%2CSkPrivateKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L205" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L205" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,SkPublicKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%24%2CSkPublicKey"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L206" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L206" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="$,SkSignature" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%24%2CSkSignature"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L207" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L207" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-procs-all">
<div id="==,SkKeyPair,SkKeyPair" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%3D%3D%2CSkKeyPair%2CSkKeyPair"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L216" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L216" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,SkPrivateKey,SkPrivateKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%3D%3D%2CSkPrivateKey%2CSkPrivateKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L210" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L210" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,SkPublicKey,SkPublicKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%3D%3D%2CSkPublicKey%2CSkPublicKey"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L212" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L212" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,SkSignature,SkSignature" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%3D%3D%2CSkSignature%2CSkSignature"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L214" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L214" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clear-procs-all">
<div id="clear,SkPrivateKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#clear%2CSkPrivateKey"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L203" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L203" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getBytes-procs-all">
<div id="getBytes,SkPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CSkPrivateKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L179" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L179" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getBytes,SkPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CSkPublicKey"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L183" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L183" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getBytes,SkSignature" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getBytes%2CSkSignature"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> and return it.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L187" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L187" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPublicKey-procs-all">
<div id="getPublicKey,SkPrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getPublicKey%2CSkPrivateKey"><span class="Identifier">getPublicKey</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Calculate and return Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> from <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L143" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L143" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init-procs-all">
<div id="init,SkPrivateKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CSkPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,SkPrivateKey,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CSkPrivateKey%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,SkPublicKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CSkPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L68" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L68" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,SkPublicKey,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CSkPublicKey%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L74" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L74" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,SkSignature,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CSkSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sig</span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L80" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L80" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,SkSignature,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CSkSignature%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sig</span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L86" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L86" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[SkPrivateKey],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BSkPrivateKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span>
<a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L97" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L97" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[SkPrivateKey],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BSkPrivateKey%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L104" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L104" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[SkPublicKey],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BSkPublicKey%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L111" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L111" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[SkPublicKey],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BSkPublicKey%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L119" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L119" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[SkSignature],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BSkSignature%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L127" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L127" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[SkSignature],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BSkSignature%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> on success.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L135" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L135" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="random-procs-all">
<div id="random,typedesc[SkKeyPair],HmacDrbgContext" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BSkKeyPair%5D%2CHmacDrbgContext"><span class="Identifier">random</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L43" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L43" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="random,typedesc[SkPrivateKey],HmacDrbgContext" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BSkPrivateKey%5D%2CHmacDrbgContext"><span class="Identifier">random</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sign-procs-all">
<div id="sign,SkPrivateKey,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#sign%2CSkPrivateKey%2CopenArray%5BT%5D"><span class="Identifier">sign</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">msg</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sign message <tt class="docutils literal"><span class="pre"><span class="Identifier">msg</span></span></tt> using private key <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> and return signature object.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toBytes-procs-all">
<div id="toBytes,SkPrivateKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CSkPrivateKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">private</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store Secp256k1 private key.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L147" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L147" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toBytes,SkPublicKey,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CSkPublicKey%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">SkResult</span><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">public</span> <span class="Identifier">key</span></span></tt> <tt class="docutils literal"><span class="pre">key</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store Secp256k1 public key.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L159" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L159" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toBytes,SkSignature,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#toBytes%2CSkSignature%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Serialize Secp256k1 <tt class="docutils literal"><span class="pre"><span class="Identifier">signature</span></span></tt> <tt class="docutils literal"><span class="pre">sig</span></tt> to raw binary form and store it to <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Procedure returns number of bytes (octets) needed to store Secp256k1 signature.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L171" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L171" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="verify-procs-all">
<div id="verify,SkSignature,openArray[T],SkPublicKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#verify%2CSkSignature%2CopenArray%5BT%5D%2CSkPublicKey"><span class="Identifier">verify</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">sig</span><span class="Other">:</span> <a href="secp.html#SkSignature"><span class="Identifier">SkSignature</span></a><span class="Other">;</span> <span class="Identifier">msg</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">key</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L198" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L198" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="pubkey-templates-all">
<div id="pubkey.t,SkKeyPair" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#pubkey.t%2CSkKeyPair"><span class="Identifier">pubkey</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a><span class="Other">)</span><span class="Other">:</span> <a href="secp.html#SkPublicKey"><span class="Identifier">SkPublicKey</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="seckey-templates-all">
<div id="seckey.t,SkKeyPair" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#seckey.t%2CSkKeyPair"><span class="Identifier">seckey</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="secp.html#SkKeyPair"><span class="Identifier">SkKeyPair</span></a><span class="Other">)</span><span class="Other">:</span> <a href="secp.html#SkPrivateKey"><span class="Identifier">SkPrivateKey</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/crypto/secp.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/crypto/secp.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:50 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

330
bumplibp2p/libp2p/dial.html Normal file
View File

@ -0,0 +1,330 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/dial</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/dial</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Dial" title="Dial = ref object of RootObj">Dial</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#14" id="64">Methods</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">addTransport
<li><a class="reference" href="#addTransport.e%2CDial%2CTransport" title="addTransport(self: Dial; transport: Transport)">addTransport(self: Dial; transport: Transport)</a></li>
</ul>
<ul class="simple nested-toc-section">connect
<li><a class="reference" href="#connect.e%2CDial%2CMultiAddress" title="connect(self: Dial; address: MultiAddress; allowUnknownPeerId = false): Future[
PeerId]">connect(self: Dial; address: MultiAddress; allowUnknownPeerId = false): Future[
PeerId]</a></li>
<li><a class="reference" href="#connect.e%2CDial%2CPeerId%2Cseq%5BMultiAddress%5D" title="connect(self: Dial; peerId: PeerId; addrs: seq[MultiAddress]; forceDial = false;
reuseConnection = true; upgradeDir = Direction.Out)">connect(self: Dial; peerId: PeerId; addrs: seq[MultiAddress]; forceDial = false;
reuseConnection = true; upgradeDir = Direction.Out)</a></li>
</ul>
<ul class="simple nested-toc-section">dial
<li><a class="reference" href="#dial.e%2CDial%2CPeerId%2Cseq%5BMultiAddress%5D%2Cseq%5Bstring%5D" title="dial(self: Dial; peerId: PeerId; addrs: seq[MultiAddress]; protos: seq[string];
forceDial = false): Future[Connection]">dial(self: Dial; peerId: PeerId; addrs: seq[MultiAddress]; protos: seq[string];
forceDial = false): Future[Connection]</a></li>
<li><a class="reference" href="#dial.e%2CDial%2CPeerId%2Cseq%5Bstring%5D" title="dial(self: Dial; peerId: PeerId; protos: seq[string]): Future[Connection]">dial(self: Dial; peerId: PeerId; protos: seq[string]): Future[Connection]</a></li>
</ul>
<ul class="simple nested-toc-section">tryDial
<li><a class="reference" href="#tryDial.e%2CDial%2CPeerId%2Cseq%5BMultiAddress%5D" title="tryDial(self: Dial; peerId: PeerId; addrs: seq[MultiAddress]): Future[
Opt[MultiAddress]]">tryDial(self: Dial; peerId: PeerId; addrs: seq[MultiAddress]): Future[
Opt[MultiAddress]]</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="peerid.html">peerid</a>, <a class="reference external" href="stream/connection.html">stream/connection</a>, <a class="reference external" href="transports/transport.html">transports/transport</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Dial" class="tohide">
<dt><pre><a href="dial.html#Dial"><span class="Identifier">Dial</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="14">
<h1><a class="toc-backref" href="#14">Methods</a></h1>
<dl class="item">
<div id="addTransport-methods-all">
<div id="addTransport.e,Dial,Transport" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#addTransport.e%2CDial%2CTransport"><span class="Identifier">addTransport</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="dial.html#Dial"><span class="Identifier">Dial</span></a><span class="Other">;</span> <span class="Identifier">transport</span><span class="Other">:</span> <a href="transports/transport.html#Transport"><span class="Identifier">Transport</span></a><span class="Other">)</span> {.<span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L67" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L67" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="connect-methods-all">
<div id="connect.e,Dial,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#connect.e%2CDial%2CMultiAddress"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="dial.html#Dial"><span class="Identifier">Dial</span></a><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">;</span> <span class="Identifier">allowUnknownPeerId</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">PeerId</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Connects to a peer and retrieve its PeerId
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="connect.e,Dial,PeerId,seq[MultiAddress]" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#connect.e%2CDial%2CPeerId%2Cseq%5BMultiAddress%5D"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="dial.html#Dial"><span class="Identifier">Dial</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">addrs</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">forceDial</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span> <span class="Identifier">reuseConnection</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">;</span>
<span class="Identifier">upgradeDir</span> <span class="Other">=</span> <a href="stream/lpstream.html#Direction"><span class="Identifier">Direction</span></a><span class="Other">.</span><span class="Identifier">Out</span><span class="Other">)</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
connect remote peer without negotiating a protocol
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="dial-methods-all">
<div id="dial.e,Dial,PeerId,seq[MultiAddress],seq[string]" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#dial.e%2CDial%2CPeerId%2Cseq%5BMultiAddress%5D%2Cseq%5Bstring%5D"><span class="Identifier">dial</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="dial.html#Dial"><span class="Identifier">Dial</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">addrs</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">protos</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">forceDial</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">Connection</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span>
<span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
create a protocol stream and establish a connection if one doesn't exist already
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="dial.e,Dial,PeerId,seq[string]" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#dial.e%2CDial%2CPeerId%2Cseq%5Bstring%5D"><span class="Identifier">dial</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="dial.html#Dial"><span class="Identifier">Dial</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">protos</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">Connection</span><span class="Other">]</span> {.
<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
create a protocol stream over an existing connection
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="tryDial-methods-all">
<div id="tryDial.e,Dial,PeerId,seq[MultiAddress]" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#tryDial.e%2CDial%2CPeerId%2Cseq%5BMultiAddress%5D"><span class="Identifier">tryDial</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="dial.html#Dial"><span class="Identifier">Dial</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">addrs</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">MultiAddress</span><span class="Other">]</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dial.nim#L72" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dial.nim#L72" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/dialer</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/dialer</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/dialer.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/dialer.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,321 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/errors</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/errors</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#LPError" title="LPError = object of CatchableError">LPError</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">allFuturesThrowing
<li><a class="reference" href="#allFuturesThrowing%2Cvarargs%5BFuture%5BT%5D%5D" title="allFuturesThrowing[T](args: varargs[Future[T]]): Future[void]">allFuturesThrowing[T](args: varargs[Future[T]]): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">toException
<li><a class="reference" href="#toException%2Ccstring" title="toException(e: cstring): ref LPError">toException(e: cstring): ref LPError</a></li>
<li><a class="reference" href="#toException%2Cstring" title="toException(e: string): ref LPError">toException(e: string): ref LPError</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">checkFutures
<li><a class="reference" href="#checkFutures.m%2Cseq%5BFuture%5BT%5D%5D%2Cuntyped" title="checkFutures[T](futs: seq[Future[T]]; exclude: untyped = []): untyped">checkFutures[T](futs: seq[Future[T]]; exclude: untyped = []): untyped</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">tryAndWarn
<li><a class="reference" href="#tryAndWarn.t%2Cstatic%5Bstring%5D%2Cuntyped" title="tryAndWarn(message: static[string]; body: untyped): untyped">tryAndWarn(message: static[string]; body: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="LPError" class="tohide">
<dt><pre><a href="errors.html#LPError"><span class="Identifier">LPError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">CatchableError</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L10" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L10" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="allFuturesThrowing-procs-all">
<div id="allFuturesThrowing,varargs[Future[T]]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#allFuturesThrowing%2Cvarargs%5BFuture%5BT%5D%5D"><span class="Identifier">allFuturesThrowing</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">args</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toException-procs-all">
<div id="toException,cstring" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#toException%2Ccstring"><span class="Identifier">toException</span></a><span class="Other">(</span><span class="Identifier">e</span><span class="Other">:</span> <span class="Identifier">cstring</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="errors.html#LPError"><span class="Identifier">LPError</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L12" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L12" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="toException,string" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#toException%2Cstring"><span class="Identifier">toException</span></a><span class="Other">(</span><span class="Identifier">e</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <a href="errors.html#LPError"><span class="Identifier">LPError</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L15" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L15" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="checkFutures-macros-all">
<div id="checkFutures.m,seq[Future[T]],untyped" class="tohide">
<dt><pre><span class="Keyword">macro</span> <a href="#checkFutures.m%2Cseq%5BFuture%5BT%5D%5D%2Cuntyped"><span class="Identifier">checkFutures</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">futs</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">exclude</span><span class="Other">:</span> <span class="Identifier">untyped</span> <span class="Other">=</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="tryAndWarn-templates-all">
<div id="tryAndWarn.t,static[string],untyped" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#tryAndWarn.t%2Cstatic%5Bstring%5D%2Cuntyped"><span class="Identifier">tryAndWarn</span></a><span class="Other">(</span><span class="Identifier">message</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">body</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/errors.nim#L69" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/errors.nim#L69" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,348 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/multibase</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/multibase</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#MultiBase" title="MultiBase = object">MultiBase</a></li>
<li><a class="reference" href="#MultiBaseStatus" title="MultiBaseStatus {.pure.} = enum
Error, Success, Overrun, Incorrect, BadCodec, NotSupported">MultiBaseStatus</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">decode
<li><a class="reference" href="#decode%2Ctypedesc%5BMultiBase%5D%2CopenArray%5Bchar%5D" title="decode(mbtype: typedesc[MultiBase]; inbytes: openArray[char]): Result[seq[byte],
string]">decode(mbtype: typedesc[MultiBase]; inbytes: openArray[char]): Result[seq[byte],
string]</a></li>
<li><a class="reference" href="#decode%2Ctypedesc%5BMultiBase%5D%2CopenArray%5Bchar%5D%2CopenArray%5Bbyte%5D%2Cint" title="decode(mbtype: typedesc[MultiBase]; inbytes: openArray[char];
outbytes: var openArray[byte]; outlen: var int): MultiBaseStatus">decode(mbtype: typedesc[MultiBase]; inbytes: openArray[char];
outbytes: var openArray[byte]; outlen: var int): MultiBaseStatus</a></li>
</ul>
<ul class="simple nested-toc-section">decodedLength
<li><a class="reference" href="#decodedLength%2Ctypedesc%5BMultiBase%5D%2Cchar%2Cint" title="decodedLength(mbtype: typedesc[MultiBase]; encoding: char; length: int): int">decodedLength(mbtype: typedesc[MultiBase]; encoding: char; length: int): int</a></li>
</ul>
<ul class="simple nested-toc-section">encode
<li><a class="reference" href="#encode%2Ctypedesc%5BMultiBase%5D%2Cstring%2CopenArray%5Bbyte%5D" title="encode(mbtype: typedesc[MultiBase]; encoding: string; inbytes: openArray[byte]): Result[
string, string]">encode(mbtype: typedesc[MultiBase]; encoding: string; inbytes: openArray[byte]): Result[
string, string]</a></li>
<li><a class="reference" href="#encode%2Ctypedesc%5BMultiBase%5D%2Cstring%2CopenArray%5Bbyte%5D%2CopenArray%5Bchar%5D%2Cint" title="encode(mbtype: typedesc[MultiBase]; encoding: string; inbytes: openArray[byte];
outbytes: var openArray[char]; outlen: var int): MultiBaseStatus">encode(mbtype: typedesc[MultiBase]; encoding: string; inbytes: openArray[byte];
outbytes: var openArray[char]; outlen: var int): MultiBaseStatus</a></li>
</ul>
<ul class="simple nested-toc-section">encodedLength
<li><a class="reference" href="#encodedLength%2Ctypedesc%5BMultiBase%5D%2Cstring%2Cint" title="encodedLength(mbtype: typedesc[MultiBase]; encoding: string; length: int): int">encodedLength(mbtype: typedesc[MultiBase]; encoding: string; length: int): int</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements MultiBase.</p>
<p>TODO:</p>
<ol class="simple"><li>base32z</li>
</ol>
</p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="MultiBase" class="tohide">
<dt><pre><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MultiBaseStatus" class="tohide">
<dt><pre><a href="multibase.html#MultiBaseStatus"><span class="Identifier">MultiBaseStatus</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Error</span><span class="Other">,</span> <span class="Identifier">Success</span><span class="Other">,</span> <span class="Identifier">Overrun</span><span class="Other">,</span> <span class="Identifier">Incorrect</span><span class="Other">,</span> <span class="Identifier">BadCodec</span><span class="Other">,</span> <span class="Identifier">NotSupported</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="decode-procs-all">
<div id="decode,typedesc[MultiBase],openArray[char]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#decode%2Ctypedesc%5BMultiBase%5D%2CopenArray%5Bchar%5D"><span class="Identifier">decode</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">inbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">char</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">string</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Decode MultiBase encoded array <tt class="docutils literal"><span class="pre">inbytes</span></tt> and return decoded sequence of bytes.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L465" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L465" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="decode,typedesc[MultiBase],openArray[char],openArray[byte],int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#decode%2Ctypedesc%5BMultiBase%5D%2CopenArray%5Bchar%5D%2CopenArray%5Bbyte%5D%2Cint"><span class="Identifier">decode</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">inbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">char</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">outbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">outlen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="multibase.html#MultiBaseStatus"><span class="Identifier">MultiBaseStatus</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Decode array <tt class="docutils literal"><span class="pre">inbytes</span></tt> using MultiBase encoding and store decoded value to <tt class="docutils literal"><span class="pre">outbytes</span></tt>.</p>
<p>If <tt class="docutils literal"><span class="pre">inbytes</span></tt> is not correct MultiBase string, then <tt class="docutils literal"><span class="pre">MultiBaseStatus.BadCodec</span></tt> if first character is wrong, or <tt class="docutils literal"><span class="pre">MultiBaseStatus.Incorrect</span></tt> if string has incorrect characters for such encoding.</p>
<p>If length of <tt class="docutils literal"><span class="pre">outbytes</span></tt> is not enough to store decoded result, then <tt class="docutils literal"><span class="pre">MultiBaseStatus.Overrun</span></tt> error will be returned and <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to length required.</p>
<p>On successfull decoding <tt class="docutils literal"><span class="pre">MultiBaseStatus.Success</span></tt> will be returned and <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to number of encoded octets (bytes).</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L411" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L411" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="decodedLength-procs-all">
<div id="decodedLength,typedesc[MultiBase],char,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#decodedLength%2Ctypedesc%5BMultiBase%5D%2Cchar%2Cint"><span class="Identifier">decodedLength</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">encoding</span><span class="Other">:</span> <span class="Identifier">char</span><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return estimated size of buffer to store MultiBase decoded value with encoding character <tt class="docutils literal"><span class="pre">encoding</span></tt> of length <tt class="docutils literal"><span class="pre">length</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L358" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L358" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encode-procs-all">
<div id="encode,typedesc[MultiBase],string,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2Ctypedesc%5BMultiBase%5D%2Cstring%2CopenArray%5Bbyte%5D"><span class="Identifier">encode</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">encoding</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">inbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">,</span> <span class="Identifier">string</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Encode array <tt class="docutils literal"><span class="pre">inbytes</span></tt> using MultiBase encoding scheme <tt class="docutils literal"><span class="pre">encoding</span></tt> and return encoded string.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L441" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L441" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="encode,typedesc[MultiBase],string,openArray[byte],openArray[char],int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2Ctypedesc%5BMultiBase%5D%2Cstring%2CopenArray%5Bbyte%5D%2CopenArray%5Bchar%5D%2Cint"><span class="Identifier">encode</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">encoding</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">inbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">outbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">char</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">outlen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="multibase.html#MultiBaseStatus"><span class="Identifier">MultiBaseStatus</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Encode array <tt class="docutils literal"><span class="pre">inbytes</span></tt> using MultiBase encoding scheme <tt class="docutils literal"><span class="pre">encoding</span></tt> and store encoded value to <tt class="docutils literal"><span class="pre">outbytes</span></tt>.</p>
<p>If <tt class="docutils literal"><span class="pre">encoding</span></tt> is not supported <tt class="docutils literal"><span class="pre">MultiBaseStatus.NotSupported</span></tt> will be returned.</p>
<p>If <tt class="docutils literal"><span class="pre">encoding</span></tt> is not correct string, then <tt class="docutils literal"><span class="pre">MultBaseStatus.BadCodec</span></tt> will be returned.</p>
<p>If length of <tt class="docutils literal"><span class="pre">outbytes</span></tt> is not enough to store encoded result, then <tt class="docutils literal"><span class="pre">MultiBaseStatus.Overrun</span></tt> error will be returned and <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to length required.</p>
<p>On successfull encoding <tt class="docutils literal"><span class="pre">MultiBaseStatus.Success</span></tt> will be returned and <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to number of encoded octets (bytes).</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L371" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L371" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encodedLength-procs-all">
<div id="encodedLength,typedesc[MultiBase],string,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encodedLength%2Ctypedesc%5BMultiBase%5D%2Cstring%2Cint"><span class="Identifier">encodedLength</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">encoding</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return estimated size of buffer to store MultiBase encoded value with encoding <tt class="docutils literal"><span class="pre">encoding</span></tt> of length <tt class="docutils literal"><span class="pre">length</span></tt>.</p>
<p>Procedure returns <tt class="docutils literal"><span class="pre">-1</span></tt> if <tt class="docutils literal"><span class="pre">encoding</span></tt> scheme is not supported or not present.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multibase.nim#L342" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multibase.nim#L342" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:50 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,430 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/multicodec</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/multicodec</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#MultiCodec" title="MultiCodec = distinct int">MultiCodec</a></li>
<li><a class="reference" href="#MultiCodecError" title="MultiCodecError = enum
MultiCodecNotSupported">MultiCodecError</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#InvalidMultiCodec" title="InvalidMultiCodec = -1">InvalidMultiCodec</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">!=
<li><a class="reference" href="#%21%3D%2CMultiCodec%2CMultiCodec" title="`!=`(a, b: MultiCodec): bool">`!=`(a, b: MultiCodec): bool</a></li>
</ul>
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CMultiCodec" title="`$`(mc: MultiCodec): string">`$`(mc: MultiCodec): string</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D%2CMultiCodec%2CMultiCodec" title="`==`(a, b: MultiCodec): bool">`==`(a, b: MultiCodec): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CMultiCodec%2Cint" title="`==`(mc: MultiCodec; code: int): bool">`==`(mc: MultiCodec; code: int): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CMultiCodec%2Cstring" title="`==`(mc: MultiCodec; name: string): bool">`==`(mc: MultiCodec; name: string): bool</a></li>
</ul>
<ul class="simple nested-toc-section">codec
<li><a class="reference" href="#codec%2Ctypedesc%5BMultiCodec%5D%2Cint" title="codec(mt: typedesc[MultiCodec]; code: int): MultiCodec">codec(mt: typedesc[MultiCodec]; code: int): MultiCodec</a></li>
<li><a class="reference" href="#codec%2Ctypedesc%5BMultiCodec%5D%2Cstring" title="codec(mt: typedesc[MultiCodec]; name: string): MultiCodec">codec(mt: typedesc[MultiCodec]; name: string): MultiCodec</a></li>
</ul>
<ul class="simple nested-toc-section">hash
<li><a class="reference" href="#hash%2CMultiCodec" title="hash(m: MultiCodec): Hash">hash(m: MultiCodec): Hash</a></li>
</ul>
<ul class="simple nested-toc-section">multiCodec
<li><a class="reference" href="#multiCodec%2Cint" title="multiCodec(code: int): MultiCodec">multiCodec(code: int): MultiCodec</a></li>
<li><a class="reference" href="#multiCodec%2Cstring" title="multiCodec(name: string): MultiCodec">multiCodec(name: string): MultiCodec</a></li>
</ul>
<ul class="simple nested-toc-section">write
<li><a class="reference" href="#write%2CVBuffer%2CMultiCodec" title="write(vb: var VBuffer; mc: MultiCodec)">write(vb: var VBuffer; mc: MultiCodec)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements MultiCodec.List of officially supported codecs can BE found here <a class="reference external" href="https://github.com/multiformats/multicodec/blob/master/table.csv">https://github.com/multiformats/multicodec/blob/master/table.csv</a></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="varint.html">varint</a>, <a class="reference external" href="vbuffer.html">vbuffer</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="MultiCodec" class="tohide">
<dt><pre><a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L239" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L239" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MultiCodecError" class="tohide">
<dt><pre><a href="multicodec.html#MultiCodecError"><span class="Identifier">MultiCodecError</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">MultiCodecNotSupported</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L240" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L240" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="InvalidMultiCodec" class="tohide">
<dt><pre><a href="multicodec.html#InvalidMultiCodec"><span class="Identifier">InvalidMultiCodec</span></a> <span class="Other">=</span> <span class="DecNumber">-1</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L244" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L244" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="!=-procs-all">
<div id="!=,MultiCodec,MultiCodec" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%21%3D%2CMultiCodec%2CMultiCodec"><span class="Identifier">`!=`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if MultiCodecs <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt> are not equal.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L291" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L291" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="$-procs-all">
<div id="$,MultiCodec" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CMultiCodec"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">mc</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns string representation of MultiCodec <tt class="docutils literal"><span class="pre">mc</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L270" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L270" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-procs-all">
<div id="==,MultiCodec,MultiCodec" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CMultiCodec%2CMultiCodec"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if MultiCodecs <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt> are equal.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L287" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L287" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,MultiCodec,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CMultiCodec%2Cint"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">mc</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">;</span> <span class="Identifier">code</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compares MultiCodec <tt class="docutils literal"><span class="pre">mc</span></tt> with integer <tt class="docutils literal"><span class="pre">code</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L283" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L283" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,MultiCodec,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CMultiCodec%2Cstring"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">mc</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compares MultiCodec <tt class="docutils literal"><span class="pre">mc</span></tt> with string <tt class="docutils literal"><span class="pre">name</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L276" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L276" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="codec-procs-all">
<div id="codec,typedesc[MultiCodec],int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#codec%2Ctypedesc%5BMultiCodec%5D%2Cint"><span class="Identifier">codec</span></a><span class="Other">(</span><span class="Identifier">mt</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">code</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return MultiCodec from integer representation <tt class="docutils literal"><span class="pre">code</span></tt>. If <tt class="docutils literal"><span class="pre">code</span></tt> is not valid multicodec code, then <tt class="docutils literal"><span class="pre">InvalidMultiCodec</span></tt> will be returned.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L305" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L305" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="codec,typedesc[MultiCodec],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#codec%2Ctypedesc%5BMultiCodec%5D%2Cstring"><span class="Identifier">codec</span></a><span class="Other">(</span><span class="Identifier">mt</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return MultiCodec from string representation <tt class="docutils literal"><span class="pre">name</span></tt>. If <tt class="docutils literal"><span class="pre">name</span></tt> is not valid multicodec name, then <tt class="docutils literal"><span class="pre">InvalidMultiCodec</span></tt> will be returned.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L299" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L299" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hash-procs-all">
<div id="hash,MultiCodec" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#hash%2CMultiCodec"><span class="Identifier">hash</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Hash</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Hash procedure for tables.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L295" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L295" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="multiCodec-procs-all">
<div id="multiCodec,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#multiCodec%2Cint"><span class="Identifier">multiCodec</span></a><span class="Other">(</span><span class="Identifier">code</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a> {.<span class="Identifier">compileTime</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Generate MultiCodec from integer <tt class="docutils literal"><span class="pre">code</span></tt> at compile time.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L264" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L264" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="multiCodec,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#multiCodec%2Cstring"><span class="Identifier">multiCodec</span></a><span class="Other">(</span><span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a> {.<span class="Identifier">compileTime</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Generate MultiCodec from string <tt class="docutils literal"><span class="pre">name</span></tt> at compile time.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L258" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L258" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="write-procs-all">
<div id="write,VBuffer,MultiCodec" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CVBuffer%2CMultiCodec"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">mc</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write MultiCodec to buffer <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multicodec.nim#L315" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multicodec.nim#L315" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:50 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,616 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/multihash</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/multihash</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#MHash" title="MHash = object
mcodec*: MultiCodec
size*: int
coder*: MHashCoderProc">MHash</a></li>
<li><a class="reference" href="#MHashCoderProc" title="MHashCoderProc = proc (data: openArray[byte]; output: var openArray[byte]) {.
nimcall, gcsafe, noSideEffect, raises: [].}">MHashCoderProc</a></li>
<li><a class="reference" href="#MhResult" title="MhResult[T] = Result[T, cstring]">MhResult</a></li>
<li><a class="reference" href="#MultiHash" title="MultiHash = object
data*: VBuffer
mcodec*: MultiCodec
size*: int
dpos*: int">MultiHash</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#MaxHashSize" title="MaxHashSize = 128">MaxHashSize</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CMultiHash" title="`$`(mh: MultiHash): string">`$`(mh: MultiHash): string</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D%2CMultiHash%2CMultiHash" title="`==`(a: MultiHash; b: MultiHash): bool">`==`(a: MultiHash; b: MultiHash): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CMDigest%5BT%5D%2CMultiHash" title="`==`[T](mdigest: MDigest[T]; mh: MultiHash): bool">`==`[T](mdigest: MDigest[T]; mh: MultiHash): bool</a></li>
<li><a class="reference" href="#%3D%3D%2CMultiHash%2CMDigest%5BT%5D" title="`==`[T](mh: MultiHash; mdigest: MDigest[T]): bool">`==`[T](mh: MultiHash; mdigest: MDigest[T]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">base58
<li><a class="reference" href="#base58%2CMultiHash" title="base58(value: MultiHash): string">base58(value: MultiHash): string</a></li>
</ul>
<ul class="simple nested-toc-section">decode
<li><a class="reference" href="#decode%2Ctypedesc%5BMultiHash%5D%2CopenArray%5Bbyte%5D%2CMultiHash" title="decode(mhtype: typedesc[MultiHash]; data: openArray[byte]; mhash: var MultiHash): MhResult[
int]">decode(mhtype: typedesc[MultiHash]; data: openArray[byte]; mhash: var MultiHash): MhResult[
int]</a></li>
</ul>
<ul class="simple nested-toc-section">digest
<li><a class="reference" href="#digest%2Ctypedesc%5BMultiHash%5D%2Cint%2CopenArray%5Bbyte%5D" title="digest(mhtype: typedesc[MultiHash]; hashcode: int; data: openArray[byte]): MhResult[
MultiHash]">digest(mhtype: typedesc[MultiHash]; hashcode: int; data: openArray[byte]): MhResult[
MultiHash]</a></li>
<li><a class="reference" href="#digest%2Ctypedesc%5BMultiHash%5D%2Cstring%2CopenArray%5Bbyte%5D" title="digest(mhtype: typedesc[MultiHash]; hashname: string; data: openArray[byte]): MhResult[
MultiHash]">digest(mhtype: typedesc[MultiHash]; hashname: string; data: openArray[byte]): MhResult[
MultiHash]</a></li>
</ul>
<ul class="simple nested-toc-section">encode
<li><a class="reference" href="#encode%2Ctypedesc%5BMultiBase%5D%2Cstring%2CMultiHash" title="encode(mbtype: typedesc[MultiBase]; encoding: string; mh: MultiHash): string">encode(mbtype: typedesc[MultiBase]; encoding: string; mh: MultiHash): string</a></li>
</ul>
<ul class="simple nested-toc-section">hex
<li><a class="reference" href="#hex%2CMultiHash" title="hex(value: MultiHash): string">hex(value: MultiHash): string</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2Ctypedesc%5BMultiHash%5D%2CopenArray%5Bbyte%5D" title="init(mhtype: typedesc[MultiHash]; data: openArray[byte]): MhResult[MultiHash]">init(mhtype: typedesc[MultiHash]; data: openArray[byte]): MhResult[MultiHash]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BMultiHash%5D%2Cstring" title="init(mhtype: typedesc[MultiHash]; data: string): MhResult[MultiHash]">init(mhtype: typedesc[MultiHash]; data: string): MhResult[MultiHash]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BMultiHash%5D%2CMultiCodec%2CopenArray%5Bbyte%5D" title="init(mhtype: typedesc[MultiHash]; hashcode: MultiCodec; bdigest: openArray[byte]): MhResult[
MultiHash]">init(mhtype: typedesc[MultiHash]; hashcode: MultiCodec; bdigest: openArray[byte]): MhResult[
MultiHash]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BMultiHash%5D%2Cstring%2CopenArray%5Bbyte%5D" title="init(mhtype: typedesc[MultiHash]; hashname: string; bdigest: openArray[byte]): MhResult[
MultiHash]">init(mhtype: typedesc[MultiHash]; hashname: string; bdigest: openArray[byte]): MhResult[
MultiHash]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BMultiHash%5D%2CMultiCodec%2CMDigest%5BT%5D" title="init[T](mhtype: typedesc[MultiHash]; hashcode: MultiCodec; mdigest: MDigest[T]): MhResult[
MultiHash]">init[T](mhtype: typedesc[MultiHash]; hashcode: MultiCodec; mdigest: MDigest[T]): MhResult[
MultiHash]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BMultiHash%5D%2Cstring%2CMDigest%5BT%5D" title="init[T](mhtype: typedesc[MultiHash]; hashname: string; mdigest: MDigest[T]): MhResult[
MultiHash]">init[T](mhtype: typedesc[MultiHash]; hashname: string; mdigest: MDigest[T]): MhResult[
MultiHash]</a></li>
</ul>
<ul class="simple nested-toc-section">init58
<li><a class="reference" href="#init58%2Ctypedesc%5BMultiHash%5D%2Cstring" title="init58(mhtype: typedesc[MultiHash]; data: string): MultiHash">init58(mhtype: typedesc[MultiHash]; data: string): MultiHash</a></li>
</ul>
<ul class="simple nested-toc-section">validate
<li><a class="reference" href="#validate%2Ctypedesc%5BMultiHash%5D%2CopenArray%5Bbyte%5D" title="validate(mhtype: typedesc[MultiHash]; data: openArray[byte]): bool">validate(mhtype: typedesc[MultiHash]; data: openArray[byte]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">write
<li><a class="reference" href="#write%2CVBuffer%2CMultiHash" title="write(vb: var VBuffer; mh: MultiHash)">write(vb: var VBuffer; mh: MultiHash)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements MultiHash. Supported hashes are:<ol class="simple"><li>IDENTITY</li>
<li>SHA2-256/SHA2-512</li>
<li>DBL-SHA2-256</li>
<li>SHA3/KECCAK</li>
<li>SHAKE-128/SHAKE-256</li>
<li>BLAKE2s/BLAKE2s</li>
<li>SHA1</li>
</ol>
<p>Hashes which are not yet supported</p>
<ol class="simple"><li>SKEIN</li>
<li>MURMUR</li>
</ol>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="varint.html">varint</a>, <a class="reference external" href="vbuffer.html">vbuffer</a>, <a class="reference external" href="multicodec.html">multicodec</a>, <a class="reference external" href="multibase.html">multibase</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="MHash" class="tohide">
<dt><pre><a href="multihash.html#MHash"><span class="Identifier">MHash</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">mcodec</span><span class="Operator">*</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a>
<span class="Identifier">size</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">coder</span><span class="Operator">*</span><span class="Other">:</span> <a href="multihash.html#MHashCoderProc"><span class="Identifier">MHashCoderProc</span></a>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MHashCoderProc" class="tohide">
<dt><pre><a href="multihash.html#MHashCoderProc"><span class="Identifier">MHashCoderProc</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span> {.
<span class="Identifier">nimcall</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> </span><span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MhResult" class="tohide">
<dt><pre><a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">cstring</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L57" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L57" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MultiHash" class="tohide">
<dt><pre><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a>
<span class="Identifier">mcodec</span><span class="Operator">*</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a>
<span class="Identifier">size</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">dpos</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="MaxHashSize" class="tohide">
<dt><pre><a href="multihash.html#MaxHashSize"><span class="Identifier">MaxHashSize</span></a> <span class="Other">=</span> <span class="DecNumber">128</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CMultiHash"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">mh</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return string representation of MultiHash <tt class="docutils literal"><span class="pre">value</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L579" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L579" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-procs-all">
<div id="==,MultiHash,MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CMultiHash%2CMultiHash"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">;</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compares MultiHashes <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt>, returns <tt class="docutils literal"><span class="pre">true</span></tt> if hashes are equal, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L559" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L559" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,MDigest[T],MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CMDigest%5BT%5D%2CMultiHash"><span class="Identifier">`==`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">mdigest</span><span class="Other">:</span> <span class="Identifier">MDigest</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">mh</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compares MultiHash with nimcrypto's MDigest<a class="reference internal" href="#T">T</a>, returns <tt class="docutils literal"><span class="pre">true</span></tt> if hashes are equal, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L554" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L554" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="==,MultiHash,MDigest[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CMultiHash%2CMDigest%5BT%5D"><span class="Identifier">`==`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">mh</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">;</span> <span class="Identifier">mdigest</span><span class="Other">:</span> <span class="Identifier">MDigest</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compares MultiHash with nimcrypto's MDigest<a class="reference internal" href="#T">T</a>, returns <tt class="docutils literal"><span class="pre">true</span></tt> if hashes are equal, <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L544" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L544" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="base58-procs-all">
<div id="base58,MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#base58%2CMultiHash"><span class="Identifier">base58</span></a><span class="Other">(</span><span class="Identifier">value</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return Base58 encoded string representation of MultiHash <tt class="docutils literal"><span class="pre">value</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L575" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L575" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="decode-procs-all">
<div id="decode,typedesc[MultiHash],openArray[byte],MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#decode%2Ctypedesc%5BMultiHash%5D%2CopenArray%5Bbyte%5D%2CMultiHash"><span class="Identifier">decode</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">mhash</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Decode MultiHash value from array of bytes <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>On success decoded MultiHash will be stored into <tt class="docutils literal"><span class="pre">mhash</span></tt> and number of bytes consumed will be returned.</p>
<p>On error <tt class="docutils literal"><span class="pre">-1</span></tt> will be returned.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L436" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L436" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="digest-procs-all">
<div id="digest,typedesc[MultiHash],int,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#digest%2Ctypedesc%5BMultiHash%5D%2Cint%2CopenArray%5Bbyte%5D"><span class="Identifier">digest</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">hashcode</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span>
<a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Perform digest calculation using hash algorithm with code <tt class="docutils literal"><span class="pre">hashcode</span></tt> on data array <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L370" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L370" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="digest,typedesc[MultiHash],string,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#digest%2Ctypedesc%5BMultiHash%5D%2Cstring%2CopenArray%5Bbyte%5D"><span class="Identifier">digest</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">hashname</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span>
<a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Perform digest calculation using hash algorithm with name <tt class="docutils literal"><span class="pre">hashname</span></tt> on data array <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L356" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L356" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encode-procs-all">
<div id="encode,typedesc[MultiBase],string,MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2Ctypedesc%5BMultiBase%5D%2Cstring%2CMultiHash"><span class="Identifier">encode</span></a><span class="Other">(</span><span class="Identifier">mbtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multibase.html#MultiBase"><span class="Identifier">MultiBase</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">encoding</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">mh</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get MultiBase encoded representation of <tt class="docutils literal"><span class="pre">mh</span></tt> using encoding <tt class="docutils literal"><span class="pre">encoding</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L589" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L589" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hex-procs-all">
<div id="hex,MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#hex%2CMultiHash"><span class="Identifier">hex</span></a><span class="Other">(</span><span class="Identifier">value</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return hexadecimal string representation of MultiHash <tt class="docutils literal"><span class="pre">value</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L571" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L571" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init-procs-all">
<div id="init,typedesc[MultiHash],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BMultiHash%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span>
<a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from bytes array <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L511" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L511" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[MultiHash],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BMultiHash%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from hexadecimal string representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L518" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L518" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[MultiHash],MultiCodec,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BMultiHash%5D%2CMultiCodec%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">hashcode</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">;</span>
<span class="Identifier">bdigest</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from array of bytes <tt class="docutils literal"><span class="pre">bdigest</span></tt> and hash algorithm code <tt class="docutils literal"><span class="pre">hashcode</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L424" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L424" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[MultiHash],string,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BMultiHash%5D%2Cstring%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">hashname</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
<span class="Identifier">bdigest</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from array of bytes <tt class="docutils literal"><span class="pre">bdigest</span></tt> and hash algorithm code <tt class="docutils literal"><span class="pre">hashcode</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L408" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L408" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[MultiHash],MultiCodec,MDigest[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BMultiHash%5D%2CMultiCodec%2CMDigest%5BT%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">hashcode</span><span class="Other">:</span> <a href="multicodec.html#MultiCodec"><span class="Identifier">MultiCodec</span></a><span class="Other">;</span>
<span class="Identifier">mdigest</span><span class="Other">:</span> <span class="Identifier">MDigest</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from nimcrypto's <tt class="docutils literal"><span class="pre"><span class="Identifier">MDigest</span></span></tt> and hash algorithm code <tt class="docutils literal"><span class="pre">hashcode</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L396" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L396" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[MultiHash],string,MDigest[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BMultiHash%5D%2Cstring%2CMDigest%5BT%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">hashname</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">mdigest</span><span class="Other">:</span> <span class="Identifier">MDigest</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MhResult"><span class="Identifier">MhResult</span></a><span class="Other">[</span>
<a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from nimcrypto's <tt class="docutils literal"><span class="pre"><span class="Identifier">MDigest</span></span></tt> object and hash algorithm name <tt class="docutils literal"><span class="pre">hashname</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L380" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L380" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init58-procs-all">
<div id="init58,typedesc[MultiHash],string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init58%2Ctypedesc%5BMultiHash%5D%2Cstring"><span class="Identifier">init58</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create MultiHash from BASE58 encoded string representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L527" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L527" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="validate-procs-all">
<div id="validate,typedesc[MultiHash],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#validate%2Ctypedesc%5BMultiHash%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">validate</span></a><span class="Other">(</span><span class="Identifier">mhtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if array of bytes <tt class="docutils literal"><span class="pre">data</span></tt> has correct MultiHash inside.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L481" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L481" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="write-procs-all">
<div id="write,VBuffer,MultiHash" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CVBuffer%2CMultiHash"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">mh</span><span class="Other">:</span> <a href="multihash.html#MultiHash"><span class="Identifier">MultiHash</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write MultiHash value <tt class="docutils literal"><span class="pre">mh</span></tt> to buffer <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multihash.nim#L585" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multihash.nim#L585" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:50 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/multistream</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/multistream</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/multistream.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/multistream.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/muxers/mplex/coder</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/muxers/mplex/coder</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/mplex/coder.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/mplex/coder.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:52 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,477 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/muxers/muxer</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/muxers/muxer</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Muxer" title="Muxer = ref object of RootObj
streamHandler*: StreamHandler
handler*: Future[void]
connection*: Connection">Muxer</a></li>
<li><a class="reference" href="#MuxerConstructor" title="MuxerConstructor = proc (conn: Connection): Muxer {.gcsafe, closure, raises: [].}">MuxerConstructor</a></li>
<li><a class="reference" href="#MuxerError" title="MuxerError = object of LPError">MuxerError</a></li>
<li><a class="reference" href="#MuxerHandler" title="MuxerHandler = proc (muxer: Muxer): Future[void] {.gcsafe, raises: [].}">MuxerHandler</a></li>
<li><a class="reference" href="#MuxerProvider" title="MuxerProvider = object
newMuxer*: MuxerConstructor
codec*: string">MuxerProvider</a></li>
<li><a class="reference" href="#StreamHandler" title="StreamHandler = proc (conn: Connection): Future[void] {.gcsafe, raises: [].}">StreamHandler</a></li>
<li><a class="reference" href="#TooManyChannels" title="TooManyChannels = object of MuxerError">TooManyChannels</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#DefaultChanTimeout" title="DefaultChanTimeout = (value: 300000000000)">DefaultChanTimeout</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2Ctypedesc%5BMuxerProvider%5D%2CMuxerConstructor%2Cstring" title="new(T: typedesc[MuxerProvider]; creator: MuxerConstructor; codec: string): T:type">new(T: typedesc[MuxerProvider]; creator: MuxerConstructor; codec: string): T:type</a></li>
</ul>
<ul class="simple nested-toc-section">shortLog
<li><a class="reference" href="#shortLog%2CMuxer" title="shortLog(m: Muxer): auto">shortLog(m: Muxer): auto</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#14" id="64">Methods</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">close
<li><a class="reference" href="#close.e%2CMuxer" title="close(m: Muxer)">close(m: Muxer)</a></li>
</ul>
<ul class="simple nested-toc-section">getStreams
<li><a class="reference" href="#getStreams.e%2CMuxer" title="getStreams(m: Muxer): seq[Connection]">getStreams(m: Muxer): seq[Connection]</a></li>
</ul>
<ul class="simple nested-toc-section">handle
<li><a class="reference" href="#handle.e%2CMuxer" title="handle(m: Muxer): Future[void]">handle(m: Muxer): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">newStream
<li><a class="reference" href="#newStream.e%2CMuxer%2Cstring%2Cbool" title="newStream(m: Muxer; name: string = &quot;&quot;; lazy: bool = false): Future[Connection]">newStream(m: Muxer; name: string = &quot;&quot;; lazy: bool = false): Future[Connection]</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">formatItIMPL
<li><a class="reference" href="#formatItIMPL.t%2CMuxer" title="formatItIMPL(it: Muxer): auto">formatItIMPL(it: Muxer): auto</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../stream/connection.html">../stream/connection</a>, <a class="reference external" href="../errors.html">../errors</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Muxer" class="tohide">
<dt><pre><a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">streamHandler</span><span class="Operator">*</span><span class="Other">:</span> <a href="muxer.html#StreamHandler"><span class="Identifier">StreamHandler</span></a>
<span class="Identifier">handler</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span>
<span class="Identifier">connection</span><span class="Operator">*</span><span class="Other">:</span> <a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MuxerConstructor" class="tohide">
<dt><pre><a href="muxer.html#MuxerConstructor"><span class="Identifier">MuxerConstructor</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">conn</span><span class="Other">:</span> <a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a><span class="Other">)</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> </span><span class="Identifier">closure</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MuxerError" class="tohide">
<dt><pre><a href="muxer.html#MuxerError"><span class="Identifier">MuxerError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../errors.html#LPError"><span class="Identifier">LPError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MuxerHandler" class="tohide">
<dt><pre><a href="muxer.html#MuxerHandler"><span class="Identifier">MuxerHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">muxer</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MuxerProvider" class="tohide">
<dt><pre><a href="muxer.html#MuxerProvider"><span class="Identifier">MuxerProvider</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">newMuxer</span><span class="Operator">*</span><span class="Other">:</span> <a href="muxer.html#MuxerConstructor"><span class="Identifier">MuxerConstructor</span></a>
<span class="Identifier">codec</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="StreamHandler" class="tohide">
<dt><pre><a href="muxer.html#StreamHandler"><span class="Identifier">StreamHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">conn</span><span class="Other">:</span> <a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TooManyChannels" class="tohide">
<dt><pre><a href="muxer.html#TooManyChannels"><span class="Identifier">TooManyChannels</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="muxer.html#MuxerError"><span class="Identifier">MuxerError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L24" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L24" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="DefaultChanTimeout" class="tohide">
<dt><pre><a href="muxer.html#DefaultChanTimeout"><span class="Identifier">DefaultChanTimeout</span></a> <span class="Other">=</span> <span class="Other">(</span><span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">300000000000</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L20" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L20" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="new-procs-all">
<div id="new,typedesc[MuxerProvider],MuxerConstructor,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2Ctypedesc%5BMuxerProvider%5D%2CMuxerConstructor%2Cstring"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="muxer.html#MuxerProvider"><span class="Identifier">MuxerProvider</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">creator</span><span class="Other">:</span> <a href="muxer.html#MuxerConstructor"><span class="Identifier">MuxerConstructor</span></a><span class="Other">;</span> <span class="Identifier">codec</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T:type</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="shortLog-procs-all">
<div id="shortLog,Muxer" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#shortLog%2CMuxer"><span class="Identifier">shortLog</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="14">
<h1><a class="toc-backref" href="#14">Methods</a></h1>
<dl class="item">
<div id="close-methods-all">
<div id="close.e,Muxer" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#close.e%2CMuxer"><span class="Identifier">close</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span> {.<span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getStreams-methods-all">
<div id="getStreams.e,Muxer" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#getStreams.e%2CMuxer"><span class="Identifier">getStreams</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a><span class="Other">]</span> {.<span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="handle-methods-all">
<div id="handle.e,Muxer" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#handle.e%2CMuxer"><span class="Identifier">handle</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newStream-methods-all">
<div id="newStream.e,Muxer,string,bool" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#newStream.e%2CMuxer%2Cstring%2Cbool"><span class="Identifier">newStream</span></a><span class="Other">(</span><span class="Identifier">m</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span> <span class="Identifier">lazy</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">Connection</span><span class="Other">]</span> {.<span class="Identifier">base</span><span class="Other">,</span> <span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L48" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L48" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="formatItIMPL-templates-all">
<div id="formatItIMPL.t,Muxer" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#formatItIMPL.t%2CMuxer"><span class="Identifier">formatItIMPL</span></a><span class="Other">(</span><span class="Identifier">it</span><span class="Other">:</span> <a href="muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/muxers/muxer.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/muxers/muxer.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,336 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/nameresolving/nameresolver</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/nameresolving/nameresolver</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#NameResolver" title="NameResolver = ref object of RootObj">NameResolver</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">getHostname
<li><a class="reference" href="#getHostname%2CMultiAddress" title="getHostname(ma: MultiAddress): string">getHostname(ma: MultiAddress): string</a></li>
</ul>
<ul class="simple nested-toc-section">resolveDnsAddr
<li><a class="reference" href="#resolveDnsAddr%2CNameResolver%2CMultiAddress%2Cint" title="resolveDnsAddr(self: NameResolver; ma: MultiAddress; depth: int = 0): Future[
seq[MultiAddress]]">resolveDnsAddr(self: NameResolver; ma: MultiAddress; depth: int = 0): Future[
seq[MultiAddress]]</a></li>
</ul>
<ul class="simple nested-toc-section">resolveMAddress
<li><a class="reference" href="#resolveMAddress%2CNameResolver%2CMultiAddress" title="resolveMAddress(self: NameResolver; address: MultiAddress): Future[
seq[MultiAddress]]">resolveMAddress(self: NameResolver; address: MultiAddress): Future[
seq[MultiAddress]]</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#14" id="64">Methods</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">resolveIp
<li><a class="reference" href="#resolveIp.e%2CNameResolver%2Cstring%2CPort%2CDomain" title="resolveIp(self: NameResolver; address: string; port: Port;
domain: Domain = Domain.AF_UNSPEC): Future[seq[TransportAddress]]">resolveIp(self: NameResolver; address: string; port: Port;
domain: Domain = Domain.AF_UNSPEC): Future[seq[TransportAddress]]</a></li>
</ul>
<ul class="simple nested-toc-section">resolveTxt
<li><a class="reference" href="#resolveTxt.e%2CNameResolver%2Cstring" title="resolveTxt(self: NameResolver; address: string): Future[seq[string]]">resolveTxt(self: NameResolver; address: string): Future[seq[string]]</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../multiaddress.html">../multiaddress</a>, <a class="reference external" href="../multicodec.html">../multicodec</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="NameResolver" class="tohide">
<dt><pre><a href="nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="getHostname-procs-all">
<div id="getHostname,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getHostname%2CMultiAddress"><span class="Identifier">getHostname</span></a><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L43" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L43" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="resolveDnsAddr-procs-all">
<div id="resolveDnsAddr,NameResolver,MultiAddress,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#resolveDnsAddr%2CNameResolver%2CMultiAddress%2Cint"><span class="Identifier">resolveDnsAddr</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a><span class="Other">;</span> <span class="Identifier">ma</span><span class="Other">:</span> <a href="../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">;</span> <span class="Identifier">depth</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">MultiAddress</span><span class="Other">]</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L75" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L75" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="resolveMAddress-procs-all">
<div id="resolveMAddress,NameResolver,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#resolveMAddress%2CNameResolver%2CMultiAddress"><span class="Identifier">resolveMAddress</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <a href="../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">MultiAddress</span><span class="Other">]</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L113" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L113" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="14">
<h1><a class="toc-backref" href="#14">Methods</a></h1>
<dl class="item">
<div id="resolveIp-methods-all">
<div id="resolveIp.e,NameResolver,string,Port,Domain" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#resolveIp.e%2CNameResolver%2Cstring%2CPort%2CDomain"><span class="Identifier">resolveIp</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">port</span><span class="Other">:</span> <span class="Identifier">Port</span><span class="Other">;</span>
<span class="Identifier">domain</span><span class="Other">:</span> <span class="Identifier">Domain</span> <span class="Other">=</span> <span class="Identifier">Domain</span><span class="Other">.</span><span class="Identifier">AF_UNSPEC</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">TransportAddress</span><span class="Other">]</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Resolve the specified address
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="resolveTxt-methods-all">
<div id="resolveTxt.e,NameResolver,string" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#resolveTxt.e%2CNameResolver%2Cstring"><span class="Identifier">resolveTxt</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a><span class="Other">;</span> <span class="Identifier">address</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">]</span> {.
<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get TXT record
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/nameresolving/nameresolver.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/nameresolving/nameresolver.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,314 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/observedaddrmanager</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/observedaddrmanager</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#ObservedAddrManager" title="ObservedAddrManager = ref object of RootObj">ObservedAddrManager</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CObservedAddrManager" title="`$`(self: ObservedAddrManager): string">`$`(self: ObservedAddrManager): string</a></li>
</ul>
<ul class="simple nested-toc-section">addObservation
<li><a class="reference" href="#addObservation%2CObservedAddrManager%2CMultiAddress" title="addObservation(self: ObservedAddrManager; observedAddr: MultiAddress): bool">addObservation(self: ObservedAddrManager; observedAddr: MultiAddress): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getMostObservedProtosAndPorts
<li><a class="reference" href="#getMostObservedProtosAndPorts%2CObservedAddrManager" title="getMostObservedProtosAndPorts(self: ObservedAddrManager): seq[MultiAddress]">getMostObservedProtosAndPorts(self: ObservedAddrManager): seq[MultiAddress]</a></li>
</ul>
<ul class="simple nested-toc-section">guessDialableAddr
<li><a class="reference" href="#guessDialableAddr%2CObservedAddrManager%2CMultiAddress" title="guessDialableAddr(self: ObservedAddrManager; ma: MultiAddress): MultiAddress">guessDialableAddr(self: ObservedAddrManager; ma: MultiAddress): MultiAddress</a></li>
</ul>
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2Ctypedesc%5BObservedAddrManager%5D%2Cint%2Cint" title="new(T: typedesc[ObservedAddrManager]; maxSize = 10; minCount = 3): T:type">new(T: typedesc[ObservedAddrManager]; maxSize = 10; minCount = 3): T:type</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="multiaddress.html">multiaddress</a>, <a class="reference external" href="multicodec.html">multicodec</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="ObservedAddrManager" class="tohide">
<dt><pre><a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,ObservedAddrManager" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CObservedAddrManager"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns a string representation of the ObservedAddrManager.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L74" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L74" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addObservation-procs-all">
<div id="addObservation,ObservedAddrManager,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#addObservation%2CObservedAddrManager%2CMultiAddress"><span class="Identifier">addObservation</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a><span class="Other">;</span> <span class="Identifier">observedAddr</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Adds a new observed MultiAddress. If the number of observations exceeds maxSize, the oldest one is removed.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getMostObservedProtosAndPorts-procs-all">
<div id="getMostObservedProtosAndPorts,ObservedAddrManager" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getMostObservedProtosAndPorts%2CObservedAddrManager"><span class="Identifier">getMostObservedProtosAndPorts</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns the most observed IP4/Port and IP6/Port address or an empty seq if the number of observations are less than minCount.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="guessDialableAddr-procs-all">
<div id="guessDialableAddr,ObservedAddrManager,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#guessDialableAddr%2CObservedAddrManager%2CMultiAddress"><span class="Identifier">guessDialableAddr</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a><span class="Other">;</span> <span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Replaces the first proto value of each listen address by the corresponding (matching the proto code) most observed value. If the most observed value is not available, the original MultiAddress is returned.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L61" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L61" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="new-procs-all">
<div id="new,typedesc[ObservedAddrManager],int,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2Ctypedesc%5BObservedAddrManager%5D%2Cint%2Cint"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="DecNumber">10</span><span class="Other">;</span> <span class="Identifier">minCount</span> <span class="Other">=</span> <span class="DecNumber">3</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T:type</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates a new ObservedAddrManager.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/observedaddrmanager.nim#L78" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/observedaddrmanager.nim#L78" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,748 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/peerid</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/peerid</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#PeerId" title="PeerId = object
data*: seq[byte]">PeerId</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#maxInlineKeyLength" title="maxInlineKeyLength = 42">maxInlineKeyLength</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CPeerId" title="`$`(pid: PeerId): string">`$`(pid: PeerId): string</a></li>
</ul>
<ul class="simple nested-toc-section">cmp
<li><a class="reference" href="#cmp%2CPeerId%2CPeerId" title="cmp(a, b: PeerId): int">cmp(a, b: PeerId): int</a></li>
</ul>
<ul class="simple nested-toc-section">extractPublicKey
<li><a class="reference" href="#extractPublicKey%2CPeerId%2CPublicKey" title="extractPublicKey(pid: PeerId; pubkey: var PublicKey): bool">extractPublicKey(pid: PeerId; pubkey: var PublicKey): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getField
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CPeerId" title="getField(pb: ProtoBuffer; field: int; pid: var PeerId): ProtoResult[bool]">getField(pb: ProtoBuffer; field: int; pid: var PeerId): ProtoResult[bool]</a></li>
</ul>
<ul class="simple nested-toc-section">hasPublicKey
<li><a class="reference" href="#hasPublicKey%2CPeerId" title="hasPublicKey(pid: PeerId): bool">hasPublicKey(pid: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">hex
<li><a class="reference" href="#hex%2CPeerId" title="hex(pid: PeerId): string">hex(pid: PeerId): string</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2CPeerId%2CopenArray%5Bbyte%5D" title="init(pid: var PeerId; data: openArray[byte]): bool">init(pid: var PeerId; data: openArray[byte]): bool</a></li>
<li><a class="reference" href="#init%2CPeerId%2Cstring" title="init(pid: var PeerId; data: string): bool">init(pid: var PeerId; data: string): bool</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BPeerId%5D%2CopenArray%5Bbyte%5D" title="init(t: typedesc[PeerId]; data: openArray[byte]): Result[PeerId, cstring]">init(t: typedesc[PeerId]; data: openArray[byte]): Result[PeerId, cstring]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BPeerId%5D%2Cstring" title="init(t: typedesc[PeerId]; data: string): Result[PeerId, cstring]">init(t: typedesc[PeerId]; data: string): Result[PeerId, cstring]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BPeerId%5D%2CPublicKey" title="init(t: typedesc[PeerId]; pubkey: PublicKey): Result[PeerId, cstring]">init(t: typedesc[PeerId]; pubkey: PublicKey): Result[PeerId, cstring]</a></li>
<li><a class="reference" href="#init%2Ctypedesc%5BPeerId%5D%2CPrivateKey" title="init(t: typedesc[PeerId]; seckey: PrivateKey): Result[PeerId, cstring]">init(t: typedesc[PeerId]; seckey: PrivateKey): Result[PeerId, cstring]</a></li>
</ul>
<ul class="simple nested-toc-section">match
<li><a class="reference" href="#match%2CPeerId%2CPublicKey" title="match(pid: PeerId; pubkey: PublicKey): bool">match(pid: PeerId; pubkey: PublicKey): bool</a></li>
<li><a class="reference" href="#match%2CPeerId%2CPrivateKey" title="match(pid: PeerId; seckey: PrivateKey): bool">match(pid: PeerId; seckey: PrivateKey): bool</a></li>
</ul>
<ul class="simple nested-toc-section">random
<li><a class="reference" href="#random%2Ctypedesc%5BPeerId%5D" title="random(t: typedesc[PeerId]; rng = newRng()): Result[PeerId, cstring]">random(t: typedesc[PeerId]; rng = newRng()): Result[PeerId, cstring]</a></li>
</ul>
<ul class="simple nested-toc-section">shortLog
<li><a class="reference" href="#shortLog%2CPeerId" title="shortLog(pid: PeerId): string">shortLog(pid: PeerId): string</a></li>
</ul>
<ul class="simple nested-toc-section">toBytes
<li><a class="reference" href="#toBytes%2CPeerId%2CopenArray%5Bbyte%5D" title="toBytes(pid: PeerId; data: var openArray[byte]): int">toBytes(pid: PeerId; data: var openArray[byte]): int</a></li>
</ul>
<ul class="simple nested-toc-section">validate
<li><a class="reference" href="#validate%2CPeerId" title="validate(pid: PeerId): bool">validate(pid: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">write
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CPeerId" title="write(pb: var ProtoBuffer; field: int; pid: PeerId)">write(pb: var ProtoBuffer; field: int; pid: PeerId)</a></li>
<li><a class="reference" href="#write%2CVBuffer%2CPeerId" title="write(vb: var VBuffer; pid: PeerId)">write(vb: var VBuffer; pid: PeerId)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section"><
<li><a class="reference" href="#%3C.t%2CPeerId%2CPeerId" title="`&lt;`(a, b: PeerId): bool">`&lt;`(a, b: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section"><=
<li><a class="reference" href="#%3C%3D.t%2CPeerId%2CPeerId" title="`&lt;=`(a, b: PeerId): bool">`&lt;=`(a, b: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">==
<li><a class="reference" href="#%3D%3D.t%2CPeerId%2CPeerId" title="`==`(a, b: PeerId): bool">`==`(a, b: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">>
<li><a class="reference" href="#%3E.t%2CPeerId%2CPeerId" title="`&gt;`(a, b: PeerId): bool">`&gt;`(a, b: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">>=
<li><a class="reference" href="#%3E%3D.t%2CPeerId%2CPeerId" title="`&gt;=`(a, b: PeerId): bool">`&gt;=`(a, b: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">formatItIMPL
<li><a class="reference" href="#formatItIMPL.t%2CPeerId" title="formatItIMPL(it: PeerId): auto">formatItIMPL(it: PeerId): auto</a></li>
</ul>
<ul class="simple nested-toc-section">getBytes
<li><a class="reference" href="#getBytes.t%2CPeerId" title="getBytes(pid: PeerId): seq[byte]">getBytes(pid: PeerId): seq[byte]</a></li>
</ul>
<ul class="simple nested-toc-section">hash
<li><a class="reference" href="#hash.t%2CPeerId" title="hash(pid: PeerId): Hash">hash(pid: PeerId): Hash</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len.t%2CPeerId" title="len(pid: PeerId): int">len(pid: PeerId): int</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implementes API for libp2p peer.Serialization/Deserialization helpers</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="utility.html">utility</a>, <a class="reference external" href="crypto/crypto.html">crypto/crypto</a>, <a class="reference external" href="multicodec.html">multicodec</a>, <a class="reference external" href="multihash.html">multihash</a>, <a class="reference external" href="vbuffer.html">vbuffer</a>, <a class="reference external" href="protobuf/minprotobuf.html">protobuf/minprotobuf</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="PeerId" class="tohide">
<dt><pre><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">data</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="maxInlineKeyLength" class="tohide">
<dt><pre><a href="peerid.html#maxInlineKeyLength"><span class="Identifier">maxInlineKeyLength</span></a> <span class="Other">=</span> <span class="DecNumber">42</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#%24%2CPeerId"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return base58 encoded <tt class="docutils literal"><span class="pre">pid</span></tt> representation.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="cmp-procs-all">
<div id="cmp,PeerId,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#cmp%2CPeerId%2CPeerId"><span class="Identifier">cmp</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Compares two peer ids <tt class="docutils literal"><span class="pre">a</span></tt> and <tt class="docutils literal"><span class="pre">b</span></tt>. Returns:<p>0 iff a == b<br/>&lt; 0 iff a &lt; b<br/><blockquote class="markdown-quote"><p>0 iff a &gt; b</p></blockquote>
<br/></p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="extractPublicKey-procs-all">
<div id="extractPublicKey,PeerId,PublicKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#extractPublicKey%2CPeerId%2CPublicKey"><span class="Identifier">extractPublicKey</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">pubkey</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="crypto/crypto.html#PublicKey"><span class="Identifier">PublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
</span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns <tt class="docutils literal"><span class="pre">true</span></tt> if public key was successfully decoded from PeerId <tt class="docutils literal"><span class="pre">pid</span></tt>and stored to <tt class="docutils literal"><span class="pre">pubkey</span></tt>.</p>
<p>Returns <tt class="docutils literal"><span class="pre">false</span></tt> otherwise.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L115" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L115" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getField-procs-all">
<div id="getField,ProtoBuffer,int,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#getField%2CProtoBuffer%2Cint%2CPeerId"><span class="Identifier">getField</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="protobuf/minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">pid</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <a href="protobuf/minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Read <tt class="docutils literal"><span class="pre">PeerId</span></tt> from ProtoBuf's message and validate it
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L204" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L204" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hasPublicKey-procs-all">
<div id="hasPublicKey,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#hasPublicKey%2CPeerId"><span class="Identifier">hasPublicKey</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">pid</span></tt> is small enough to hold public key inside.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L107" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L107" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hex-procs-all">
<div id="hex,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#hex%2CPeerId"><span class="Identifier">hex</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns hexadecimal string representation of <tt class="docutils literal"><span class="pre">pid</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init-procs-all">
<div id="init,PeerId,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#init%2CPeerId%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize peer id from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Returns <tt class="docutils literal"><span class="pre">true</span></tt> if peer was successfully initialiazed.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L127" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L127" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,PeerId,string" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#init%2CPeerId%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize peer id from base58 encoded string representation.</p>
<p>Returns <tt class="docutils literal"><span class="pre">true</span></tt> if peer was successfully initialiazed.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L136" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L136" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[PeerId],openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#init%2Ctypedesc%5BPeerId%5D%2CopenArray%5Bbyte%5D"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">cstring</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
Create new peer id from raw binary representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L150" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L150" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[PeerId],string" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#init%2Ctypedesc%5BPeerId%5D%2Cstring"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">cstring</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
Create new peer id from base58 encoded string representation <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L158" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L158" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[PeerId],PublicKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#init%2Ctypedesc%5BPeerId%5D%2CPublicKey"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">pubkey</span><span class="Other">:</span> <a href="crypto/crypto.html#PublicKey"><span class="Identifier">PublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">cstring</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
Create new peer id from public key <tt class="docutils literal"><span class="pre">pubkey</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L166" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L166" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="init,typedesc[PeerId],PrivateKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#init%2Ctypedesc%5BPeerId%5D%2CPrivateKey"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">seckey</span><span class="Other">:</span> <a href="crypto/crypto.html#PrivateKey"><span class="Identifier">PrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">cstring</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
Create new peer id from private key <tt class="docutils literal"><span class="pre">seckey</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L177" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L177" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="match-procs-all">
<div id="match,PeerId,PublicKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#match%2CPeerId%2CPublicKey"><span class="Identifier">match</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">pubkey</span><span class="Other">:</span> <a href="crypto/crypto.html#PublicKey"><span class="Identifier">PublicKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">pid</span></tt> matches public key <tt class="docutils literal"><span class="pre">pubkey</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L186" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L186" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="match,PeerId,PrivateKey" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#match%2CPeerId%2CPrivateKey"><span class="Identifier">match</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">seckey</span><span class="Other">:</span> <a href="crypto/crypto.html#PrivateKey"><span class="Identifier">PrivateKey</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">pid</span></tt> matches private key <tt class="docutils literal"><span class="pre">seckey</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L190" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L190" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="random-procs-all">
<div id="random,typedesc[PeerId]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#random%2Ctypedesc%5BPeerId%5D"><span class="Identifier">random</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">rng</span> <span class="Other">=</span> <span class="Identifier">newRng</span><span class="Other">(</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">cstring</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
Create new peer id with random public key.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L181" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L181" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="shortLog-procs-all">
<div id="shortLog,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#shortLog%2CPeerId"><span class="Identifier">shortLog</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns compact string representation of <tt class="docutils literal"><span class="pre">pid</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toBytes-procs-all">
<div id="toBytes,PeerId,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#toBytes%2CPeerId%2CopenArray%5Bbyte%5D"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Store PeerId <tt class="docutils literal"><span class="pre">pid</span></tt> to array of bytes <tt class="docutils literal"><span class="pre">data</span></tt>.</p>
<p>Returns number of bytes needed to store <tt class="docutils literal"><span class="pre">pid</span></tt>.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="validate-procs-all">
<div id="validate,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#validate%2CPeerId"><span class="Identifier">validate</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Validate check if <tt class="docutils literal"><span class="pre">pid</span></tt> is empty or not.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L103" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L103" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="write-procs-all">
<div id="write,ProtoBuffer,int,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#write%2CProtoBuffer%2Cint%2CPeerId"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="protobuf/minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write PeerId value <tt class="docutils literal"><span class="pre">peerid</span></tt> to object <tt class="docutils literal"><span class="pre">pb</span></tt> using ProtoBuf's encoding.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="write,VBuffer,PeerId" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#write%2CVBuffer%2CPeerId"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write PeerId value <tt class="docutils literal"><span class="pre">peerid</span></tt> to buffer <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L196" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L196" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="&lt;-templates-all">
<div id="<.t,PeerId,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#%3C.t%2CPeerId%2CPeerId"><span class="Identifier">`&lt;`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L88" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L88" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="&lt;=-templates-all">
<div id="<=.t,PeerId,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#%3C%3D.t%2CPeerId%2CPeerId"><span class="Identifier">`&lt;=`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L85" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L85" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="==-templates-all">
<div id="==.t,PeerId,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#%3D%3D.t%2CPeerId%2CPeerId"><span class="Identifier">`==`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L97" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L97" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="&gt;-templates-all">
<div id=">.t,PeerId,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#%3E.t%2CPeerId%2CPeerId"><span class="Identifier">`&gt;`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="&gt;=-templates-all">
<div id=">=.t,PeerId,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#%3E%3D.t%2CPeerId%2CPeerId"><span class="Identifier">`&gt;=`</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="formatItIMPL-templates-all">
<div id="formatItIMPL.t,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#formatItIMPL.t%2CPeerId"><span class="Identifier">formatItIMPL</span></a><span class="Other">(</span><span class="Identifier">it</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L48" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L48" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getBytes-templates-all">
<div id="getBytes.t,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#getBytes.t%2CPeerId"><span class="Identifier">getBytes</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span></pre></dt>
<dd>
Return PeerId <tt class="docutils literal"><span class="pre">pid</span></tt> as array of bytes.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L58" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L58" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="hash-templates-all">
<div id="hash.t,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#hash.t%2CPeerId"><span class="Identifier">hash</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Hash</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-templates-all">
<div id="len.t,PeerId" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#len.t%2CPeerId"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">pid</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
<dd>
Returns length of <tt class="docutils literal"><span class="pre">pid</span></tt> binary representation.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerid.nim#L66" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerid.nim#L66" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="utility.html#withValue.t,,untyped,untyped"><span class="Identifier">withValue</span></a>, <a href="utility.html#safeConvert.t,S"><span class="Identifier">safeConvert</span></a>, <a href="utility.html#shortLog,openArray[byte]"><span class="Identifier">shortLog</span></a>, <a href="utility.html#withValue.m,,untyped,untyped,untyped"><span class="Identifier">withValue</span></a>, <a href="utility.html#public.t"><span class="Identifier">public</span></a>, <a href="utility.html#exceptionToAssert.t,untyped"><span class="Identifier">exceptionToAssert</span></a>, <a href="utility.html#valueOr.t,Option[T],untyped"><span class="Identifier">valueOr</span></a>, <a href="utility.html#shortLog,string"><span class="Identifier">shortLog</span></a>, <a href="utility.html#compilesOr.t,untyped,untyped"><span class="Identifier">compilesOr</span></a>, <a href="utility.html#capLen,seq[T],Natural"><span class="Identifier">capLen</span></a>, <a href="utility.html#toOpt.t,Result[T,E]"><span class="Identifier">toOpt</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,578 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/peerstore</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/peerstore</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AddressBook" title="AddressBook {.public.} = ref object of SeqPeerBook[MultiAddress]">AddressBook</a></li>
<li><a class="reference" href="#AgentBook" title="AgentBook {.public.} = ref object of PeerBook[string]">AgentBook</a></li>
<li><a class="reference" href="#KeyBook" title="KeyBook {.public.} = ref object of PeerBook[PublicKey]">KeyBook</a></li>
<li><a class="reference" href="#PeerBook" title="PeerBook[T] {.public.} = ref object of BasePeerBook
book*: Table[PeerId, T]">PeerBook</a></li>
<li><a class="reference" href="#PeerBookChangeHandler" title="PeerBookChangeHandler = proc (peerId: PeerId) {.gcsafe, raises: [].}">PeerBookChangeHandler</a></li>
<li><a class="reference" href="#PeerStore" title="PeerStore {.public.} = ref object
capacity*: int
toClean*: seq[PeerId]">PeerStore</a></li>
<li><a class="reference" href="#ProtoBook" title="ProtoBook {.public.} = ref object of SeqPeerBook[string]">ProtoBook</a></li>
<li><a class="reference" href="#ProtoVersionBook" title="ProtoVersionBook {.public.} = ref object of PeerBook[string]">ProtoVersionBook</a></li>
<li><a class="reference" href="#SeqPeerBook" title="SeqPeerBook[T] = ref object of PeerBook[seq[T]]">SeqPeerBook</a></li>
<li><a class="reference" href="#SPRBook" title="SPRBook {.public.} = ref object of PeerBook[Envelope]">SPRBook</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">[]
<li><a class="reference" href="#%5B%5D%2CPeerStore%2Ctype%5BT%5D" title="`[]`[T](p: PeerStore; typ: type[T]): T">`[]`[T](p: PeerStore; typ: type[T]): T</a></li>
<li><a class="reference" href="#%5B%5D%2CPeerBook%5BT%5D%2CPeerId" title="`[]`[T](peerBook: PeerBook[T]; peerId: PeerId): T">`[]`[T](peerBook: PeerBook[T]; peerId: PeerId): T</a></li>
</ul>
<ul class="simple nested-toc-section">[]=
<li><a class="reference" href="#%5B%5D%3D%2CPeerBook%5BT%5D%2CPeerId%2CT" title="`[]=`[T](peerBook: PeerBook[T]; peerId: PeerId; entry: T)">`[]=`[T](peerBook: PeerBook[T]; peerId: PeerId; entry: T)</a></li>
</ul>
<ul class="simple nested-toc-section">addHandler
<li><a class="reference" href="#addHandler%2CPeerBook%5BT%5D%2CPeerBookChangeHandler" title="addHandler[T](peerBook: PeerBook[T]; handler: PeerBookChangeHandler)">addHandler[T](peerBook: PeerBook[T]; handler: PeerBookChangeHandler)</a></li>
</ul>
<ul class="simple nested-toc-section">cleanup
<li><a class="reference" href="#cleanup%2CPeerStore%2CPeerId" title="cleanup(peerStore: PeerStore; peerId: PeerId)">cleanup(peerStore: PeerStore; peerId: PeerId)</a></li>
</ul>
<ul class="simple nested-toc-section">contains
<li><a class="reference" href="#contains%2CPeerBook%5BT%5D%2CPeerId" title="contains[T](peerBook: PeerBook[T]; peerId: PeerId): bool">contains[T](peerBook: PeerBook[T]; peerId: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">del
<li><a class="reference" href="#del%2CPeerStore%2CPeerId" title="del(peerStore: PeerStore; peerId: PeerId)">del(peerStore: PeerStore; peerId: PeerId)</a></li>
<li><a class="reference" href="#del%2CPeerBook%5BT%5D%2CPeerId" title="del[T](peerBook: PeerBook[T]; peerId: PeerId): bool">del[T](peerBook: PeerBook[T]; peerId: PeerId): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getMostObservedProtosAndPorts
<li><a class="reference" href="#getMostObservedProtosAndPorts%2CPeerStore" title="getMostObservedProtosAndPorts(self: PeerStore): seq[MultiAddress]">getMostObservedProtosAndPorts(self: PeerStore): seq[MultiAddress]</a></li>
</ul>
<ul class="simple nested-toc-section">guessDialableAddr
<li><a class="reference" href="#guessDialableAddr%2CPeerStore%2CMultiAddress" title="guessDialableAddr(self: PeerStore; ma: MultiAddress): MultiAddress">guessDialableAddr(self: PeerStore; ma: MultiAddress): MultiAddress</a></li>
</ul>
<ul class="simple nested-toc-section">identify
<li><a class="reference" href="#identify%2CPeerStore%2CMuxer" title="identify(peerStore: PeerStore; muxer: Muxer)">identify(peerStore: PeerStore; muxer: Muxer)</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CPeerBook%5BT%5D" title="len[T](peerBook: PeerBook[T]): int">len[T](peerBook: PeerBook[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2CtypePeerStore%2CIdentify%2Cint" title="new(T: type PeerStore; identify: Identify; capacity = 1000): PeerStore">new(T: type PeerStore; identify: Identify; capacity = 1000): PeerStore</a></li>
</ul>
<ul class="simple nested-toc-section">updatePeerInfo
<li><a class="reference" href="#updatePeerInfo%2CPeerStore%2CIdentifyInfo" title="updatePeerInfo(peerStore: PeerStore; info: IdentifyInfo)">updatePeerInfo(peerStore: PeerStore; info: IdentifyInfo)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">Stores generic informations about peers.
<p><strong class="examples_text">Example:</strong></p>
<pre class="listing"><span class="Comment"># Will keep info of all connected peers +</span>
<span class="Comment"># last 50 disconnected peers</span>
<span class="Keyword">let</span> <span class="Identifier">peerStore</span> <span class="Operator">=</span> <span class="Identifier">PeerStore</span><span class="Operator">.</span><span class="Identifier">new</span><span class="Punctuation">(</span><span class="Identifier">capacity</span> <span class="Operator">=</span> <span class="DecNumber">50</span><span class="Punctuation">)</span>
<span class="Comment"># Create a custom book type</span>
<span class="Keyword">type</span> <span class="Identifier">MoodBook</span> <span class="Operator">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">PeerBook</span><span class="Punctuation">[</span><span class="Identifier">string</span><span class="Punctuation">]</span>
<span class="Keyword">var</span> <span class="Identifier">somePeerId</span> <span class="Operator">=</span> <span class="Identifier">PeerId</span><span class="Operator">.</span><span class="Identifier">random</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">expect</span><span class="Punctuation">(</span><span class="StringLit">&quot;get random key&quot;</span><span class="Punctuation">)</span>
<span class="Identifier">peerStore</span><span class="Punctuation">[</span><span class="Identifier">MoodBook</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="Identifier">somePeerId</span><span class="Punctuation">]</span> <span class="Operator">=</span> <span class="StringLit">&quot;Happy&quot;</span>
<span class="Identifier">doAssert</span> <span class="Identifier">peerStore</span><span class="Punctuation">[</span><span class="Identifier">MoodBook</span><span class="Punctuation">]</span><span class="Punctuation">[</span><span class="Identifier">somePeerId</span><span class="Punctuation">]</span> <span class="Operator">==</span> <span class="StringLit">&quot;Happy&quot;</span></pre>##############################################################################</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="crypto/crypto.html">crypto/crypto</a>, <a class="reference external" href="protocols/identify.html">protocols/identify</a>, <a class="reference external" href="protocols/protocol.html">protocols/protocol</a>, <a class="reference external" href="peerid.html">peerid</a>, <a class="reference external" href="peerinfo.html">peerinfo</a>, <a class="reference external" href="routing_record.html">routing_record</a>, <a class="reference external" href="multiaddress.html">multiaddress</a>, <a class="reference external" href="stream/connection.html">stream/connection</a>, <a class="reference external" href="multistream.html">multistream</a>, <a class="reference external" href="muxers/muxer.html">muxers/muxer</a>, <a class="reference external" href="utility.html">utility</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AddressBook" class="tohide">
<dt><pre><a href="peerstore.html#AddressBook"><span class="Identifier">AddressBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#SeqPeerBook"><span class="Identifier">SeqPeerBook</span></a><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L61" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L61" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AgentBook" class="tohide">
<dt><pre><a href="peerstore.html#AgentBook"><span class="Identifier">AgentBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L65" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L65" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="KeyBook" class="tohide">
<dt><pre><a href="peerstore.html#KeyBook"><span class="Identifier">KeyBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><a href="crypto/crypto.html#PublicKey"><span class="Identifier">PublicKey</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PeerBook" class="tohide">
<dt><pre><a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">BasePeerBook</span>
<span class="Identifier">book</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Table</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">,</span> <span class="Identifier">T</span><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PeerBookChangeHandler" class="tohide">
<dt><pre><a href="peerstore.html#PeerBookChangeHandler"><span class="Identifier">PeerBookChangeHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PeerStore" class="tohide">
<dt><pre><a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">capacity</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">toClean</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoBook" class="tohide">
<dt><pre><a href="peerstore.html#ProtoBook"><span class="Identifier">ProtoBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#SeqPeerBook"><span class="Identifier">SeqPeerBook</span></a><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L62" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L62" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoVersionBook" class="tohide">
<dt><pre><a href="peerstore.html#ProtoVersionBook"><span class="Identifier">ProtoVersionBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L66" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L66" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SeqPeerBook" class="tohide">
<dt><pre><a href="peerstore.html#SeqPeerBook"><span class="Identifier">SeqPeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SPRBook" class="tohide">
<dt><pre><a href="peerstore.html#SPRBook"><span class="Identifier">SPRBook</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><a href="signed_envelope.html#Envelope"><span class="Identifier">Envelope</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L67" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L67" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="[]-procs-all">
<div id="[],PeerStore,type[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CPeerStore%2Ctype%5BT%5D"><span class="Identifier">`[]`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">typ</span><span class="Other">:</span> <span class="Identifier">type</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get a book from the PeerStore (ex: peerStore<a class="reference internal nimdoc" title="type AddressBook" href="#AddressBook">AddressBook</a>)
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L135" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L135" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],PeerBook[T],PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CPeerBook%5BT%5D%2CPeerId"><span class="Identifier">`[]`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Get all known metadata of a provided peer, or default(T) if missing
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L89" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L89" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="[]=-procs-all">
<div id="[]=,PeerBook[T],PeerId,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%3D%2CPeerBook%5BT%5D%2CPeerId%2CT"><span class="Identifier">`[]=`</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">entry</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.<span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Set metadata for a given peerId.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="addHandler-procs-all">
<div id="addHandler,PeerBook[T],PeerBookChangeHandler" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#addHandler%2CPeerBook%5BT%5D%2CPeerBookChangeHandler"><span class="Identifier">addHandler</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="peerstore.html#PeerBookChangeHandler"><span class="Identifier">PeerBookChangeHandler</span></a><span class="Other">)</span> {.
<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Adds a callback that will be called everytime the book changes
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L121" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L121" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="cleanup-procs-all">
<div id="cleanup,PeerStore,PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#cleanup%2CPeerStore%2CPeerId"><span class="Identifier">cleanup</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L180" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L180" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="contains-procs-all">
<div id="contains,PeerBook[T],PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#contains%2CPeerBook%5BT%5D%2CPeerId"><span class="Identifier">contains</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">public</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L118" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L118" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="del-procs-all">
<div id="del,PeerStore,PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#del%2CPeerStore%2CPeerId"><span class="Identifier">del</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Delete the provided peer from every book.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L148" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L148" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="del,PeerBook[T],PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#del%2CPeerBook%5BT%5D%2CPeerId"><span class="Identifier">del</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerId</span><span class="Other">:</span> <a href="peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Delete the provided peer from the book. Returns whether the peer was in the book
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L105" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L105" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getMostObservedProtosAndPorts-procs-all">
<div id="getMostObservedProtosAndPorts,PeerStore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getMostObservedProtosAndPorts%2CPeerStore"><span class="Identifier">getMostObservedProtosAndPorts</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L221" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L221" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="guessDialableAddr-procs-all">
<div id="guessDialableAddr,PeerStore,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#guessDialableAddr%2CPeerStore%2CMultiAddress"><span class="Identifier">guessDialableAddr</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L224" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L224" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="identify-procs-all">
<div id="identify,PeerStore,Muxer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#identify%2CPeerStore%2CMuxer"><span class="Identifier">identify</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">muxer</span><span class="Other">:</span> <a href="muxers/muxer.html#Muxer"><span class="Identifier">Muxer</span></a><span class="Other">)</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L196" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L196" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,PeerBook[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CPeerBook%5BT%5D"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">peerBook</span><span class="Other">:</span> <a href="peerstore.html#PeerBook"><span class="Identifier">PeerBook</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L125" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L125" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="new-procs-all">
<div id="new,typePeerStore,Identify,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2CtypePeerStore%2CIdentify%2Cint"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">PeerStore</span><span class="Other">;</span> <span class="Identifier">identify</span><span class="Other">:</span> <a href="protocols/identify.html#Identify"><span class="Identifier">Identify</span></a><span class="Other">;</span> <span class="Identifier">capacity</span> <span class="Other">=</span> <span class="DecNumber">1000</span><span class="Other">)</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a> {.
<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="updatePeerInfo-procs-all">
<div id="updatePeerInfo,PeerStore,IdentifyInfo" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#updatePeerInfo%2CPeerStore%2CIdentifyInfo"><span class="Identifier">updatePeerInfo</span></a><span class="Other">(</span><span class="Identifier">peerStore</span><span class="Other">:</span> <a href="peerstore.html#PeerStore"><span class="Identifier">PeerStore</span></a><span class="Other">;</span> <span class="Identifier">info</span><span class="Other">:</span> <a href="protocols/identify.html#IdentifyInfo"><span class="Identifier">IdentifyInfo</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/peerstore.nim#L154" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/peerstore.nim#L154" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,842 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/protobuf/minprotobuf</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/protobuf/minprotobuf</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#ProtoBuffer" title="ProtoBuffer = object
buffer*: seq[byte]
offset*: int
length*: int
maxSize*: uint">ProtoBuffer</a></li>
<li><a class="reference" href="#ProtoError" title="ProtoError {.pure.} = enum
VarintDecode, MessageIncomplete, BufferOverflow, MessageTooBig, BadWireType,
IncorrectBlob, RequiredFieldMissing">ProtoError</a></li>
<li><a class="reference" href="#ProtoField" title="ProtoField = object
index*: int
case kind*: ProtoFieldKind
of Varint:
vint*: uint64
of Fixed64:
vfloat64*: float64
of Length:
vbuffer*: seq[byte]
of Fixed32:
vfloat32*: float32
of StartGroup, EndGroup:
nil">ProtoField</a></li>
<li><a class="reference" href="#ProtoFieldKind" title="ProtoFieldKind = enum
Varint, Fixed64, Length, StartGroup, EndGroup, Fixed32">ProtoFieldKind</a></li>
<li><a class="reference" href="#ProtoFlags" title="ProtoFlags = enum
WithVarintLength, WithUint32BeLength, WithUint32LeLength">ProtoFlags</a></li>
<li><a class="reference" href="#ProtoHeader" title="ProtoHeader = object
wire*: ProtoFieldKind
index*: uint64">ProtoHeader</a></li>
<li><a class="reference" href="#ProtoResult" title="ProtoResult[T] = Result[T, ProtoError]">ProtoResult</a></li>
<li><a class="reference" href="#ProtoScalar" title="ProtoScalar = uint | uint32 | uint64 | zint | zint32 | zint64 | hint | hint32 |
hint64 |
float32 |
float64">ProtoScalar</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SupportedWireTypes" title="SupportedWireTypes = [0, 1, 2, 5]">SupportedWireTypes</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">finish
<li><a class="reference" href="#finish%2CProtoBuffer" title="finish(pb: var ProtoBuffer)">finish(pb: var ProtoBuffer)</a></li>
</ul>
<ul class="simple nested-toc-section">getField
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CProtoBuffer" title="getField(pb: ProtoBuffer; field: int; output: var ProtoBuffer): ProtoResult[bool]">getField(pb: ProtoBuffer; field: int; output: var ProtoBuffer): ProtoResult[bool]</a></li>
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CopenArray%5BT%5D%2Cint" title="getField[T: byte | char](data: ProtoBuffer; field: int;
output: var openArray[T]; outlen: var int): ProtoResult[
bool]">getField[T: byte | char](data: ProtoBuffer; field: int;
output: var openArray[T]; outlen: var int): ProtoResult[
bool]</a></li>
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CT" title="getField[T: ProtoScalar](data: ProtoBuffer; field: int; output: var T): ProtoResult[
bool]">getField[T: ProtoScalar](data: ProtoBuffer; field: int; output: var T): ProtoResult[
bool]</a></li>
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CT_2" title="getField[T: seq[byte] | string](data: ProtoBuffer; field: int; output: var T): ProtoResult[
bool]">getField[T: seq[byte] | string](data: ProtoBuffer; field: int; output: var T): ProtoResult[
bool]</a></li>
</ul>
<ul class="simple nested-toc-section">getPackedRepeatedField
<li><a class="reference" href="#getPackedRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D" title="getPackedRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
output: var seq[T]): ProtoResult[bool]">getPackedRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
output: var seq[T]): ProtoResult[bool]</a></li>
</ul>
<ul class="simple nested-toc-section">getRepeatedField
<li><a class="reference" href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D_2" title="getRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
output: var seq[T]): ProtoResult[bool]">getRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
output: var seq[T]): ProtoResult[bool]</a></li>
<li><a class="reference" href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D" title="getRepeatedField[T: seq[byte] | string](data: ProtoBuffer; field: int;
output: var seq[T]): ProtoResult[bool]">getRepeatedField[T: seq[byte] | string](data: ProtoBuffer; field: int;
output: var seq[T]): ProtoResult[bool]</a></li>
</ul>
<ul class="simple nested-toc-section">getRequiredField
<li><a class="reference" href="#getRequiredField%2CProtoBuffer%2Cint%2CT" title="getRequiredField[T](pb: ProtoBuffer; field: int; output: var T): ProtoResult[
void]">getRequiredField[T](pb: ProtoBuffer; field: int; output: var T): ProtoResult[
void]</a></li>
</ul>
<ul class="simple nested-toc-section">getRequiredRepeatedField
<li><a class="reference" href="#getRequiredRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D" title="getRequiredRepeatedField[T](pb: ProtoBuffer; field: int; output: var seq[T]): ProtoResult[
void]">getRequiredRepeatedField[T](pb: ProtoBuffer; field: int; output: var seq[T]): ProtoResult[
void]</a></li>
</ul>
<ul class="simple nested-toc-section">initProtoBuffer
<li><a class="reference" href="#initProtoBuffer%2CopenArray%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D" title="initProtoBuffer(data: openArray[byte]; offset = 0;
options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer">initProtoBuffer(data: openArray[byte]; offset = 0;
options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer</a></li>
<li><a class="reference" href="#initProtoBuffer%2Cseq%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D" title="initProtoBuffer(data: seq[byte]; offset = 0; options: set[ProtoFlags] = {};
maxSize = MaxMessageSize): ProtoBuffer">initProtoBuffer(data: seq[byte]; offset = 0; options: set[ProtoFlags] = {};
maxSize = MaxMessageSize): ProtoBuffer</a></li>
<li><a class="reference" href="#initProtoBuffer%2Cset%5BProtoFlags%5D" title="initProtoBuffer(options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer">initProtoBuffer(options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer</a></li>
</ul>
<ul class="simple nested-toc-section">vsizeof
<li><a class="reference" href="#vsizeof%2CProtoField" title="vsizeof(field: ProtoField): int">vsizeof(field: ProtoField): int</a></li>
</ul>
<ul class="simple nested-toc-section">write
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CProtoBuffer" title="write(pb: var ProtoBuffer; field: int; value: ProtoBuffer)">write(pb: var ProtoBuffer; field: int; value: ProtoBuffer)</a></li>
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CopenArray%5BT%5D" title="write[T: byte | char](pb: var ProtoBuffer; field: int; value: openArray[T])">write[T: byte | char](pb: var ProtoBuffer; field: int; value: openArray[T])</a></li>
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CT" title="write[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: T)">write[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: T)</a></li>
</ul>
<ul class="simple nested-toc-section">writePacked
<li><a class="reference" href="#writePacked%2CProtoBuffer%2Cint%2CopenArray%5BT%5D" title="writePacked[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: openArray[T])">writePacked[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: openArray[T])</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">checkFieldNumber
<li><a class="reference" href="#checkFieldNumber.t%2Cint" title="checkFieldNumber(i: int)">checkFieldNumber(i: int)</a></li>
</ul>
<ul class="simple nested-toc-section">getLen
<li><a class="reference" href="#getLen.t%2CProtoBuffer" title="getLen(pb: ProtoBuffer): int">getLen(pb: ProtoBuffer): int</a></li>
</ul>
<ul class="simple nested-toc-section">getProtoHeader
<li><a class="reference" href="#getProtoHeader.t%2CProtoField" title="getProtoHeader(field: ProtoField): uint64">getProtoHeader(field: ProtoField): uint64</a></li>
<li><a class="reference" href="#getProtoHeader.t%2Cint%2CProtoFieldKind" title="getProtoHeader(index: int; wire: ProtoFieldKind): uint64">getProtoHeader(index: int; wire: ProtoFieldKind): uint64</a></li>
</ul>
<ul class="simple nested-toc-section">getPtr
<li><a class="reference" href="#getPtr.t%2CProtoBuffer" title="getPtr(pb: ProtoBuffer): pointer">getPtr(pb: ProtoBuffer): pointer</a></li>
</ul>
<ul class="simple nested-toc-section">isEmpty
<li><a class="reference" href="#isEmpty.t%2CProtoBuffer" title="isEmpty(pb: ProtoBuffer): bool">isEmpty(pb: ProtoBuffer): bool</a></li>
</ul>
<ul class="simple nested-toc-section">isEnough
<li><a class="reference" href="#isEnough.t%2CProtoBuffer%2Cint" title="isEnough(pb: ProtoBuffer; length: int): bool">isEnough(pb: ProtoBuffer; length: int): bool</a></li>
</ul>
<ul class="simple nested-toc-section">toOpenArray
<li><a class="reference" href="#toOpenArray.t%2CProtoBuffer" title="toOpenArray(pb: ProtoBuffer): untyped">toOpenArray(pb: ProtoBuffer): untyped</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements minimal Google's ProtoBuf primitives.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../varint.html">../varint</a>, <a class="reference external" href="../utility.html">../utility</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="ProtoBuffer" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
<span class="Identifier">offset</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">length</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">maxSize</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint</span>
</pre></dt>
<dd>
Protobuf's message representation object
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L30" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L30" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoError" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoError"><span class="Identifier">ProtoError</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">VarintDecode</span><span class="Other">,</span> <span class="Identifier">MessageIncomplete</span><span class="Other">,</span> <span class="Identifier">BufferOverflow</span><span class="Other">,</span> <span class="Identifier">MessageTooBig</span><span class="Other">,</span> <span class="Identifier">BadWireType</span><span class="Other">,</span>
<span class="Identifier">IncorrectBlob</span><span class="Other">,</span> <span class="Identifier">RequiredFieldMissing</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L57" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L57" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoField" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoField"><span class="Identifier">ProtoField</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">index</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a>
<span class="Keyword">of</span> <span class="Identifier">Varint</span><span class="Other">:</span>
<span class="Identifier">vint</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint64</span>
<span class="Keyword">of</span> <span class="Identifier">Fixed64</span><span class="Other">:</span>
<span class="Identifier">vfloat64</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">float64</span>
<span class="Keyword">of</span> <span class="Identifier">Length</span><span class="Other">:</span>
<span class="Identifier">vbuffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
<span class="Keyword">of</span> <span class="Identifier">Fixed32</span><span class="Other">:</span>
<span class="Identifier">vfloat32</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">float32</span>
<span class="Keyword">of</span> <span class="Identifier">StartGroup</span><span class="Other">,</span> <span class="Identifier">EndGroup</span><span class="Other">:</span>
<span class="Keyword">nil</span>
</pre></dt>
<dd>
Protobuf's message field representation object
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoFieldKind" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Varint</span><span class="Other">,</span> <span class="Identifier">Fixed64</span><span class="Other">,</span> <span class="Identifier">Length</span><span class="Other">,</span> <span class="Identifier">StartGroup</span><span class="Other">,</span> <span class="Identifier">EndGroup</span><span class="Other">,</span> <span class="Identifier">Fixed32</span></pre></dt>
<dd>
Protobuf's field types enum
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoFlags" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">WithVarintLength</span><span class="Other">,</span> <span class="Identifier">WithUint32BeLength</span><span class="Other">,</span> <span class="Identifier">WithUint32LeLength</span></pre></dt>
<dd>
Protobuf's encoding types
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoHeader" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoHeader"><span class="Identifier">ProtoHeader</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">wire</span><span class="Operator">*</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a>
<span class="Identifier">index</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint64</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoResult" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <a href="minprotobuf.html#ProtoError"><span class="Identifier">ProtoError</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L66" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L66" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoScalar" class="tohide">
<dt><pre><a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a> <span class="Other">=</span> <span class="Identifier">uint</span> <span class="Operator">|</span> <span class="Identifier">uint32</span> <span class="Operator">|</span> <span class="Identifier">uint64</span> <span class="Operator">|</span> <a href="../varint.html#zint"><span class="Identifier">zint</span></a> <span class="Operator">|</span> <a href="../varint.html#zint32"><span class="Identifier">zint32</span></a> <span class="Operator">|</span> <a href="../varint.html#zint64"><span class="Identifier">zint64</span></a> <span class="Operator">|</span> <a href="../varint.html#hint"><span class="Identifier">hint</span></a> <span class="Operator">|</span> <a href="../varint.html#hint32"><span class="Identifier">hint32</span></a> <span class="Operator">|</span>
<a href="../varint.html#hint64"><span class="Identifier">hint64</span></a> <span class="Operator">|</span>
<span class="Identifier">float32</span> <span class="Operator">|</span>
<span class="Identifier">float64</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L68" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L68" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="SupportedWireTypes" class="tohide">
<dt><pre><a href="minprotobuf.html#SupportedWireTypes"><span class="Identifier">SupportedWireTypes</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0</span><span class="Other">,</span> <span class="DecNumber">1</span><span class="Other">,</span> <span class="DecNumber">2</span><span class="Other">,</span> <span class="DecNumber">5</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L72" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L72" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="finish-procs-all">
<div id="finish,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#finish%2CProtoBuffer"><span class="Identifier">finish</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Prepare protobuf's buffer <tt class="docutils literal"><span class="pre">pb</span></tt> for writing to stream.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L273" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L273" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getField-procs-all">
<div id="getField,ProtoBuffer,int,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CProtoBuffer"><span class="Identifier">getField</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
<span class="Identifier">bool</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L576" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L576" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getField,ProtoBuffer,int,openArray[T],int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CopenArray%5BT%5D%2Cint"><span class="Identifier">getField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">outlen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
<span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L487" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L487" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getField,ProtoBuffer,int,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CT"><span class="Identifier">getField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
<span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L446" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L446" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getField,ProtoBuffer,int,T_2" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CT_2"><span class="Identifier">getField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">string</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L539" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L539" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPackedRepeatedField-procs-all">
<div id="getPackedRepeatedField,ProtoBuffer,int,seq[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getPackedRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"><span class="Identifier">getPackedRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L675" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L675" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRepeatedField-procs-all">
<div id="getRepeatedField,ProtoBuffer,int,seq[T]_2" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D_2"><span class="Identifier">getRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L629" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L629" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getRepeatedField,ProtoBuffer,int,seq[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"><span class="Identifier">getRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">string</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L592" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L592" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRequiredField-procs-all">
<div id="getRequiredField,ProtoBuffer,int,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getRequiredField%2CProtoBuffer%2Cint%2CT"><span class="Identifier">getRequiredField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L585" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L585" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getRequiredRepeatedField-procs-all">
<div id="getRequiredRepeatedField,ProtoBuffer,int,seq[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getRequiredRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"><span class="Identifier">getRequiredRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L668" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L668" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initProtoBuffer-procs-all">
<div id="initProtoBuffer,openArray[byte],int,set[ProtoFlags]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initProtoBuffer%2CopenArray%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D"><span class="Identifier">initProtoBuffer</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">offset</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span>
<span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="Identifier">MaxMessageSize</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ProtoBuffer with copy of <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L130" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L130" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="initProtoBuffer,seq[byte],int,set[ProtoFlags]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initProtoBuffer%2Cseq%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D"><span class="Identifier">initProtoBuffer</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">offset</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
<span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="Identifier">MaxMessageSize</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
</span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ProtoBuffer with shallow copy of <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L121" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L121" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="initProtoBuffer,set[ProtoFlags]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initProtoBuffer%2Cset%5BProtoFlags%5D"><span class="Identifier">initProtoBuffer</span></a><span class="Other">(</span><span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="Identifier">MaxMessageSize</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize ProtoBuffer with new sequence of capacity <tt class="docutils literal"><span class="pre">cap</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L139" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L139" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="vsizeof-procs-all">
<div id="vsizeof,ProtoField" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#vsizeof%2CProtoField"><span class="Identifier">vsizeof</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoField"><span class="Identifier">ProtoField</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns number of bytes required to store protobuf's field <tt class="docutils literal"><span class="pre">field</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L106" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L106" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="write-procs-all">
<div id="write,ProtoBuffer,int,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CProtoBuffer%2Cint%2CProtoBuffer"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Encode Protobuf's sub-message <tt class="docutils literal"><span class="pre">value</span></tt> and store it to protobuf's buffer <tt class="docutils literal"><span class="pre">pb</span></tt> with field number <tt class="docutils literal"><span class="pre">field</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L268" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L268" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="write,ProtoBuffer,int,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CProtoBuffer%2Cint%2CopenArray%5BT%5D"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L248" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L248" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="write,ProtoBuffer,int,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CProtoBuffer%2Cint%2CT"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L155" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writePacked-procs-all">
<div id="writePacked,ProtoBuffer,int,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#writePacked%2CProtoBuffer%2Cint%2CopenArray%5BT%5D"><span class="Identifier">writePacked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="checkFieldNumber-templates-all">
<div id="checkFieldNumber.t,int" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#checkFieldNumber.t%2Cint"><span class="Identifier">checkFieldNumber</span></a><span class="Other">(</span><span class="Identifier">i</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getLen-templates-all">
<div id="getLen.t,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#getLen.t%2CProtoBuffer"><span class="Identifier">getLen</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L103" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L103" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getProtoHeader-templates-all">
<div id="getProtoHeader.t,ProtoField" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#getProtoHeader.t%2CProtoField"><span class="Identifier">getProtoHeader</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoField"><span class="Identifier">ProtoField</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint64</span></pre></dt>
<dd>
Get protobuf's field header integer for <tt class="docutils literal"><span class="pre">field</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L87" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L87" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="getProtoHeader.t,int,ProtoFieldKind" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#getProtoHeader.t%2Cint%2CProtoFieldKind"><span class="Identifier">getProtoHeader</span></a><span class="Other">(</span><span class="Identifier">index</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">wire</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint64</span></pre></dt>
<dd>
Get protobuf's field header integer for <tt class="docutils literal"><span class="pre">index</span></tt> and <tt class="docutils literal"><span class="pre">wire</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L83" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L83" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getPtr-templates-all">
<div id="getPtr.t,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#getPtr.t%2CProtoBuffer"><span class="Identifier">getPtr</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">pointer</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isEmpty-templates-all">
<div id="isEmpty.t,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#isEmpty.t%2CProtoBuffer"><span class="Identifier">isEmpty</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isEnough-templates-all">
<div id="isEnough.t,ProtoBuffer,int" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#isEnough.t%2CProtoBuffer%2Cint"><span class="Identifier">isEnough</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L97" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L97" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toOpenArray-templates-all">
<div id="toOpenArray.t,ProtoBuffer" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#toOpenArray.t%2CProtoBuffer"><span class="Identifier">toOpenArray</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protobuf/minprotobuf.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="../utility.html#withValue.t,,untyped,untyped"><span class="Identifier">withValue</span></a>, <a href="../utility.html#safeConvert.t,S"><span class="Identifier">safeConvert</span></a>, <a href="../utility.html#shortLog,openArray[byte]"><span class="Identifier">shortLog</span></a>, <a href="../utility.html#withValue.m,,untyped,untyped,untyped"><span class="Identifier">withValue</span></a>, <a href="../utility.html#public.t"><span class="Identifier">public</span></a>, <a href="../utility.html#exceptionToAssert.t,untyped"><span class="Identifier">exceptionToAssert</span></a>, <a href="../utility.html#valueOr.t,Option[T],untyped"><span class="Identifier">valueOr</span></a>, <a href="../utility.html#shortLog,string"><span class="Identifier">shortLog</span></a>, <a href="../utility.html#compilesOr.t,untyped,untyped"><span class="Identifier">compilesOr</span></a>, <a href="../utility.html#capLen,seq[T],Natural"><span class="Identifier">capLen</span></a>, <a href="../utility.html#toOpt.t,Result[T,E]"><span class="Identifier">toOpt</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:47 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,435 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/protocols/connectivity/autonat/core</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/protocols/connectivity/autonat/core</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AutonatDial" title="AutonatDial = object
peerInfo*: Opt[AutonatPeerInfo]">AutonatDial</a></li>
<li><a class="reference" href="#AutonatDialResponse" title="AutonatDialResponse = object
status*: ResponseStatus
text*: Opt[string]
ma*: Opt[MultiAddress]">AutonatDialResponse</a></li>
<li><a class="reference" href="#AutonatError" title="AutonatError = object of LPError">AutonatError</a></li>
<li><a class="reference" href="#AutonatMsg" title="AutonatMsg = object
msgType*: MsgType
dial*: Opt[AutonatDial]
response*: Opt[AutonatDialResponse]">AutonatMsg</a></li>
<li><a class="reference" href="#AutonatPeerInfo" title="AutonatPeerInfo = object
id*: Opt[PeerId]
addrs*: seq[MultiAddress]">AutonatPeerInfo</a></li>
<li><a class="reference" href="#AutonatUnreachableError" title="AutonatUnreachableError = object of LPError">AutonatUnreachableError</a></li>
<li><a class="reference" href="#MsgType" title="MsgType = enum
Dial = 0, DialResponse = 1">MsgType</a></li>
<li><a class="reference" href="#NetworkReachability" title="NetworkReachability {.pure.} = enum
Unknown, NotReachable, Reachable">NetworkReachability</a></li>
<li><a class="reference" href="#ResponseStatus" title="ResponseStatus = enum
Ok = 0, DialError = 100, DialRefused = 101, BadRequest = 200,
InternalError = 300">ResponseStatus</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AddressLimit" title="AddressLimit = 8">AddressLimit</a></li>
<li><a class="reference" href="#AutonatCodec" title="AutonatCodec = &quot;/libp2p/autonat/1.0.0&quot;">AutonatCodec</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">decode
<li><a class="reference" href="#decode%2Ctypedesc%5BAutonatMsg%5D%2Cseq%5Bbyte%5D" title="decode(__4412408491: typedesc[AutonatMsg]; buf: seq[byte]): Opt[AutonatMsg]">decode(__4412408491: typedesc[AutonatMsg]; buf: seq[byte]): Opt[AutonatMsg]</a></li>
</ul>
<ul class="simple nested-toc-section">encode
<li><a class="reference" href="#encode%2CAutonatDial" title="encode(d: AutonatDial): ProtoBuffer">encode(d: AutonatDial): ProtoBuffer</a></li>
<li><a class="reference" href="#encode%2CAutonatMsg" title="encode(msg: AutonatMsg): ProtoBuffer">encode(msg: AutonatMsg): ProtoBuffer</a></li>
<li><a class="reference" href="#encode%2CAutonatDialResponse" title="encode(r: AutonatDialResponse): ProtoBuffer">encode(r: AutonatDialResponse): ProtoBuffer</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../../../multiaddress.html">../../../multiaddress</a>, <a class="reference external" href="../../../peerid.html">../../../peerid</a>, <a class="reference external" href="../../../errors.html">../../../errors</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AutonatDial" class="tohide">
<dt><pre><a href="core.html#AutonatDial"><span class="Identifier">AutonatDial</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">peerInfo</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="core.html#AutonatPeerInfo"><span class="Identifier">AutonatPeerInfo</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AutonatDialResponse" class="tohide">
<dt><pre><a href="core.html#AutonatDialResponse"><span class="Identifier">AutonatDialResponse</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">status</span><span class="Operator">*</span><span class="Other">:</span> <a href="core.html#ResponseStatus"><span class="Identifier">ResponseStatus</span></a>
<span class="Identifier">text</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span>
<span class="Identifier">ma</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="../../../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AutonatError" class="tohide">
<dt><pre><a href="core.html#AutonatError"><span class="Identifier">AutonatError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../../../errors.html#LPError"><span class="Identifier">LPError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AutonatMsg" class="tohide">
<dt><pre><a href="core.html#AutonatMsg"><span class="Identifier">AutonatMsg</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">msgType</span><span class="Operator">*</span><span class="Other">:</span> <a href="core.html#MsgType"><span class="Identifier">MsgType</span></a>
<span class="Identifier">dial</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="core.html#AutonatDial"><span class="Identifier">AutonatDial</span></a><span class="Other">]</span>
<span class="Identifier">response</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="core.html#AutonatDialResponse"><span class="Identifier">AutonatDialResponse</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AutonatPeerInfo" class="tohide">
<dt><pre><a href="core.html#AutonatPeerInfo"><span class="Identifier">AutonatPeerInfo</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">id</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="../../../peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">]</span>
<span class="Identifier">addrs</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="../../../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AutonatUnreachableError" class="tohide">
<dt><pre><a href="core.html#AutonatUnreachableError"><span class="Identifier">AutonatUnreachableError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../../../errors.html#LPError"><span class="Identifier">LPError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="MsgType" class="tohide">
<dt><pre><a href="core.html#MsgType"><span class="Identifier">MsgType</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Dial</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">,</span> <span class="Identifier">DialResponse</span> <span class="Other">=</span> <span class="DecNumber">1</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="NetworkReachability" class="tohide">
<dt><pre><a href="core.html#NetworkReachability"><span class="Identifier">NetworkReachability</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Unknown</span><span class="Other">,</span> <span class="Identifier">NotReachable</span><span class="Other">,</span> <span class="Identifier">Reachable</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L57" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L57" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ResponseStatus" class="tohide">
<dt><pre><a href="core.html#ResponseStatus"><span class="Identifier">ResponseStatus</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Ok</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">,</span> <span class="Identifier">DialError</span> <span class="Other">=</span> <span class="DecNumber">100</span><span class="Other">,</span> <span class="Identifier">DialRefused</span> <span class="Other">=</span> <span class="DecNumber">101</span><span class="Other">,</span> <span class="Identifier">BadRequest</span> <span class="Other">=</span> <span class="DecNumber">200</span><span class="Other">,</span>
<span class="Identifier">InternalError</span> <span class="Other">=</span> <span class="DecNumber">300</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="AddressLimit" class="tohide">
<dt><pre><a href="core.html#AddressLimit"><span class="Identifier">AddressLimit</span></a> <span class="Other">=</span> <span class="DecNumber">8</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L23" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L23" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="AutonatCodec" class="tohide">
<dt><pre><a href="core.html#AutonatCodec"><span class="Identifier">AutonatCodec</span></a> <span class="Other">=</span> <span class="StringLit">&quot;/libp2p/autonat/1.0.0&quot;</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="decode-procs-all">
<div id="decode,typedesc[AutonatMsg],seq[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#decode%2Ctypedesc%5BAutonatMsg%5D%2Cseq%5Bbyte%5D"><span class="Identifier">decode</span></a><span class="Other">(</span><span class="Operator">__4412408491</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="core.html#AutonatMsg"><span class="Identifier">AutonatMsg</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="core.html#AutonatMsg"><span class="Identifier">AutonatMsg</span></a><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L97" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L97" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="encode-procs-all">
<div id="encode,AutonatDial" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2CAutonatDial"><span class="Identifier">encode</span></a><span class="Other">(</span><span class="Identifier">d</span><span class="Other">:</span> <a href="core.html#AutonatDial"><span class="Identifier">AutonatDial</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../../../protobuf/minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L68" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L68" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="encode,AutonatMsg" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2CAutonatMsg"><span class="Identifier">encode</span></a><span class="Other">(</span><span class="Identifier">msg</span><span class="Other">:</span> <a href="core.html#AutonatMsg"><span class="Identifier">AutonatMsg</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../../../protobuf/minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="encode,AutonatDialResponse" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encode%2CAutonatDialResponse"><span class="Identifier">encode</span></a><span class="Other">(</span><span class="Identifier">r</span><span class="Other">:</span> <a href="core.html#AutonatDialResponse"><span class="Identifier">AutonatDialResponse</span></a><span class="Other">)</span><span class="Other">:</span> <a href="../../../protobuf/minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/connectivity/autonat/core.nim#L78" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/connectivity/autonat/core.nim#L78" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,560 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/protocols/identify</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/protocols/identify</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Identify" title="Identify = ref object of LPProtocol
peerInfo*: PeerInfo
sendSignedPeerRecord*: bool
observedAddrManager*: ObservedAddrManager">Identify</a></li>
<li><a class="reference" href="#IdentifyError" title="IdentifyError = object of LPError">IdentifyError</a></li>
<li><a class="reference" href="#IdentifyInfo" title="IdentifyInfo {.public.} = object
pubkey*: Option[PublicKey]
peerId*: PeerId
addrs*: seq[MultiAddress]
observedAddr*: Option[MultiAddress]
protoVersion*: Option[string]
agentVersion*: Option[string]
protos*: seq[string]
signedPeerRecord*: Option[Envelope]">IdentifyInfo</a></li>
<li><a class="reference" href="#IdentifyNoPubKeyError" title="IdentifyNoPubKeyError = object of IdentifyError">IdentifyNoPubKeyError</a></li>
<li><a class="reference" href="#IdentifyPush" title="IdentifyPush = ref object of LPProtocol">IdentifyPush</a></li>
<li><a class="reference" href="#IdentifyPushHandler" title="IdentifyPushHandler = proc (peer: PeerId; newInfo: IdentifyInfo): Future[void] {.
gcsafe, raises: [], public().}">IdentifyPushHandler</a></li>
<li><a class="reference" href="#IdentityInvalidMsgError" title="IdentityInvalidMsgError = object of IdentifyError">IdentityInvalidMsgError</a></li>
<li><a class="reference" href="#IdentityNoMatchError" title="IdentityNoMatchError = object of IdentifyError">IdentityNoMatchError</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AgentVersion" title="AgentVersion = &quot;nim-libp2p/0.0.1&quot;">AgentVersion</a></li>
<li><a class="reference" href="#IdentifyCodec" title="IdentifyCodec = &quot;/ipfs/id/1.0.0&quot;">IdentifyCodec</a></li>
<li><a class="reference" href="#IdentifyPushCodec" title="IdentifyPushCodec = &quot;/ipfs/id/push/1.0.0&quot;">IdentifyPushCodec</a></li>
<li><a class="reference" href="#ProtoVersion" title="ProtoVersion = &quot;ipfs/0.1.0&quot;">ProtoVersion</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">decodeMsg
<li><a class="reference" href="#decodeMsg%2Cseq%5Bbyte%5D" title="decodeMsg(buf: seq[byte]): Opt[IdentifyInfo]">decodeMsg(buf: seq[byte]): Opt[IdentifyInfo]</a></li>
</ul>
<ul class="simple nested-toc-section">identify
<li><a class="reference" href="#identify%2CIdentify%2CConnection%2CPeerId" title="identify(self: Identify; conn: Connection; remotePeerId: PeerId): Future[
IdentifyInfo]">identify(self: Identify; conn: Connection; remotePeerId: PeerId): Future[
IdentifyInfo]</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2CIdentifyPush" title="init(p: IdentifyPush)">init(p: IdentifyPush)</a></li>
</ul>
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2Ctypedesc%5BIdentify%5D%2CPeerInfo" title="new(T: typedesc[Identify]; peerInfo: PeerInfo; sendSignedPeerRecord = false): T:type">new(T: typedesc[Identify]; peerInfo: PeerInfo; sendSignedPeerRecord = false): T:type</a></li>
<li><a class="reference" href="#new%2Ctypedesc%5BIdentifyPush%5D%2CIdentifyPushHandler" title="new(T: typedesc[IdentifyPush]; handler: IdentifyPushHandler = nil): T:type">new(T: typedesc[IdentifyPush]; handler: IdentifyPushHandler = nil): T:type</a></li>
</ul>
<ul class="simple nested-toc-section">push
<li><a class="reference" href="#push%2CIdentifyPush%2CPeerInfo%2CConnection" title="push(p: IdentifyPush; peerInfo: PeerInfo; conn: Connection)">push(p: IdentifyPush; peerInfo: PeerInfo; conn: Connection)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#14" id="64">Methods</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init.e%2CIdentify" title="init(p: Identify)">init(p: Identify)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">expandItIMPL
<li><a class="reference" href="#expandItIMPL.t%2Cauto%2Cstaticstring%2CIdentifyInfo" title="expandItIMPL(record: auto; it_name: static string; it: IdentifyInfo)">expandItIMPL(record: auto; it_name: static string; it: IdentifyInfo)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><a class="reference external" href="https://docs.libp2p.io/concepts/protocols/#identify">Identify</a> and <a class="reference external" href="https://docs.libp2p.io/concepts/protocols/#identify-push">Push Identify</a> implementation</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../protobuf/minprotobuf.html">../protobuf/minprotobuf</a>, <a class="reference external" href="../peerinfo.html">../peerinfo</a>, <a class="reference external" href="../stream/connection.html">../stream/connection</a>, <a class="reference external" href="../peerid.html">../peerid</a>, <a class="reference external" href="../crypto/crypto.html">../crypto/crypto</a>, <a class="reference external" href="../multiaddress.html">../multiaddress</a>, <a class="reference external" href="protocol.html">protocol</a>, <a class="reference external" href="../utility.html">../utility</a>, <a class="reference external" href="../errors.html">../errors</a>, <a class="reference external" href="../observedaddrmanager.html">../observedaddrmanager</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Identify" class="tohide">
<dt><pre><a href="identify.html#Identify"><span class="Identifier">Identify</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a>
<span class="Identifier">peerInfo</span><span class="Operator">*</span><span class="Other">:</span> <a href="../peerinfo.html#PeerInfo"><span class="Identifier">PeerInfo</span></a>
<span class="Identifier">sendSignedPeerRecord</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">observedAddrManager</span><span class="Operator">*</span><span class="Other">:</span> <a href="../observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyError" class="tohide">
<dt><pre><a href="identify.html#IdentifyError"><span class="Identifier">IdentifyError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../errors.html#LPError"><span class="Identifier">LPError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyInfo" class="tohide">
<dt><pre><a href="identify.html#IdentifyInfo"><span class="Identifier">IdentifyInfo</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">pubkey</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><a href="../crypto/crypto.html#PublicKey"><span class="Identifier">PublicKey</span></a><span class="Other">]</span>
<span class="Identifier">peerId</span><span class="Operator">*</span><span class="Other">:</span> <a href="../peerid.html#PeerId"><span class="Identifier">PeerId</span></a>
<span class="Identifier">addrs</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span>
<span class="Identifier">observedAddr</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><a href="../multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span>
<span class="Identifier">protoVersion</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span>
<span class="Identifier">agentVersion</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span>
<span class="Identifier">protos</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span>
<span class="Identifier">signedPeerRecord</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><a href="../signed_envelope.html#Envelope"><span class="Identifier">Envelope</span></a><span class="Other">]</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyNoPubKeyError" class="tohide">
<dt><pre><a href="identify.html#IdentifyNoPubKeyError"><span class="Identifier">IdentifyNoPubKeyError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="identify.html#IdentifyError"><span class="Identifier">IdentifyError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyPush" class="tohide">
<dt><pre><a href="identify.html#IdentifyPush"><span class="Identifier">IdentifyPush</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L67" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L67" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyPushHandler" class="tohide">
<dt><pre><a href="identify.html#IdentifyPushHandler"><span class="Identifier">IdentifyPushHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">peer</span><span class="Other">:</span> <a href="../peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">;</span> <span class="Identifier">newInfo</span><span class="Other">:</span> <a href="identify.html#IdentifyInfo"><span class="Identifier">IdentifyInfo</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">(</span><span class="Other">)</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L61" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L61" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentityInvalidMsgError" class="tohide">
<dt><pre><a href="identify.html#IdentityInvalidMsgError"><span class="Identifier">IdentityInvalidMsgError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="identify.html#IdentifyError"><span class="Identifier">IdentifyError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L43" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L43" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentityNoMatchError" class="tohide">
<dt><pre><a href="identify.html#IdentityNoMatchError"><span class="Identifier">IdentityNoMatchError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="identify.html#IdentifyError"><span class="Identifier">IdentifyError</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L42" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L42" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="AgentVersion" class="tohide">
<dt><pre><a href="identify.html#AgentVersion"><span class="Identifier">AgentVersion</span></a> <span class="Other">=</span> <span class="StringLit">&quot;nim-libp2p/0.0.1&quot;</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L38" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L38" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyCodec" class="tohide">
<dt><pre><a href="identify.html#IdentifyCodec"><span class="Identifier">IdentifyCodec</span></a> <span class="Other">=</span> <span class="StringLit">&quot;/ipfs/id/1.0.0&quot;</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="IdentifyPushCodec" class="tohide">
<dt><pre><a href="identify.html#IdentifyPushCodec"><span class="Identifier">IdentifyPushCodec</span></a> <span class="Other">=</span> <span class="StringLit">&quot;/ipfs/id/push/1.0.0&quot;</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="ProtoVersion" class="tohide">
<dt><pre><a href="identify.html#ProtoVersion"><span class="Identifier">ProtoVersion</span></a> <span class="Other">=</span> <span class="StringLit">&quot;ipfs/0.1.0&quot;</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="decodeMsg-procs-all">
<div id="decodeMsg,seq[byte]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#decodeMsg%2Cseq%5Bbyte%5D"><span class="Identifier">decodeMsg</span></a><span class="Other">(</span><span class="Identifier">buf</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="identify.html#IdentifyInfo"><span class="Identifier">IdentifyInfo</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L112" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L112" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="identify-procs-all">
<div id="identify,Identify,Connection,PeerId" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#identify%2CIdentify%2CConnection%2CPeerId"><span class="Identifier">identify</span></a><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <a href="identify.html#Identify"><span class="Identifier">Identify</span></a><span class="Other">;</span> <span class="Identifier">conn</span><span class="Other">:</span> <a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a><span class="Other">;</span> <span class="Identifier">remotePeerId</span><span class="Other">:</span> <a href="../peerid.html#PeerId"><span class="Identifier">PeerId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">IdentifyInfo</span><span class="Other">]</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">TimeEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L169" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L169" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="init-procs-all">
<div id="init,IdentifyPush" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2CIdentifyPush"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="identify.html#IdentifyPush"><span class="Identifier">IdentifyPush</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L200" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L200" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="new-procs-all">
<div id="new,typedesc[Identify],PeerInfo" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2Ctypedesc%5BIdentify%5D%2CPeerInfo"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="identify.html#Identify"><span class="Identifier">Identify</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">peerInfo</span><span class="Other">:</span> <a href="../peerinfo.html#PeerInfo"><span class="Identifier">PeerInfo</span></a><span class="Other">;</span> <span class="Identifier">sendSignedPeerRecord</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T:type</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L139" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L139" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="new,typedesc[IdentifyPush],IdentifyPushHandler" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2Ctypedesc%5BIdentifyPush%5D%2CIdentifyPushHandler"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="identify.html#IdentifyPush"><span class="Identifier">IdentifyPush</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="identify.html#IdentifyPushHandler"><span class="Identifier">IdentifyPushHandler</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T:type</span> {.
<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create a IdentifyPush protocol. <tt class="docutils literal"><span class="pre"><span class="Identifier">handler</span></span></tt> will be called every time a peer sends us new <tt class="docutils literal"><span class="pre"><span class="Identifier">PeerInfo</span></span></tt>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L193" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L193" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="push-procs-all">
<div id="push,IdentifyPush,PeerInfo,Connection" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#push%2CIdentifyPush%2CPeerInfo%2CConnection"><span class="Identifier">push</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="identify.html#IdentifyPush"><span class="Identifier">IdentifyPush</span></a><span class="Other">;</span> <span class="Identifier">peerInfo</span><span class="Other">:</span> <a href="../peerinfo.html#PeerInfo"><span class="Identifier">PeerInfo</span></a><span class="Other">;</span> <span class="Identifier">conn</span><span class="Other">:</span> <a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a><span class="Other">)</span> {.<span class="Identifier">async</span><span class="Other">,</span>
<span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Send new <tt class="docutils literal"><span class="pre"><span class="Identifier">peerInfo</span></span></tt>s to a connection
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L229" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L229" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="14">
<h1><a class="toc-backref" href="#14">Methods</a></h1>
<dl class="item">
<div id="init-methods-all">
<div id="init.e,Identify" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#init.e%2CIdentify"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="identify.html#Identify"><span class="Identifier">Identify</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L152" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L152" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="expandItIMPL-templates-all">
<div id="expandItIMPL.t,auto,staticstring,IdentifyInfo" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#expandItIMPL.t%2Cauto%2Cstaticstring%2CIdentifyInfo"><span class="Identifier">expandItIMPL</span></a><span class="Other">(</span><span class="Identifier">record</span><span class="Other">:</span> <span class="Identifier">auto</span><span class="Other">;</span> <span class="Identifier">it_name</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">it</span><span class="Other">:</span> <a href="identify.html#IdentifyInfo"><span class="Identifier">IdentifyInfo</span></a><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/identify.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/identify.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
<a href="../observedaddrmanager.html#$,ObservedAddrManager"><span class="Identifier">$</span></a>, <a href="../observedaddrmanager.html#getMostObservedProtosAndPorts,ObservedAddrManager"><span class="Identifier">getMostObservedProtosAndPorts</span></a>, <a href="../observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a>, <a href="../observedaddrmanager.html#addObservation,ObservedAddrManager,MultiAddress"><span class="Identifier">addObservation</span></a>, <a href="../observedaddrmanager.html#guessDialableAddr,ObservedAddrManager,MultiAddress"><span class="Identifier">guessDialableAddr</span></a>, <a href="../observedaddrmanager.html#new,typedesc[ObservedAddrManager],int,int"><span class="Identifier">new</span></a>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,423 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/protocols/protocol</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/protocols/protocol</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#LPProtocol" title="LPProtocol = ref object of RootObj
codecs*: seq[string]
handler*: LPProtoHandler ## this handler gets invoked by the protocol negotiator
started*: bool">LPProtocol</a></li>
<li><a class="reference" href="#LPProtoHandler" title="LPProtoHandler = proc (conn: Connection; proto: string): Future[void] {.gcsafe,
raises: [].}">LPProtoHandler</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#DefaultMaxIncomingStreams" title="DefaultMaxIncomingStreams = 10">DefaultMaxIncomingStreams</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">codec
<li><a class="reference" href="#codec%2CLPProtocol" title="codec(p: LPProtocol): string">codec(p: LPProtocol): string</a></li>
</ul>
<ul class="simple nested-toc-section">codec=
<li><a class="reference" href="#codec%3D%2CLPProtocol%2Cstring" title="codec=(p: LPProtocol; codec: string)">codec=(p: LPProtocol; codec: string)</a></li>
</ul>
<ul class="simple nested-toc-section">maxIncomingStreams
<li><a class="reference" href="#maxIncomingStreams%2CLPProtocol" title="maxIncomingStreams(p: LPProtocol): int">maxIncomingStreams(p: LPProtocol): int</a></li>
</ul>
<ul class="simple nested-toc-section">maxIncomingStreams=
<li><a class="reference" href="#maxIncomingStreams%3D%2CLPProtocol%2Cint" title="maxIncomingStreams=(p: LPProtocol; val: int)">maxIncomingStreams=(p: LPProtocol; val: int)</a></li>
</ul>
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2CtypeLPProtocol%2Cseq%5Bstring%5D%2CLPProtoHandler" title="new(T: type LPProtocol; codecs: seq[string]; handler: LPProtoHandler;
maxIncomingStreams: Opt[int] | int = Opt.none(int)): T:type">new(T: type LPProtocol; codecs: seq[string]; handler: LPProtoHandler;
maxIncomingStreams: Opt[int] | int = Opt.none(int)): T:type</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#14" id="64">Methods</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init.e%2CLPProtocol" title="init(p: LPProtocol)">init(p: LPProtocol)</a></li>
</ul>
<ul class="simple nested-toc-section">start
<li><a class="reference" href="#start.e%2CLPProtocol" title="start(p: LPProtocol)">start(p: LPProtocol)</a></li>
</ul>
<ul class="simple nested-toc-section">stop
<li><a class="reference" href="#stop.e%2CLPProtocol" title="stop(p: LPProtocol)">stop(p: LPProtocol)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../stream/connection.html">../stream/connection</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="LPProtocol" class="tohide">
<dt><pre><a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">codecs</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span>
<span class="Identifier">handler</span><span class="Operator">*</span><span class="Other">:</span> <a href="protocol.html#LPProtoHandler"><span class="Identifier">LPProtoHandler</span></a> <span class="Comment">## this handler gets invoked by the protocol negotiator</span>
<span class="Identifier">started</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">bool</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="LPProtoHandler" class="tohide">
<dt><pre><a href="protocol.html#LPProtoHandler"><span class="Identifier">LPProtoHandler</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">conn</span><span class="Other">:</span> <a href="../stream/connection.html#Connection"><span class="Identifier">Connection</span></a><span class="Other">;</span> <span class="Identifier">proto</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="DefaultMaxIncomingStreams" class="tohide">
<dt><pre><a href="protocol.html#DefaultMaxIncomingStreams"><span class="Identifier">DefaultMaxIncomingStreams</span></a> <span class="Other">=</span> <span class="DecNumber">10</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L18" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L18" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="codec-procs-all">
<div id="codec,LPProtocol" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#codec%2CLPProtocol"><span class="Identifier">codec</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L43" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L43" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="codec=-procs-all">
<div id="codec=,LPProtocol,string" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#codec%3D%2CLPProtocol%2Cstring"><span class="Identifier">codec=</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">;</span> <span class="Identifier">codec</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L47" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L47" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="maxIncomingStreams-procs-all">
<div id="maxIncomingStreams,LPProtocol" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#maxIncomingStreams%2CLPProtocol"><span class="Identifier">maxIncomingStreams</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="maxIncomingStreams=-procs-all">
<div id="maxIncomingStreams=,LPProtocol,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#maxIncomingStreams%3D%2CLPProtocol%2Cint"><span class="Identifier">maxIncomingStreams=</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">;</span> <span class="Identifier">val</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="new-procs-all">
<div id="new,typeLPProtocol,seq[string],LPProtoHandler" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2CtypeLPProtocol%2Cseq%5Bstring%5D%2CLPProtoHandler"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">LPProtocol</span><span class="Other">;</span> <span class="Identifier">codecs</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">handler</span><span class="Other">:</span> <a href="protocol.html#LPProtoHandler"><span class="Identifier">LPProtoHandler</span></a><span class="Other">;</span>
<span class="Identifier">maxIncomingStreams</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">Opt</span><span class="Other">.</span><span class="Identifier">none</span><span class="Other">(</span><span class="Identifier">int</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T:type</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="14">
<h1><a class="toc-backref" href="#14">Methods</a></h1>
<dl class="item">
<div id="init-methods-all">
<div id="init.e,LPProtocol" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#init.e%2CLPProtocol"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">)</span> {.<span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="start-methods-all">
<div id="start.e,LPProtocol" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#start.e%2CLPProtocol"><span class="Identifier">start</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">)</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="stop-methods-all">
<div id="stop.e,LPProtocol" class="tohide">
<dt><pre><span class="Keyword">method</span> <a href="#stop.e%2CLPProtocol"><span class="Identifier">stop</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="protocol.html#LPProtocol"><span class="Identifier">LPProtocol</span></a><span class="Other">)</span> {.<span class="Identifier">async</span><span class="Other">,</span> <span class="Identifier">base</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/protocol.nim#L35" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/protocol.nim#L35" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/protocols/secure/secure</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/protocols/secure/secure</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/protocols/secure/secure.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protocols/secure/secure.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/stream/chronosstream</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/stream/chronosstream</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/chronosstream.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/chronosstream.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:52 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/stream/lpstream</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/stream/lpstream</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/lpstream.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/lpstream.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,402 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/stream/streamseq</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/stream/streamseq</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#StreamSeq" title="StreamSeq = object">StreamSeq</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">add
<li><a class="reference" href="#add%2CStreamSeq%2CopenArray%5Bbyte%5D" title="add(v: var StreamSeq; data: openArray[byte])">add(v: var StreamSeq; data: openArray[byte])</a></li>
</ul>
<ul class="simple nested-toc-section">assign
<li><a class="reference" href="#assign%2CStreamSeq%2CopenArray%5Bbyte%5D" title="assign(v: var StreamSeq; buf: openArray[byte])">assign(v: var StreamSeq; buf: openArray[byte])</a></li>
</ul>
<ul class="simple nested-toc-section">clear
<li><a class="reference" href="#clear%2CStreamSeq" title="clear(v: var StreamSeq)">clear(v: var StreamSeq)</a></li>
</ul>
<ul class="simple nested-toc-section">consume
<li><a class="reference" href="#consume%2CStreamSeq%2Cint" title="consume(v: var StreamSeq; n: int)">consume(v: var StreamSeq; n: int)</a></li>
</ul>
<ul class="simple nested-toc-section">consumeTo
<li><a class="reference" href="#consumeTo%2CStreamSeq%2CopenArray%5Bbyte%5D" title="consumeTo(v: var StreamSeq; buf: var openArray[byte]): int">consumeTo(v: var StreamSeq; buf: var openArray[byte]): int</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">commit
<li><a class="reference" href="#commit.t%2CStreamSeq%2Cint" title="commit(v: var StreamSeq; n: int)">commit(v: var StreamSeq; n: int)</a></li>
</ul>
<ul class="simple nested-toc-section">data
<li><a class="reference" href="#data.t%2CStreamSeq" title="data(v: StreamSeq): openArray[byte]">data(v: StreamSeq): openArray[byte]</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len.t%2CStreamSeq" title="len(v: StreamSeq): int">len(v: StreamSeq): int</a></li>
</ul>
<ul class="simple nested-toc-section">prepare
<li><a class="reference" href="#prepare.t%2CStreamSeq%2Cint" title="prepare(v: var StreamSeq; n: int): var openArray[byte]">prepare(v: var StreamSeq; n: int): var openArray[byte]</a></li>
</ul>
<ul class="simple nested-toc-section">toOpenArray
<li><a class="reference" href="#toOpenArray.t%2CStreamSeq%2Cint%2Cint" title="toOpenArray(v: StreamSeq; b, e: int): openArray[byte]">toOpenArray(v: StreamSeq; b, e: int): openArray[byte]</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="StreamSeq" class="tohide">
<dt><pre><a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L15" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L15" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="add-procs-all">
<div id="add,StreamSeq,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#add%2CStreamSeq%2CopenArray%5Bbyte%5D"><span class="Identifier">add</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Add data - the equivalent of <tt class="docutils literal"><span class="pre"><span class="Identifier">buf</span><span class="Operator">.</span><span class="Identifier">prepare</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">)</span> <span class="Operator">=</span> <span class="Identifier">data</span><span class="Punctuation">;</span> <span class="Identifier">buf</span><span class="Operator">.</span><span class="Identifier">commit</span><span class="Punctuation">(</span><span class="Identifier">n</span><span class="Punctuation">)</span></span></tt>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L63" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L63" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="assign-procs-all">
<div id="assign,StreamSeq,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#assign%2CStreamSeq%2CopenArray%5Bbyte%5D"><span class="Identifier">assign</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L94" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L94" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="clear-procs-all">
<div id="clear,StreamSeq" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#clear%2CStreamSeq"><span class="Identifier">clear</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="consume-procs-all">
<div id="consume,StreamSeq,int" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#consume%2CStreamSeq%2Cint"><span class="Identifier">consume</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Mark <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> bytes that were returned via <tt class="docutils literal"><span class="pre"><span class="Identifier">data</span></span></tt> as consumed
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L80" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L80" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="consumeTo-procs-all">
<div id="consumeTo,StreamSeq,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#consumeTo%2CStreamSeq%2CopenArray%5Bbyte%5D"><span class="Identifier">consumeTo</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">buf</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L84" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L84" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="commit-templates-all">
<div id="commit.t,StreamSeq,int" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#commit.t%2CStreamSeq%2Cint"><span class="Identifier">commit</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span></pre></dt>
<dd>
Mark <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> bytes in the buffer returned by <tt class="docutils literal"><span class="pre"><span class="Identifier">prepare</span></span></tt> as ready for reading
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L59" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L59" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="data-templates-all">
<div id="data.t,StreamSeq" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#data.t%2CStreamSeq"><span class="Identifier">data</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-templates-all">
<div id="len.t,StreamSeq" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#len.t%2CStreamSeq"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L27" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L27" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="prepare-templates-all">
<div id="prepare.t,StreamSeq,int" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#prepare.t%2CStreamSeq%2Cint"><span class="Identifier">prepare</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span></pre></dt>
<dd>
Return a buffer that is at least <tt class="docutils literal"><span class="pre"><span class="Identifier">n</span></span></tt> bytes long
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toOpenArray-templates-all">
<div id="toOpenArray.t,StreamSeq,int,int" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#toOpenArray.t%2CStreamSeq%2Cint%2Cint"><span class="Identifier">toOpenArray</span></a><span class="Other">(</span><span class="Identifier">v</span><span class="Other">:</span> <a href="streamseq.html#StreamSeq"><span class="Identifier">StreamSeq</span></a><span class="Other">;</span> <span class="Identifier">b</span><span class="Other">,</span> <span class="Identifier">e</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/stream/streamseq.nim#L75" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/stream/streamseq.nim#L75" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/transcoder</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/transcoder</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#Transcoder" title="Transcoder = object
stringToBuffer*: proc (s: string; vb: var VBuffer): bool {.nimcall, gcsafe,
noSideEffect, raises: [].}
bufferToString*: proc (vb: var VBuffer; s: var string): bool {.nimcall,
gcsafe, noSideEffect, raises: [].}
validateBuffer*: proc (vb: var VBuffer): bool {.nimcall, gcsafe, noSideEffect,
raises: [].}">Transcoder</a></li>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/transcoder.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/transcoder.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements transcoder interface.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="vbuffer.html">vbuffer</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="Transcoder" class="tohide">
<dt><pre><a href="transcoder.html#Transcoder"><span class="Identifier">Transcoder</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">stringToBuffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span> <span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">nimcall</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span>
</span><span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}
<span class="Identifier">bufferToString</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">nimcall</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> </span><span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}
<span class="Identifier">validateBuffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">nimcall</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> </span><span class="Identifier">noSideEffect</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/transcoder.nim#L14" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/transcoder.nim#L14" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/transports/tcptransport</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/transports/tcptransport</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/transports/tcptransport.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/transports/tcptransport.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:52 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/transports/transport</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/transports/transport</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/transports/transport.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/transports/transport.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,399 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/utility</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/utility</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">capLen
<li><a class="reference" href="#capLen%2Cseq%5BT%5D%2CNatural" title="capLen[T](s: var seq[T]; length: Natural)">capLen[T](s: var seq[T]; length: Natural)</a></li>
</ul>
<ul class="simple nested-toc-section">shortLog
<li><a class="reference" href="#shortLog%2CopenArray%5Bbyte%5D" title="shortLog(item: openArray[byte]): string">shortLog(item: openArray[byte]): string</a></li>
<li><a class="reference" href="#shortLog%2Cstring" title="shortLog(item: string): string">shortLog(item: string): string</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">withValue
<li><a class="reference" href="#withValue.m%2C%2Cuntyped%2Cuntyped%2Cuntyped" title="withValue[T](self: Opt[T] | Option[T]; value, body, body2: untyped): untyped">withValue[T](self: Opt[T] | Option[T]; value, body, body2: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">compilesOr
<li><a class="reference" href="#compilesOr.t%2Cuntyped%2Cuntyped" title="compilesOr(a, b: untyped): untyped">compilesOr(a, b: untyped): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">exceptionToAssert
<li><a class="reference" href="#exceptionToAssert.t%2Cuntyped" title="exceptionToAssert(body: untyped): untyped">exceptionToAssert(body: untyped): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">public
<li><a class="reference" href="#public.t" title="public()">public()</a></li>
</ul>
<ul class="simple nested-toc-section">safeConvert
<li><a class="reference" href="#safeConvert.t%2CS" title="safeConvert[T: SomeInteger; S: Ordinal](value: S): T">safeConvert[T: SomeInteger; S: Ordinal](value: S): T</a></li>
</ul>
<ul class="simple nested-toc-section">toOpt
<li><a class="reference" href="#toOpt.t%2CResult%5BT%2CE%5D" title="toOpt[T, E](self: Result[T, E]): Opt[T]">toOpt[T, E](self: Result[T, E]): Opt[T]</a></li>
</ul>
<ul class="simple nested-toc-section">valueOr
<li><a class="reference" href="#valueOr.t%2COption%5BT%5D%2Cuntyped" title="valueOr[T](self: Option[T]; body: untyped): untyped">valueOr[T](self: Option[T]; body: untyped): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">withValue
<li><a class="reference" href="#withValue.t%2C%2Cuntyped%2Cuntyped" title="withValue[T](self: Opt[T] | Option[T]; value, body: untyped): untyped">withValue[T](self: Opt[T] | Option[T]; value, body: untyped): untyped</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="capLen-procs-all">
<div id="capLen,seq[T],Natural" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#capLen%2Cseq%5BT%5D%2CNatural"><span class="Identifier">capLen</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">Natural</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="shortLog-procs-all">
<div id="shortLog,openArray[byte]" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#shortLog%2CopenArray%5Bbyte%5D"><span class="Identifier">shortLog</span></a><span class="Other">(</span><span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L28" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L28" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="shortLog,string" class="tohide">
<dt><pre><span class="Keyword">func</span> <a href="#shortLog%2Cstring"><span class="Identifier">shortLog</span></a><span class="Other">(</span><span class="Identifier">item</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="withValue-macros-all">
<div id="withValue.m,,untyped,untyped,untyped" class="tohide">
<dt><pre><span class="Keyword">macro</span> <a href="#withValue.m%2C%2Cuntyped%2Cuntyped%2Cuntyped"><span class="Identifier">withValue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">Option</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">,</span> <span class="Identifier">body</span><span class="Other">,</span> <span class="Identifier">body2</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L96" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L96" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="compilesOr-templates-all">
<div id="compilesOr.t,untyped,untyped" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#compilesOr.t%2Cuntyped%2Cuntyped"><span class="Identifier">compilesOr</span></a><span class="Other">(</span><span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="exceptionToAssert-templates-all">
<div id="exceptionToAssert.t,untyped" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#exceptionToAssert.t%2Cuntyped"><span class="Identifier">exceptionToAssert</span></a><span class="Other">(</span><span class="Identifier">body</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="public-templates-all">
<div id="public.t" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#public.t"><span class="Identifier">public</span></a><span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">pragma</span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L17" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L17" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="safeConvert-templates-all">
<div id="safeConvert.t,S" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#safeConvert.t%2CS"><span class="Identifier">safeConvert</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">SomeInteger</span><span class="Other">;</span> <span class="Identifier">S</span><span class="Other">:</span> <span class="Identifier">Ordinal</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">S</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
Converts <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> from S to <tt class="docutils literal"><span class="pre"><span class="Identifier">T</span></span></tt> iff <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span></span></tt> is guaranteed to be preserved.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L66" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L66" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="toOpt-templates-all">
<div id="toOpt.t,Result[T,E]" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#toOpt.t%2CResult%5BT%2CE%5D"><span class="Identifier">toOpt</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L111" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L111" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="valueOr-templates-all">
<div id="valueOr.t,Option[T],untyped" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#valueOr.t%2COption%5BT%5D%2Cuntyped"><span class="Identifier">valueOr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">body</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L105" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L105" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="withValue-templates-all">
<div id="withValue.t,,untyped,untyped" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#withValue.t%2C%2Cuntyped%2Cuntyped"><span class="Identifier">withValue</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">self</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">Option</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">,</span> <span class="Identifier">body</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utility.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utility.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:47 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,321 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/utils/semaphore</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/utils/semaphore</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AsyncSemaphore" title="AsyncSemaphore = ref object of RootObj
size*: int">AsyncSemaphore</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">acquire
<li><a class="reference" href="#acquire%2CAsyncSemaphore" title="acquire(s: AsyncSemaphore): Future[void]">acquire(s: AsyncSemaphore): Future[void]</a></li>
</ul>
<ul class="simple nested-toc-section">count
<li><a class="reference" href="#count%2CAsyncSemaphore" title="count(s: AsyncSemaphore): int">count(s: AsyncSemaphore): int</a></li>
</ul>
<ul class="simple nested-toc-section">forceAcquire
<li><a class="reference" href="#forceAcquire%2CAsyncSemaphore" title="forceAcquire(s: AsyncSemaphore)">forceAcquire(s: AsyncSemaphore)</a></li>
</ul>
<ul class="simple nested-toc-section">newAsyncSemaphore
<li><a class="reference" href="#newAsyncSemaphore%2Cint" title="newAsyncSemaphore(size: int): AsyncSemaphore">newAsyncSemaphore(size: int): AsyncSemaphore</a></li>
</ul>
<ul class="simple nested-toc-section">release
<li><a class="reference" href="#release%2CAsyncSemaphore" title="release(s: AsyncSemaphore)">release(s: AsyncSemaphore)</a></li>
</ul>
<ul class="simple nested-toc-section">tryAcquire
<li><a class="reference" href="#tryAcquire%2CAsyncSemaphore" title="tryAcquire(s: AsyncSemaphore): bool">tryAcquire(s: AsyncSemaphore): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AsyncSemaphore" class="tohide">
<dt><pre><a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">size</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="acquire-procs-all">
<div id="acquire,AsyncSemaphore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#acquire%2CAsyncSemaphore"><span class="Identifier">acquire</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Acquire a resource and decrement the resource counter. If no more resources are available, the returned future will not complete until the resource count goes above 0.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="count-procs-all">
<div id="count,AsyncSemaphore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#count%2CAsyncSemaphore"><span class="Identifier">count</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="forceAcquire-procs-all">
<div id="forceAcquire,AsyncSemaphore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#forceAcquire%2CAsyncSemaphore"><span class="Identifier">forceAcquire</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
ForceAcquire will always succeed, creating a temporary slot if required. This temporary slot will stay usable until there is less <tt class="docutils literal"><span class="pre"><span class="Identifier">acquire</span></span></tt>s than <tt class="docutils literal"><span class="pre"><span class="Identifier">release</span></span></tt>s
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L65" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L65" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newAsyncSemaphore-procs-all">
<div id="newAsyncSemaphore,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#newAsyncSemaphore%2Cint"><span class="Identifier">newAsyncSemaphore</span></a><span class="Other">(</span><span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L26" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L26" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="release-procs-all">
<div id="release,AsyncSemaphore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#release%2CAsyncSemaphore"><span class="Identifier">release</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Release a resource from the semaphore, by picking the first future from the queue and completing it and incrementing the internal resource count
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L72" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L72" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="tryAcquire-procs-all">
<div id="tryAcquire,AsyncSemaphore" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#tryAcquire%2CAsyncSemaphore"><span class="Identifier">tryAcquire</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="semaphore.html#AsyncSemaphore"><span class="Identifier">AsyncSemaphore</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Attempts to acquire a resource, if successful returns true, otherwise false
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/utils/semaphore.nim#L31" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/utils/semaphore.nim#L31" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:51 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,635 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/varint</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/varint</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#hint" title="hint = distinct int">hint</a></li>
<li><a class="reference" href="#hint32" title="hint32 = distinct int32">hint32</a></li>
<li><a class="reference" href="#hint64" title="hint64 = distinct int64">hint64</a></li>
<li><a class="reference" href="#LP" title="LP = object">LP</a></li>
<li><a class="reference" href="#LPSomeUVarint" title="LPSomeUVarint = uint | uint64 | uint32 | uint16 | uint8">LPSomeUVarint</a></li>
<li><a class="reference" href="#LPSomeVarint" title="LPSomeVarint = LPSomeUVarint">LPSomeVarint</a></li>
<li><a class="reference" href="#PB" title="PB = object">PB</a></li>
<li><a class="reference" href="#PBSomeSVarint" title="PBSomeSVarint = hint | hint64 | hint32">PBSomeSVarint</a></li>
<li><a class="reference" href="#PBSomeUVarint" title="PBSomeUVarint = uint | uint64 | uint32">PBSomeUVarint</a></li>
<li><a class="reference" href="#PBSomeVarint" title="PBSomeVarint = PBSomeUVarint | PBSomeSVarint | PBZigVarint">PBSomeVarint</a></li>
<li><a class="reference" href="#PBZigVarint" title="PBZigVarint = zint | zint64 | zint32">PBZigVarint</a></li>
<li><a class="reference" href="#SomeUVarint" title="SomeUVarint = PBSomeUVarint | LPSomeUVarint">SomeUVarint</a></li>
<li><a class="reference" href="#SomeVarint" title="SomeVarint = PBSomeVarint | LPSomeVarint">SomeVarint</a></li>
<li><a class="reference" href="#VarintError" title="VarintError {.pure.} = enum
Error, Overflow, Incomplete, Overlong, Overrun">VarintError</a></li>
<li><a class="reference" href="#VarintResult" title="VarintResult[T] = Result[T, VarintError]">VarintResult</a></li>
<li><a class="reference" href="#zint" title="zint = distinct int">zint</a></li>
<li><a class="reference" href="#zint32" title="zint32 = distinct int32">zint32</a></li>
<li><a class="reference" href="#zint64" title="zint64 = distinct int64">zint64</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">encodeVarint
<li><a class="reference" href="#encodeVarint%2Ctypedesc%5BLP%5D%2CLPSomeVarint" title="encodeVarint(vtype: typedesc[LP]; value: LPSomeVarint): VarintResult[seq[byte]]">encodeVarint(vtype: typedesc[LP]; value: LPSomeVarint): VarintResult[seq[byte]]</a></li>
<li><a class="reference" href="#encodeVarint%2Ctypedesc%5BPB%5D%2CPBSomeVarint" title="encodeVarint(vtype: typedesc[PB]; value: PBSomeVarint): VarintResult[seq[byte]]">encodeVarint(vtype: typedesc[PB]; value: PBSomeVarint): VarintResult[seq[byte]]</a></li>
</ul>
<ul class="simple nested-toc-section">getSVarint
<li><a class="reference" href="#getSVarint%2CopenArray%5Bbyte%5D%2Cint%2C" title="getSVarint(pbytes: openArray[byte]; outsize: var int;
outval: var (PBZigVarint | PBSomeSVarint)): VarintResult[void]">getSVarint(pbytes: openArray[byte]; outsize: var int;
outval: var (PBZigVarint | PBSomeSVarint)): VarintResult[void]</a></li>
</ul>
<ul class="simple nested-toc-section">getUVarint
<li><a class="reference" href="#getUVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeUVarint" title="getUVarint[T: PB | LP](vtype: typedesc[T]; pbytes: openArray[byte];
outlen: var int; outval: var SomeUVarint): VarintResult[
void]">getUVarint[T: PB | LP](vtype: typedesc[T]; pbytes: openArray[byte];
outlen: var int; outval: var SomeUVarint): VarintResult[
void]</a></li>
</ul>
<ul class="simple nested-toc-section">getVarint
<li><a class="reference" href="#getVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeVarint" title="getVarint[T: PB | LP](vtype: typedesc[T]; pbytes: openArray[byte];
nbytes: var int; value: var SomeVarint): VarintResult[void]">getVarint[T: PB | LP](vtype: typedesc[T]; pbytes: openArray[byte];
nbytes: var int; value: var SomeVarint): VarintResult[void]</a></li>
</ul>
<ul class="simple nested-toc-section">putSVarint
<li><a class="reference" href="#putSVarint%2CopenArray%5Bbyte%5D%2Cint%2C" title="putSVarint(pbytes: var openArray[byte]; outsize: var int;
outval: (PBZigVarint | PBSomeSVarint)): VarintResult[void]">putSVarint(pbytes: var openArray[byte]; outsize: var int;
outval: (PBZigVarint | PBSomeSVarint)): VarintResult[void]</a></li>
</ul>
<ul class="simple nested-toc-section">putUVarint
<li><a class="reference" href="#putUVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeUVarint" title="putUVarint[T: PB | LP](vtype: typedesc[T]; pbytes: var openArray[byte];
outlen: var int; outval: SomeUVarint): VarintResult[void]">putUVarint[T: PB | LP](vtype: typedesc[T]; pbytes: var openArray[byte];
outlen: var int; outval: SomeUVarint): VarintResult[void]</a></li>
</ul>
<ul class="simple nested-toc-section">putVarint
<li><a class="reference" href="#putVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeVarint" title="putVarint[T: PB | LP](vtype: typedesc[T]; pbytes: var openArray[byte];
nbytes: var int; value: SomeVarint): VarintResult[void]">putVarint[T: PB | LP](vtype: typedesc[T]; pbytes: var openArray[byte];
nbytes: var int; value: SomeVarint): VarintResult[void]</a></li>
</ul>
<ul class="simple nested-toc-section">vsizeof
<li><a class="reference" href="#vsizeof%2CSomeVarint" title="vsizeof(x: SomeVarint): int">vsizeof(x: SomeVarint): int</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">toBytes
<li><a class="reference" href="#toBytes.t%2Ctypedesc%5BPB%5D%2CPBSomeVarint" title="toBytes(vtype: typedesc[PB]; value: PBSomeVarint): auto">toBytes(vtype: typedesc[PB]; value: PBSomeVarint): auto</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements Variable Integer <tt class="docutils literal"><span class="pre"><span class="Identifier">VARINT</span></span></tt>. This module supports two variants of variable integer<ul class="simple"><li>Google ProtoBuf varint, which is able to encode full uint64 number and maximum size of encoded value is 10 octets (bytes). <a class="reference external" href="https://developers.google.com/protocol-buffers/docs/encoding#varints">https://developers.google.com/protocol-buffers/docs/encoding#varints</a></li>
<li>LibP2P varint, which is able to encode only 63bits of uint64 number and maximum size of encoded value is 9 octets (bytes). <a class="reference external" href="https://github.com/multiformats/unsigned-varint">https://github.com/multiformats/unsigned-varint</a></li>
</ul>
</p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="hint" class="tohide">
<dt><pre><a href="varint.html#hint"><span class="Identifier">hint</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int</span></pre></dt>
<dd>
Signed integer types which will be encoded using simple cast.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L46" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L46" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="hint32" class="tohide">
<dt><pre><a href="varint.html#hint32"><span class="Identifier">hint32</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int32</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="hint64" class="tohide">
<dt><pre><a href="varint.html#hint64"><span class="Identifier">hint64</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int64</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="LP" class="tohide">
<dt><pre><a href="varint.html#LP"><span class="Identifier">LP</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
</pre></dt>
<dd>
Use this type to specify LibP2P varint encoding
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L36" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L36" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="LPSomeUVarint" class="tohide">
<dt><pre><a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a> <span class="Other">=</span> <span class="Identifier">uint</span> <span class="Operator">|</span> <span class="Identifier">uint64</span> <span class="Operator">|</span> <span class="Identifier">uint32</span> <span class="Operator">|</span> <span class="Identifier">uint16</span> <span class="Operator">|</span> <span class="Identifier">uint8</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L53" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L53" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="LPSomeVarint" class="tohide">
<dt><pre><a href="varint.html#LPSomeVarint"><span class="Identifier">LPSomeVarint</span></a> <span class="Other">=</span> <a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PB" class="tohide">
<dt><pre><a href="varint.html#PB"><span class="Identifier">PB</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
</pre></dt>
<dd>
Use this type to specify Google ProtoBuf's varint encoding
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PBSomeSVarint" class="tohide">
<dt><pre><a href="varint.html#PBSomeSVarint"><span class="Identifier">PBSomeSVarint</span></a> <span class="Other">=</span> <a href="varint.html#hint"><span class="Identifier">hint</span></a> <span class="Operator">|</span> <a href="varint.html#hint64"><span class="Identifier">hint64</span></a> <span class="Operator">|</span> <a href="varint.html#hint32"><span class="Identifier">hint32</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L50" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L50" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PBSomeUVarint" class="tohide">
<dt><pre><a href="varint.html#PBSomeUVarint"><span class="Identifier">PBSomeUVarint</span></a> <span class="Other">=</span> <span class="Identifier">uint</span> <span class="Operator">|</span> <span class="Identifier">uint64</span> <span class="Operator">|</span> <span class="Identifier">uint32</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L49" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L49" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PBSomeVarint" class="tohide">
<dt><pre><a href="varint.html#PBSomeVarint"><span class="Identifier">PBSomeVarint</span></a> <span class="Other">=</span> <a href="varint.html#PBSomeUVarint"><span class="Identifier">PBSomeUVarint</span></a> <span class="Operator">|</span> <a href="varint.html#PBSomeSVarint"><span class="Identifier">PBSomeSVarint</span></a> <span class="Operator">|</span> <a href="varint.html#PBZigVarint"><span class="Identifier">PBZigVarint</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="PBZigVarint" class="tohide">
<dt><pre><a href="varint.html#PBZigVarint"><span class="Identifier">PBZigVarint</span></a> <span class="Other">=</span> <a href="varint.html#zint"><span class="Identifier">zint</span></a> <span class="Operator">|</span> <a href="varint.html#zint64"><span class="Identifier">zint64</span></a> <span class="Operator">|</span> <a href="varint.html#zint32"><span class="Identifier">zint32</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SomeUVarint" class="tohide">
<dt><pre><a href="varint.html#SomeUVarint"><span class="Identifier">SomeUVarint</span></a> <span class="Other">=</span> <a href="varint.html#PBSomeUVarint"><span class="Identifier">PBSomeUVarint</span></a> <span class="Operator">|</span> <a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L56" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L56" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SomeVarint" class="tohide">
<dt><pre><a href="varint.html#SomeVarint"><span class="Identifier">SomeVarint</span></a> <span class="Other">=</span> <a href="varint.html#PBSomeVarint"><span class="Identifier">PBSomeVarint</span></a> <span class="Operator">|</span> <a href="varint.html#LPSomeVarint"><span class="Identifier">LPSomeVarint</span></a></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="VarintError" class="tohide">
<dt><pre><a href="varint.html#VarintError"><span class="Identifier">VarintError</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Error</span><span class="Other">,</span> <span class="Identifier">Overflow</span><span class="Other">,</span> <span class="Identifier">Incomplete</span><span class="Other">,</span> <span class="Identifier">Overlong</span><span class="Other">,</span> <span class="Identifier">Overrun</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="VarintResult" class="tohide">
<dt><pre><a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <a href="varint.html#VarintError"><span class="Identifier">VarintError</span></a><span class="Other">]</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L32" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L32" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="zint" class="tohide">
<dt><pre><a href="varint.html#zint"><span class="Identifier">zint</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int</span></pre></dt>
<dd>
Signed integer types which will be encoded using zigzag encoding.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L41" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L41" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="zint32" class="tohide">
<dt><pre><a href="varint.html#zint32"><span class="Identifier">zint32</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int32</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="zint64" class="tohide">
<dt><pre><a href="varint.html#zint64"><span class="Identifier">zint64</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int64</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L40" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L40" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="encodeVarint-procs-all">
<div id="encodeVarint,typedesc[LP],LPSomeVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encodeVarint%2Ctypedesc%5BLP%5D%2CLPSomeVarint"><span class="Identifier">encodeVarint</span></a><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="varint.html#LP"><span class="Identifier">LP</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#LPSomeVarint"><span class="Identifier">LPSomeVarint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Encode integer to LibP2P <tt class="docutils literal"><span class="pre"><span class="Identifier">unsigned</span> <span class="Identifier">varint</span></span></tt> and returns sequence of bytes as buffer.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L288" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L288" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="encodeVarint,typedesc[PB],PBSomeVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#encodeVarint%2Ctypedesc%5BPB%5D%2CPBSomeVarint"><span class="Identifier">encodeVarint</span></a><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="varint.html#PB"><span class="Identifier">PB</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#PBSomeVarint"><span class="Identifier">PBSomeVarint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span>
<span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Encode integer to Google ProtoBuf's <tt class="docutils literal"><span class="pre"><span class="Identifier">signed</span><span class="Operator">/</span><span class="Identifier">unsigned</span> <span class="Identifier">varint</span></span></tt> and returns sequence of bytes as buffer.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L268" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L268" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getSVarint-procs-all">
<div id="getSVarint,openArray[byte],int," class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getSVarint%2CopenArray%5Bbyte%5D%2Cint%2C"><span class="Identifier">getSVarint</span></a><span class="Other">(</span><span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">outsize</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">outval</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Other">(</span><a href="varint.html#PBZigVarint"><span class="Identifier">PBZigVarint</span></a> <span class="Operator">|</span> <a href="varint.html#PBSomeSVarint"><span class="Identifier">PBSomeSVarint</span></a><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Decode signed integer (<tt class="docutils literal"><span class="pre">int32</span></tt> or <tt class="docutils literal"><span class="pre">int64</span></tt>) from buffer <tt class="docutils literal"><span class="pre">pbytes</span></tt> and store it to <tt class="docutils literal"><span class="pre">outval</span></tt>.</p>
<p>On success <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to number of bytes processed while decoding signed varint.</p>
<p>If array <tt class="docutils literal"><span class="pre">pbytes</span></tt> is empty, <tt class="docutils literal"><span class="pre">Incomplete</span></tt> error will be returned.</p>
<p>If there not enough bytes available in array <tt class="docutils literal"><span class="pre">pbytes</span></tt> to decode <tt class="docutils literal"><span class="pre"><span class="Identifier">signed</span> <span class="Identifier">varint</span></span></tt>, <tt class="docutils literal"><span class="pre">Incomplete</span></tt> error will be returned.</p>
<p>If encoded value can produce integer overflow, <tt class="docutils literal"><span class="pre">Overflow</span></tt> error will be returned.</p>
<p>Note, when decoding 10th byte of 64bit integer only 1 bit from byte will be decoded, all other bits will be ignored. When decoding 5th byte of 32bit integer only 4 bits from byte will be decoded, all other bits will be ignored.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L180" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L180" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getUVarint-procs-all">
<div id="getUVarint,typedesc[T],openArray[byte],int,SomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getUVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeUVarint"><span class="Identifier">getUVarint</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="varint.html#PB"><span class="Identifier">PB</span></a> <span class="Operator">|</span> <a href="varint.html#LP"><span class="Identifier">LP</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">outlen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">outval</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="varint.html#SomeUVarint"><span class="Identifier">SomeUVarint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Decode <tt class="docutils literal"><span class="pre"><span class="Identifier">unsigned</span> <span class="Identifier">varint</span></span></tt> from buffer <tt class="docutils literal"><span class="pre">pbytes</span></tt> and store it to <tt class="docutils literal"><span class="pre">outval</span></tt>. On success <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to number of bytes processed while decoding <tt class="docutils literal"><span class="pre"><span class="Identifier">unsigned</span> <span class="Identifier">varint</span></span></tt>.</p>
<p>If array <tt class="docutils literal"><span class="pre">pbytes</span></tt> is empty, <tt class="docutils literal"><span class="pre">Incomplete</span></tt> error will be returned.</p>
<p>If there not enough bytes available in array <tt class="docutils literal"><span class="pre">pbytes</span></tt> to decode <tt class="docutils literal"><span class="pre"><span class="Identifier">unsigned</span> <span class="Identifier">varint</span></span></tt>, <tt class="docutils literal"><span class="pre">Incomplete</span></tt> error will be returned.</p>
<p>If encoded value can produce integer overflow, <tt class="docutils literal"><span class="pre">Overflow</span></tt> error will be returned.</p>
<p>Google ProtoBuf When decoding 10th byte of Google Protobuf's 64bit integer only 1 bit from byte will be decoded, all other bits will be ignored. When decoding 5th byte of 32bit integer only 4 bits from byte will be decoded, all other bits will be ignored.</p>
<p>LibP2P When decoding 5th byte of 32bit integer only 4 bits from byte will be decoded, all other bits will be ignored.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L102" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L102" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getVarint-procs-all">
<div id="getVarint,typedesc[T],openArray[byte],int,SomeVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeVarint"><span class="Identifier">getVarint</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="varint.html#PB"><span class="Identifier">PB</span></a> <span class="Operator">|</span> <a href="varint.html#LP"><span class="Identifier">LP</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">nbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="varint.html#SomeVarint"><span class="Identifier">SomeVarint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L247" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L247" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="putSVarint-procs-all">
<div id="putSVarint,openArray[byte],int," class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#putSVarint%2CopenArray%5Bbyte%5D%2Cint%2C"><span class="Identifier">putSVarint</span></a><span class="Other">(</span><span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">outsize</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span>
<span class="Identifier">outval</span><span class="Other">:</span> <span class="Other">(</span><a href="varint.html#PBZigVarint"><span class="Identifier">PBZigVarint</span></a> <span class="Operator">|</span> <a href="varint.html#PBSomeSVarint"><span class="Identifier">PBSomeSVarint</span></a><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Encode signed integer <tt class="docutils literal"><span class="pre">outval</span></tt> using ProtoBuffer's zigzag encoding (<tt class="docutils literal"><span class="pre">sint32</span></tt> or <tt class="docutils literal"><span class="pre">sint64</span></tt>) and store it to array <tt class="docutils literal"><span class="pre">pbytes</span></tt>.</p>
<p>On success <tt class="docutils literal"><span class="pre">outlen</span></tt> will hold number of bytes (octets) used to encode unsigned integer <tt class="docutils literal"><span class="pre">v</span></tt>.</p>
<p>If there not enough bytes available in buffer <tt class="docutils literal"><span class="pre">pbytes</span></tt>, <tt class="docutils literal"><span class="pre">Incomplete</span></tt> error will be returned and <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to number of bytes required.</p>
<p>Maximum encoded length of 64bit integer is 10 octets. Maximum encoded length of 32bit integer is 5 octets.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L210" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L210" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="putUVarint-procs-all">
<div id="putUVarint,typedesc[T],openArray[byte],int,SomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#putUVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeUVarint"><span class="Identifier">putUVarint</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="varint.html#PB"><span class="Identifier">PB</span></a> <span class="Operator">|</span> <a href="varint.html#LP"><span class="Identifier">LP</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">outlen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">outval</span><span class="Other">:</span> <a href="varint.html#SomeUVarint"><span class="Identifier">SomeUVarint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Encode <tt class="docutils literal"><span class="pre"><span class="Identifier">unsigned</span> <span class="Identifier">varint</span></span></tt> <tt class="docutils literal"><span class="pre">outval</span></tt> and store it to array <tt class="docutils literal"><span class="pre">pbytes</span></tt>.</p>
<p>On success <tt class="docutils literal"><span class="pre">outlen</span></tt> will hold number of bytes (octets) used to encode unsigned integer <tt class="docutils literal"><span class="pre">v</span></tt>.</p>
<p>If there not enough bytes available in buffer <tt class="docutils literal"><span class="pre">pbytes</span></tt>, <tt class="docutils literal"><span class="pre">Incomplete</span></tt> error will be returned and <tt class="docutils literal"><span class="pre">outlen</span></tt> will be set to number of bytes required.</p>
<p>Google ProtoBuf Maximum encoded length of 64bit integer is 10 octets. Maximum encoded length of 32bit integer is 5 octets.</p>
<p>LibP2P Maximum encoded length of 63bit integer is 9 octets. Maximum encoded length of 32bit integer is 5 octets.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L148" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L148" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="putVarint-procs-all">
<div id="putVarint,typedesc[T],openArray[byte],int,SomeVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#putVarint%2Ctypedesc%5BT%5D%2CopenArray%5Bbyte%5D%2Cint%2CSomeVarint"><span class="Identifier">putVarint</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="varint.html#PB"><span class="Identifier">PB</span></a> <span class="Operator">|</span> <a href="varint.html#LP"><span class="Identifier">LP</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">pbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">nbytes</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#SomeVarint"><span class="Identifier">SomeVarint</span></a><span class="Other">)</span><span class="Other">:</span> <a href="varint.html#VarintResult"><span class="Identifier">VarintResult</span></a><span class="Other">[</span>
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L230" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L230" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="vsizeof-procs-all">
<div id="vsizeof,SomeVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#vsizeof%2CSomeVarint"><span class="Identifier">vsizeof</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="varint.html#SomeVarint"><span class="Identifier">SomeVarint</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns number of bytes required to encode integer <tt class="docutils literal"><span class="pre">x</span></tt> as varint.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="toBytes-templates-all">
<div id="toBytes.t,typedesc[PB],PBSomeVarint" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#toBytes.t%2Ctypedesc%5BPB%5D%2CPBSomeVarint"><span class="Identifier">toBytes</span></a><span class="Other">(</span><span class="Identifier">vtype</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="varint.html#PB"><span class="Identifier">PB</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#PBSomeVarint"><span class="Identifier">PBSomeVarint</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">auto</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/varint.nim#L265" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/varint.nim#L265" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:47 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

View File

@ -0,0 +1,593 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/vbuffer</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/vbuffer</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#VBuffer" title="VBuffer = object
buffer*: seq[byte]
offset*: int">VBuffer</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CVBuffer" title="`$`(vb: VBuffer): string">`$`(vb: VBuffer): string</a></li>
</ul>
<ul class="simple nested-toc-section">finish
<li><a class="reference" href="#finish%2CVBuffer" title="finish(vb: var VBuffer)">finish(vb: var VBuffer)</a></li>
</ul>
<ul class="simple nested-toc-section">high
<li><a class="reference" href="#high%2CVBuffer" title="high(vb: VBuffer): int">high(vb: VBuffer): int</a></li>
</ul>
<ul class="simple nested-toc-section">initVBuffer
<li><a class="reference" href="#initVBuffer" title="initVBuffer(): VBuffer">initVBuffer(): VBuffer</a></li>
<li><a class="reference" href="#initVBuffer%2CopenArray%5Bbyte%5D%2Cint" title="initVBuffer(data: openArray[byte]; offset = 0): VBuffer">initVBuffer(data: openArray[byte]; offset = 0): VBuffer</a></li>
<li><a class="reference" href="#initVBuffer%2Cseq%5Bbyte%5D%2Cint" title="initVBuffer(data: seq[byte]; offset = 0): VBuffer">initVBuffer(data: seq[byte]; offset = 0): VBuffer</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CVBuffer" title="len(vb: VBuffer): int">len(vb: VBuffer): int</a></li>
</ul>
<ul class="simple nested-toc-section">peekArray
<li><a class="reference" href="#peekArray%2CVBuffer%2CopenArray%5BT%5D" title="peekArray[T: char | byte](vb: var VBuffer; value: var openArray[T]): int">peekArray[T: char | byte](vb: var VBuffer; value: var openArray[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">peekSeq
<li><a class="reference" href="#peekSeq%2CVBuffer%2CT" title="peekSeq[T: string | seq[byte]](vb: var VBuffer; value: var T): int">peekSeq[T: string | seq[byte]](vb: var VBuffer; value: var T): int</a></li>
</ul>
<ul class="simple nested-toc-section">peekVarint
<li><a class="reference" href="#peekVarint%2CVBuffer%2CLPSomeUVarint" title="peekVarint(vb: var VBuffer; value: var LPSomeUVarint): int">peekVarint(vb: var VBuffer; value: var LPSomeUVarint): int</a></li>
</ul>
<ul class="simple nested-toc-section">readArray
<li><a class="reference" href="#readArray%2CVBuffer%2CopenArray%5BT%5D" title="readArray[T: char | byte](vb: var VBuffer; value: var openArray[T]): int">readArray[T: char | byte](vb: var VBuffer; value: var openArray[T]): int</a></li>
</ul>
<ul class="simple nested-toc-section">readSeq
<li><a class="reference" href="#readSeq%2CVBuffer%2CT" title="readSeq[T: string | seq[byte]](vb: var VBuffer; value: var T): int">readSeq[T: string | seq[byte]](vb: var VBuffer; value: var T): int</a></li>
</ul>
<ul class="simple nested-toc-section">readVarint
<li><a class="reference" href="#readVarint%2CVBuffer%2CLPSomeUVarint" title="readVarint(vb: var VBuffer; value: var LPSomeUVarint): int">readVarint(vb: var VBuffer; value: var LPSomeUVarint): int</a></li>
</ul>
<ul class="simple nested-toc-section">writeArray
<li><a class="reference" href="#writeArray%2CVBuffer%2CopenArray%5BT%5D" title="writeArray[T: byte | char](vb: var VBuffer; value: openArray[T])">writeArray[T: byte | char](vb: var VBuffer; value: openArray[T])</a></li>
</ul>
<ul class="simple nested-toc-section">writeLPVarint
<li><a class="reference" href="#writeLPVarint%2CVBuffer%2CLPSomeUVarint" title="writeLPVarint(vb: var VBuffer; value: LPSomeUVarint)">writeLPVarint(vb: var VBuffer; value: LPSomeUVarint)</a></li>
</ul>
<ul class="simple nested-toc-section">writePBVarint
<li><a class="reference" href="#writePBVarint%2CVBuffer%2CPBSomeUVarint" title="writePBVarint(vb: var VBuffer; value: PBSomeUVarint)">writePBVarint(vb: var VBuffer; value: PBSomeUVarint)</a></li>
</ul>
<ul class="simple nested-toc-section">writeSeq
<li><a class="reference" href="#writeSeq%2CVBuffer%2CopenArray%5BT%5D" title="writeSeq[T: byte | char](vb: var VBuffer; value: openArray[T])">writeSeq[T: byte | char](vb: var VBuffer; value: openArray[T])</a></li>
</ul>
<ul class="simple nested-toc-section">writeVarint
<li><a class="reference" href="#writeVarint%2CVBuffer%2CLPSomeUVarint" title="writeVarint(vb: var VBuffer; value: LPSomeUVarint)">writeVarint(vb: var VBuffer; value: LPSomeUVarint)</a></li>
</ul>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">isEmpty
<li><a class="reference" href="#isEmpty.t%2CVBuffer" title="isEmpty(vb: VBuffer): bool">isEmpty(vb: VBuffer): bool</a></li>
</ul>
<ul class="simple nested-toc-section">isEnough
<li><a class="reference" href="#isEnough.t%2CVBuffer%2Cint" title="isEnough(vb: VBuffer; length: int): bool">isEnough(vb: VBuffer; length: int): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements variable buffer.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="varint.html">varint</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="VBuffer" class="tohide">
<dt><pre><a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
<span class="Identifier">offset</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L17" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L17" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,VBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CVBuffer"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Return hexadecimal string representation of buffer <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L182" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L182" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="finish-procs-all">
<div id="finish,VBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#finish%2CVBuffer"><span class="Identifier">finish</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Finishes <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L100" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L100" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="high-procs-all">
<div id="high,VBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#high%2CVBuffer"><span class="Identifier">high</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns number of bytes left in buffer <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initVBuffer-procs-all">
<div id="initVBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initVBuffer"><span class="Identifier">initVBuffer</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize empty VBuffer.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L51" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L51" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="initVBuffer,openArray[byte],int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initVBuffer%2CopenArray%5Bbyte%5D%2Cint"><span class="Identifier">initVBuffer</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">offset</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize VBuffer with copy of <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="initVBuffer,seq[byte],int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initVBuffer%2Cseq%5Bbyte%5D%2Cint"><span class="Identifier">initVBuffer</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">offset</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Initialize VBuffer with shallow copy of <tt class="docutils literal"><span class="pre">data</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,VBuffer" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CVBuffer"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns number of bytes left in buffer <tt class="docutils literal"><span class="pre">vb</span></tt>.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="peekArray-procs-all">
<div id="peekArray,VBuffer,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#peekArray%2CVBuffer%2CopenArray%5BT%5D"><span class="Identifier">peekArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">char</span> <span class="Operator">|</span> <span class="Identifier">byte</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Peek array from buffer <tt class="docutils literal"><span class="pre">vb</span></tt> and store result to <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
<p>This procedure will not adjust internal offset.</p>
<p>Returns number of bytes peeked from <tt class="docutils literal"><span class="pre">vb</span></tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> on error.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L141" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L141" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="peekSeq-procs-all">
<div id="peekSeq,VBuffer,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#peekSeq%2CVBuffer%2CT"><span class="Identifier">peekSeq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Operator">|</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Peek length prefixed array from buffer <tt class="docutils literal"><span class="pre">vb</span></tt> and store result to <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
<p>This procedure will not adjust internal offset.</p>
<p>Returns number of bytes peeked from <tt class="docutils literal"><span class="pre">vb</span></tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> on error.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L119" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L119" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="peekVarint-procs-all">
<div id="peekVarint,VBuffer,LPSomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#peekVarint%2CVBuffer%2CLPSomeUVarint"><span class="Identifier">peekVarint</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Peek unsigned integer from buffer <tt class="docutils literal"><span class="pre">vb</span></tt> and store result to <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
<p>This procedure will not adjust internal offset.</p>
<p>Returns number of bytes peeked from <tt class="docutils literal"><span class="pre">vb</span></tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> on error.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L104" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L104" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readArray-procs-all">
<div id="readArray,VBuffer,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#readArray%2CVBuffer%2CopenArray%5BT%5D"><span class="Identifier">readArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">char</span> <span class="Operator">|</span> <span class="Identifier">byte</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Read array from buffer <tt class="docutils literal"><span class="pre">vb</span></tt> and store result to <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
<p>Returns number of bytes consumed from <tt class="docutils literal"><span class="pre">vb</span></tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> on error.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L173" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L173" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readSeq-procs-all">
<div id="readSeq,VBuffer,T" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#readSeq%2CVBuffer%2CT"><span class="Identifier">readSeq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">string</span> <span class="Operator">|</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.
<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Read length prefixed array from buffer <tt class="docutils literal"><span class="pre">vb</span></tt> and store result to <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
<p>Returns number of bytes consumed from <tt class="docutils literal"><span class="pre">vb</span></tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> on error.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L163" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L163" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="readVarint-procs-all">
<div id="readVarint,VBuffer,LPSomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#readVarint%2CVBuffer%2CLPSomeUVarint"><span class="Identifier">readVarint</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Read unsigned integer from buffer <tt class="docutils literal"><span class="pre">vb</span></tt> and store result to <tt class="docutils literal"><span class="pre">value</span></tt>.</p>
<p>Returns number of bytes consumed from <tt class="docutils literal"><span class="pre">vb</span></tt> or <tt class="docutils literal"><span class="pre">-1</span></tt> on error.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L155" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L155" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeArray-procs-all">
<div id="writeArray,VBuffer,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#writeArray%2CVBuffer%2CopenArray%5BT%5D"><span class="Identifier">writeArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write array <tt class="docutils literal"><span class="pre">value</span></tt> to buffer <tt class="docutils literal"><span class="pre">vb</span></tt>, value will NOT be prefixed with varint length of the array.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L92" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L92" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeLPVarint-procs-all">
<div id="writeLPVarint,VBuffer,LPSomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#writeLPVarint%2CVBuffer%2CLPSomeUVarint"><span class="Identifier">writeLPVarint</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write <tt class="docutils literal"><span class="pre">value</span></tt> as variable unsigned integer.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L65" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L65" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writePBVarint-procs-all">
<div id="writePBVarint,VBuffer,PBSomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#writePBVarint%2CVBuffer%2CPBSomeUVarint"><span class="Identifier">writePBVarint</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#PBSomeUVarint"><span class="Identifier">PBSomeUVarint</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write <tt class="docutils literal"><span class="pre">value</span></tt> as variable unsigned integer.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L55" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L55" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeSeq-procs-all">
<div id="writeSeq,VBuffer,openArray[T]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#writeSeq%2CVBuffer%2CopenArray%5BT%5D"><span class="Identifier">writeSeq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Write array <tt class="docutils literal"><span class="pre">value</span></tt> to buffer <tt class="docutils literal"><span class="pre">vb</span></tt>, value will be prefixed with varint length of the array.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L79" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L79" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeVarint-procs-all">
<div id="writeVarint,VBuffer,LPSomeUVarint" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#writeVarint%2CVBuffer%2CLPSomeUVarint"><span class="Identifier">writeVarint</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="varint.html#LPSomeUVarint"><span class="Identifier">LPSomeUVarint</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L76" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L76" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
<div class="section" id="18">
<h1><a class="toc-backref" href="#18">Templates</a></h1>
<dl class="item">
<div id="isEmpty-templates-all">
<div id="isEmpty.t,VBuffer" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#isEmpty.t%2CVBuffer"><span class="Identifier">isEmpty</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if buffer <tt class="docutils literal"><span class="pre">vb</span></tt> is empty.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isEnough-templates-all">
<div id="isEnough.t,VBuffer,int" class="tohide">
<dt><pre><span class="Keyword">template</span> <a href="#isEnough.t%2CVBuffer%2Cint"><span class="Identifier">isEnough</span></a><span class="Other">(</span><span class="Identifier">vb</span><span class="Other">:</span> <a href="vbuffer.html#VBuffer"><span class="Identifier">VBuffer</span></a><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if buffer <tt class="docutils literal"><span class="pre">vb</span></tt> holds at least <tt class="docutils literal"><span class="pre">length</span></tt> bytes.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/vbuffer.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/vbuffer.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:50 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

559
bumplibp2p/libp2p/wire.html Normal file
View File

@ -0,0 +1,559 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libp2p/wire</title>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<!-- JS -->
<script type="text/javascript" src="../dochack.js"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/wire</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="../theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" onkeyup="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<script type="text/javascript">
function main2() {
// Create the slider
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
var newSlider = document.createRange().createContextualFragment(`
<div class="theme-switch-wrapper">
<label class="theme-switch" for="internalcheckbox">
<input type="checkbox" id="internalcheckbox">
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Internal</em>
</div>
`);
var sliderInst = firstSlider.after(newSlider);
// Restore slider state from storage
var currentMode = localStorage.getItem('privateMode');
if (currentMode == "private") {
document.getElementById("internalcheckbox").checked = true;
} else {
hidePrivateProcs();
}
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
}
function hidePrivateProcs() {
var toHide = document.getElementsByClassName("tohide");
for (var i = 0; i < toHide.length; i++) {
var pragmas = toHide[i].querySelectorAll("span.Identifier");
var public = false;
for (var z = 0; z < pragmas.length; z++) {
if (pragmas[z].innerText == "public") {
public = true;
break;
}
}
if (public == false) {
toHide[i].style.display = "none";
toHide[i].classList.add("hidden");
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
for (var y = 0; y < links.length; y++) {
links[y].parentNode.style.display = "none";
links[y].parentNode.classList.add("hidden");
}
}
}
// TOC
var nestedSections = document.getElementsByClassName("nested-toc-section");
for (var i = 0; i < nestedSections.length; i++) {
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
nestedSections[i].style.display = "none";
nestedSections[i].classList.add("hidden");
}
}
var sections = document.getElementsByClassName("simple-toc-section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
sections[i].parentNode.style.display = "none";
sections[i].parentNode.classList.add("hidden");
}
}
// Sections
var sections = document.getElementsByClassName("section");
for (var i = 0; i < sections.length; i++) {
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
sections[i].style.display = "none";
sections[i].classList.add("hidden");
}
}
}
function showPrivateProcs() {
var toHide = Array.from(document.getElementsByClassName("hidden"));
for (var i = 0; i < toHide.length; i++) {
toHide[i].style.display = "";
toHide[i].classList.remove("hidden");
}
}
function togglePrivateProcs() {
if (document.getElementById("internalcheckbox").checked) {
localStorage.setItem('privateMode', 'private');
showPrivateProcs();
} else {
localStorage.setItem('privateMode', 'public');
hidePrivateProcs();
}
}
window.addEventListener("DOMContentLoaded", main2);
</script>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#RTRANSPMA" title="RTRANSPMA = (operator: Or, args: [(operator: Or, args: [(operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 53),
(operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55),
(operator: Eq, args: [], value: 56)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 4),
(operator: Eq, args: [], value: 41)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [(
operator: And, args: [(operator: Or, args: [(operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 53),
(operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55),
(operator: Eq, args: [], value: 56)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 4),
(operator: Eq, args: [], value: 41)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0)], value: 0),
(operator: Eq, args: [], value: 477)], value: 0), (
operator: And, args: [(operator: Or, args: [(operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 53),
(operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55),
(operator: Eq, args: [], value: 56)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 4),
(operator: Eq, args: [], value: 41)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [
(operator: Eq, args: [], value: 478), (operator: And, args: [
(operator: Eq, args: [], value: 448), (operator: Eq, args: [], value: 477)],
value: 0)], value: 0)], value: 0)], value: 0),
(operator: Eq, args: [], value: 400)],
value: 0)">RTRANSPMA</a></li>
<li><a class="reference" href="#TRANSPMA" title="TRANSPMA = (operator: Or, args: [(operator: Or, args: [(operator: Or, args: [(
operator: And, args: [(operator: Or, args: [
(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)],
value: 0), (operator: Eq, args: [], value: 6)],
value: 0), (operator: And, args: [(operator: Or, args: [
(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)],
value: 0),
(operator: Eq, args: [], value: 6)],
value: 0)], value: 0), (operator: Or, args: [(operator: And, args: [(
operator: Or, args: [(operator: And, args: [(operator: Or, args: [
(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)],
value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 4),
(operator: Eq, args: [], value: 41)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0)], value: 0),
(operator: Eq, args: [], value: 477)], value: 0), (operator: And, args: [(
operator: Or, args: [(operator: And, args: [(operator: Or, args: [
(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)],
value: 0), (operator: Eq, args: [], value: 6)], value: 0), (operator: And, args: [(
operator: Or, args: [(operator: Eq, args: [], value: 4),
(operator: Eq, args: [], value: 41)], value: 0),
(operator: Eq, args: [], value: 6)], value: 0)], value: 0), (operator: Or, args: [
(operator: Eq, args: [], value: 478), (operator: And, args: [
(operator: Eq, args: [], value: 448), (operator: Eq, args: [], value: 477)],
value: 0)], value: 0)], value: 0)], value: 0),
(operator: Eq, args: [], value: 400)], value: 0), (operator: Or, args: [(
operator: And, args: [(operator: Or, args: [
(operator: Eq, args: [], value: 53), (operator: Eq, args: [], value: 54),
(operator: Eq, args: [], value: 55), (operator: Eq, args: [], value: 56)],
value: 0), (operator: Eq, args: [], value: 273)],
value: 0), (operator: And, args: [(operator: Or, args: [
(operator: Eq, args: [], value: 4), (operator: Eq, args: [], value: 41)],
value: 0),
(operator: Eq, args: [], value: 273)],
value: 0)], value: 0)], value: 0)">TRANSPMA</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">bindAsyncSocket
<li><a class="reference" href="#bindAsyncSocket%2CAsyncFD%2CMultiAddress" title="bindAsyncSocket(sock: AsyncFD; ma: MultiAddress): bool">bindAsyncSocket(sock: AsyncFD; ma: MultiAddress): bool</a></li>
</ul>
<ul class="simple nested-toc-section">connect
<li><a class="reference" href="#connect%2CMultiAddress%2CStreamTransport%2COpt%5BMultiAddress%5D" title="connect(ma: MultiAddress; bufferSize = DefaultStreamBufferSize;
child: StreamTransport = nil; flags = default(set[SocketFlags]);
localAddress: Opt[MultiAddress] = Opt.none(MultiAddress)): Future[
StreamTransport]">connect(ma: MultiAddress; bufferSize = DefaultStreamBufferSize;
child: StreamTransport = nil; flags = default(set[SocketFlags]);
localAddress: Opt[MultiAddress] = Opt.none(MultiAddress)): Future[
StreamTransport]</a></li>
</ul>
<ul class="simple nested-toc-section">createAsyncSocket
<li><a class="reference" href="#createAsyncSocket%2CMultiAddress" title="createAsyncSocket(ma: MultiAddress): AsyncFD">createAsyncSocket(ma: MultiAddress): AsyncFD</a></li>
</ul>
<ul class="simple nested-toc-section">createStreamServer
<li><a class="reference" href="#createStreamServer%2CMultiAddress%2CStreamCallback%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback" title="createStreamServer[T](ma: MultiAddress; cbproc: StreamCallback;
flags: set[ServerFlags] = {}; udata: ref T;
sock: AsyncFD = asyncInvalidSocket; backlog: int = 100;
bufferSize: int = DefaultStreamBufferSize;
child: StreamServer = nil;
init: TransportInitCallback = nil): StreamServer">createStreamServer[T](ma: MultiAddress; cbproc: StreamCallback;
flags: set[ServerFlags] = {}; udata: ref T;
sock: AsyncFD = asyncInvalidSocket; backlog: int = 100;
bufferSize: int = DefaultStreamBufferSize;
child: StreamServer = nil;
init: TransportInitCallback = nil): StreamServer</a></li>
<li><a class="reference" href="#createStreamServer%2CMultiAddress%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback" title="createStreamServer[T](ma: MultiAddress; flags: set[ServerFlags] = {};
udata: ref T; sock: AsyncFD = asyncInvalidSocket;
backlog: int = 100;
bufferSize: int = DefaultStreamBufferSize;
child: StreamServer = nil;
init: TransportInitCallback = nil): StreamServer">createStreamServer[T](ma: MultiAddress; flags: set[ServerFlags] = {};
udata: ref T; sock: AsyncFD = asyncInvalidSocket;
backlog: int = 100;
bufferSize: int = DefaultStreamBufferSize;
child: StreamServer = nil;
init: TransportInitCallback = nil): StreamServer</a></li>
</ul>
<ul class="simple nested-toc-section">getLocalAddress
<li><a class="reference" href="#getLocalAddress%2CAsyncFD" title="getLocalAddress(sock: AsyncFD): TransportAddress">getLocalAddress(sock: AsyncFD): TransportAddress</a></li>
</ul>
<ul class="simple nested-toc-section">initTAddress
<li><a class="reference" href="#initTAddress%2CMultiAddress" title="initTAddress(ma: MultiAddress): MaResult[TransportAddress]">initTAddress(ma: MultiAddress): MaResult[TransportAddress]</a></li>
</ul>
<ul class="simple nested-toc-section">isPublicMA
<li><a class="reference" href="#isPublicMA%2CMultiAddress" title="isPublicMA(ma: MultiAddress): bool">isPublicMA(ma: MultiAddress): bool</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc">This module implements wire network connection procedures.</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="multiaddress.html">multiaddress</a>, <a class="reference external" href="multicodec.html">multicodec</a>, <a class="reference external" href="errors.html">errors</a>, <a class="reference external" href="utility.html">utility</a>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="RTRANSPMA" class="tohide">
<dt><pre><a href="wire.html#RTRANSPMA"><span class="Identifier">RTRANSPMA</span></a> <span class="Other">=</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">477</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">478</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">448</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">477</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">400</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L22" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L22" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="TRANSPMA" class="tohide">
<dt><pre><a href="wire.html#TRANSPMA"><span class="Identifier">TRANSPMA</span></a> <span class="Other">=</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">477</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">6</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">478</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">448</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">477</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">400</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span>
<span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">53</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">54</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">55</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">56</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">273</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">And</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Or</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">4</span><span class="Other">)</span><span class="Other">,</span> <span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">41</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">,</span>
<span class="Other">(</span><span class="Identifier">operator</span><span class="Other">:</span> <span class="DecNumber">Eq</span><span class="Other">,</span> <span class="Identifier">args</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">273</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="DecNumber">0</span><span class="Other">)</span></pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L28" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L28" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="bindAsyncSocket-procs-all">
<div id="bindAsyncSocket,AsyncFD,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#bindAsyncSocket%2CAsyncFD%2CMultiAddress"><span class="Identifier">bindAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <span class="Identifier">AsyncFD</span><span class="Other">;</span> <span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="errors.html#LPError"><span class="Identifier">LPError</span></a><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Bind socket <tt class="docutils literal"><span class="pre">sock</span></tt> to MultiAddress <tt class="docutils literal"><span class="pre">ma</span></tt>.</p>
<p>Note: This procedure only used in <tt class="docutils literal"><span class="pre"><span class="Identifier">go</span><span class="Operator">-</span><span class="Identifier">libp2p</span><span class="Operator">-</span><span class="Identifier">daemon</span></span></tt> wrapper. </p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L187" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L187" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="connect-procs-all">
<div id="connect,MultiAddress,StreamTransport,Opt[MultiAddress]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#connect%2CMultiAddress%2CStreamTransport%2COpt%5BMultiAddress%5D"><span class="Identifier">connect</span></a><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">;</span> <span class="Identifier">bufferSize</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
<span class="Identifier">child</span><span class="Other">:</span> <span class="Identifier">StreamTransport</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span> <span class="Identifier">flags</span> <span class="Other">=</span> <span class="Identifier">default</span><span class="Other">(</span><span class="Identifier">set</span><span class="Other">[</span><span class="Identifier">SocketFlags</span><span class="Other">]</span><span class="Other">)</span><span class="Other">;</span>
<span class="Identifier">localAddress</span><span class="Other">:</span> <span class="Identifier">Opt</span><span class="Other">[</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Opt</span><span class="Other">.</span><span class="Identifier">none</span><span class="Other">(</span><span class="Identifier">MultiAddress</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Future</span><span class="Other">[</span>
<span class="Identifier">StreamTransport</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="errors.html#LPError"><span class="Identifier">LPError</span></a><span class="Other">,</span> <a href="multiaddress.html#MaInvalidAddress"><span class="Identifier">MaInvalidAddress</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Open new connection to remote peer with address <tt class="docutils literal"><span class="pre">ma</span></tt> and create new transport object <tt class="docutils literal"><span class="pre">StreamTransport</span></tt> for established connection. <tt class="docutils literal"><span class="pre">bufferSize</span></tt> is size of internal buffer for transport.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L73" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L73" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="createAsyncSocket-procs-all">
<div id="createAsyncSocket,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#createAsyncSocket%2CMultiAddress"><span class="Identifier">createAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">AsyncFD</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span> <a href="errors.html#LPError"><span class="Identifier">LPError</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Create new asynchronous socket using MultiAddress' <tt class="docutils literal"><span class="pre">ma</span></tt> socket type and protocol information.</p>
<p>Returns <tt class="docutils literal"><span class="pre">asyncInvalidSocket</span></tt> on error.</p>
<p>Note: This procedure only used in <tt class="docutils literal"><span class="pre"><span class="Identifier">go</span><span class="Operator">-</span><span class="Identifier">libp2p</span><span class="Operator">-</span><span class="Identifier">daemon</span></span></tt> wrapper. </p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L154" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L154" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="createStreamServer-procs-all">
<div id="createStreamServer,MultiAddress,StreamCallback,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CMultiAddress%2CStreamCallback%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">;</span> <span class="Identifier">cbproc</span><span class="Other">:</span> <span class="Identifier">StreamCallback</span><span class="Other">;</span>
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><span class="Identifier">ServerFlags</span><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">sock</span><span class="Other">:</span> <span class="Identifier">AsyncFD</span> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">100</span><span class="Other">;</span>
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
<span class="Identifier">child</span><span class="Other">:</span> <span class="Identifier">StreamServer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">init</span><span class="Other">:</span> <span class="Identifier">TransportInitCallback</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">StreamServer</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="errors.html#LPError"><span class="Identifier">LPError</span></a><span class="Other">,</span> <a href="multiaddress.html#MaInvalidAddress"><span class="Identifier">MaInvalidAddress</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create new TCP stream server which bounds to <tt class="docutils literal"><span class="pre">ma</span></tt> address.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="createStreamServer,MultiAddress,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#createStreamServer%2CMultiAddress%2Cset%5BServerFlags%5D%2Cref.T%2CAsyncFD%2Cint%2Cint%2CStreamServer%2CTransportInitCallback"><span class="Identifier">createStreamServer</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><span class="Identifier">ServerFlags</span><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
<span class="Identifier">udata</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">sock</span><span class="Other">:</span> <span class="Identifier">AsyncFD</span> <span class="Other">=</span> <span class="Identifier">asyncInvalidSocket</span><span class="Other">;</span>
<span class="Identifier">backlog</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="DecNumber">100</span><span class="Other">;</span>
<span class="Identifier">bufferSize</span><span class="Other">:</span> <span class="Identifier">int</span> <span class="Other">=</span> <span class="Identifier">DefaultStreamBufferSize</span><span class="Other">;</span>
<span class="Identifier">child</span><span class="Other">:</span> <span class="Identifier">StreamServer</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">init</span><span class="Other">:</span> <span class="Identifier">TransportInitCallback</span> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">StreamServer</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="errors.html#LPError"><span class="Identifier">LPError</span></a><span class="Other">,</span> <a href="multiaddress.html#MaInvalidAddress"><span class="Identifier">MaInvalidAddress</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create new TCP stream server which bounds to <tt class="docutils literal"><span class="pre">ma</span></tt> address.
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L126" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L126" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="getLocalAddress-procs-all">
<div id="getLocalAddress,AsyncFD" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#getLocalAddress%2CAsyncFD"><span class="Identifier">getLocalAddress</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <span class="Identifier">AsyncFD</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">TransportAddress</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Retrieve local socket <tt class="docutils literal"><span class="pre">sock</span></tt> address.</p>
<p>Note: This procedure only used in <tt class="docutils literal"><span class="pre"><span class="Identifier">go</span><span class="Operator">-</span><span class="Identifier">libp2p</span><span class="Operator">-</span><span class="Identifier">daemon</span></span></tt> wrapper.</p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L206" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L206" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="initTAddress-procs-all">
<div id="initTAddress,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#initTAddress%2CMultiAddress"><span class="Identifier">initTAddress</span></a><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <a href="multiaddress.html#MaResult"><span class="Identifier">MaResult</span></a><span class="Other">[</span><span class="Identifier">TransportAddress</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Initialize <tt class="docutils literal"><span class="pre">TransportAddress</span></tt> with MultiAddress <tt class="docutils literal"><span class="pre">ma</span></tt>.</p>
<p>MultiAddress must be wire address, e.g. <tt class="docutils literal"><span class="pre">{IP4, IP6, UNIX}/{TCP, UDP}</span></tt>. </p>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L34" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L34" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="isPublicMA-procs-all">
<div id="isPublicMA,MultiAddress" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#isPublicMA%2CMultiAddress"><span class="Identifier">isPublicMA</span></a><span class="Other">(</span><span class="Identifier">ma</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/status-im/nim-libp2p/tree/bumplibp2p/libp2p/wire.nim#L217" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/wire.nim#L217" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2023-10-04 16:04:52 UTC</small>
</div>
</div>
</div>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
</body>
</html>

1026
bumplibp2p/nimdoc.out.css Normal file

File diff suppressed because one or more lines are too long