nim-libp2p/master/libp2p/builders.html

820 lines
216 KiB
HTML
Raw Normal View History

2023-12-18 18:06:09 +00:00
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="http://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">
<!-- 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=">
<!-- 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'/>
<!-- CSS -->
<title>libp2p/builders</title>
<link rel="stylesheet" type="text/css" href="../nimdoc.out.css">
<script type="text/javascript" src="../dochack.js"></script>
<script type="text/javascript">
function main() {
var pragmaDots = document.getElementsByClassName("pragmadots");
for (var i = 0; i < pragmaDots.length; i++) {
pragmaDots[i].onclick = function(event) {
// Hide tease
event.target.parentNode.style.display = "none";
// Show actual
event.target.parentNode.nextElementSibling.style.display = "inline";
}
}
function switchTheme(e) {
if (e.target.checked) {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
}
}
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
if (toggleSwitch !== null) {
toggleSwitch.addEventListener('change', switchTheme, false);
}
var currentTheme = localStorage.getItem('theme');
if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) {
currentTheme = 'dark';
}
if (currentTheme) {
document.documentElement.setAttribute('data-theme', currentTheme);
if (currentTheme === 'dark' && toggleSwitch !== null) {
toggleSwitch.checked = true;
}
}
}
window.addEventListener('DOMContentLoaded', main);
</script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">libp2p/builders</h1>
<div class="row">
<div class="three columns">
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox">
<input type="checkbox" id="checkbox" />
<div class="slider round"></div>
</label>
&nbsp;&nbsp;&nbsp; <em>Dark Mode</em>
</div>
<div id="global-links">
<ul class="simple">
<li>
<a href="../theindex.html">Index</a>
</li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="text" 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>
<ul class="simple simple-toc-section">
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SecureProtocol"
title="SecureProtocol {.pure.} = enum
2024-04-29 13:39:28 +00:00
Noise">SecureProtocol</a></li>
2023-12-18 18:06:09 +00:00
<li><a class="reference" href="#SwitchBuilder"
title="SwitchBuilder = ref object
privKey: Option[PrivateKey]
addresses: seq[MultiAddress]
secureManagers: seq[SecureProtocol]
muxers: seq[MuxerProvider]
transports: seq[TransportProvider]
rng: ref HmacDrbgContext
maxConnections: int
maxIn: int
sendSignedPeerRecord: bool
maxOut: int
maxConnsPerPeer: int
protoVersion: string
agentVersion: string
nameResolver: NameResolver
peerStoreCapacity: Opt[int]
autonat: bool
circuitRelay: Relay
rdv: RendezVous
2024-04-29 13:39:28 +00:00
services: seq[Service]
2024-06-06 11:07:46 +00:00
observedAddrManager: ObservedAddrManager
enableWildcardResolver: bool">SwitchBuilder</a></li>
2023-12-18 18:06:09 +00:00
<li><a class="reference" href="#TransportProvider"
title="TransportProvider {.public.} = proc (upgr: Upgrade): Transport {.gcsafe,
raises: [].}">TransportProvider</a></li>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">new
<li><a class="reference" href="#new%2Ctype%5BSwitchBuilder%5D"
title="new(T: type[SwitchBuilder]): T:type">new(T: type[SwitchBuilder]): T:type</a></li>
</ul>
<ul class="simple nested-toc-section">newStandardSwitch
<li><a class="reference" href="#newStandardSwitch%2CopenArray%5BSecureProtocol%5D%2Cset%5BServerFlags%5D%2CDuration%2CDuration%2Cint%2Cint%2CNameResolver%2Cint"
title="newStandardSwitch(privKey = none(PrivateKey); addrs: MultiAddress |
2024-04-29 13:39:28 +00:00
seq[MultiAddress] = init(MultiAddress, &quot;/ip4/127.0.0.1/tcp/0&quot;).expect(
&quot;valid address&quot;); secureManagers: openArray[SecureProtocol] = [
SecureProtocol.Noise]; transportFlags: set[ServerFlags] = {};
rng = newRng(); inTimeout: Duration = 5.minutes;
2023-12-18 18:06:09 +00:00
outTimeout: Duration = 5.minutes;
maxConnections = MaxConnections; maxIn = -1; maxOut = -1;
maxConnsPerPeer = MaxConnectionsPerPeer;
nameResolver: NameResolver = nil;
sendSignedPeerRecord = false; peerStoreCapacity = 1000): Switch">newStandardSwitch(privKey = none(PrivateKey); addrs: MultiAddress |
2024-04-29 13:39:28 +00:00
seq[MultiAddress] = init(MultiAddress, &quot;/ip4/127.0.0.1/tcp/0&quot;).expect(
&quot;valid address&quot;); secureManagers: openArray[SecureProtocol] = [
SecureProtocol.Noise]; transportFlags: set[ServerFlags] = {};
rng = newRng(); inTimeout: Duration = 5.minutes;
2023-12-18 18:06:09 +00:00
outTimeout: Duration = 5.minutes;
maxConnections = MaxConnections; maxIn = -1; maxOut = -1;
maxConnsPerPeer = MaxConnectionsPerPeer;
nameResolver: NameResolver = nil;
sendSignedPeerRecord = false; peerStoreCapacity = 1000): Switch</a></li>
</ul>
<ul class="simple nested-toc-section">withAddress
2024-06-06 11:07:46 +00:00
<li><a class="reference" href="#withAddress%2CSwitchBuilder%2CMultiAddress%2Cbool"
title="withAddress(b: SwitchBuilder; address: MultiAddress;
enableWildcardResolver: bool = true): SwitchBuilder">withAddress(b: SwitchBuilder; address: MultiAddress;
enableWildcardResolver: bool = true): SwitchBuilder</a></li>
2023-12-18 18:06:09 +00:00
</ul>
<ul class="simple nested-toc-section">withAddresses
2024-06-06 11:07:46 +00:00
<li><a class="reference" href="#withAddresses%2CSwitchBuilder%2Cseq%5BMultiAddress%5D%2Cbool"
title="withAddresses(b: SwitchBuilder; addresses: seq[MultiAddress];
enableWildcardResolver: bool = true): SwitchBuilder">withAddresses(b: SwitchBuilder; addresses: seq[MultiAddress];
enableWildcardResolver: bool = true): SwitchBuilder</a></li>
2023-12-18 18:06:09 +00:00
</ul>
<ul class="simple nested-toc-section">withAgentVersion
<li><a class="reference" href="#withAgentVersion%2CSwitchBuilder%2Cstring"
title="withAgentVersion(b: SwitchBuilder; agentVersion: string): SwitchBuilder">withAgentVersion(b: SwitchBuilder; agentVersion: string): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withAutonat
<li><a class="reference" href="#withAutonat%2CSwitchBuilder"
title="withAutonat(b: SwitchBuilder): SwitchBuilder">withAutonat(b: SwitchBuilder): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withCircuitRelay
<li><a class="reference" href="#withCircuitRelay%2CSwitchBuilder%2CRelay"
title="withCircuitRelay(b: SwitchBuilder; r: Relay = Relay.new()): SwitchBuilder">withCircuitRelay(b: SwitchBuilder; r: Relay = Relay.new()): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withMaxConnections
<li><a class="reference" href="#withMaxConnections%2CSwitchBuilder%2Cint"
title="withMaxConnections(b: SwitchBuilder; maxConnections: int): SwitchBuilder">withMaxConnections(b: SwitchBuilder; maxConnections: int): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withMaxConnsPerPeer
<li><a class="reference" href="#withMaxConnsPerPeer%2CSwitchBuilder%2Cint"
title="withMaxConnsPerPeer(b: SwitchBuilder; maxConnsPerPeer: int): SwitchBuilder">withMaxConnsPerPeer(b: SwitchBuilder; maxConnsPerPeer: int): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withMaxIn
<li><a class="reference" href="#withMaxIn%2CSwitchBuilder%2Cint"
title="withMaxIn(b: SwitchBuilder; maxIn: int): SwitchBuilder">withMaxIn(b: SwitchBuilder; maxIn: int): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withMaxOut
<li><a class="reference" href="#withMaxOut%2CSwitchBuilder%2Cint"
title="withMaxOut(b: SwitchBuilder; maxOut: int): SwitchBuilder">withMaxOut(b: SwitchBuilder; maxOut: int): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withNameResolver
<li><a class="reference" href="#withNameResolver%2CSwitchBuilder%2CNameResolver"
title="withNameResolver(b: SwitchBuilder; nameResolver: NameResolver): SwitchBuilder">withNameResolver(b: SwitchBuilder; nameResolver: NameResolver): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withNoise
<li><a class="reference" href="#withNoise%2CSwitchBuilder"
title="withNoise(b: SwitchBuilder): SwitchBuilder">withNoise(b: SwitchBuilder): SwitchBuilder</a></li>
2024-04-29 13:39:28 +00:00
</ul>
<ul class="simple nested-toc-section">withObservedAddrManager
<li><a class="reference" href="#withObservedAddrManager%2CSwitchBuilder%2CObservedAddrManager"
title="withObservedAddrManager(b: SwitchBuilder;
observedAddrManager: ObservedAddrManager): SwitchBuilder">withObservedAddrManager(b: SwitchBuilder;
observedAddrManager: ObservedAddrManager): SwitchBuilder</a></li>
2023-12-18 18:06:09 +00:00
</ul>
<ul class="simple nested-toc-section">withPeerStore
<li><a class="reference" href="#withPeerStore%2CSwitchBuilder%2Cint"
title="withPeerStore(b: SwitchBuilder; capacity: int): SwitchBuilder">withPeerStore(b: SwitchBuilder; capacity: int): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withPrivateKey
<li><a class="reference" href="#withPrivateKey%2CSwitchBuilder%2CPrivateKey"
title="withPrivateKey(b: SwitchBuilder; privateKey: PrivateKey): SwitchBuilder">withPrivateKey(b: SwitchBuilder; privateKey: PrivateKey): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withProtoVersion
<li><a class="reference" href="#withProtoVersion%2CSwitchBuilder%2Cstring"
title="withProtoVersion(b: SwitchBuilder; protoVersion: string): SwitchBuilder">withProtoVersion(b: SwitchBuilder; protoVersion: string): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withRendezVous
<li><a class="reference" href="#withRendezVous%2CSwitchBuilder%2CRendezVous"
title="withRendezVous(b: SwitchBuilder; rdv: RendezVous = RendezVous.new()): SwitchBuilder">withRendezVous(b: SwitchBuilder; rdv: RendezVous = RendezVous.new()): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withRng
<li><a class="reference" href="#withRng%2CSwitchBuilder%2Cref.HmacDrbgContext"
title="withRng(b: SwitchBuilder; rng: ref HmacDrbgContext): SwitchBuilder">withRng(b: SwitchBuilder; rng: ref HmacDrbgContext): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withServices
<li><a class="reference" href="#withServices%2CSwitchBuilder%2Cseq%5BService%5D"
title="withServices(b: SwitchBuilder; services: seq[Service]): SwitchBuilder">withServices(b: SwitchBuilder; services: seq[Service]): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withSignedPeerRecord
<li><a class="reference" href="#withSignedPeerRecord%2CSwitchBuilder"
title="withSignedPeerRecord(b: SwitchBuilder; sendIt = true): SwitchBuilder">withSignedPeerRecord(b: SwitchBuilder; sendIt = true): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withTcpTransport
<li><a class="reference" href="#withTcpTransport%2CSwitchBuilder%2Cset%5BServerFlags%5D"
title="withTcpTransport(b: SwitchBuilder; flags: set[ServerFlags] = {}): SwitchBuilder">withTcpTransport(b: SwitchBuilder; flags: set[ServerFlags] = {}): SwitchBuilder</a></li>
</ul>
<ul class="simple nested-toc-section">withTransport
<li><a class="reference" href="#withTransport%2CSwitchBuilder%2CTransportProvider"
title="withTransport(b: SwitchBuilder; prov: TransportProvider): SwitchBuilder">withTransport(b: SwitchBuilder; prov: TransportProvider): SwitchBuilder</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
<ul class="simple simple-toc-section">
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L1"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc">This module contains a Switch Building helper.
<p><strong class="examples_text">Example:</strong></p>
2024-06-11 15:19:55 +00:00
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">switch</span> <span class="Operator">=</span> <span class="Identifier">SwitchBuilder</span><span class="Operator">.</span><span class="Identifier">new</span><span class="Punctuation">(</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">withRng</span><span class="Punctuation">(</span><span class="Identifier">rng</span><span class="Punctuation">)</span><span class="Operator">.</span><span class="Identifier">withAddresses</span><span class="Punctuation">(</span><span class="Identifier">multiaddress</span><span class="Punctuation">)</span>
<span class="Comment"># etc</span>
<span class="Operator">.</span><span class="Identifier">build</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre></p>
2023-12-18 18:06:09 +00:00
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
2024-06-06 11:07:46 +00:00
<a class="reference external" href="switch.html">switch</a>, <a class="reference external" href="peerid.html">peerid</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="multiaddress.html">multiaddress</a>, <a class="reference external" href="crypto/crypto.html">crypto/crypto</a>, <a class="reference external" href="transports/transport.html">transports/transport</a>, <a class="reference external" href="transports/tcptransport.html">transports/tcptransport</a>, <a class="reference external" href="muxers/muxer.html">muxers/muxer</a>, <a class="reference external" href="muxers/mplex/mplex.html">muxers/mplex/mplex</a>, <a class="reference external" href="muxers/yamux/yamux.html">muxers/yamux/yamux</a>, <a class="reference external" href="protocols/identify.html">protocols/identify</a>, <a class="reference external" href="protocols/secure/secure.html">protocols/secure/secure</a>, <a class="reference external" href="protocols/secure/noise.html">protocols/secure/noise</a>, <a class="reference external" href="protocols/rendezvous.html">protocols/rendezvous</a>, <a class="reference external" href="protocols/connectivity/autonat/server.html">protocols/connectivity/autonat/server</a>, <a class="reference external" href="protocols/connectivity/relay/relay.html">protocols/connectivity/relay/relay</a>, <a class="reference external" href="protocols/connectivity/relay/client.html">protocols/connectivity/relay/client</a>, <a class="reference external" href="protocols/connectivity/relay/rtransport.html">protocols/connectivity/relay/rtransport</a>, <a class="reference external" href="connmanager.html">connmanager</a>, <a class="reference external" href="upgrademngrs/muxedupgrade.html">upgrademngrs/muxedupgrade</a>, <a class="reference external" href="observedaddrmanager.html">observedaddrmanager</a>, <a class="reference external" href="nameresolving/nameresolver.html">nameresolving/nameresolver</a>, <a class="reference external" href="errors.html">errors</a>, <a class="reference external" href="utility.html">utility</a>, <a class="reference external" href="services/wildcardresolverservice.html">services/wildcardresolverservice</a>
2023-12-18 18:06:09 +00:00
</dl></div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="SecureProtocol" class="tohide">
<dt><pre><a href="muxers/mplex/mplex.html#SecureProtocol"><span class="Identifier">SecureProtocol</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
2024-04-29 13:39:28 +00:00
<span class="Identifier">Noise</span></pre></dt>
2023-12-18 18:06:09 +00:00
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L43"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L43" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="SwitchBuilder" class="tohide">
<dt><pre><a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span>
<span class="Identifier">privKey</span><span class="Other">:</span> <span class="Identifier">Option</span><span class="Other">[</span><a href="crypto/crypto.html#PrivateKey"><span class="Identifier">PrivateKey</span></a><span class="Other">]</span>
<span class="Identifier">addresses</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">secureManagers</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="muxers/mplex/mplex.html#SecureProtocol"><span class="Identifier">SecureProtocol</span></a><span class="Other">]</span>
<span class="Identifier">muxers</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="muxers/muxer.html#MuxerProvider"><span class="Identifier">MuxerProvider</span></a><span class="Other">]</span>
<span class="Identifier">transports</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="muxers/mplex/mplex.html#TransportProvider"><span class="Identifier">TransportProvider</span></a><span class="Other">]</span>
<span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">HmacDrbgContext</span>
<span class="Identifier">maxConnections</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">maxIn</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">sendSignedPeerRecord</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">maxOut</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">maxConnsPerPeer</span><span class="Other">:</span> <span class="Identifier">int</span>
<span class="Identifier">protoVersion</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Identifier">agentVersion</span><span class="Other">:</span> <span class="Identifier">string</span>
<span class="Identifier">nameResolver</span><span class="Other">:</span> <a href="nameresolving/nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a>
<span class="Identifier">peerStoreCapacity</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="Identifier">autonat</span><span class="Other">:</span> <span class="Identifier">bool</span>
<span class="Identifier">circuitRelay</span><span class="Other">:</span> <a href="protocols/connectivity/relay/relay.html#Relay"><span class="Identifier">Relay</span></a>
<span class="Identifier">rdv</span><span class="Other">:</span> <a href="protocols/rendezvous.html#RendezVous"><span class="Identifier">RendezVous</span></a>
<span class="Identifier">services</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="transports/transport.html#Service"><span class="Identifier">Service</span></a><span class="Other">]</span>
2024-04-29 13:39:28 +00:00
<span class="Identifier">observedAddrManager</span><span class="Other">:</span> <a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a>
2024-06-06 11:07:46 +00:00
<span class="Identifier">enableWildcardResolver</span><span class="Other">:</span> <span class="Identifier">bool</span>
2023-12-18 18:06:09 +00:00
</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L46"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L46" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="TransportProvider" class="tohide">
<dt><pre><a href="muxers/mplex/mplex.html#TransportProvider"><span class="Identifier">TransportProvider</span></a> {.<span class="Identifier">public</span>.} <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">upgr</span><span class="Other">:</span> <a href="connmanager.html#Upgrade"><span class="Identifier">Upgrade</span></a><span class="Other">)</span><span class="Other">:</span> <a href="upgrademngrs/upgrade.html#Transport"><span class="Identifier">Transport</span></a> {.<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>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L41"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L41" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</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,type[SwitchBuilder]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#new%2Ctype%5BSwitchBuilder%5D"><span class="Identifier">new</span></a><span class="Other">(</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">type</span><span class="Other">[</span><a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">]</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>
Creates a SwitchBuilder
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L69"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L69" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="newStandardSwitch,openArray[SecureProtocol],set[ServerFlags],Duration,Duration,int,int,NameResolver,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#newStandardSwitch%2CopenArray%5BSecureProtocol%5D%2Cset%5BServerFlags%5D%2CDuration%2CDuration%2Cint%2Cint%2CNameResolver%2Cint"><span class="Identifier">newStandardSwitch</span></a><span class="Other">(</span><span class="Identifier">privKey</span> <span class="Other">=</span> <span class="Identifier">none</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">addrs</span><span class="Other">:</span> <a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a> <span class="Operator">|</span>
2024-04-29 13:39:28 +00:00
<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">init</span><span class="Other">(</span><a href="multiaddress.html#MultiAddress"><span class="Identifier">MultiAddress</span></a><span class="Other">,</span> <span class="StringLit">&quot;/ip4/127.0.0.1/tcp/0&quot;</span><span class="Other">)</span><span class="Other">.</span><span class="Identifier">expect</span><span class="Other">(</span>
<span class="StringLit">&quot;valid address&quot;</span><span class="Other">)</span><span class="Other">;</span> <span class="Identifier">secureManagers</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><a href="muxers/mplex/mplex.html#SecureProtocol"><span class="Identifier">SecureProtocol</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">[</span>
<a href="muxers/mplex/mplex.html#SecureProtocol"><span class="Identifier">SecureProtocol</span></a><span class="Other">.</span><span class="Identifier">Noise</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">transportFlags</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">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="Identifier">inTimeout</span><span class="Other">:</span> <span class="Identifier">Duration</span> <span class="Other">=</span> <span class="DecNumber">5</span><span class="Other">.</span><span class="Identifier">minutes</span><span class="Other">;</span>
2023-12-18 18:06:09 +00:00
<span class="Identifier">outTimeout</span><span class="Other">:</span> <span class="Identifier">Duration</span> <span class="Other">=</span> <span class="DecNumber">5</span><span class="Other">.</span><span class="Identifier">minutes</span><span class="Other">;</span>
<span class="Identifier">maxConnections</span> <span class="Other">=</span> <span class="Identifier">MaxConnections</span><span class="Other">;</span> <span class="Identifier">maxIn</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">;</span> <span class="Identifier">maxOut</span> <span class="Other">=</span> <span class="DecNumber">-1</span><span class="Other">;</span>
<span class="Identifier">maxConnsPerPeer</span> <span class="Other">=</span> <span class="Identifier">MaxConnectionsPerPeer</span><span class="Other">;</span>
<span class="Identifier">nameResolver</span><span class="Other">:</span> <a href="nameresolving/nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a> <span class="Other">=</span> <span class="Keyword">nil</span><span class="Other">;</span>
<span class="Identifier">sendSignedPeerRecord</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">;</span> <span class="Identifier">peerStoreCapacity</span> <span class="Other">=</span> <span class="DecNumber">1000</span><span class="Other">)</span><span class="Other">:</span> <a href="transports/transport.html#Switch"><span class="Identifier">Switch</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><a href="errors.html#LPError"><span class="Identifier">LPError</span></a><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">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Helper for common switch configurations.
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L320"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L320" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
2024-06-06 11:07:46 +00:00
<div id="withAddress,SwitchBuilder,MultiAddress,bool" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withAddress%2CSwitchBuilder%2CMultiAddress%2Cbool"><span class="Identifier">withAddress</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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">enableWildcardResolver</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
2023-12-18 18:06:09 +00:00
<dd>
<p>Set the listening address of the switch<br/>Calling it multiple time will override the value<br/></p>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L106"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L106" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
2024-06-06 11:07:46 +00:00
<div id="withAddresses,SwitchBuilder,seq[MultiAddress],bool" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withAddresses%2CSwitchBuilder%2Cseq%5BMultiAddress%5D%2Cbool"><span class="Identifier">withAddresses</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">addresses</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">enableWildcardResolver</span><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
2023-12-18 18:06:09 +00:00
<dd>
<p>Set the listening addresses of the switch<br/>Calling it multiple time will override the value<br/></p>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L97"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L97" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withAgentVersion,SwitchBuilder,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withAgentVersion%2CSwitchBuilder%2Cstring"><span class="Identifier">withAgentVersion</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">agentVersion</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L207"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L207" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withAutonat,SwitchBuilder" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withAutonat%2CSwitchBuilder"><span class="Identifier">withAutonat</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L219"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L219" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withCircuitRelay,SwitchBuilder,Relay" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withCircuitRelay%2CSwitchBuilder%2CRelay"><span class="Identifier">withCircuitRelay</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">r</span><span class="Other">:</span> <a href="protocols/connectivity/relay/relay.html#Relay"><span class="Identifier">Relay</span></a> <span class="Other">=</span> <a href="protocols/connectivity/relay/relay.html#Relay"><span class="Identifier">Relay</span></a><span class="Other">.</span><span class="Identifier">new</span><span class="Other">(</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L223"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L223" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withMaxConnections,SwitchBuilder,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withMaxConnections%2CSwitchBuilder%2Cint"><span class="Identifier">withMaxConnections</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">maxConnections</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Maximum concurrent connections of the switch. You should either use this, or <a class="reference external" href="#withMaxIn,SwitchBuilder,int">withMaxIn</a> &amp; <a class="reference external" href="#withMaxOut,SwitchBuilder,int">withMaxOut</a>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L173"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L173" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withMaxConnsPerPeer,SwitchBuilder,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withMaxConnsPerPeer%2CSwitchBuilder%2Cint"><span class="Identifier">withMaxConnsPerPeer</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">maxConnsPerPeer</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L191"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L191" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withMaxIn,SwitchBuilder,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withMaxIn%2CSwitchBuilder%2Cint"><span class="Identifier">withMaxIn</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">maxIn</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Maximum concurrent incoming connections. Should be used with <a class="reference external" href="#withMaxOut,SwitchBuilder,int">withMaxOut</a>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L181"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L181" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withMaxOut,SwitchBuilder,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withMaxOut%2CSwitchBuilder%2Cint"><span class="Identifier">withMaxOut</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">maxOut</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Maximum concurrent outgoing connections. Should be used with <a class="reference external" href="#withMaxIn,SwitchBuilder,int">withMaxIn</a>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L186"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L186" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withNameResolver,SwitchBuilder,NameResolver" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withNameResolver%2CSwitchBuilder%2CNameResolver"><span class="Identifier">withNameResolver</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">nameResolver</span><span class="Other">:</span> <a href="nameresolving/nameresolver.html#NameResolver"><span class="Identifier">NameResolver</span></a><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L213"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L213" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withNoise,SwitchBuilder" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withNoise%2CSwitchBuilder"><span class="Identifier">withNoise</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L142"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L142" class="link-seesrc" target="_blank" >Edit</a>
2024-04-29 13:39:28 +00:00
</dd>
</div>
<div id="withObservedAddrManager,SwitchBuilder,ObservedAddrManager" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withObservedAddrManager%2CSwitchBuilder%2CObservedAddrManager"><span class="Identifier">withObservedAddrManager</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span>
<span class="Identifier">observedAddrManager</span><span class="Other">:</span> <a href="observedaddrmanager.html#ObservedAddrManager"><span class="Identifier">ObservedAddrManager</span></a><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L237"
2024-04-29 13:39:28 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L237" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withPeerStore,SwitchBuilder,int" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withPeerStore%2CSwitchBuilder%2Cint"><span class="Identifier">withPeerStore</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">capacity</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L197"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L197" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withPrivateKey,SwitchBuilder,PrivateKey" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withPrivateKey%2CSwitchBuilder%2CPrivateKey"><span class="Identifier">withPrivateKey</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">privateKey</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> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Set the private key of the switch. Will be used to generate a PeerId
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L88"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L88" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withProtoVersion,SwitchBuilder,string" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withProtoVersion%2CSwitchBuilder%2Cstring"><span class="Identifier">withProtoVersion</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">protoVersion</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L201"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L201" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withRendezVous,SwitchBuilder,RendezVous" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withRendezVous%2CSwitchBuilder%2CRendezVous"><span class="Identifier">withRendezVous</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">rdv</span><span class="Other">:</span> <a href="protocols/rendezvous.html#RendezVous"><span class="Identifier">RendezVous</span></a> <span class="Other">=</span> <a href="protocols/rendezvous.html#RendezVous"><span class="Identifier">RendezVous</span></a><span class="Other">.</span><span class="Identifier">new</span><span class="Other">(</span><span class="Other">)</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L227"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L227" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withRng,SwitchBuilder,ref.HmacDrbgContext" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withRng%2CSwitchBuilder%2Cref.HmacDrbgContext"><span class="Identifier">withRng</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">rng</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">HmacDrbgContext</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L169"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L169" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withServices,SwitchBuilder,seq[Service]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withServices%2CSwitchBuilder%2Cseq%5BService%5D"><span class="Identifier">withServices</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">services</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="transports/transport.html#Service"><span class="Identifier">Service</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L233"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L233" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withSignedPeerRecord,SwitchBuilder" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withSignedPeerRecord%2CSwitchBuilder"><span class="Identifier">withSignedPeerRecord</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">sendIt</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L113"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L113" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withTcpTransport,SwitchBuilder,set[ServerFlags]" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withTcpTransport%2CSwitchBuilder%2Cset%5BServerFlags%5D"><span class="Identifier">withTcpTransport</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L161"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L161" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
<div id="withTransport,SwitchBuilder,TransportProvider" class="tohide">
<dt><pre><span class="Keyword">proc</span> <a href="#withTransport%2CSwitchBuilder%2CTransportProvider"><span class="Identifier">withTransport</span></a><span class="Other">(</span><span class="Identifier">b</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</span></a><span class="Other">;</span> <span class="Identifier">prov</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#TransportProvider"><span class="Identifier">TransportProvider</span></a><span class="Other">)</span><span class="Other">:</span> <a href="muxers/mplex/mplex.html#SwitchBuilder"><span class="Identifier">SwitchBuilder</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 class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Use a custom transport
<p><strong class="examples_text">Example:</strong></p>
2024-06-11 15:19:55 +00:00
<pre class="listing"><span class="Keyword">let</span> <span class="Identifier">switch</span> <span class="Operator">=</span> <span class="Identifier">SwitchBuilder</span>
<span class="Operator">.</span><span class="Identifier">new</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
<span class="Operator">.</span><span class="Identifier">withTransport</span><span class="Punctuation">(</span>
<span class="Keyword">proc</span><span class="Punctuation">(</span><span class="Identifier">upgr</span><span class="Punctuation">:</span> <span class="Identifier">Upgrade</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Identifier">Transport</span> <span class="Operator">=</span>
<span class="Identifier">TcpTransport</span><span class="Operator">.</span><span class="Identifier">new</span><span class="Punctuation">(</span><span class="Identifier">flags</span><span class="Punctuation">,</span> <span class="Identifier">upgr</span><span class="Punctuation">)</span>
<span class="Punctuation">)</span>
2023-12-18 18:06:09 +00:00
<span class="Operator">.</span><span class="Identifier">build</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre>
&nbsp;&nbsp;<a
2024-06-19 14:49:07 +00:00
href="https://github.com/vacp2p/nim-libp2p/tree/master/libp2p/builders.nim#L146"
2023-12-18 18:06:09 +00:00
class="link-seesrc" target="_blank">Source</a>
2024-06-19 14:49:07 +00:00
&nbsp;&nbsp;<a href="https://github.com/vacp2p/nim-libp2p/edit/devel/libp2p/builders.nim#L146" class="link-seesrc" target="_blank" >Edit</a>
2023-12-18 18:06:09 +00:00
</dd>
</div>
</dl></div>
<div class="section" id="19">
<h1><a class="toc-backref" href="#19">Exports</a></h1>
<dl class="item">
2024-08-01 12:52:21 +00:00
<a href="multiaddress.html#DNS_OR_IP"><span class="Identifier">DNS_OR_IP</span></a>, <a href="peerstore.html#AlreadyExpectingConnectionError"><span class="Identifier">AlreadyExpectingConnectionError</span></a>, <a href="transports/transport.html#removePeerEventHandler,Switch,PeerEventHandler,PeerEventKind"><span class="Identifier">removePeerEventHandler</span></a>, <a href="protocols/secure/secure.html#shortLog,SecureConn"><span class="Identifier">shortLog</span></a>, <a href="crypto/crypto.html#random,typedesc[PrivateKey],HmacDrbgContext"><span class="Identifier">random</span></a>, <a href="peerinfo.html#new,typedesc[PeerInfo],PrivateKey,openArray[MultiAddress],openArray[string],string,string"><span class="Identifier">new</span></a>, <a href="multiaddress.html#UDP_DNS"><span class="Identifier">UDP_DNS</span></a>, <a href="multiaddress.html#$,MultiAddress"><span class="Identifier">$</span></a>, <a href="peerid.html#<=.t,PeerId,PeerId"><span class="Identifier">&lt;=</span></a>, <a href="peerstore.html#MaxConnectionsPerPeer"><span class="Identifier">MaxConnectionsPerPeer</span></a>, <a href="crypto/ecnist.html#ephemeral,EcCurveKind,HmacDrbgContext"><span class="Identifier">ephemeral</span></a>, <a href="transports/transport.html#dial.e,Switch,PeerId,seq[string]"><span class="Identifier">dial</span></a>, <a href="signed_envelope.html#decode,typedesc[SignedPayload[T]],seq[byte]"><span class="Identifier">decode</span></a>, <a href="multiaddress.html#MaPatternOp"><span class="Identifier">MaPatternOp</span></a>, <a href="peerid.html#==.t,PeerId,PeerId"><span class="Identifier">==</span></a>, <a href="multiaddress.html#WS_DNS"><span class="Identifier">WS_DNS</span></a>, <a href="vbuffer.html#initVBuffer,openArray[byte],int"><span class="Identifier">initVBuffer</span></a>, <a href="protobuf/minprotobuf.html#getProtoHeader.t,ProtoField"><span class="Identifier">getProtoHeader</span></a>, <a href="stream/lpstream.html#MaxSizeError"><span class="Identifier">MaxSizeError</span></a>, <a href="dialer.html#DialFailedError"><span class="Identifier">DialFailedError</span></a>, <a href="protobuf/minprotobuf.html#ProtoHeader"><span class="Identifier">ProtoHeader</span></a>, <a href="protobuf/minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a>, <a href="protocols/protocol.html#handler=,LPProtocol,LPProtoHandler"><span class="Identifier">handler=</span></a>, <a href="protobuf/minprotobuf.html#getLen.t,ProtoBuffer"><span class="Identifier">getLen</span></a>, <a href="protocols/protocol.html#handler.t,LPProtocol"><span class="Identifier">handler</span></a>, <a href="crypto/ecnist.html#ECDHEScheme"><span class="Identifier">ECDHEScheme</span></a>, <a href="crypto/crypto.html#shortLog"><span class="Identifier">shortLog</span></a>, <a href="dialer.html#dial.e,Dialer,PeerId,seq[string]"><span class="Identifier">dial</span></a>, <a href="crypto/crypto.html#key,Secret,int"><span class="Identifier">key</span></a>, <a href="stream/lpstream.html#closed.e,LPStream"><span class="Identifier">closed</span></a>, <a href="peerstore.html#addConnEventHandler,ConnManager,ConnEventHandler,ConnEventKind"><span class="Identifier">addConnEventHandler</span></a>, <a href="vbuffer.html#readVarint,VBuffer,LPSomeUVarint"><span class="Identifier">readVarint</span></a>, <a href="multiaddress.html#toString,MultiAddress"><span class="Identifier">toString</span></a>, <a href="multiaddress.html#[],MultiAddress,"><span class="Identifier">[]</span></a>, <a href="stream/connection.html#new,typeConnection,PeerId,Direction,Opt[MultiAddress],Duration,TimeoutHandler"><span class="Identifier">new</span></a>, <a href="crypto/crypto.html#shuffle,ref.HmacDrbgContext,openArray[T]"><span class="Identifier">shuffle</span></a>, <a href="crypto/crypto.html#random,typedesc[KeyPair],HmacDrbgContext"><span class="Identifier">random</span></a>, <a href="crypto/crypto.html#init,Signature,string"><span class="Identifier">init</span></a>, <a href="multistream.html#new,typedesc[MultistreamSelect]"><span class="Identifier">new</span></a>, <a href="vbuffer.html#VBuffer"><span c
2023-12-18 18:06:09 +00:00
</dl></div>
</div>
</div>
<div class="row">
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
2024-09-05 16:27:59 +00:00
<small style="color: var(--hint);">Made with Nim. Generated: 2024-09-05 16:27:48 UTC</small>
2023-12-18 18:06:09 +00:00
</div>
</div>
</div>
</div>
</body>
</html>