mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-29 08:01:13 +00:00
deploy: db713eb6364e5676ca76c0b25c13013b8808735b
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="DNS endpoint discovery for iroh"><title>iroh::address_lookup::dns - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module dns</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module dns</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#constants" title="Constants">Constants</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>address_<wbr>lookup</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">address_lookup</a></div><h1>Module <span>dns</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/address_lookup/dns.rs.html#1-138">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>DNS endpoint discovery for iroh</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="DNS endpoint discovery for iroh"><title>iroh::address_lookup::dns - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module dns</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module dns</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#constants" title="Constants">Constants</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>address_<wbr>lookup</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">address_lookup</a></div><h1>Module <span>dns</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/address_lookup/dns.rs.html#1-136">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>DNS endpoint discovery for iroh</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.DnsAddressLookup.html" title="struct iroh::address_lookup::dns::DnsAddressLookup">DnsAddress<wbr>Lookup</a></dt><dd>DNS endpoint discovery</dd><dt><a class="struct" href="struct.DnsAddressLookupBuilder.html" title="struct iroh::address_lookup::dns::DnsAddressLookupBuilder">DnsAddress<wbr>Lookup<wbr>Builder</a></dt><dd>Builder for <a href="struct.DnsAddressLookup.html" title="struct iroh::address_lookup::dns::DnsAddressLookup"><code>DnsAddressLookup</code></a>.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.N0_DNS_ENDPOINT_ORIGIN_PROD.html" title="constant iroh::address_lookup::dns::N0_DNS_ENDPOINT_ORIGIN_PROD">N0_<wbr>DNS_<wbr>ENDPOINT_<wbr>ORIGIN_<wbr>PROD</a></dt><dd>The n0 address lookup DNS origin, for production.</dd><dt><a class="constant" href="constant.N0_DNS_ENDPOINT_ORIGIN_STAGING.html" title="constant iroh::address_lookup::dns::N0_DNS_ENDPOINT_ORIGIN_STAGING">N0_<wbr>DNS_<wbr>ENDPOINT_<wbr>ORIGIN_<wbr>STAGING</a></dt><dd>The n0 address lookup DNS origin, for testing.</dd></dl></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Lookup the address of an Endpoint ID."><title>iroh::address_lookup - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module address_lookup</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module address_<wbr>lookup</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>address_<wbr>lookup</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/address_lookup.rs.html#1-1401">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Lookup the address of an Endpoint ID.</p>
|
||||
<p>To connect to an iroh endpoint a <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a> is needed, which may contain a
|
||||
<a href="../struct.RelayUrl.html" title="struct iroh::RelayUrl"><code>RelayUrl</code></a> or one or more <em>direct addresses</em> in addition to the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>.</p>
|
||||
<p>Since there is a conversion from <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> to <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a>, you can also use
|
||||
<p>Since there is a conversion from <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> to <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a>, you can also
|
||||
connect directly with a <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>.</p>
|
||||
<p>For this to work however, the endpoint has to get the addressing information by
|
||||
<p>For this to work however, the endpoint has to get the addressing information by
|
||||
other means.</p>
|
||||
<p><a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a> is an automated system for an <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> to retrieve this addressing
|
||||
information. Each iroh endpoint will automatically publish their own addressing
|
||||
@@ -42,16 +42,16 @@ using HTTP.</p>
|
||||
<p>mDNS-based and Mainline-DHT-based Address Lookup services live in
|
||||
separate crates: <a href="https://docs.rs/iroh-mdns-address-lookup"><code>iroh-mdns-address-lookup</code></a> and
|
||||
<a href="https://docs.rs/iroh-mainline-address-lookup"><code>iroh-mainline-address-lookup</code></a>.</p>
|
||||
<p>To use multiple Address Lookup’ssimultaneously you can call <a href="../endpoint/struct.Builder.html#method.address_lookup" title="method iroh::endpoint::Builder::address_lookup"><code>Builder::address_lookup</code></a>.
|
||||
<p>To use multiple Address Lookups simultaneously you can call <a href="../endpoint/struct.Builder.html#method.address_lookup" title="method iroh::endpoint::Builder::address_lookup"><code>Builder::address_lookup</code></a>.
|
||||
This will use <a href="struct.AddressLookupServices.html" title="struct iroh::address_lookup::AddressLookupServices"><code>AddressLookupServices</code></a> under the hood, which performs lookups to all
|
||||
Address Lookupsystems at the same time.</p>
|
||||
Address Lookup systems at the same time.</p>
|
||||
<p><a href="../endpoint/struct.Builder.html#method.address_lookup" title="method iroh::endpoint::Builder::address_lookup"><code>Builder::address_lookup</code></a> takes any type that implements <a href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder"><code>AddressLookupBuilder</code></a>. You can
|
||||
implement that trait on a builder struct if your Address Lookup needs information
|
||||
from the endpoint it is mounted on. After endpoint construction, your Address Lookup
|
||||
is built by calling <a href="trait.AddressLookupBuilder.html#tymethod.into_address_lookup" title="method iroh::address_lookup::AddressLookupBuilder::into_address_lookup"><code>AddressLookupBuilder::into_address_lookup</code></a>, passing the finished <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> to your
|
||||
builder.</p>
|
||||
<p>If your Address Lookupdoes not need any information from its endpoint, you can
|
||||
pass the Address Lookupservice directly to <a href="../endpoint/struct.Builder.html#method.address_lookup" title="method iroh::endpoint::Builder::address_lookup"><code>Builder::address_lookup</code></a>: All types that
|
||||
<p>If your Address Lookup does not need any information from its endpoint, you can
|
||||
pass the Address Lookup service directly to <a href="../endpoint/struct.Builder.html#method.address_lookup" title="method iroh::endpoint::Builder::address_lookup"><code>Builder::address_lookup</code></a>: All types that
|
||||
implement <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a> also have a blanket implementation of <a href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder"><code>AddressLookupBuilder</code></a>.</p>
|
||||
<h2 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h2>
|
||||
<p>A very common setup is to enable DNS Address Lookup, which needs to be done in two parts as a
|
||||
@@ -69,4 +69,4 @@ implement <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::
|
||||
.address_lookup(address_lookup::DnsAddressLookup::n0_dns())
|
||||
.bind()
|
||||
.<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt><code>pub use <a class="mod" href="dns/index.html" title="mod iroh::address_lookup::dns">dns</a>::*;</code><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dt><code>pub use <a class="mod" href="memory/index.html" title="mod iroh::address_lookup::memory">memory</a>::*;</code></dt><dt><code>pub use <a class="mod" href="pkarr/index.html" title="mod iroh::address_lookup::pkarr">pkarr</a>::*;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="dns/index.html" title="mod iroh::address_lookup::dns">dns</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dd>DNS endpoint discovery for iroh</dd><dt><a class="mod" href="memory/index.html" title="mod iroh::address_lookup::memory">memory</a></dt><dd>An in-memory address lookup system to manually add endpoint addressing information.</dd><dt><a class="mod" href="pkarr/index.html" title="mod iroh::address_lookup::pkarr">pkarr</a></dt><dd>An address lookup service which publishes and resolves endpoint information using a <a href="https://pkarr.org">pkarr</a> relay.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">Addr<wbr>Filter</a></dt><dd>A filter and/or reordering function applied to transport addresses,
|
||||
typically used by AddressLookup services in iroh before publishing.</dd><dt><a class="struct" href="struct.AddressLookupServices.html" title="struct iroh::address_lookup::AddressLookupServices">Address<wbr>Lookup<wbr>Services</a></dt><dd>Registry for address lookup services for an <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>.</dd><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh::address_lookup::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.Error.html" title="struct iroh::address_lookup::Error">Error</a></dt><dd>Error returned by address lookup services when failing to perform the lookup.</dd><dt><a class="struct" href="struct.FilteredAddressLookup.html" title="struct iroh::address_lookup::FilteredAddressLookup">Filtered<wbr>Address<wbr>Lookup</a></dt><dd>An <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a> wrapper that filters addresses before publishing.</dd><dt><a class="struct" href="struct.Item.html" title="struct iroh::address_lookup::Item">Item</a></dt><dd>Address lookup results from <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a>s.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">User<wbr>Data</a></dt><dd>Under the hood this is a UTF-8 String is no longer than <a href="struct.UserData.html#associatedconstant.MAX_LENGTH" title="associated constant iroh::address_lookup::UserData::MAX_LENGTH"><code>UserData::MAX_LENGTH</code></a> bytes.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.AddressLookupBuilderError.html" title="enum iroh::address_lookup::AddressLookupBuilderError">Address<wbr>Lookup<wbr>Builder<wbr>Error</a></dt><dd><a href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder"><code>AddressLookupBuilder</code></a> errors</dd><dt><a class="enum" href="enum.AddressLookupFailed.html" title="enum iroh::address_lookup::AddressLookupFailed">Address<wbr>Lookup<wbr>Failed</a></dt><dd><a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a> errors</dd><dt><a class="enum" href="enum.ParseError.html" title="enum iroh::address_lookup::ParseError">Parse<wbr>Error</a></dt></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">Address<wbr>Lookup</a></dt><dd>AddressLookup system for <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>super::Endpoint</code></a>.</dd><dt><a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">Address<wbr>Lookup<wbr>Builder</a></dt><dd>Trait for structs that can be converted into <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a>s.</dd></dl></section></div></main></body></html>
|
||||
typically used by AddressLookup services in iroh before publishing.</dd><dt><a class="struct" href="struct.AddressLookupServices.html" title="struct iroh::address_lookup::AddressLookupServices">Address<wbr>Lookup<wbr>Services</a></dt><dd>Registry for address lookup services for an <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>.</dd><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh::address_lookup::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.Error.html" title="struct iroh::address_lookup::Error">Error</a></dt><dd>Error returned by address lookup services when failing to perform the lookup.</dd><dt><a class="struct" href="struct.FilteredAddressLookup.html" title="struct iroh::address_lookup::FilteredAddressLookup">Filtered<wbr>Address<wbr>Lookup</a></dt><dd>An <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a> wrapper that filters addresses before publishing.</dd><dt><a class="struct" href="struct.Item.html" title="struct iroh::address_lookup::Item">Item</a></dt><dd>Address lookup results from <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a>s.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">User<wbr>Data</a></dt><dd>User-defined data that can be published and resolved through endpoint discovery.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.AddressLookupBuilderError.html" title="enum iroh::address_lookup::AddressLookupBuilderError">Address<wbr>Lookup<wbr>Builder<wbr>Error</a></dt><dd><a href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder"><code>AddressLookupBuilder</code></a> errors</dd><dt><a class="enum" href="enum.AddressLookupFailed.html" title="enum iroh::address_lookup::AddressLookupFailed">Address<wbr>Lookup<wbr>Failed</a></dt><dd><a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a> errors</dd><dt><a class="enum" href="enum.ParseError.html" title="enum iroh::address_lookup::ParseError">Parse<wbr>Error</a></dt></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">Address<wbr>Lookup</a></dt><dd>AddressLookup system for <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>super::Endpoint</code></a>.</dd><dt><a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">Address<wbr>Lookup<wbr>Builder</a></dt><dd>Trait for structs that can be converted into <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a>s.</dd></dl></section></div></main></body></html>
|
||||
@@ -1,8 +1,8 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An in-memory address lookup system to manually add endpoint addressing information."><title>iroh::address_lookup::memory - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module memory</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module memory</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>address_<wbr>lookup</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">address_lookup</a></div><h1>Module <span>memory</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/address_lookup/memory.rs.html#1-305">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An in-memory address lookup system to manually add endpoint addressing information.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An in-memory address lookup system to manually add endpoint addressing information."><title>iroh::address_lookup::memory - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module memory</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module memory</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>address_<wbr>lookup</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">address_lookup</a></div><h1>Module <span>memory</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/address_lookup/memory.rs.html#1-306">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An in-memory address lookup system to manually add endpoint addressing information.</p>
|
||||
<p>Often an application might get endpoint addressing information out-of-band in an
|
||||
application-specific way. <a href="https://docs.rs/iroh-tickets/latest/iroh_tickets/endpoint/struct.EndpointTicket.html"><code>EndpointTicket</code></a>’s are one common way used to achieve this.
|
||||
This addressing information is often only usable for a limited time so needs to
|
||||
be able to be removed again once know it is no longer useful.</p>
|
||||
be able to be removed again once you know it is no longer useful.</p>
|
||||
<p>This is where the <a href="struct.MemoryLookup.html" title="struct iroh::address_lookup::memory::MemoryLookup"><code>MemoryLookup</code></a> is useful: it allows applications to add and
|
||||
retract endpoint addressing information that is otherwise out-of-band to iroh.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.MemoryLookup.html" title="struct iroh::address_lookup::memory::MemoryLookup">Memory<wbr>Lookup</a></dt><dd>An in-memory address lookup system to manually add endpoint addressing information.</dd></dl></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An address lookup service which publishes and resolves endpoint information using a pkarr relay."><title>iroh::address_lookup::pkarr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module pkarr</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module pkarr</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>address_<wbr>lookup</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">address_lookup</a></div><h1>Module <span>pkarr</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/address_lookup/pkarr.rs.html#1-681">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An address lookup service which publishes and resolves endpoint information using a <a href="https://pkarr.org">pkarr</a> relay.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="An address lookup service which publishes and resolves endpoint information using a pkarr relay."><title>iroh::address_lookup::pkarr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module pkarr</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module pkarr</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>address_<wbr>lookup</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">address_lookup</a></div><h1>Module <span>pkarr</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/address_lookup/pkarr.rs.html#1-683">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An address lookup service which publishes and resolves endpoint information using a <a href="https://pkarr.org">pkarr</a> relay.</p>
|
||||
<p>Public-Key Addressable Resource Records, <a href="https://pkarr.org">pkarr</a>, is a system which allows publishing
|
||||
<a href="https://en.wikipedia.org/wiki/Domain_Name_System#Resource_records">DNS Resource Records</a> owned by a particular <a href="../../struct.SecretKey.html" title="struct iroh::SecretKey"><code>SecretKey</code></a> under a name derived from its
|
||||
corresponding <a href="../../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a>, also known as the <a href="../../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>. Additionally this pkarr
|
||||
|
||||
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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -13,15 +13,15 @@ services, should they not fit into e.g. a single DNS packet otherwise.</p>
|
||||
<p>See also <a href="struct.EndpointData.html#method.set_user_data" title="method iroh::address_lookup::EndpointData::set_user_data"><code>Self::set_user_data</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_relay_url" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#111">Source</a><h4 class="code-header">pub fn <a href="#method.add_relay_url" class="fn">add_relay_url</a>(&mut self, relay_url: <a class="struct" href="../struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>)</h4></section></summary><div class="docblock"><p>Adds the relay URL to the end of the endpoint data, unless it already existed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#119">Source</a><h4 class="code-header">pub fn <a href="#method.add_ip_addrs" class="fn">add_ip_addrs</a>(&mut self, addresses: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses in order with duplicates or already existing addresses filtered out.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#124">Source</a><h4 class="code-header">pub fn <a href="#method.add_addrs" class="fn">add_addrs</a>(&mut self, addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses to the endpoint data in the given ordered, but with duplicates filtered.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#135">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data" class="fn">set_user_data</a>(&mut self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the user-defined data and returns the updated endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#124">Source</a><h4 class="code-header">pub fn <a href="#method.add_addrs" class="fn">add_addrs</a>(&mut self, addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses to the endpoint data in the given order, but with duplicates filtered.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#135">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data" class="fn">set_user_data</a>(&mut self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the user-defined data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#140">Source</a><h4 class="code-header">pub fn <a href="#method.clear_ip_addrs" class="fn">clear_ip_addrs</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all direct addresses from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#146">Source</a><h4 class="code-header">pub fn <a href="#method.clear_relay_urls" class="fn">clear_relay_urls</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all direct addresses from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#146">Source</a><h4 class="code-header">pub fn <a href="#method.clear_relay_urls" class="fn">clear_relay_urls</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all relay URLs from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#152">Source</a><h4 class="code-header">pub fn <a href="#method.relay_urls" class="fn">relay_urls</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="struct" href="../struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the relay URL of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#160">Source</a><h4 class="code-header">pub fn <a href="#method.user_data" class="fn">user_data</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>></h4></section></summary><div class="docblock"><p>Returns the optional user-defined data of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#165">Source</a><h4 class="code-header">pub fn <a href="#method.ip_addrs" class="fn">ip_addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns the direct addresses of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Does this have any addresses?</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns whether this has any addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.filtered_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#185">Source</a><h4 class="code-header">pub fn <a href="#method.filtered_addrs" class="fn">filtered_addrs</a>(&self, filter: &<a class="struct" href="struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>></h4></section></summary><div class="docblock"><p>Apply the given filter to the current addresses.</p>
|
||||
<p>Returns a vec to allow re-ordering of addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.apply_filter" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#190">Source</a><h4 class="code-header">pub fn <a href="#method.apply_filter" class="fn">apply_filter</a>(&self, filter: &<a class="struct" href="struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">EndpointData</a>></h4></section></summary><div class="docblock"><p>Returns the <code>EndpointData</code> with given filter applied.</p>
|
||||
|
||||
@@ -16,14 +16,14 @@ directly from <a href="struct.Item.html" title="struct iroh::address_lookup::Ite
|
||||
this item.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.last_updated" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#420-422">Source</a><h4 class="code-header">pub fn <a href="#method.last_updated" class="fn">last_updated</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>></h4></section></summary><div class="docblock"><p>Returns the optional timestamp when this endpoint info was last updated.</p>
|
||||
<p>The value is microseconds since the unix epoch.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_endpoint_addr" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#425-427">Source</a><h4 class="code-header">pub fn <a href="#method.to_endpoint_addr" class="fn">to_endpoint_addr</a>(&self) -> <a class="struct" href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class="docblock"><p>Converts into a <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a> by cloning the needed fields.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_endpoint_addr" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#430-432">Source</a><h4 class="code-header">pub fn <a href="#method.into_endpoint_addr" class="fn">into_endpoint_addr</a>(self) -> <a class="struct" href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class="docblock"><p>Converts into a <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a> without cloning.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_endpoint_addr" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#425-427">Source</a><h4 class="code-header">pub fn <a href="#method.to_endpoint_addr" class="fn">to_endpoint_addr</a>(&self) -> <a class="struct" href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class="docblock"><p>Returns an <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a> by cloning the needed fields.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.into_endpoint_addr" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#430-432">Source</a><h4 class="code-header">pub fn <a href="#method.into_endpoint_addr" class="fn">into_endpoint_addr</a>(self) -> <a class="struct" href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class="docblock"><p>Converts into an <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a> without cloning.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.user_data" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#435-437">Source</a><h4 class="code-header">pub fn <a href="#method.user_data" class="fn">user_data</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>></h4></section></summary><div class="docblock"><p>Returns any user-defined data.</p>
|
||||
</div></details></div></details></div><details class="toggle big-toggle" open><summary><h2 id="deref-methods-EndpointData" class="section-header"><span>Methods from <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/deref/trait.Deref.html" title="trait core::ops::deref::Deref">Deref</a><Target = <a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">EndpointData</a>></span><a href="#deref-methods-EndpointData" class="anchor">§</a></h2></summary><div id="deref-methods-EndpointData-1" class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#152">Source</a><h4 class="code-header">pub fn <a href="#method.relay_urls" class="fn">relay_urls</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="struct" href="../struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the relay URL of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.user_data-1" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#160">Source</a><h4 class="code-header">pub fn <a href="#method.user_data-1" class="fn">user_data</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>></h4></section></summary><div class="docblock"><p>Returns the optional user-defined data of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#165">Source</a><h4 class="code-header">pub fn <a href="#method.ip_addrs" class="fn">ip_addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns the direct addresses of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Does this have any addresses?</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns whether this has any addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.filtered_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#185">Source</a><h4 class="code-header">pub fn <a href="#method.filtered_addrs" class="fn">filtered_addrs</a>(&self, filter: &<a class="struct" href="struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>></h4></section></summary><div class="docblock"><p>Apply the given filter to the current addresses.</p>
|
||||
<p>Returns a vec to allow re-ordering of addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.apply_filter" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#190">Source</a><h4 class="code-header">pub fn <a href="#method.apply_filter" class="fn">apply_filter</a>(&self, filter: &<a class="struct" href="struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">EndpointData</a>></h4></section></summary><div class="docblock"><p>Returns the <code>EndpointData</code> with given filter applied.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -22,7 +22,7 @@ Address Lookup information changes. If an Address Lookup mechanism requires a pe
|
||||
refresh, it should start its own task.</p>
|
||||
</div></details><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.publish" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#341">Source</a><h4 class="code-header">fn <a href="#method.publish" class="fn">publish</a>(&self, _data: &<a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">EndpointData</a>)</h4></section></summary><div class="docblock"><p>Publishes the given <a href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData"><code>EndpointData</code></a> to the Address Lookup mechanism.</p>
|
||||
<p>This is fire and forget, since the <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> can not wait for successful
|
||||
publishing. If publishing is async, the implementation should start it’s own task.</p>
|
||||
publishing. If publishing is async, the implementation should start its own task.</p>
|
||||
<p>This will be called from a tokio task, so it is safe to spawn new tasks.
|
||||
These tasks will be run on the runtime of the <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>super::Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.resolve" class="method"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#347-349">Source</a><h4 class="code-header">fn <a href="#method.resolve" class="fn">resolve</a>(
|
||||
@@ -34,4 +34,4 @@ work.</p>
|
||||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-AddressLookup-for-Arc%3CT%3E" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#352-360">Source</a><a href="#impl-AddressLookup-for-Arc%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a>> <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><T></h3></section></summary><div class="impl-items"><section id="method.publish-1" class="method trait-impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#353-355">Source</a><a href="#method.publish-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.publish" class="fn">publish</a>(&self, data: &<a class="struct" href="struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">EndpointData</a>)</h4></section><section id="method.resolve-1" class="method trait-impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#357-359">Source</a><a href="#method.resolve-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.resolve" class="fn">resolve</a>(
|
||||
&self,
|
||||
endpoint_id: <a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><BoxStream<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Item.html" title="struct iroh::address_lookup::Item">Item</a>, <a class="struct" href="struct.Error.html" title="struct iroh::address_lookup::Error">Error</a>>>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AddressLookup-for-DnsAddressLookup" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/dns.rs.html#115-138">Source</a><a href="#impl-AddressLookup-for-DnsAddressLookup" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="dns/struct.DnsAddressLookup.html" title="struct iroh::address_lookup::dns::DnsAddressLookup">DnsAddressLookup</a></h3><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></section><section id="impl-AddressLookup-for-MemoryLookup" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/memory.rs.html#217-240">Source</a><a href="#impl-AddressLookup-for-MemoryLookup" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="memory/struct.MemoryLookup.html" title="struct iroh::address_lookup::memory::MemoryLookup">MemoryLookup</a></h3></section><section id="impl-AddressLookup-for-PkarrPublisher" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#355-359">Source</a><a href="#impl-AddressLookup-for-PkarrPublisher" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="pkarr/struct.PkarrPublisher.html" title="struct iroh::address_lookup::pkarr::PkarrPublisher">PkarrPublisher</a></h3></section><section id="impl-AddressLookup-for-PkarrResolver" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#534-550">Source</a><a href="#impl-AddressLookup-for-PkarrResolver" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="pkarr/struct.PkarrResolver.html" title="struct iroh::address_lookup::pkarr::PkarrResolver">PkarrResolver</a></h3></section><section id="impl-AddressLookup-for-FilteredAddressLookup%3CT%3E" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#180-189">Source</a><a href="#impl-AddressLookup-for-FilteredAddressLookup%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a>> <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="struct.FilteredAddressLookup.html" title="struct iroh::address_lookup::FilteredAddressLookup">FilteredAddressLookup</a><T></h3></section></div><script src="../../trait.impl/iroh/address_lookup/trait.AddressLookup.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html>
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><BoxStream<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Item.html" title="struct iroh::address_lookup::Item">Item</a>, <a class="struct" href="struct.Error.html" title="struct iroh::address_lookup::Error">Error</a>>>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AddressLookup-for-DnsAddressLookup" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/dns.rs.html#113-136">Source</a><a href="#impl-AddressLookup-for-DnsAddressLookup" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="dns/struct.DnsAddressLookup.html" title="struct iroh::address_lookup::dns::DnsAddressLookup">DnsAddressLookup</a></h3><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></section><section id="impl-AddressLookup-for-MemoryLookup" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/memory.rs.html#218-241">Source</a><a href="#impl-AddressLookup-for-MemoryLookup" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="memory/struct.MemoryLookup.html" title="struct iroh::address_lookup::memory::MemoryLookup">MemoryLookup</a></h3></section><section id="impl-AddressLookup-for-PkarrPublisher" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#357-361">Source</a><a href="#impl-AddressLookup-for-PkarrPublisher" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="pkarr/struct.PkarrPublisher.html" title="struct iroh::address_lookup::pkarr::PkarrPublisher">PkarrPublisher</a></h3></section><section id="impl-AddressLookup-for-PkarrResolver" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#536-552">Source</a><a href="#impl-AddressLookup-for-PkarrResolver" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="pkarr/struct.PkarrResolver.html" title="struct iroh::address_lookup::pkarr::PkarrResolver">PkarrResolver</a></h3></section><section id="impl-AddressLookup-for-FilteredAddressLookup%3CT%3E" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#180-189">Source</a><a href="#impl-AddressLookup-for-FilteredAddressLookup%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a>> <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a> for <a class="struct" href="struct.FilteredAddressLookup.html" title="struct iroh::address_lookup::FilteredAddressLookup">FilteredAddressLookup</a><T></h3></section></div><script src="../../trait.impl/iroh/address_lookup/trait.AddressLookup.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html>
|
||||
@@ -20,5 +20,5 @@ endpoint to <a href="trait.AddressLookupBuilder.html#tymethod.into_address_looku
|
||||
endpoint: &<a class="struct" href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><impl <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a>, <a class="enum" href="enum.AddressLookupBuilderError.html" title="enum iroh::address_lookup::AddressLookupBuilderError">AddressLookupBuilderError</a>></h4></section></summary><div class="docblock"><p>Turns this builder into a ready-to-use <a href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>AddressLookup</code></a>.</p>
|
||||
<p>If an error is returned, building the endpoint will fail with this error.</p>
|
||||
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AddressLookupBuilder-for-DnsAddressLookupBuilder" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/dns.rs.html#103-113">Source</a><a href="#impl-AddressLookupBuilder-for-DnsAddressLookupBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for <a class="struct" href="dns/struct.DnsAddressLookupBuilder.html" title="struct iroh::address_lookup::dns::DnsAddressLookupBuilder">DnsAddressLookupBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></section><section id="impl-AddressLookupBuilder-for-PkarrPublisherBuilder" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#239-251">Source</a><a href="#impl-AddressLookupBuilder-for-PkarrPublisherBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for <a class="struct" href="pkarr/struct.PkarrPublisherBuilder.html" title="struct iroh::address_lookup::pkarr::PkarrPublisherBuilder">PkarrPublisherBuilder</a></h3></section><section id="impl-AddressLookupBuilder-for-PkarrResolverBuilder" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#470-482">Source</a><a href="#impl-AddressLookupBuilder-for-PkarrResolverBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for <a class="struct" href="pkarr/struct.PkarrResolverBuilder.html" title="struct iroh::address_lookup::pkarr::PkarrResolverBuilder">PkarrResolverBuilder</a></h3></section><section id="impl-AddressLookupBuilder-for-T" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#192-199">Source</a><a href="#impl-AddressLookupBuilder-for-T" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a>> <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for T</h3><div class="docblock"><p>Blanket no-op impl of <code>AddressLookupBuilder</code> for <code>T: AddressLookup</code>.</p>
|
||||
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-AddressLookupBuilder-for-DnsAddressLookupBuilder" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/dns.rs.html#101-111">Source</a><a href="#impl-AddressLookupBuilder-for-DnsAddressLookupBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for <a class="struct" href="dns/struct.DnsAddressLookupBuilder.html" title="struct iroh::address_lookup::dns::DnsAddressLookupBuilder">DnsAddressLookupBuilder</a></h3><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></section><section id="impl-AddressLookupBuilder-for-PkarrPublisherBuilder" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#239-251">Source</a><a href="#impl-AddressLookupBuilder-for-PkarrPublisherBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for <a class="struct" href="pkarr/struct.PkarrPublisherBuilder.html" title="struct iroh::address_lookup::pkarr::PkarrPublisherBuilder">PkarrPublisherBuilder</a></h3></section><section id="impl-AddressLookupBuilder-for-PkarrResolverBuilder" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup/pkarr.rs.html#472-484">Source</a><a href="#impl-AddressLookupBuilder-for-PkarrResolverBuilder" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for <a class="struct" href="pkarr/struct.PkarrResolverBuilder.html" title="struct iroh::address_lookup::pkarr::PkarrResolverBuilder">PkarrResolverBuilder</a></h3></section><section id="impl-AddressLookupBuilder-for-T" class="impl"><a class="src rightside" href="../../src/iroh/address_lookup.rs.html#192-199">Source</a><a href="#impl-AddressLookupBuilder-for-T" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup">AddressLookup</a>> <a class="trait" href="trait.AddressLookupBuilder.html" title="trait iroh::address_lookup::AddressLookupBuilder">AddressLookupBuilder</a> for T</h3><div class="docblock"><p>Blanket no-op impl of <code>AddressLookupBuilder</code> for <code>T: AddressLookup</code>.</p>
|
||||
</div></section></div><script src="../../trait.impl/iroh/address_lookup/trait.AddressLookupBuilder.js" async></script></section></div></main></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Get the default `RelayConfig` for Asia-Pacific"><title>default_ap_relay in iroh::defaults::prod - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">default_ap_relay</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>defaults::<wbr>prod</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">defaults</a>::<wbr><a href="index.html">prod</a></div><h1>Function <span class="fn">default_<wbr>ap_<wbr>relay</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/defaults.rs.html#73-79">Source</a> </span></div><pre class="rust item-decl"><code>pub fn default_ap_relay() -> <a class="struct" href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig">RelayConfig</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for Asia-Pacific</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Get the default `RelayConfig` for Asia-Pacific."><title>default_ap_relay in iroh::defaults::prod - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">default_ap_relay</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>defaults::<wbr>prod</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">defaults</a>::<wbr><a href="index.html">prod</a></div><h1>Function <span class="fn">default_<wbr>ap_<wbr>relay</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/defaults.rs.html#73-79">Source</a> </span></div><pre class="rust item-decl"><code>pub fn default_ap_relay() -> <a class="struct" href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig">RelayConfig</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for Asia-Pacific.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Production configuration."><title>iroh::defaults::prod - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module prod</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module prod</a></h2><h3><a href="#constants">Module Items</a></h3><ul class="block"><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh::<wbr>defaults</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">defaults</a></div><h1>Module <span>prod</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/defaults.rs.html#20">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Production configuration.</p>
|
||||
</div></details><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.AP_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::AP_RELAY_HOSTNAME">AP_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default Asia-Pacific relay.</dd><dt><a class="constant" href="constant.EU_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::EU_RELAY_HOSTNAME">EU_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default EU relay.</dd><dt><a class="constant" href="constant.NA_EAST_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::NA_EAST_RELAY_HOSTNAME">NA_<wbr>EAST_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default NA east relay.</dd><dt><a class="constant" href="constant.NA_WEST_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::NA_WEST_RELAY_HOSTNAME">NA_<wbr>WEST_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default NA west relay.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.default_ap_relay.html" title="fn iroh::defaults::prod::default_ap_relay">default_<wbr>ap_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for Asia-Pacific</dd><dt><a class="fn" href="fn.default_eu_relay.html" title="fn iroh::defaults::prod::default_eu_relay">default_<wbr>eu_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for EU.</dd><dt><a class="fn" href="fn.default_na_east_relay.html" title="fn iroh::defaults::prod::default_na_east_relay">default_<wbr>na_<wbr>east_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for NA east.</dd><dt><a class="fn" href="fn.default_na_west_relay.html" title="fn iroh::defaults::prod::default_na_west_relay">default_<wbr>na_<wbr>west_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for NA west.</dd><dt><a class="fn" href="fn.default_relay_map.html" title="fn iroh::defaults::prod::default_relay_map">default_<wbr>relay_<wbr>map</a></dt><dd>Get the default <a href="../../struct.RelayMap.html" title="struct iroh::RelayMap"><code>RelayMap</code></a>.</dd></dl></section></div></main></body></html>
|
||||
</div></details><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.AP_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::AP_RELAY_HOSTNAME">AP_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default Asia-Pacific relay.</dd><dt><a class="constant" href="constant.EU_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::EU_RELAY_HOSTNAME">EU_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default EU relay.</dd><dt><a class="constant" href="constant.NA_EAST_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::NA_EAST_RELAY_HOSTNAME">NA_<wbr>EAST_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default NA east relay.</dd><dt><a class="constant" href="constant.NA_WEST_RELAY_HOSTNAME.html" title="constant iroh::defaults::prod::NA_WEST_RELAY_HOSTNAME">NA_<wbr>WEST_<wbr>RELAY_<wbr>HOSTNAME</a></dt><dd>Hostname of the default NA west relay.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.default_ap_relay.html" title="fn iroh::defaults::prod::default_ap_relay">default_<wbr>ap_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for Asia-Pacific.</dd><dt><a class="fn" href="fn.default_eu_relay.html" title="fn iroh::defaults::prod::default_eu_relay">default_<wbr>eu_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for EU.</dd><dt><a class="fn" href="fn.default_na_east_relay.html" title="fn iroh::defaults::prod::default_na_east_relay">default_<wbr>na_<wbr>east_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for NA east.</dd><dt><a class="fn" href="fn.default_na_west_relay.html" title="fn iroh::defaults::prod::default_na_west_relay">default_<wbr>na_<wbr>west_<wbr>relay</a></dt><dd>Get the default <a href="../../struct.RelayConfig.html" title="struct iroh::RelayConfig"><code>RelayConfig</code></a> for NA west.</dd><dt><a class="fn" href="fn.default_relay_map.html" title="fn iroh::defaults::prod::default_relay_map">default_<wbr>relay_<wbr>map</a></dt><dd>Get the default <a href="../../struct.RelayMap.html" title="struct iroh::RelayMap"><code>RelayMap</code></a>.</dd></dl></section></div></main></body></html>
|
||||
@@ -15,7 +15,7 @@ public DNS.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-DnsResolver" class="impl"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#327">Source</a><a href="#impl-DnsResolver" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.DnsResolver.html" title="struct iroh::dns::DnsResolver">DnsResolver</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#333">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> <a class="struct" href="struct.DnsResolver.html" title="struct iroh::dns::DnsResolver">DnsResolver</a></h4></section></summary><div class="docblock"><p>Creates a new DNS resolver with sensible cross-platform defaults.</p>
|
||||
<p>We first try to read the system’s resolver from <code>/etc/resolv.conf</code>.
|
||||
This does not work at least on some Androids, therefore we fallback
|
||||
to the default <code>ResolverConfig</code> which uses eg. to google’s <code>8.8.8.8</code> or <code>8.8.4.4</code>.</p>
|
||||
to the default <code>ResolverConfig</code> which uses e.g. Google’s <code>8.8.8.8</code> or <code>8.8.4.4</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_nameserver" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#338">Source</a><h4 class="code-header">pub fn <a href="#method.with_nameserver" class="fn">with_nameserver</a>(nameserver: <a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>) -> <a class="struct" href="struct.DnsResolver.html" title="struct iroh::dns::DnsResolver">DnsResolver</a></h4></section></summary><div class="docblock"><p>Creates a new DNS resolver configured with a single UDP DNS nameserver.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.builder" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#345">Source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fn">builder</a>() -> <a class="struct" href="struct.Builder.html" title="struct iroh::dns::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Creates a builder to construct a DNS resolver with custom options.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.custom" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#354">Source</a><h4 class="code-header">pub fn <a href="#method.custom" class="fn">custom</a>(resolver: impl <a class="trait" href="trait.Resolver.html" title="trait iroh::dns::Resolver">Resolver</a>) -> <a class="struct" href="struct.DnsResolver.html" title="struct iroh::dns::DnsResolver">DnsResolver</a></h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.DnsResolver.html" title="struct iroh::dns::DnsResolver"><code>DnsResolver</code></a> from a struct that implements <a href="trait.Resolver.html" title="trait iroh::dns::Resolver"><code>Resolver</code></a>.</p>
|
||||
|
||||
@@ -38,13 +38,13 @@ atomic swap. Build a new instance with re-bound sockets and re-read nameserver
|
||||
configuration rather than mutating in place. Must not perform IO: defer DNS
|
||||
queries and socket binds until the new resolver is first used. May be called
|
||||
concurrently, in which case all but one allocated replacement is dropped unused.</p>
|
||||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#422">Source</a><a href="#impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Resolver.html" title="trait iroh::dns::Resolver">Resolver</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><SimpleDnsResolver></h3></section></summary><div class="impl-items"><section id="method.lookup_ipv4" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#423">Source</a><a href="#method.lookup_ipv4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv4" class="fn">lookup_ipv4</a>(
|
||||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#424">Source</a><a href="#impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Resolver.html" title="trait iroh::dns::Resolver">Resolver</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><SimpleDnsResolver></h3></section></summary><div class="impl-items"><section id="method.lookup_ipv4" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#425">Source</a><a href="#method.lookup_ipv4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv4" class="fn">lookup_ipv4</a>(
|
||||
&self,
|
||||
host: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv4Addr.html" title="struct core::net::ip_addr::Ipv4Addr">Ipv4Addr</a>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh::dns::DnsError">DnsError</a>>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section><section id="method.lookup_ipv6" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#432">Source</a><a href="#method.lookup_ipv6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv6" class="fn">lookup_ipv6</a>(
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv4Addr.html" title="struct core::net::ip_addr::Ipv4Addr">Ipv4Addr</a>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh::dns::DnsError">DnsError</a>>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section><section id="method.lookup_ipv6" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#434">Source</a><a href="#method.lookup_ipv6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv6" class="fn">lookup_ipv6</a>(
|
||||
&self,
|
||||
host: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv6Addr.html" title="struct core::net::ip_addr::Ipv6Addr">Ipv6Addr</a>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh::dns::DnsError">DnsError</a>>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section><section id="method.lookup_txt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#441">Source</a><a href="#method.lookup_txt" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_txt" class="fn">lookup_txt</a>(
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv6Addr.html" title="struct core::net::ip_addr::Ipv6Addr">Ipv6Addr</a>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh::dns::DnsError">DnsError</a>>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section><section id="method.lookup_txt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#443">Source</a><a href="#method.lookup_txt" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_txt" class="fn">lookup_txt</a>(
|
||||
&self,
|
||||
host: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="struct.TxtRecordData.html" title="struct iroh::dns::TxtRecordData">TxtRecordData</a>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh::dns::DnsError">DnsError</a>>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section><section id="method.clear_cache" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#450">Source</a><a href="#method.clear_cache" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.clear_cache" class="fn">clear_cache</a>(&self)</h4></section><section id="method.reset" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#454">Source</a><a href="#method.reset" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.reset" class="fn">reset</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.Resolver.html" title="trait iroh::dns::Resolver">Resolver</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/iroh_dns/dns/trait.Resolver.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html>
|
||||
) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="struct.TxtRecordData.html" title="struct iroh::dns::TxtRecordData">TxtRecordData</a>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh::dns::DnsError">DnsError</a>>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section><section id="method.clear_cache" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#452">Source</a><a href="#method.clear_cache" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.clear_cache" class="fn">clear_cache</a>(&self)</h4></section><section id="method.reset" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#456">Source</a><a href="#method.reset" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.reset" class="fn">reset</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.Resolver.html" title="trait iroh::dns::Resolver">Resolver</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/iroh_dns/dns/trait.Resolver.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Environment variable to force the use of staging relays."><title>ENV_FORCE_STAGING_RELAYS in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">ENV_FORCE_STAGING_RELAYS</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Constant <span class="constant">ENV_<wbr>FORCE_<wbr>STAGING_<wbr>RELAYS</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1931">Source</a> </span></div><pre class="rust item-decl"><code>pub const ENV_FORCE_STAGING_RELAYS: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = "IROH_FORCE_STAGING_RELAYS";</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Environment variable to force the use of staging relays.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Environment variable to force the use of staging relays."><title>ENV_FORCE_STAGING_RELAYS in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc constant"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">ENV_FORCE_STAGING_RELAYS</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Constant <span class="constant">ENV_<wbr>FORCE_<wbr>STAGING_<wbr>RELAYS</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1933">Source</a> </span></div><pre class="rust item-decl"><code>pub const ENV_FORCE_STAGING_RELAYS: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = "IROH_FORCE_STAGING_RELAYS";</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Environment variable to force the use of staging relays.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">default_relay_mode</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Function <span class="fn">default_<wbr>relay_<wbr>mode</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1942-1948">Source</a> </span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -> <a class="enum" href="enum.RelayMode.html" title="enum iroh::endpoint::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">default_relay_mode</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Function <span class="fn">default_<wbr>relay_<wbr>mode</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1944-1950">Source</a> </span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -> <a class="enum" href="enum.RelayMode.html" title="enum iroh::endpoint::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
|
||||
<p>If the <code>IROH_FORCE_STAGING_RELAYS</code> environment variable is non empty, it will return <code>RelayMode::Staging</code>.
|
||||
Otherwise, it will return <code>RelayMode::Default</code>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns `true` if the use of staging relays is forced."><title>force_staging_infra in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">force_staging_infra</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Function <span class="fn">force_<wbr>staging_<wbr>infra</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1934-1936">Source</a> </span></div><pre class="rust item-decl"><code>pub fn force_staging_infra() -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns <code>true</code> if the use of staging relays is forced.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns `true` if the use of staging relays is forced."><title>force_staging_infra in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">force_staging_infra</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Function <span class="fn">force_<wbr>staging_<wbr>infra</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1936-1938">Source</a> </span></div><pre class="rust item-decl"><code>pub fn force_staging_infra() -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns <code>true</code> if the use of staging relays is forced.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The `Endpoint` allows establishing connections to other iroh endpoints."><title>iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module endpoint</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module endpoint</a></h2><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>endpoint</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1-4002">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> allows establishing connections to other iroh endpoints.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The `Endpoint` allows establishing connections to other iroh endpoints."><title>iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module endpoint</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module endpoint</a></h2><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>endpoint</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#1-4004">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> allows establishing connections to other iroh endpoints.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> is the main API interface to manage a local iroh endpoint. It allows
|
||||
connecting to and accepting connections from other endpoints. See the <a href="../index.html" title="mod iroh">module docs</a> for
|
||||
more details on how iroh connections work.</p>
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>iroh::{Endpoint, RelayMode, Watcher, endpoint::presets};
|
||||
|
||||
<span class="kw">let </span>endpoint = Endpoint::builder(presets::N0).bind().<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Empty.html" title="struct iroh::endpoint::presets::Empty">Empty</a></dt><dd>An empty preset that doesn’t set anything on the builder.</dd><dt><a class="struct" href="struct.Minimal.html" title="struct iroh::endpoint::presets::Minimal">Minimal</a><wbr><span class="stab portability" title="Available on `with_crypto_provider` only"><code>with_crypto_provider</code></span></dt><dd>A preset that is almost empty, besides setting mandatory options.</dd><dt><a class="struct" href="struct.N0.html" title="struct iroh::endpoint::presets::N0">N0</a><wbr><span class="stab portability" title="Available on `with_crypto_provider` only"><code>with_crypto_provider</code></span></dt><dd>Configures the endpoint to use the n0 defaults</dd><dt><a class="struct" href="struct.N0DisableRelay.html" title="struct iroh::endpoint::presets::N0DisableRelay">N0Disable<wbr>Relay</a><wbr><span class="stab portability" title="Available on `with_crypto_provider` only"><code>with_crypto_provider</code></span></dt><dd>Configures the endpoint to use the n0 defaults, but with relay mode disabled.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Preset.html" title="trait iroh::endpoint::presets::Preset">Preset</a></dt><dd>Defines a preset</dd></dl></section></div></main></body></html>
|
||||
<span class="kw">let </span>endpoint = Endpoint::builder(presets::N0).bind().<span class="kw">await</span><span class="question-mark">?</span>;</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Empty.html" title="struct iroh::endpoint::presets::Empty">Empty</a></dt><dd>An empty preset that doesn’t set anything on the builder.</dd><dt><a class="struct" href="struct.Minimal.html" title="struct iroh::endpoint::presets::Minimal">Minimal</a><wbr><span class="stab portability" title="Available on `with_crypto_provider` only"><code>with_crypto_provider</code></span></dt><dd>A preset that is almost empty, besides setting mandatory options.</dd><dt><a class="struct" href="struct.N0.html" title="struct iroh::endpoint::presets::N0">N0</a><wbr><span class="stab portability" title="Available on `with_crypto_provider` only"><code>with_crypto_provider</code></span></dt><dd>Configures the endpoint to use the n0 defaults</dd><dt><a class="struct" href="struct.N0DisableRelay.html" title="struct iroh::endpoint::presets::N0DisableRelay">N0Disable<wbr>Relay</a><wbr><span class="stab portability" title="Available on `with_crypto_provider` only"><code>with_crypto_provider</code></span></dt><dd>Configures the endpoint to use the n0 defaults, but with relay mode disabled.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Preset.html" title="trait iroh::endpoint::presets::Preset">Preset</a></dt><dd>A reusable bundle of endpoint <a href="../struct.Builder.html" title="struct iroh::endpoint::Builder"><code>Builder</code></a> configuration.</dd></dl></section></div></main></body></html>
|
||||
@@ -6,8 +6,8 @@
|
||||
<li>setting the [<code>rustls::crypto::CryptoProvider</code>] to <a href="rustls::crypto::ring::default_provider">ring</a> or <a href="rustls::crypto::aws_lc_rs::default_provider">aws-lc-rs</a>, depending
|
||||
on which feature is enabled in iroh (preferring ring if both are enabled).</li>
|
||||
</ul>
|
||||
<p>Due to the last point, this preset is only available with the <code>ring</code> or
|
||||
<code>aws-lc-rs</code> preset installed.
|
||||
<p>Due to the last point, this preset is only available with the <code>tls-ring</code> or
|
||||
<code>tls-aws-lc-rs</code> feature enabled.
|
||||
If you want to set your own crypto provider, we recommend copying the
|
||||
implementation of this preset into your own and setting the appropriate crypto
|
||||
provider there.</p>
|
||||
|
||||
@@ -7,8 +7,8 @@ relay urls.</li>
|
||||
<li>setting the [<code>rustls::crypto::CryptoProvider</code>] to <a href="rustls::crypto::ring::default_provider">ring</a> or <a href="rustls::crypto::aws_lc_rs::default_provider">aws-lc-rs</a>, depending
|
||||
on which feature is enabled in iroh (preferring ring if both are enabled).</li>
|
||||
</ul>
|
||||
<p>Due to the last point, this preset is only available with the <code>ring</code> or
|
||||
<code>aws-lc-rs</code> preset installed.
|
||||
<p>Due to the last point, this preset is only available with the <code>tls-ring</code> or
|
||||
<code>tls-aws-lc-rs</code> feature enabled.
|
||||
If you want to set your own crypto provider, we recommend copying the
|
||||
implementation of this preset into your own and setting the appropriate crypto
|
||||
provider there.</p>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Defines a preset"><title>Preset in iroh::endpoint::presets - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Preset</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Preset</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.apply" title="apply">apply</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Preset-for-Arc%3CTestTransport%3E" title="Arc<TestTransport>">Arc<TestTransport></a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint::<wbr>presets</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">endpoint</a>::<wbr><a href="index.html">presets</a></div><h1>Trait <span class="trait">Preset</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/endpoint/presets.rs.html#21-24">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Preset {
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A reusable bundle of endpoint `Builder` configuration."><title>Preset in iroh::endpoint::presets - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Preset</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Preset</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.apply" title="apply">apply</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Preset-for-Arc%3CTestTransport%3E" title="Arc<TestTransport>">Arc<TestTransport></a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint::<wbr>presets</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh</a>::<wbr><a href="../index.html">endpoint</a>::<wbr><a href="index.html">presets</a></div><h1>Trait <span class="trait">Preset</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh/endpoint/presets.rs.html#21-24">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Preset {
|
||||
// Required method
|
||||
fn <a href="#tymethod.apply" class="fn">apply</a>(self, builder: <a class="struct" href="../struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a>) -> <a class="struct" href="../struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Defines a preset</p>
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A reusable bundle of endpoint <a href="../struct.Builder.html" title="struct iroh::endpoint::Builder"><code>Builder</code></a> configuration.</p>
|
||||
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.apply" class="method"><a class="src rightside" href="../../../src/iroh/endpoint/presets.rs.html#23">Source</a><h4 class="code-header">fn <a href="#tymethod.apply" class="fn">apply</a>(self, builder: <a class="struct" href="../struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a>) -> <a class="struct" href="../struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Applies the configuration to the passed in <a href="../struct.Builder.html" title="struct iroh::endpoint::Builder"><code>Builder</code></a>.</p>
|
||||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Preset-for-Arc%3CTestTransport%3E" class="impl"><a class="src rightside" href="../../../src/iroh/test_utils/test_transport.rs.html#49-68">Source</a><a href="#impl-Preset-for-Arc%3CTestTransport%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Preset.html" title="trait iroh::endpoint::presets::Preset">Preset</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><<a class="struct" href="../../test_utils/test_transport/struct.TestTransport.html" title="struct iroh::test_utils::test_transport::TestTransport">TestTransport</a>></h3><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>unstable-custom-transports</code> and (crate features <code>test-utils</code>)</strong> only.</div></span></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.apply" class="method trait-impl"><a class="src rightside" href="../../../src/iroh/test_utils/test_transport.rs.html#63-67">Source</a><a href="#method.apply" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.apply" class="fn">apply</a>(self, builder: <a class="struct" href="../struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a>) -> <a class="struct" href="../struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Configures the builder with this transport and the network’s address lookup.</p>
|
||||
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
|
||||
|
||||
@@ -92,7 +92,7 @@ is set to <code>false</code> explicitly.</p>
|
||||
destination addresses. It is valid to configure this, but no more than one such
|
||||
socket should be bound or the routing will be non-deterministic.</p>
|
||||
<p>To use a subnet with a non-zero prefix length as the default route in addition to
|
||||
being routed when its prefix matches, use <a href="struct.BindOpts.html#method.set_is_default_route" title="method iroh::endpoint::BindOpts::set_is_default_route">`BindOpts::set_is_default_route</a>.
|
||||
being routed when its prefix matches, use <a href="struct.BindOpts.html#method.set_is_default_route" title="method iroh::endpoint::BindOpts::set_is_default_route"><code>BindOpts::set_is_default_route</code></a>.
|
||||
Subnets with a prefix length of zero are always marked as default routes.</p>
|
||||
<p>Finally note that most outgoing datagrams are part of an existing network flow. That
|
||||
is, they are in response to an incoming datagram. In this case the outgoing datagram
|
||||
@@ -142,7 +142,7 @@ direct addresses or relay URLs will fail.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addr_filter" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#607-610">Source</a><h4 class="code-header">pub fn <a href="#method.addr_filter" class="fn">addr_filter</a>(self, filter: <a class="struct" href="../address_lookup/struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets the address filter applied to all address data before publishing.</p>
|
||||
<p>This filter is applied once, at the <a href="../address_lookup/struct.AddressLookupServices.html" title="struct iroh::address_lookup::AddressLookupServices"><code>AddressLookupServices</code></a> level, before
|
||||
distributing data to any individual address lookup service. This ensures
|
||||
consistent filtering regardless of how the services configured.</p>
|
||||
consistent filtering regardless of how the services are configured.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_addr_filter" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#616-619">Source</a><h4 class="code-header">pub fn <a href="#method.clear_addr_filter" class="fn">clear_addr_filter</a>(self) -> Self</h4></section></summary><div class="docblock"><p>Clears the address filter, allowing all addresses to be published.</p>
|
||||
<p>This removes any filter previously set via <a href="struct.Builder.html#method.addr_filter" title="method iroh::endpoint::Builder::addr_filter"><code>Self::addr_filter</code></a>, including
|
||||
filters set by presets.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ receiving CONNECTION_CLOSE the peer may drop any stream data not yet delivered t
|
||||
application. <a href="struct.Connection.html#method.close" title="method iroh::endpoint::Connection::close"><code>Connection::close</code></a> describes in more detail how to gracefully close a
|
||||
connection without losing application data.</p>
|
||||
<p>May be cloned to obtain another handle to the same connection.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Connection%3CT%3E" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#811-1060">Source</a><a href="#impl-Connection%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.ConnectionState.html" title="trait iroh::endpoint::ConnectionState">ConnectionState</a>> <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.open_uni" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#818-820">Source</a><h4 class="code-header">pub fn <a href="#method.open_uni" class="fn">open_uni</a>(&self) -> <a class="struct" href="struct.OpenUni.html" title="struct iroh::endpoint::OpenUni">OpenUni</a><'_> <a href="#" class="tooltip" data-notable-ty="OpenUni<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Initiates a new outgoing unidirectional stream.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Connection%3CT%3E" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#811-1062">Source</a><a href="#impl-Connection%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="trait.ConnectionState.html" title="trait iroh::endpoint::ConnectionState">ConnectionState</a>> <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><T></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.open_uni" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#818-820">Source</a><h4 class="code-header">pub fn <a href="#method.open_uni" class="fn">open_uni</a>(&self) -> <a class="struct" href="struct.OpenUni.html" title="struct iroh::endpoint::OpenUni">OpenUni</a><'_> <a href="#" class="tooltip" data-notable-ty="OpenUni<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Initiates a new outgoing unidirectional stream.</p>
|
||||
<p>Streams are cheap and instantaneous to open unless blocked by flow control. As a
|
||||
consequence, the peer won’t be notified that a stream has been opened until the
|
||||
stream is actually used.</p>
|
||||
@@ -18,13 +18,13 @@ consequence, the peer won’t be notified that a stream has been opened until th
|
||||
stream is actually used. Calling <a href="struct.Connection.html#method.open_bi" title="method iroh::endpoint::Connection::open_bi"><code>open_bi</code></a> then waiting on the <a href="struct.RecvStream.html" title="struct iroh::endpoint::RecvStream"><code>RecvStream</code></a>
|
||||
without writing anything to <a href="struct.SendStream.html" title="struct iroh::endpoint::SendStream"><code>SendStream</code></a> will never succeed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept_uni" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#839-841">Source</a><h4 class="code-header">pub fn <a href="#method.accept_uni" class="fn">accept_uni</a>(&self) -> <a class="struct" href="struct.AcceptUni.html" title="struct iroh::endpoint::AcceptUni">AcceptUni</a><'_> <a href="#" class="tooltip" data-notable-ty="AcceptUni<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts the next incoming uni-directional stream.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept_bi" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#854-856">Source</a><h4 class="code-header">pub fn <a href="#method.accept_bi" class="fn">accept_bi</a>(&self) -> <a class="struct" href="struct.AcceptBi.html" title="struct iroh::endpoint::AcceptBi">AcceptBi</a><'_> <a href="#" class="tooltip" data-notable-ty="AcceptBi<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accept the next incoming bidirectional stream.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept_bi" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#854-856">Source</a><h4 class="code-header">pub fn <a href="#method.accept_bi" class="fn">accept_bi</a>(&self) -> <a class="struct" href="struct.AcceptBi.html" title="struct iroh::endpoint::AcceptBi">AcceptBi</a><'_> <a href="#" class="tooltip" data-notable-ty="AcceptBi<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts the next incoming bidirectional stream.</p>
|
||||
<p><strong>Important Note</strong>: The peer that calls <a href="struct.Connection.html#method.open_bi" title="method iroh::endpoint::Connection::open_bi"><code>open_bi</code></a> must write to its <a href="struct.SendStream.html" title="struct iroh::endpoint::SendStream"><code>SendStream</code></a>
|
||||
before the peer <code>Connection</code> is able to accept the stream using
|
||||
<code>accept_bi()</code>. Calling <a href="struct.Connection.html#method.open_bi" title="method iroh::endpoint::Connection::open_bi"><code>open_bi</code></a> then waiting on the <a href="struct.RecvStream.html" title="struct iroh::endpoint::RecvStream"><code>RecvStream</code></a> without
|
||||
writing anything to the connected <a href="struct.SendStream.html" title="struct iroh::endpoint::SendStream"><code>SendStream</code></a> will never succeed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.read_datagram" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#860-862">Source</a><h4 class="code-header">pub fn <a href="#method.read_datagram" class="fn">read_datagram</a>(&self) -> <a class="struct" href="struct.ReadDatagram.html" title="struct iroh::endpoint::ReadDatagram">ReadDatagram</a><'_> <a href="#" class="tooltip" data-notable-ty="ReadDatagram<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Receives an application datagram.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.closed" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#870-872">Source</a><h4 class="code-header">pub async fn <a href="#method.closed" class="fn">closed</a>(&self) -> <a class="enum" href="enum.ConnectionError.html" title="enum iroh::endpoint::ConnectionError">ConnectionError</a></h4></section></summary><div class="docblock"><p>Wait for the connection to be closed for any reason.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.closed" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#870-872">Source</a><h4 class="code-header">pub async fn <a href="#method.closed" class="fn">closed</a>(&self) -> <a class="enum" href="enum.ConnectionError.html" title="enum iroh::endpoint::ConnectionError">ConnectionError</a></h4></section></summary><div class="docblock"><p>Waits for the connection to be closed for any reason.</p>
|
||||
<p>Despite the return type’s name, closed connections are often not an error condition
|
||||
at the application layer. Cases that might be routine include
|
||||
<a href="enum.ConnectionError.html#variant.LocallyClosed" title="variant iroh::endpoint::ConnectionError::LocallyClosed"><code>ConnectionError::LocallyClosed</code></a> and <a href="enum.ConnectionError.html#variant.ApplicationClosed" title="variant iroh::endpoint::ConnectionError::ApplicationClosed"><code>ConnectionError::ApplicationClosed</code></a>.</p>
|
||||
@@ -97,17 +97,18 @@ strong and pseudorandom, and are suitable for use as keying material.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_max_concurrent_uni_streams" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1042-1044">Source</a><h4 class="code-header">pub fn <a href="#method.set_max_concurrent_uni_streams" class="fn">set_max_concurrent_uni_streams</a>(&self, count: <a class="struct" href="struct.VarInt.html" title="struct iroh::endpoint::VarInt">VarInt</a>)</h4></section></summary><div class="docblock"><p>Modifies the number of unidirectional streams that may be concurrently opened.</p>
|
||||
<p>No streams may be opened by the peer unless fewer than <code>count</code> are already
|
||||
open. Large <code>count</code>s increase both minimum and worst-case memory consumption.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_receive_window" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1048-1050">Source</a><h4 class="code-header">pub fn <a href="#method.set_receive_window" class="fn">set_receive_window</a>(&self, receive_window: <a class="struct" href="struct.VarInt.html" title="struct iroh::endpoint::VarInt">VarInt</a>)</h4></section></summary><div class="docblock"><p>See [<code>noq_proto::TransportConfig::receive_window</code>].</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_max_concurrent_bi_streams" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1057-1059">Source</a><h4 class="code-header">pub fn <a href="#method.set_max_concurrent_bi_streams" class="fn">set_max_concurrent_bi_streams</a>(&self, count: <a class="struct" href="struct.VarInt.html" title="struct iroh::endpoint::VarInt">VarInt</a>)</h4></section></summary><div class="docblock"><p>Modifies the number of bidirectional streams that may be concurrently opened.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_receive_window" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1050-1052">Source</a><h4 class="code-header">pub fn <a href="#method.set_receive_window" class="fn">set_receive_window</a>(&self, receive_window: <a class="struct" href="struct.VarInt.html" title="struct iroh::endpoint::VarInt">VarInt</a>)</h4></section></summary><div class="docblock"><p>Sets the connection-level flow control receive window.</p>
|
||||
<p>See [<code>noq_proto::TransportConfig::receive_window</code>].</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_max_concurrent_bi_streams" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1059-1061">Source</a><h4 class="code-header">pub fn <a href="#method.set_max_concurrent_bi_streams" class="fn">set_max_concurrent_bi_streams</a>(&self, count: <a class="struct" href="struct.VarInt.html" title="struct iroh::endpoint::VarInt">VarInt</a>)</h4></section></summary><div class="docblock"><p>Modifies the number of bidirectional streams that may be concurrently opened.</p>
|
||||
<p>No streams may be opened by the peer unless fewer than <code>count</code> are already
|
||||
open. Large <code>count</code>s increase both minimum and worst-case memory consumption.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Connection" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1062-1146">Source</a><a href="#impl-Connection" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><<a class="struct" href="struct.HandshakeCompleted.html" title="struct iroh::endpoint::HandshakeCompleted">HandshakeCompleted</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.alpn" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1064-1066">Source</a><h4 class="code-header">pub fn <a href="#method.alpn" class="fn">alpn</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class="docblock"><p>Extracts the ALPN protocol from the peer’s handshake data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_id" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1076-1078">Source</a><h4 class="code-header">pub fn <a href="#method.remote_id" class="fn">remote_id</a>(&self) -> <a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a></h4></section></summary><div class="docblock"><p>Returns the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> from the peer’s TLS certificate.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Connection" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1064-1148">Source</a><a href="#impl-Connection" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><<a class="struct" href="struct.HandshakeCompleted.html" title="struct iroh::endpoint::HandshakeCompleted">HandshakeCompleted</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.alpn" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1066-1068">Source</a><h4 class="code-header">pub fn <a href="#method.alpn" class="fn">alpn</a>(&self) -> &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>] <a href="#" class="tooltip" data-notable-ty="&[u8]">ⓘ</a></h4></section></summary><div class="docblock"><p>Extracts the ALPN protocol from the peer’s handshake data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_id" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1078-1080">Source</a><h4 class="code-header">pub fn <a href="#method.remote_id" class="fn">remote_id</a>(&self) -> <a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a></h4></section></summary><div class="docblock"><p>Returns the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> from the peer’s TLS certificate.</p>
|
||||
<p>The <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> of an endpoint is also known as an <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>. This <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> is
|
||||
included in the TLS certificate presented during the handshake when connecting.
|
||||
This function allows you to get the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> of the remote endpoint of this
|
||||
connection.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.paths" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1093-1095">Source</a><h4 class="code-header">pub fn <a href="#method.paths" class="fn">paths</a>(&self) -> <a class="struct" href="struct.PathList.html" title="struct iroh::endpoint::PathList">PathList</a><'_></h4></section></summary><div class="docblock"><p>Returns the currently open network paths for this connection.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.paths" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1095-1097">Source</a><h4 class="code-header">pub fn <a href="#method.paths" class="fn">paths</a>(&self) -> <a class="struct" href="struct.PathList.html" title="struct iroh::endpoint::PathList">PathList</a><'_></h4></section></summary><div class="docblock"><p>Returns the currently open network paths for this connection.</p>
|
||||
<p>A connection typically has one path via the relay server and,
|
||||
once holepunching succeeds, a direct path. The returned
|
||||
<a href="struct.PathList.html" title="struct iroh::endpoint::PathList"><code>PathList</code></a> is a snapshot taken at call time: it does not
|
||||
@@ -116,14 +117,14 @@ already closed.</p>
|
||||
<p>To observe changes over time, see <a href="struct.Connection.html#method.paths_stream" title="method iroh::endpoint::Connection::paths_stream"><code>Connection::paths_stream</code></a>
|
||||
for a stream of <a href="struct.PathList.html" title="struct iroh::endpoint::PathList"><code>PathList</code></a> snapshots and
|
||||
<a href="struct.Connection.html#method.path_events" title="method iroh::endpoint::Connection::path_events"><code>Connection::path_events</code></a> for individual <a href="enum.PathEvent.html" title="enum iroh::endpoint::PathEvent"><code>PathEvent</code></a>s.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.paths_stream" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1106-1108">Source</a><h4 class="code-header">pub fn <a href="#method.paths_stream" class="fn">paths_stream</a>(&self) -> <a class="struct" href="struct.PathListStream.html" title="struct iroh::endpoint::PathListStream">PathListStream</a><'_></h4></section></summary><div class="docblock"><p>Returns a stream of <a href="struct.PathList.html" title="struct iroh::endpoint::PathList"><code>PathList</code></a> snapshots for this connection.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.paths_stream" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1108-1110">Source</a><h4 class="code-header">pub fn <a href="#method.paths_stream" class="fn">paths_stream</a>(&self) -> <a class="struct" href="struct.PathListStream.html" title="struct iroh::endpoint::PathListStream">PathListStream</a><'_></h4></section></summary><div class="docblock"><p>Returns a stream of <a href="struct.PathList.html" title="struct iroh::endpoint::PathList"><code>PathList</code></a> snapshots for this connection.</p>
|
||||
<p>Yields the current snapshot on the first poll, and a fresh
|
||||
snapshot whenever the open paths or the selected path change.
|
||||
Ends when the connection closes.</p>
|
||||
<p>The stream borrows this <a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a>. To consume it from a
|
||||
spawned task, move a <a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a> clone into the task and
|
||||
call this method inside.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.path_events" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1125-1127">Source</a><h4 class="code-header">pub fn <a href="#method.path_events" class="fn">path_events</a>(&self) -> <a class="struct" href="struct.PathEventStream.html" title="struct iroh::endpoint::PathEventStream">PathEventStream</a></h4></section></summary><div class="docblock"><p>Returns a stream of <a href="enum.PathEvent.html" title="enum iroh::endpoint::PathEvent"><code>PathEvent</code></a>s for this connection.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.path_events" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1127-1129">Source</a><h4 class="code-header">pub fn <a href="#method.path_events" class="fn">path_events</a>(&self) -> <a class="struct" href="struct.PathEventStream.html" title="struct iroh::endpoint::PathEventStream">PathEventStream</a></h4></section></summary><div class="docblock"><p>Returns a stream of <a href="enum.PathEvent.html" title="enum iroh::endpoint::PathEvent"><code>PathEvent</code></a>s for this connection.</p>
|
||||
<p>Each event reports one of: a path opened, a path closed (with
|
||||
final per-path statistics), the selected transmission path
|
||||
changed, or the consumer fell behind. The stream ends when the
|
||||
@@ -133,14 +134,14 @@ may be moved into a spawned task.</p>
|
||||
single <a href="enum.PathEvent.html#variant.Lagged" title="variant iroh::endpoint::PathEvent::Lagged"><code>PathEvent::Lagged</code></a>; the current state of the open
|
||||
paths and the selected path remains recoverable via
|
||||
<a href="struct.Connection.html#method.paths" title="method iroh::endpoint::Connection::paths"><code>Connection::paths</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.side" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1130-1132">Source</a><h4 class="code-header">pub fn <a href="#method.side" class="fn">side</a>(&self) -> <a class="enum" href="enum.Side.html" title="enum iroh::endpoint::Side">Side</a></h4></section></summary><div class="docblock"><p>Returns the side of the connection (client or server).</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.weak_handle" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1140-1145">Source</a><h4 class="code-header">pub fn <a href="#method.weak_handle" class="fn">weak_handle</a>(&self) -> <a class="struct" href="struct.WeakConnectionHandle.html" title="struct iroh::endpoint::WeakConnectionHandle">WeakConnectionHandle</a></h4></section></summary><div class="docblock"><p>Returns a <a href="struct.WeakConnectionHandle.html" title="struct iroh::endpoint::WeakConnectionHandle"><code>WeakConnectionHandle</code></a> for this connection.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.side" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1132-1134">Source</a><h4 class="code-header">pub fn <a href="#method.side" class="fn">side</a>(&self) -> <a class="enum" href="enum.Side.html" title="enum iroh::endpoint::Side">Side</a></h4></section></summary><div class="docblock"><p>Returns the side of the connection (client or server).</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.weak_handle" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1142-1147">Source</a><h4 class="code-header">pub fn <a href="#method.weak_handle" class="fn">weak_handle</a>(&self) -> <a class="struct" href="struct.WeakConnectionHandle.html" title="struct iroh::endpoint::WeakConnectionHandle">WeakConnectionHandle</a></h4></section></summary><div class="docblock"><p>Returns a <a href="struct.WeakConnectionHandle.html" title="struct iroh::endpoint::WeakConnectionHandle"><code>WeakConnectionHandle</code></a> for this connection.</p>
|
||||
<p>A <a href="struct.WeakConnectionHandle.html" title="struct iroh::endpoint::WeakConnectionHandle"><code>WeakConnectionHandle</code></a> does not keep the connection alive. It can be used to
|
||||
wait for the connection to be closed via <a href="struct.WeakConnectionHandle.html#method.closed" title="method iroh::endpoint::WeakConnectionHandle::closed"><code>WeakConnectionHandle::closed</code></a> and to
|
||||
attempt to upgrade back to a strong <a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a> via
|
||||
<a href="struct.WeakConnectionHandle.html#method.upgrade" title="method iroh::endpoint::WeakConnectionHandle::upgrade"><code>WeakConnectionHandle::upgrade</code></a>.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Connection%3CIncomingZeroRtt%3E" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1148-1181">Source</a><a href="#impl-Connection%3CIncomingZeroRtt%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><<a class="struct" href="struct.IncomingZeroRtt.html" title="struct iroh::endpoint::IncomingZeroRtt">IncomingZeroRtt</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.alpn-1" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1150-1152">Source</a><h4 class="code-header">pub fn <a href="#method.alpn-1" class="fn">alpn</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>></h4></section></summary><div class="docblock"><p>Extracts the ALPN protocol from the peer’s handshake data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.handshake_completed" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1166-1168">Source</a><h4 class="code-header">pub async fn <a href="#method.handshake_completed" class="fn">handshake_completed</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a>, <a class="enum" href="enum.ConnectingError.html" title="enum iroh::endpoint::ConnectingError">ConnectingError</a>></h4></section></summary><div class="docblock"><p>Waits until the full handshake occurs and then returns a <a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a>.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Connection%3CIncomingZeroRtt%3E" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1150-1183">Source</a><a href="#impl-Connection%3CIncomingZeroRtt%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><<a class="struct" href="struct.IncomingZeroRtt.html" title="struct iroh::endpoint::IncomingZeroRtt">IncomingZeroRtt</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.alpn-1" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1152-1154">Source</a><h4 class="code-header">pub fn <a href="#method.alpn-1" class="fn">alpn</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>></h4></section></summary><div class="docblock"><p>Extracts the ALPN protocol from the peer’s handshake data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.handshake_completed" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1168-1170">Source</a><h4 class="code-header">pub async fn <a href="#method.handshake_completed" class="fn">handshake_completed</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a>, <a class="enum" href="enum.ConnectingError.html" title="enum iroh::endpoint::ConnectingError">ConnectingError</a>></h4></section></summary><div class="docblock"><p>Waits until the full handshake occurs and then returns a <a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a>.</p>
|
||||
<p>This may fail with <a href="enum.ConnectingError.html#variant.ConnectionError" title="variant iroh::endpoint::ConnectingError::ConnectionError"><code>ConnectingError::ConnectionError</code></a>, if there was
|
||||
some general failure with the connection, such as a network timeout since
|
||||
we accepted the connection.</p>
|
||||
@@ -149,18 +150,18 @@ doesn’t use the right TLS authentication, which usually every iroh endpoint
|
||||
uses and requires.</p>
|
||||
<p>Thus, those errors should only occur if someone connects to you with a
|
||||
modified iroh endpoint or with a plain QUIC client.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_id-1" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1178-1180">Source</a><h4 class="code-header">pub fn <a href="#method.remote_id-1" class="fn">remote_id</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>, <a class="struct" href="struct.RemoteEndpointIdError.html" title="struct iroh::endpoint::RemoteEndpointIdError">RemoteEndpointIdError</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> from the peer’s TLS certificate.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_id-1" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1180-1182">Source</a><h4 class="code-header">pub fn <a href="#method.remote_id-1" class="fn">remote_id</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>, <a class="struct" href="struct.RemoteEndpointIdError.html" title="struct iroh::endpoint::RemoteEndpointIdError">RemoteEndpointIdError</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> from the peer’s TLS certificate.</p>
|
||||
<p>The <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> of an endpoint is also known as an <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>. This <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> is
|
||||
included in the TLS certificate presented during the handshake when connecting.
|
||||
This function allows you to get the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> of the remote endpoint of this
|
||||
connection.</p>
|
||||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Connection%3COutgoingZeroRtt%3E" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1183-1223">Source</a><a href="#impl-Connection%3COutgoingZeroRtt%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><<a class="struct" href="struct.OutgoingZeroRtt.html" title="struct iroh::endpoint::OutgoingZeroRtt">OutgoingZeroRtt</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.alpn-2" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1185-1187">Source</a><h4 class="code-header">pub fn <a href="#method.alpn-2" class="fn">alpn</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>></h4></section></summary><div class="docblock"><p>Extracts the ALPN protocol from the peer’s handshake data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.handshake_completed-1" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1208-1210">Source</a><h4 class="code-header">pub async fn <a href="#method.handshake_completed-1" class="fn">handshake_completed</a>(
|
||||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Connection%3COutgoingZeroRtt%3E" class="impl"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1185-1225">Source</a><a href="#impl-Connection%3COutgoingZeroRtt%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a><<a class="struct" href="struct.OutgoingZeroRtt.html" title="struct iroh::endpoint::OutgoingZeroRtt">OutgoingZeroRtt</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.alpn-2" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1187-1189">Source</a><h4 class="code-header">pub fn <a href="#method.alpn-2" class="fn">alpn</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>></h4></section></summary><div class="docblock"><p>Extracts the ALPN protocol from the peer’s handshake data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.handshake_completed-1" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1210-1212">Source</a><h4 class="code-header">pub async fn <a href="#method.handshake_completed-1" class="fn">handshake_completed</a>(
|
||||
&self,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="enum.ZeroRttStatus.html" title="enum iroh::endpoint::ZeroRttStatus">ZeroRttStatus</a>, <a class="enum" href="enum.ConnectingError.html" title="enum iroh::endpoint::ConnectingError">ConnectingError</a>></h4></section></summary><div class="docblock"><p>Waits until the full handshake occurs and returns a <a href="enum.ZeroRttStatus.html" title="enum iroh::endpoint::ZeroRttStatus"><code>ZeroRttStatus</code></a>.</p>
|
||||
<p>If <code>ZeroRttStatus::Accepted</code> is returned, than any streams created before
|
||||
<p>If <code>ZeroRttStatus::Accepted</code> is returned, then any streams created before
|
||||
the handshake has completed can still be used.</p>
|
||||
<p>If <code>ZeroRttStatus::Rejected</code> is returned, than any streams created before
|
||||
<p>If <code>ZeroRttStatus::Rejected</code> is returned, then any streams created before
|
||||
the handshake will error and any data sent should be re-sent on a
|
||||
new stream.</p>
|
||||
<p>This may fail with <a href="enum.ConnectingError.html#variant.ConnectionError" title="variant iroh::endpoint::ConnectingError::ConnectionError"><code>ConnectingError::ConnectionError</code></a>, if there was
|
||||
@@ -171,7 +172,7 @@ doesn’t use the right TLS authentication, which usually every iroh endpoint
|
||||
uses and requires.</p>
|
||||
<p>Thus, those errors should only occur if someone connects to you with a
|
||||
modified iroh endpoint or with a plain QUIC client.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_id-2" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1220-1222">Source</a><h4 class="code-header">pub fn <a href="#method.remote_id-2" class="fn">remote_id</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>, <a class="struct" href="struct.RemoteEndpointIdError.html" title="struct iroh::endpoint::RemoteEndpointIdError">RemoteEndpointIdError</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> from the peer’s TLS certificate.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_id-2" class="method"><a class="src rightside" href="../../src/iroh/endpoint/connection.rs.html#1222-1224">Source</a><h4 class="code-header">pub fn <a href="#method.remote_id-2" class="fn">remote_id</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>, <a class="struct" href="struct.RemoteEndpointIdError.html" title="struct iroh::endpoint::RemoteEndpointIdError">RemoteEndpointIdError</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> from the peer’s TLS certificate.</p>
|
||||
<p>The <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> of an endpoint is also known as an <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>. This <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> is
|
||||
included in the TLS certificate presented during the handshake when connecting.
|
||||
This function allows you to get the <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> of the remote endpoint of this
|
||||
|
||||
@@ -13,7 +13,7 @@ behaviour.</p>
|
||||
<a href="struct.Endpoint.html#method.connect" title="method iroh::endpoint::Endpoint::connect"><code>Endpoint::connect</code></a> and <a href="struct.Endpoint.html#method.accept" title="method iroh::endpoint::Endpoint::accept"><code>Endpoint::accept</code></a> methods. Once established, the
|
||||
<a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a> gives access to most <a href="https://quicwg.org">QUIC</a> features. Individual streams to send data to
|
||||
the peer are created using the <a href="struct.Connection.html#method.open_bi" title="method iroh::endpoint::Connection::open_bi"><code>Connection::open_bi</code></a>, <a href="struct.Connection.html#method.accept_bi" title="method iroh::endpoint::Connection::accept_bi"><code>Connection::accept_bi</code></a>,
|
||||
<a href="struct.Connection.html#method.open_uni" title="method iroh::endpoint::Connection::open_uni"><code>Connection::open_uni</code></a> and <a href="struct.Connection.html#method.open_bi" title="method iroh::endpoint::Connection::open_bi"><code>Connection::open_bi</code></a> functions.</p>
|
||||
<a href="struct.Connection.html#method.open_uni" title="method iroh::endpoint::Connection::open_uni"><code>Connection::open_uni</code></a> and <a href="struct.Connection.html#method.accept_uni" title="method iroh::endpoint::Connection::accept_uni"><code>Connection::accept_uni</code></a> functions.</p>
|
||||
<p>Note that due to the light-weight properties of streams a stream will only be accepted
|
||||
once the initiating peer has sent some data on it.</p>
|
||||
<h2 id="usage-on-android"><a class="doc-anchor" href="#usage-on-android">§</a>Usage on Android</h2>
|
||||
@@ -22,7 +22,7 @@ through JNI, which needs a JVM context published to <a href="https://docs.rs/ndk
|
||||
must initialize that context before constructing the endpoint, or the
|
||||
resolver build panics. See <a href="../dns/struct.DnsResolver.html" title="struct iroh::dns::DnsResolver"><code>DnsResolver</code></a> for the supported
|
||||
initialization paths.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Endpoint" class="impl"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#906-1726">Source</a><a href="#impl-Endpoint" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.builder" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#914-916">Source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fn">builder</a>(preset: impl <a class="trait" href="presets/trait.Preset.html" title="trait iroh::endpoint::presets::Preset">Preset</a>) -> <a class="struct" href="struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Returns the builder for an <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>, with the given <a href="presets/trait.Preset.html" title="trait iroh::endpoint::presets::Preset"><code>Preset</code></a> configuration.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Endpoint" class="impl"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#906-1728">Source</a><a href="#impl-Endpoint" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.builder" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#914-916">Source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fn">builder</a>(preset: impl <a class="trait" href="presets/trait.Preset.html" title="trait iroh::endpoint::presets::Preset">Preset</a>) -> <a class="struct" href="struct.Builder.html" title="struct iroh::endpoint::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Returns the builder for an <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>, with the given <a href="presets/trait.Preset.html" title="trait iroh::endpoint::presets::Preset"><code>Preset</code></a> configuration.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bind" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#919-921">Source</a><h4 class="code-header">pub async fn <a href="#method.bind" class="fn">bind</a>(preset: impl <a class="trait" href="presets/trait.Preset.html" title="trait iroh::endpoint::presets::Preset">Preset</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, <a class="enum" href="enum.BindError.html" title="enum iroh::endpoint::BindError">BindError</a>></h4></section></summary><div class="docblock"><p>Constructs a default <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> using the provided <a href="presets/trait.Preset.html" title="trait iroh::endpoint::presets::Preset"><code>Preset</code></a> and binds it immediately.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_alpns" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#930-939">Source</a><h4 class="code-header">pub fn <a href="#method.set_alpns" class="fn">set_alpns</a>(&self, alpns: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>>)</h4></section></summary><div class="docblock"><p>Sets the list of accepted ALPN protocols.</p>
|
||||
<p>This will only affect new incoming connections.
|
||||
@@ -117,8 +117,8 @@ changes.</p>
|
||||
understand if the endpoint has ever been considered “online”. But after
|
||||
that initial call to <a href="struct.Endpoint.html#method.online" title="method iroh::endpoint::Endpoint::online"><code>Endpoint::online</code></a>, to understand if your
|
||||
endpoint is no longer able to be connected to by endpoints outside
|
||||
of the private or local network, watch for changes in it’s <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a>.
|
||||
If there are no <code>addrs</code>in the <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a>, you may not be dialable by other endpoints
|
||||
of the private or local network, watch for changes in its <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a>.
|
||||
If there are no <code>addrs</code> in the <a href="../struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a>, you may not be dialable by other endpoints
|
||||
on the internet.</p>
|
||||
<p>The <code>EndpointAddr</code> will change as:</p>
|
||||
<ul>
|
||||
@@ -146,7 +146,7 @@ tokio::spawn(endpoint_closed.run_until(<span class="kw">async move </span>{
|
||||
}));
|
||||
<span class="comment">// Do fancy things, then close the endpoint.
|
||||
// Our task above will stop even if there are still clones of `Endpoint` alive somewhere.
|
||||
</span>endpoint.close().<span class="kw">await</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.online" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1317-1332">Source</a><h4 class="code-header">pub async fn <a href="#method.online" class="fn">online</a>(&self)</h4></section></summary><div class="docblock"><p>A convenience method that waits for the endpoint to be considered “online”.</p>
|
||||
</span>endpoint.close().<span class="kw">await</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.online" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1319-1334">Source</a><h4 class="code-header">pub async fn <a href="#method.online" class="fn">online</a>(&self)</h4></section></summary><div class="docblock"><p>A convenience method that waits for the endpoint to be considered “online”.</p>
|
||||
<p>This currently means at least one relay server has completed its
|
||||
connection handshake (i.e. the endpoint is registered and reachable
|
||||
via that relay). Merely selecting a relay URL is not sufficient.</p>
|
||||
@@ -167,49 +167,45 @@ entirely.</p>
|
||||
<p>The online method does not interact with <a href="../address_lookup/trait.AddressLookup.html" title="trait iroh::address_lookup::AddressLookup"><code>crate::address_lookup::AddressLookup</code></a>
|
||||
services, which means that any Address Lookup that relies on a WAN
|
||||
connection is independent of the endpoint’s online status.</p>
|
||||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5><div class="example-wrap"><pre class="language-no"><code>use iroh::Endpoint;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// After this await returns, the endpoint is bound to a local socket.
|
||||
// It can be dialed, but almost certainly hasn't finished picking a
|
||||
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="comment">// After this await returns, the endpoint is bound to a local socket.
|
||||
// It can be dialed, but almost certainly hasn't finished picking a
|
||||
// relay.
|
||||
let endpoint = Endpoint::bind().await;
|
||||
</span><span class="kw">let </span>endpoint = Endpoint::bind(presets::N0).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
|
||||
// After this await returns we have a connection to at least one relay
|
||||
<span class="comment">// After this await returns we have a connection to at least one relay
|
||||
// and holepunching should work as expected.
|
||||
endpoint.online().await;
|
||||
}</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay_status" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1346-1348">Source</a><h4 class="code-header">pub fn <a href="#method.home_relay_status" class="fn">home_relay_status</a>(
|
||||
</span>endpoint.online().<span class="kw">await</span>;</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay_status" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1348-1350">Source</a><h4 class="code-header">pub fn <a href="#method.home_relay_status" class="fn">home_relay_status</a>(
|
||||
&self,
|
||||
) -> impl <a class="trait" href="../trait.Watcher.html" title="trait iroh::Watcher">Watcher</a><Value = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="struct.RelayStatus.html" title="struct iroh::endpoint::RelayStatus">RelayStatus</a>>> + use<></h4></section></summary><div class="docblock"><p>Returns a <a href="../trait.Watcher.html" title="trait iroh::Watcher"><code>Watcher</code></a> over the connection status of the endpoint’s home relays.</p>
|
||||
<p>The watched value has one entry per home relay whose URL is known,
|
||||
and is empty when no relays are configured or before the endpoint has
|
||||
selected one the home relay from the list of configured relays.
|
||||
selected a home relay from the list of configured relays.
|
||||
The watcher updates whenever any home relay’s connection status changes.
|
||||
See <a href="struct.RelayStatus.html" title="struct iroh::endpoint::RelayStatus"><code>RelayStatus</code></a> for the information available on each entry.</p>
|
||||
<p>The returned watcher only becomes disconnected once the last clone of
|
||||
the <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> is dropped. Closing the endpoint does not disconnect
|
||||
the watcher. To stop a task once the endpoint stops, combine with
|
||||
<a href="struct.Endpoint.html#method.closed" title="method iroh::endpoint::Endpoint::closed"><code>Self::closed</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1406-1412">Source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1408-1414">Source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> always binds on an IPv4 address and also tries to bind on an IPv6
|
||||
address if available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1426-1431">Source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="../dns/struct.DnsResolver.html" title="struct iroh::dns::DnsResolver">DnsResolver</a>, <a class="enum" href="enum.EndpointError.html" title="enum iroh::endpoint::EndpointError">EndpointError</a>></h4></section><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></summary><div class="docblock"><p>Returns the DNS resolver used in this <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1428-1433">Source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="../dns/struct.DnsResolver.html" title="struct iroh::dns::DnsResolver">DnsResolver</a>, <a class="enum" href="enum.EndpointError.html" title="enum iroh::endpoint::EndpointError">EndpointError</a>></h4></section><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span></summary><div class="docblock"><p>Returns the DNS resolver used in this <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||||
<p>Returns an <code>EndpointError::Closed</code> error if the endpoint is closed.</p>
|
||||
<p>See <a href="struct.Builder.html#method.dns_resolver" title="method iroh::endpoint::Builder::dns_resolver"><code>Builder::dns_resolver</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.tls_config" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1443-1445">Source</a><h4 class="code-header">pub fn <a href="#method.tls_config" class="fn">tls_config</a>(&self) -> &ClientConfig</h4></section></summary><div class="docblock"><p>Returns the [<code>rustls::ClientConfig</code>] used by the endpoint for connecting to external services.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.tls_config" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1445-1447">Source</a><h4 class="code-header">pub fn <a href="#method.tls_config" class="fn">tls_config</a>(&self) -> &ClientConfig</h4></section></summary><div class="docblock"><p>Returns the [<code>rustls::ClientConfig</code>] used by the endpoint for connecting to external services.</p>
|
||||
<p>This might be useful for address lookup services or other functions
|
||||
that want to use the same trust anchors as iroh does for verifying the
|
||||
validity of TLS certificates presented by external services.</p>
|
||||
<p>Note that this TLS config is unrelated to how iroh validates the authenticity
|
||||
of iroh connections itself.</p>
|
||||
<p>The config is based on the trust anchors set via <a href="struct.Builder.html#method.ca_tls_config" title="method iroh::endpoint::Builder::ca_tls_config"><code>Builder::ca_tls_config</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.address_lookup" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1454-1459">Source</a><h4 class="code-header">pub fn <a href="#method.address_lookup" class="fn">address_lookup</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="../address_lookup/struct.AddressLookupServices.html" title="struct iroh::address_lookup::AddressLookupServices">AddressLookupServices</a>, <a class="enum" href="enum.EndpointError.html" title="enum iroh::endpoint::EndpointError">EndpointError</a>></h4></section></summary><div class="docblock"><p>Returns the Address Lookup service, if configured.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.address_lookup" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1456-1461">Source</a><h4 class="code-header">pub fn <a href="#method.address_lookup" class="fn">address_lookup</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&<a class="struct" href="../address_lookup/struct.AddressLookupServices.html" title="struct iroh::address_lookup::AddressLookupServices">AddressLookupServices</a>, <a class="enum" href="enum.EndpointError.html" title="enum iroh::endpoint::EndpointError">EndpointError</a>></h4></section></summary><div class="docblock"><p>Returns the Address Lookup service, if configured.</p>
|
||||
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
|
||||
<p>Returns a <code>EndpointError::Closed</code> error if the endpoint is closed.</p>
|
||||
<p>See <a href="struct.Builder.html#method.address_lookup" title="method iroh::endpoint::Builder::address_lookup"><code>Builder::address_lookup</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.metrics" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1572-1574">Source</a><h4 class="code-header">pub fn <a href="#method.metrics" class="fn">metrics</a>(&self) -> &<a class="struct" href="../metrics/struct.EndpointMetrics.html" title="struct iroh::metrics::EndpointMetrics">EndpointMetrics</a></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>metrics</code></strong> only.</div></span></summary><div class="docblock"><p>Returns metrics collected for this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.metrics" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1574-1576">Source</a><h4 class="code-header">pub fn <a href="#method.metrics" class="fn">metrics</a>(&self) -> &<a class="struct" href="../metrics/struct.EndpointMetrics.html" title="struct iroh::metrics::EndpointMetrics">EndpointMetrics</a></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>metrics</code></strong> only.</div></span></summary><div class="docblock"><p>Returns metrics collected for this endpoint.</p>
|
||||
<p>The endpoint internally collects various metrics about its operation.
|
||||
The returned <a href="../metrics/struct.EndpointMetrics.html" title="struct iroh::metrics::EndpointMetrics"><code>EndpointMetrics</code></a> struct contains all of these metrics.</p>
|
||||
<p>You can access individual metrics directly by using the public fields:</p>
|
||||
@@ -275,13 +271,13 @@ registry.write().unwrap().register_all(endpoint.metrics());
|
||||
</span>.std_context(<span class="string">"text"</span>)<span class="question-mark">?</span>;
|
||||
|
||||
<span class="macro">assert!</span>(res.contains(<span class="string">r#"TYPE socket_recv_datagrams counter"#</span>));
|
||||
<span class="macro">assert!</span>(res.contains(<span class="string">r#"socket_recv_datagrams_total 0"#</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1584-1589">Source</a><h4 class="code-header">pub async fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, endpoint_id: <a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.RemoteInfo.html" title="struct iroh::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns addressing information about a recently used remote endpoint.</p>
|
||||
<span class="macro">assert!</span>(res.contains(<span class="string">r#"socket_recv_datagrams_total 0"#</span>));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1586-1591">Source</a><h4 class="code-header">pub async fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, endpoint_id: <a class="type" href="../type.EndpointId.html" title="type iroh::EndpointId">EndpointId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.RemoteInfo.html" title="struct iroh::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns addressing information about a recently used remote endpoint.</p>
|
||||
<p>The returned <a href="struct.RemoteInfo.html" title="struct iroh::endpoint::RemoteInfo"><code>RemoteInfo</code></a> contains a list of all transport addresses for the remote
|
||||
that we know about. This is a snapshot in time and not a watcher.</p>
|
||||
<p>Returns <code>None</code> if the endpoint doesn’t have information about the remote or if the endpoint is closed.
|
||||
When remote endpoints are no longer used, our endpoint will keep information around
|
||||
for a little while, and then drop it. Afterwards, this will return <code>None</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1605-1611">Source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1607-1613">Source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
<p>On many systems iroh is able to detect network changes by itself, however
|
||||
some systems like android do not expose this functionality to native code.
|
||||
Android does however provide this functionality to Java code. This
|
||||
@@ -290,14 +286,14 @@ this.</p>
|
||||
<p>Even when the network did not change, or iroh was already able to detect
|
||||
the network change itself, there is no harm in calling this function.</p>
|
||||
<p>If the endpoint is closed, this method will log a warning and ignore the request.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data_for_address_lookup" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1625-1631">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data_for_address_lookup" class="fn">set_user_data_for_address_lookup</a>(&self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the initial user-defined data to be published in Address Lookups for this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data_for_address_lookup" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1627-1633">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data_for_address_lookup" class="fn">set_user_data_for_address_lookup</a>(&self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the initial user-defined data to be published in Address Lookups for this endpoint.</p>
|
||||
<p>If the user-defined data passed to this function is different to the previous one,
|
||||
the endpoint will republish its endpoint info to the configured Address Lookups.</p>
|
||||
<p>See also <a href="struct.Builder.html#method.user_data_for_address_lookup" title="method iroh::endpoint::Builder::user_data_for_address_lookup"><code>Builder::user_data_for_address_lookup</code></a> for setting an initial value when
|
||||
building the endpoint.</p>
|
||||
<p>If the endpoint is closed, this method will log a warning and ignore the
|
||||
request.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1667-1669">Source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(&self)</h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the socket.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1669-1671">Source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(&self)</h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the socket.</p>
|
||||
<p>This will close any remaining open <a href="struct.Connection.html" title="struct iroh::endpoint::Connection"><code>Connection</code></a>s with an error code
|
||||
of <code>0</code> and an empty reason. Though it is best practice to close those
|
||||
explicitly before with a custom error code and reason.</p>
|
||||
@@ -322,9 +318,9 @@ sockets. This is due to QUIC and its acknowledgments being implemented in user-l
|
||||
while TCP sockets usually get closed and drained by the operating system in the
|
||||
kernel during the “Time-Wait” period of the TCP socket.</p>
|
||||
<p>Be aware however that the underlying UDP sockets are only closed once all clones of
|
||||
the the respective <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> are dropped.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_closed" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1672-1674">Source</a><h4 class="code-header">pub fn <a href="#method.is_closed" class="fn">is_closed</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Check if this endpoint is still alive, or already closed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.closed" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1696-1700">Source</a><h4 class="code-header">pub fn <a href="#method.closed" class="fn">closed</a>(&self) -> <a class="struct" href="struct.EndpointClosed.html" title="struct iroh::endpoint::EndpointClosed">EndpointClosed</a> <a href="#" class="tooltip" data-notable-ty="EndpointClosed">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a future that resolves once the endpoint closes.</p>
|
||||
the respective <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> are dropped.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_closed" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1674-1676">Source</a><h4 class="code-header">pub fn <a href="#method.is_closed" class="fn">is_closed</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Check if this endpoint is still alive, or already closed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.closed" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1698-1702">Source</a><h4 class="code-header">pub fn <a href="#method.closed" class="fn">closed</a>(&self) -> <a class="struct" href="struct.EndpointClosed.html" title="struct iroh::endpoint::EndpointClosed">EndpointClosed</a> <a href="#" class="tooltip" data-notable-ty="EndpointClosed">ⓘ</a></h4></section></summary><div class="docblock"><p>Returns a future that resolves once the endpoint closes.</p>
|
||||
<p>The returned future does not contain a clone or reference to the <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>,
|
||||
so keeping the returned future alive does not prevent the endpoint from being dropped.</p>
|
||||
<p>To run a task and stop it once the endpoint closes, you can use
|
||||
@@ -333,7 +329,7 @@ so keeping the returned future alive does not prevent the endpoint from being dr
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>endpoint = Endpoint::bind(presets::N0).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
tokio::spawn(endpoint.closed().run_until(<span class="kw">async move </span>{
|
||||
<span class="comment">// the future will be aborted once the endpoint closes.
|
||||
</span>}));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.create_server_config_builder" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1706-1709">Source</a><h4 class="code-header">pub fn <a href="#method.create_server_config_builder" class="fn">create_server_config_builder</a>(
|
||||
</span>}));</code></pre></div></div></details><details class="toggle method-toggle" open><summary><section id="method.create_server_config_builder" class="method"><a class="src rightside" href="../../src/iroh/endpoint.rs.html#1708-1711">Source</a><h4 class="code-header">pub fn <a href="#method.create_server_config_builder" class="fn">create_server_config_builder</a>(
|
||||
&self,
|
||||
alpns: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>>,
|
||||
) -> <a class="struct" href="struct.ServerConfigBuilder.html" title="struct iroh::endpoint::ServerConfigBuilder">ServerConfigBuilder</a></h4></section></summary><div class="docblock"><p>Create a <a href="struct.ServerConfigBuilder.html" title="struct iroh::endpoint::ServerConfigBuilder"><code>ServerConfigBuilder</code></a> for this endpoint that includes the given alpns.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -136,7 +136,7 @@ enable multipath as well.</p>
|
||||
<p>If the path is idle for this long the path will be abandoned. Bear in mind this will
|
||||
interact with the <a href="struct.QuicTransportConfigBuilder.html#method.max_idle_timeout" title="method iroh::endpoint::QuicTransportConfigBuilder::max_idle_timeout"><code>QuicTransportConfigBuilder::max_idle_timeout</code></a>, if the last path is
|
||||
abandoned the entire connection will be closed.</p>
|
||||
<p>Note: values higher than [<code>PATH_MAX_IDLE_TIMEOUT</code>] are clamped and a warning is logged.</p>
|
||||
<p>Note: values higher than <code>PATH_MAX_IDLE_TIMEOUT</code> (15 seconds) are clamped and a warning is logged.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_path_keep_alive_interval" class="method"><a class="src rightside" href="../../src/iroh/endpoint/quic.rs.html#513-523">Source</a><h4 class="code-header">pub fn <a href="#method.default_path_keep_alive_interval" class="fn">default_path_keep_alive_interval</a>(self, interval: <a class="struct" href="https://doc.rust-lang.org/nightly/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> Self</h4></section></summary><div class="docblock"><p>Sets a default per-path keep alive interval.</p>
|
||||
<p>Note that this does not interact with the connection-wide
|
||||
<a href="struct.QuicTransportConfigBuilder.html#method.keep_alive_interval" title="method iroh::endpoint::QuicTransportConfigBuilder::keep_alive_interval"><code>QuicTransportConfigBuilder::keep_alive_interval</code></a>. This setting will keep this path active,
|
||||
|
||||
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
@@ -17,7 +17,7 @@
|
||||
<p>For each hook, all installed hooks are invoked in the order they were installed on
|
||||
the endpoint builder. If a hook returns <code>Accept</code>, processing continues with the next
|
||||
hook. If a hook returns <code>Reject</code>, processing is aborted and further hooks
|
||||
are not invoked for this hook.</p>
|
||||
are not invoked for this hook point.</p>
|
||||
<h3 id="notes-to-implementers"><a class="doc-anchor" href="#notes-to-implementers">§</a>Notes to implementers</h3>
|
||||
<p>As hooks are stored on the endpoint, you must make sure to never store an <a href="struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a>
|
||||
on the hook struct itself, as this would create reference counting loop and cause the
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Support for handling DNS resource records for dialing by `EndpointId`."><title>iroh::endpoint_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module endpoint_info</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module endpoint_<wbr>info</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>endpoint_<wbr>info</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_dns/lib.rs.html#13">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support for handling DNS resource records for dialing by <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>.</p>
|
||||
<p>Dialing by <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> is supported by iroh endpoints publishing <a href="https://app.pkarr.org">Pkarr</a> records to DNS
|
||||
servers or the Mainline DHT. This module supports creating and parsing these records.</p>
|
||||
<p><a href="../address_lookup/struct.EndpointInfo.html" title="struct iroh::address_lookup::EndpointInfo"><code>EndpointInfo</code></a> combines an <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>iroh_base::EndpointId</code></a> with <a href="../address_lookup/struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData"><code>EndpointData</code></a> —
|
||||
<p><a href="../address_lookup/struct.EndpointInfo.html" title="struct iroh::address_lookup::EndpointInfo"><code>EndpointInfo</code></a> combines an <a href="../type.EndpointId.html" title="type iroh::EndpointId"><code>iroh_base::EndpointId</code></a> with <a href="../address_lookup/struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData"><code>EndpointData</code></a>:
|
||||
the addressing and metadata that discovery services publish and resolve.
|
||||
Discovery services use <a href="../address_lookup/struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter"><code>AddrFilter</code></a> to control which addresses are published.</p>
|
||||
<p>This module also provides serialization to and from pkarr signed packets and
|
||||
DNS TXT records. See the [<code>crate::attrs</code>] module for the on-the-wire format.</p>
|
||||
DNS TXT records.</p>
|
||||
<p>DNS records are published under the following names:</p>
|
||||
<p><code>_iroh.<z32-endpoint-id>.<origin-domain> TXT</code></p>
|
||||
<ul>
|
||||
@@ -36,4 +36,4 @@ Each address is an IPv4 or IPv6 address with a port.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.AddrFilter.html" title="struct iroh::endpoint_info::AddrFilter">Addr<wbr>Filter</a></dt><dd>A filter and/or reordering function applied to transport addresses,
|
||||
typically used by AddressLookup services in iroh before publishing.</dd><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh::endpoint_info::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh::endpoint_info::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.MaxLengthExceededError.html" title="struct iroh::endpoint_info::MaxLengthExceededError">MaxLength<wbr>Exceeded<wbr>Error</a></dt><dd>Error returned when an input value is too long for <a href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh::endpoint_info::UserData">User<wbr>Data</a></dt><dd>Under the hood this is a UTF-8 String is no longer than <a href="../address_lookup/struct.UserData.html#associatedconstant.MAX_LENGTH" title="associated constant iroh::address_lookup::UserData::MAX_LENGTH"><code>UserData::MAX_LENGTH</code></a> bytes.</dd></dl></section></div></main></body></html>
|
||||
typically used by AddressLookup services in iroh before publishing.</dd><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh::endpoint_info::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh::endpoint_info::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.MaxLengthExceededError.html" title="struct iroh::endpoint_info::MaxLengthExceededError">MaxLength<wbr>Exceeded<wbr>Error</a></dt><dd>Error returned when an input value is too long for <a href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh::endpoint_info::UserData">User<wbr>Data</a></dt><dd>User-defined data that can be published and resolved through endpoint discovery.</dd></dl></section></div></main></body></html>
|
||||
@@ -13,15 +13,15 @@ services, should they not fit into e.g. a single DNS packet otherwise.</p>
|
||||
<p>See also <a href="../address_lookup/struct.EndpointData.html#method.set_user_data" title="method iroh::address_lookup::EndpointData::set_user_data"><code>Self::set_user_data</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_relay_url" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#111">Source</a><h4 class="code-header">pub fn <a href="#method.add_relay_url" class="fn">add_relay_url</a>(&mut self, relay_url: <a class="struct" href="../struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>)</h4></section></summary><div class="docblock"><p>Adds the relay URL to the end of the endpoint data, unless it already existed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#119">Source</a><h4 class="code-header">pub fn <a href="#method.add_ip_addrs" class="fn">add_ip_addrs</a>(&mut self, addresses: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses in order with duplicates or already existing addresses filtered out.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#124">Source</a><h4 class="code-header">pub fn <a href="#method.add_addrs" class="fn">add_addrs</a>(&mut self, addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses to the endpoint data in the given ordered, but with duplicates filtered.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#135">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data" class="fn">set_user_data</a>(&mut self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the user-defined data and returns the updated endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#124">Source</a><h4 class="code-header">pub fn <a href="#method.add_addrs" class="fn">add_addrs</a>(&mut self, addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses to the endpoint data in the given order, but with duplicates filtered.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#135">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data" class="fn">set_user_data</a>(&mut self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the user-defined data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#140">Source</a><h4 class="code-header">pub fn <a href="#method.clear_ip_addrs" class="fn">clear_ip_addrs</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all direct addresses from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#146">Source</a><h4 class="code-header">pub fn <a href="#method.clear_relay_urls" class="fn">clear_relay_urls</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all direct addresses from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#146">Source</a><h4 class="code-header">pub fn <a href="#method.clear_relay_urls" class="fn">clear_relay_urls</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all relay URLs from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#152">Source</a><h4 class="code-header">pub fn <a href="#method.relay_urls" class="fn">relay_urls</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="struct" href="../struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the relay URL of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#160">Source</a><h4 class="code-header">pub fn <a href="#method.user_data" class="fn">user_data</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="../address_lookup/struct.UserData.html" title="struct iroh::address_lookup::UserData">UserData</a>></h4></section></summary><div class="docblock"><p>Returns the optional user-defined data of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#165">Source</a><h4 class="code-header">pub fn <a href="#method.ip_addrs" class="fn">ip_addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns the direct addresses of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Does this have any addresses?</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns whether this has any addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.filtered_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#185">Source</a><h4 class="code-header">pub fn <a href="#method.filtered_addrs" class="fn">filtered_addrs</a>(&self, filter: &<a class="struct" href="../address_lookup/struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="../enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>></h4></section></summary><div class="docblock"><p>Apply the given filter to the current addresses.</p>
|
||||
<p>Returns a vec to allow re-ordering of addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.apply_filter" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#190">Source</a><h4 class="code-header">pub fn <a href="#method.apply_filter" class="fn">apply_filter</a>(&self, filter: &<a class="struct" href="../address_lookup/struct.AddrFilter.html" title="struct iroh::address_lookup::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="../address_lookup/struct.EndpointData.html" title="struct iroh::address_lookup::EndpointData">EndpointData</a>></h4></section></summary><div class="docblock"><p>Returns the <code>EndpointData</code> with given filter applied.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,8 +3,8 @@
|
||||
Ip(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>),
|
||||
Custom(<a class="struct" href="../iroh_base/endpoint_addr/struct.CustomAddr.html" title="struct iroh_base::endpoint_addr::CustomAddr">CustomAddr</a>),
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Available address types.</p>
|
||||
</div></details><h2 id="variants" class="variants section-header">Variants (Non-exhaustive)<a href="#variants" class="anchor">§</a></h2><details class="toggle non-exhaustive"><summary class="hideme"><span>This enum is marked as non-exhaustive</span></summary><div class="docblock">Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.</div></details><div class="variants"><section id="variant.Relay" class="variant"><a href="#variant.Relay" class="anchor">§</a><h3 class="code-header">Relay(<a class="struct" href="struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>)</h3></section><div class="docblock"><p>Relays</p>
|
||||
</div><section id="variant.Ip" class="variant"><a href="#variant.Ip" class="anchor">§</a><h3 class="code-header">Ip(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>)</h3></section><div class="docblock"><p>IP based addresses</p>
|
||||
</div></details><h2 id="variants" class="variants section-header">Variants (Non-exhaustive)<a href="#variants" class="anchor">§</a></h2><details class="toggle non-exhaustive"><summary class="hideme"><span>This enum is marked as non-exhaustive</span></summary><div class="docblock">Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.</div></details><div class="variants"><section id="variant.Relay" class="variant"><a href="#variant.Relay" class="anchor">§</a><h3 class="code-header">Relay(<a class="struct" href="struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>)</h3></section><div class="docblock"><p>A relay server address.</p>
|
||||
</div><section id="variant.Ip" class="variant"><a href="#variant.Ip" class="anchor">§</a><h3 class="code-header">Ip(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>)</h3></section><div class="docblock"><p>An IP based address.</p>
|
||||
</div><section id="variant.Custom" class="variant"><a href="#variant.Custom" class="anchor">§</a><h3 class="code-header">Custom(<a class="struct" href="../iroh_base/endpoint_addr/struct.CustomAddr.html" title="struct iroh_base::endpoint_addr::CustomAddr">CustomAddr</a>)</h3></section><div class="docblock"><p>Custom transport address</p>
|
||||
</div></div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-TransportAddr" class="impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#64">Source</a><a href="#impl-TransportAddr" class="anchor">§</a><h3 class="code-header">impl <a class="enum" href="enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.is_relay" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#66">Source</a><h4 class="code-header">pub fn <a href="#method.is_relay" class="fn">is_relay</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether this is a transport address via a relay server.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_ip" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#71">Source</a><h4 class="code-header">pub fn <a href="#method.is_ip" class="fn">is_ip</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether this is an IP transport address.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Co-locating all of the iroh metrics structs"><title>iroh::metrics - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module metrics</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module metrics</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>metrics</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/metrics.rs.html#1-37">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Co-locating all of the iroh metrics structs</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.EndpointMetrics.html" title="struct iroh::metrics::EndpointMetrics">Endpoint<wbr>Metrics</a></dt><dd>Metrics collected by an <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>crate::endpoint::Endpoint</code></a>.</dd><dt><a class="struct" href="struct.NetReportMetrics.html" title="struct iroh::metrics::NetReportMetrics">NetReport<wbr>Metrics</a></dt><dd>Enum of metrics for the module</dd><dt><a class="struct" href="struct.RelayMetrics.html" title="struct iroh::metrics::RelayMetrics">Relay<wbr>Metrics</a><wbr><span class="stab portability" title="Available on crate feature `test-utils` only"><code>test-utils</code></span></dt><dd>Metrics tracked for the relay server</dd><dt><a class="struct" href="struct.SocketMetrics.html" title="struct iroh::metrics::SocketMetrics">Socket<wbr>Metrics</a></dt><dd>Enum of metrics for the module</dd></dl></section></div></main></body></html>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.EndpointMetrics.html" title="struct iroh::metrics::EndpointMetrics">Endpoint<wbr>Metrics</a></dt><dd>Metrics collected by an <a href="../endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>crate::endpoint::Endpoint</code></a>.</dd><dt><a class="struct" href="struct.NetReportMetrics.html" title="struct iroh::metrics::NetReportMetrics">NetReport<wbr>Metrics</a></dt><dd>Enum of metrics for the module</dd><dt><a class="struct" href="struct.RelayMetrics.html" title="struct iroh::metrics::RelayMetrics">Relay<wbr>Metrics</a><wbr><span class="stab portability" title="Available on crate feature `test-utils` only"><code>test-utils</code></span></dt><dd>Metrics tracked for the relay server</dd><dt><a class="struct" href="struct.SocketMetrics.html" title="struct iroh::metrics::SocketMetrics">Socket<wbr>Metrics</a></dt><dd>Metrics collected by the iroh socket.</dd></dl></section></div></main></body></html>
|
||||
@@ -26,21 +26,26 @@
|
||||
pub http_connections_closed: Counter,
|
||||
pub http_connections_errored: Counter,
|
||||
</details>}</code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Metrics tracked for the relay server</p>
|
||||
</div></details><h2 id="fields" class="fields section-header">Fields (Non-exhaustive)<a href="#fields" class="anchor">§</a></h2><details class="toggle non-exhaustive"><summary class="hideme"><span>This struct is marked as non-exhaustive</span></summary><div class="docblock">Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional <code>Struct { .. }</code> syntax; cannot be matched against without a wildcard <code>..</code>; and struct update syntax will not work.</div></details><span id="structfield.bytes_sent" class="structfield section-header"><a href="#structfield.bytes_sent" class="anchor field">§</a><code>bytes_sent: Counter</code></span><div class="docblock"><p>Bytes sent from a <code>FrameType::SendPacket</code></p>
|
||||
</div><span id="structfield.bytes_recv" class="structfield section-header"><a href="#structfield.bytes_recv" class="anchor field">§</a><code>bytes_recv: Counter</code></span><div class="docblock"><p>Bytes received from a <code>FrameType::SendPacket</code></p>
|
||||
</div><span id="structfield.send_packets_sent" class="structfield section-header"><a href="#structfield.send_packets_sent" class="anchor field">§</a><code>send_packets_sent: Counter</code></span><div class="docblock"><p><code>FrameType::SendPacket</code> sent</p>
|
||||
</div><span id="structfield.send_packets_recv" class="structfield section-header"><a href="#structfield.send_packets_recv" class="anchor field">§</a><code>send_packets_recv: Counter</code></span><div class="docblock"><p><code>FrameType::SendPacket</code> received</p>
|
||||
</div><span id="structfield.send_packets_dropped" class="structfield section-header"><a href="#structfield.send_packets_dropped" class="anchor field">§</a><code>send_packets_dropped: Counter</code></span><div class="docblock"><p><code>FrameType::SendPacket</code> dropped</p>
|
||||
</div><span id="structfield.other_packets_sent" class="structfield section-header"><a href="#structfield.other_packets_sent" class="anchor field">§</a><code>other_packets_sent: Counter</code></span><div class="docblock"><p>Packets of other <code>FrameType</code>s sent</p>
|
||||
</div><span id="structfield.other_packets_recv" class="structfield section-header"><a href="#structfield.other_packets_recv" class="anchor field">§</a><code>other_packets_recv: Counter</code></span><div class="docblock"><p>Packets of other <code>FrameType</code>s received</p>
|
||||
</div><span id="structfield.other_packets_dropped" class="structfield section-header"><a href="#structfield.other_packets_dropped" class="anchor field">§</a><code>other_packets_dropped: Counter</code></span><div class="docblock"><p>Packets of other <code>FrameType</code>s dropped</p>
|
||||
</div><span id="structfield.got_ping" class="structfield section-header"><a href="#structfield.got_ping" class="anchor field">§</a><code>got_ping: Counter</code></span><div class="docblock"><p>Number of <code>FrameType::Ping</code>s received</p>
|
||||
</div><span id="structfield.sent_pong" class="structfield section-header"><a href="#structfield.sent_pong" class="anchor field">§</a><code>sent_pong: Counter</code></span><div class="docblock"><p>Number of <code>FrameType::Pong</code>s sent</p>
|
||||
</div><span id="structfield.unknown_frames" class="structfield section-header"><a href="#structfield.unknown_frames" class="anchor field">§</a><code>unknown_frames: Counter</code></span><div class="docblock"><p>Number of <code>FrameType::Unknown</code> received</p>
|
||||
</div></details><h2 id="fields" class="fields section-header">Fields (Non-exhaustive)<a href="#fields" class="anchor">§</a></h2><details class="toggle non-exhaustive"><summary class="hideme"><span>This struct is marked as non-exhaustive</span></summary><div class="docblock">Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional <code>Struct { .. }</code> syntax; cannot be matched against without a wildcard <code>..</code>; and struct update syntax will not work.</div></details><span id="structfield.bytes_sent" class="structfield section-header"><a href="#structfield.bytes_sent" class="anchor field">§</a><code>bytes_sent: Counter</code></span><div class="docblock"><p>Bytes sent to a client in <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.RelayToClientDatagram" title="variant iroh_relay::protos::common::FrameType::RelayToClientDatagram"><code>RelayToClientDatagram</code></a> or <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.RelayToClientDatagramBatch" title="variant iroh_relay::protos::common::FrameType::RelayToClientDatagramBatch"><code>RelayToClientDatagramBatch</code></a> frames.</p>
|
||||
</div><span id="structfield.bytes_recv" class="structfield section-header"><a href="#structfield.bytes_recv" class="anchor field">§</a><code>bytes_recv: Counter</code></span><div class="docblock"><p>Bytes received from a client in <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.ClientToRelayDatagram" title="variant iroh_relay::protos::common::FrameType::ClientToRelayDatagram"><code>ClientToRelayDatagram</code></a> or <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.ClientToRelayDatagramBatch" title="variant iroh_relay::protos::common::FrameType::ClientToRelayDatagramBatch"><code>ClientToRelayDatagramBatch</code></a> frames.</p>
|
||||
</div><span id="structfield.send_packets_sent" class="structfield section-header"><a href="#structfield.send_packets_sent" class="anchor field">§</a><code>send_packets_sent: Counter</code></span><div class="docblock"><p><a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.RelayToClientDatagram" title="variant iroh_relay::protos::common::FrameType::RelayToClientDatagram"><code>RelayToClientDatagram</code></a> or <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.RelayToClientDatagramBatch" title="variant iroh_relay::protos::common::FrameType::RelayToClientDatagramBatch"><code>RelayToClientDatagramBatch</code></a> frames sent to a client.</p>
|
||||
</div><span id="structfield.send_packets_recv" class="structfield section-header"><a href="#structfield.send_packets_recv" class="anchor field">§</a><code>send_packets_recv: Counter</code></span><div class="docblock"><p><a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.ClientToRelayDatagram" title="variant iroh_relay::protos::common::FrameType::ClientToRelayDatagram"><code>ClientToRelayDatagram</code></a> or <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.ClientToRelayDatagramBatch" title="variant iroh_relay::protos::common::FrameType::ClientToRelayDatagramBatch"><code>ClientToRelayDatagramBatch</code></a> frames received from a client.</p>
|
||||
</div><span id="structfield.send_packets_dropped" class="structfield section-header"><a href="#structfield.send_packets_dropped" class="anchor field">§</a><code>send_packets_dropped: Counter</code></span><div class="docblock"><p><a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.RelayToClientDatagram" title="variant iroh_relay::protos::common::FrameType::RelayToClientDatagram"><code>RelayToClientDatagram</code></a> or <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.RelayToClientDatagramBatch" title="variant iroh_relay::protos::common::FrameType::RelayToClientDatagramBatch"><code>RelayToClientDatagramBatch</code></a> frames dropped instead of being
|
||||
delivered to a client, because the recipient is not connected or writing to its stream failed.</p>
|
||||
<p>Note that frames dropped because the recipient’s send queue is full or closed are not counted
|
||||
here.</p>
|
||||
</div><span id="structfield.other_packets_sent" class="structfield section-header"><a href="#structfield.other_packets_sent" class="anchor field">§</a><code>other_packets_sent: Counter</code></span><div class="docblock"><p>Intended to count sent frames other than datagrams, but currently unused (never incremented).</p>
|
||||
</div><span id="structfield.other_packets_recv" class="structfield section-header"><a href="#structfield.other_packets_recv" class="anchor field">§</a><code>other_packets_recv: Counter</code></span><div class="docblock"><p>Intended to count received frames other than datagrams, but currently unused (never incremented).</p>
|
||||
</div><span id="structfield.other_packets_dropped" class="structfield section-header"><a href="#structfield.other_packets_dropped" class="anchor field">§</a><code>other_packets_dropped: Counter</code></span><div class="docblock"><p>Intended to count dropped frames other than datagrams, but currently unused (never incremented).</p>
|
||||
</div><span id="structfield.got_ping" class="structfield section-header"><a href="#structfield.got_ping" class="anchor field">§</a><code>got_ping: Counter</code></span><div class="docblock"><p>Number of <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.Ping" title="variant iroh_relay::protos::common::FrameType::Ping"><code>FrameType::Ping</code></a> frames received from a client.</p>
|
||||
</div><span id="structfield.sent_pong" class="structfield section-header"><a href="#structfield.sent_pong" class="anchor field">§</a><code>sent_pong: Counter</code></span><div class="docblock"><p>Number of <a href="../../iroh_relay/protos/common/enum.FrameType.html#variant.Pong" title="variant iroh_relay::protos::common::FrameType::Pong"><code>FrameType::Pong</code></a> frames sent to a client.</p>
|
||||
</div><span id="structfield.unknown_frames" class="structfield section-header"><a href="#structfield.unknown_frames" class="anchor field">§</a><code>unknown_frames: Counter</code></span><div class="docblock"><p>Intended to count received frames with an unrecognized <a href="../../iroh_relay/protos/common/enum.FrameType.html" title="enum iroh_relay::protos::common::FrameType"><code>FrameType</code></a>,
|
||||
but currently unused (never incremented).</p>
|
||||
</div><span id="structfield.bytes_rx_ratelimited_total" class="structfield section-header"><a href="#structfield.bytes_rx_ratelimited_total" class="anchor field">§</a><code>bytes_rx_ratelimited_total: Counter</code></span><div class="docblock"><p>Number of bytes received from client connection which have been rate-limited.</p>
|
||||
</div><span id="structfield.conns_rx_ratelimited_total" class="structfield section-header"><a href="#structfield.conns_rx_ratelimited_total" class="anchor field">§</a><code>conns_rx_ratelimited_total: Counter</code></span><div class="docblock"><p>Number of client connections which have had any frames rate-limited.</p>
|
||||
</div><span id="structfield.accepts" class="structfield section-header"><a href="#structfield.accepts" class="anchor field">§</a><code>accepts: Counter</code></span><div class="docblock"><p>Number of times this server has accepted a connection.</p>
|
||||
</div><span id="structfield.disconnects" class="structfield section-header"><a href="#structfield.disconnects" class="anchor field">§</a><code>disconnects: Counter</code></span><div class="docblock"><p>Number of connections we have removed because of an error</p>
|
||||
</div><span id="structfield.disconnects" class="structfield section-header"><a href="#structfield.disconnects" class="anchor field">§</a><code>disconnects: Counter</code></span><div class="docblock"><p>Number of times a client connection was disconnected.</p>
|
||||
<p>Incremented once per connection, paired with <a href="struct.RelayMetrics.html#structfield.accepts" title="field iroh::metrics::RelayMetrics::accepts"><code>Self::accepts</code></a>.</p>
|
||||
</div><span id="structfield.unique_client_keys" class="structfield section-header"><a href="#structfield.unique_client_keys" class="anchor field">§</a><code>unique_client_keys: Counter</code></span><div class="docblock"><p>Number of unique client keys per day</p>
|
||||
</div><span id="structfield.clients_inactive_added" class="structfield section-header"><a href="#structfield.clients_inactive_added" class="anchor field">§</a><code>clients_inactive_added: Counter</code></span><div class="docblock"><p>Number of times a client was moved into the inactive state.</p>
|
||||
<p>A client becomes inactive when a new client connects with the same endpoint id. An inactive
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@ the source address, actively refuse the connection, or silently drop it.</p>
|
||||
<p>What this does depends on the connection type:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><strong>Direct (UDP) connections</strong> : this is QUIC source address
|
||||
<p><strong>Direct (UDP) connections</strong>: this is QUIC source address
|
||||
validation. If the socket address was spoofed, the retry token is
|
||||
sent to the spoofed address, so we never hear from the attacker
|
||||
again. If the address was real, the client repeats the connection
|
||||
@@ -20,7 +20,7 @@ attempt with the token, and the next <a href="../endpoint/struct.Incoming.html"
|
||||
bound to the source address.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>Relay connections</strong> : there is no source address to validate
|
||||
<p><strong>Relay connections</strong>: there is no source address to validate
|
||||
(the relay already vouches for the packet origin), so the
|
||||
“validation” itself has no security meaning. However, the retry
|
||||
still imposes a real cost on the client: an extra round trip
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
<p>This combines an endpoint’s identifier with network-level addressing information of how to
|
||||
contact the endpoint.</p>
|
||||
<p>To establish a network connection to an endpoint both the <a href="type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> and one or more network
|
||||
paths are needed. The network paths can come from various sources, current sources can come from</p>
|
||||
paths are needed. The network paths can come from various sources:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>An <a href="https://docs.rs/iroh/*/iroh/index.html#address-lookup">Address Lookup</a> service which can provide routing information for a given <a href="type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a>.</p>
|
||||
@@ -24,7 +24,7 @@ connection without the help of a <a href="https://docs.rs/iroh/*/iroh/index.html
|
||||
number of other addressing information. It is a generic addressing type used whenever a connection
|
||||
to other endpoints needs to be established.</p>
|
||||
</div></details><h2 id="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.id" class="structfield section-header"><a href="#structfield.id" class="anchor field">§</a><code>id: <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></code></span><div class="docblock"><p>The endpoint’s identifier.</p>
|
||||
</div><span id="structfield.addrs" class="structfield section-header"><a href="#structfield.addrs" class="anchor field">§</a><code>addrs: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/collections/btree/set/struct.BTreeSet.html" title="struct alloc::collections::btree::set::BTreeSet">BTreeSet</a><<a class="enum" href="enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></code></span><div class="docblock"><p>The endpoint’s addresses</p>
|
||||
</div><span id="structfield.addrs" class="structfield section-header"><a href="#structfield.addrs" class="anchor field">§</a><code>addrs: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/collections/btree/set/struct.BTreeSet.html" title="struct alloc::collections::btree::set::BTreeSet">BTreeSet</a><<a class="enum" href="enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>></code></span><div class="docblock"><p>The endpoint’s addresses.</p>
|
||||
</div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-EndpointAddr" class="impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#91">Source</a><a href="#impl-EndpointAddr" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#96">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(id: <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>) -> <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr"><code>EndpointAddr</code></a> with no network level addresses.</p>
|
||||
<p>This still is usable with e.g. an address lookup service to establish a connection,
|
||||
depending on the situation.</p>
|
||||
@@ -38,9 +38,9 @@ depending on the situation.</p>
|
||||
self,
|
||||
addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="enum.TransportAddr.html" title="enum iroh::TransportAddr">TransportAddr</a>>,
|
||||
) -> <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class="docblock"><p>Adds a list of addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#132">Source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true, if only a <a href="type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> is present.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ip_addrs" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#137">Source</a><h4 class="code-header">pub fn <a href="#method.ip_addrs" class="fn">ip_addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns a list of IP addresses of this peer.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.relay_urls" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#147">Source</a><h4 class="code-header">pub fn <a href="#method.relay_urls" class="fn">relay_urls</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="struct" href="struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns a list of relay urls of this peer.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_empty" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#132">Source</a><h4 class="code-header">pub fn <a href="#method.is_empty" class="fn">is_empty</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns true if only an <a href="type.EndpointId.html" title="type iroh::EndpointId"><code>EndpointId</code></a> is present.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ip_addrs" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#137">Source</a><h4 class="code-header">pub fn <a href="#method.ip_addrs" class="fn">ip_addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns an iterator over the IP addresses of this endpoint address.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.relay_urls" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#147">Source</a><h4 class="code-header">pub fn <a href="#method.relay_urls" class="fn">relay_urls</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="struct" href="struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns an iterator over the relay URLs of this endpoint address.</p>
|
||||
<p>In practice this is expected to be zero or one home relay for all known cases currently.</p>
|
||||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-EndpointAddr" class="impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#41">Source</a><a href="#impl-Clone-for-EndpointAddr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#41">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h4></section></summary><div class='docblock'>Returns a duplicate of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#245-247">Source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-EndpointAddr" class="impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#41">Source</a><a href="#impl-Debug-for-EndpointAddr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#41">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-EndpointAddr" class="impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#41">Source</a><a href="#impl-Deserialize%3C'de%3E-for-EndpointAddr" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="https://docs.rs/serde_core/1.0.228/serde_core/de/trait.Deserialize.html" title="trait serde_core::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.EndpointAddr.html" title="struct iroh::EndpointAddr">EndpointAddr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#41">Source</a><a href="#method.deserialize" class="anchor">§</a><h4 class="code-header">fn <a href="https://docs.rs/serde_core/1.0.228/serde_core/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><__D>(
|
||||
__deserializer: __D,
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="TLS configuration for iroh."><title>iroh::tls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module tls</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module tls</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>tls</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/tls.rs.html#1-140">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>TLS configuration for iroh.</p>
|
||||
<p>Currently there is one mechanisms available</p>
|
||||
<p>Currently there is one mechanism available:</p>
|
||||
<ul>
|
||||
<li>Raw Public Keys, using the TLS extension described in <a href="https://datatracker.ietf.org/doc/html/rfc7250">RFC 7250</a></li>
|
||||
</ul>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,8 +3,8 @@
|
||||
Ip(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>),
|
||||
Custom(<a class="struct" href="struct.CustomAddr.html" title="struct iroh_base::CustomAddr">CustomAddr</a>),
|
||||
}</code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>key</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Available address types.</p>
|
||||
</div></details><h2 id="variants" class="variants section-header">Variants (Non-exhaustive)<a href="#variants" class="anchor">§</a></h2><details class="toggle non-exhaustive"><summary class="hideme"><span>This enum is marked as non-exhaustive</span></summary><div class="docblock">Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.</div></details><div class="variants"><section id="variant.Relay" class="variant"><a href="#variant.Relay" class="anchor">§</a><h3 class="code-header">Relay(<a class="struct" href="struct.RelayUrl.html" title="struct iroh_base::RelayUrl">RelayUrl</a>)</h3></section><div class="docblock"><p>Relays</p>
|
||||
</div><section id="variant.Ip" class="variant"><a href="#variant.Ip" class="anchor">§</a><h3 class="code-header">Ip(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>)</h3></section><div class="docblock"><p>IP based addresses</p>
|
||||
</div></details><h2 id="variants" class="variants section-header">Variants (Non-exhaustive)<a href="#variants" class="anchor">§</a></h2><details class="toggle non-exhaustive"><summary class="hideme"><span>This enum is marked as non-exhaustive</span></summary><div class="docblock">Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.</div></details><div class="variants"><section id="variant.Relay" class="variant"><a href="#variant.Relay" class="anchor">§</a><h3 class="code-header">Relay(<a class="struct" href="struct.RelayUrl.html" title="struct iroh_base::RelayUrl">RelayUrl</a>)</h3></section><div class="docblock"><p>A relay server address.</p>
|
||||
</div><section id="variant.Ip" class="variant"><a href="#variant.Ip" class="anchor">§</a><h3 class="code-header">Ip(<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>)</h3></section><div class="docblock"><p>An IP based address.</p>
|
||||
</div><section id="variant.Custom" class="variant"><a href="#variant.Custom" class="anchor">§</a><h3 class="code-header">Custom(<a class="struct" href="struct.CustomAddr.html" title="struct iroh_base::CustomAddr">CustomAddr</a>)</h3></section><div class="docblock"><p>Custom transport address</p>
|
||||
</div></div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-TransportAddr" class="impl"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#64-79">Source</a><a href="#impl-TransportAddr" class="anchor">§</a><h3 class="code-header">impl <a class="enum" href="enum.TransportAddr.html" title="enum iroh_base::TransportAddr">TransportAddr</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.is_relay" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#66-68">Source</a><h4 class="code-header">pub fn <a href="#method.is_relay" class="fn">is_relay</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether this is a transport address via a relay server.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.is_ip" class="method"><a class="src rightside" href="../src/iroh_base/endpoint_addr.rs.html#71-73">Source</a><h4 class="code-header">pub fn <a href="#method.is_ip" class="fn">is_ip</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Whether this is an IP transport address.</p>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Base types and utilities for Iroh"><title>iroh_base - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="iroh_base" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate iroh_base</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../iroh_base/index.html">iroh_<wbr>base</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#structs">Crate Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>iroh_<wbr>base</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/iroh_base/lib.rs.html#1-21">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Base types and utilities for Iroh</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.CustomAddr.html" title="struct iroh_base::CustomAddr">Custom<wbr>Addr</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>A custom transport address consisting of a transport id and opaque address data.</dd><dt><a class="struct" href="struct.EndpointAddr.html" title="struct iroh_base::EndpointAddr">Endpoint<wbr>Addr</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Network-level addressing information for an iroh endpoint.</dd><dt><a class="struct" href="struct.PublicKey.html" title="struct iroh_base::PublicKey">Public<wbr>Key</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>A public key.</dd><dt><a class="struct" href="struct.RelayUrl.html" title="struct iroh_base::RelayUrl">Relay<wbr>Url</a><wbr><span class="stab portability" title="Available on crate feature `relay` only"><code>relay</code></span></dt><dd>A URL identifying a relay server.</dd><dt><a class="struct" href="struct.RelayUrlParseError.html" title="struct iroh_base::RelayUrlParseError">Relay<wbr>UrlParse<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `relay` only"><code>relay</code></span></dt><dd>Can occur when parsing a string into a <a href="struct.RelayUrl.html" title="struct iroh_base::RelayUrl"><code>RelayUrl</code></a>.</dd><dt><a class="struct" href="struct.SecretKey.html" title="struct iroh_base::SecretKey">Secret<wbr>Key</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>A secret key.</dd><dt><a class="struct" href="struct.Signature.html" title="struct iroh_base::Signature">Signature</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Ed25519 signature.</dd><dt><a class="struct" href="struct.SignatureError.html" title="struct iroh_base::SignatureError">Signature<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Verification of a signature failed.</dd><dt><a class="struct" href="struct.SignatureParsingError.html" title="struct iroh_base::SignatureParsingError">Signature<wbr>Parsing<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Error generated when failed to parse an ED25519 signature.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.KeyParsingError.html" title="enum iroh_base::KeyParsingError">KeyParsing<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Error when deserialising a <a href="struct.PublicKey.html" title="struct iroh_base::PublicKey"><code>PublicKey</code></a> or a <a href="struct.SecretKey.html" title="struct iroh_base::SecretKey"><code>SecretKey</code></a>.</dd><dt><a class="enum" href="enum.TransportAddr.html" title="enum iroh_base::TransportAddr">Transport<wbr>Addr</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Available address types.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.EndpointId.html" title="type iroh_base::EndpointId">Endpoint<wbr>Id</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>The identifier for an endpoint in the (iroh) network.</dd></dl><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</div>"}</script></section></div></main></body></html>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.CustomAddr.html" title="struct iroh_base::CustomAddr">Custom<wbr>Addr</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>A custom transport address consisting of a transport id and opaque address data.</dd><dt><a class="struct" href="struct.EndpointAddr.html" title="struct iroh_base::EndpointAddr">Endpoint<wbr>Addr</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Network-level addressing information for an iroh endpoint.</dd><dt><a class="struct" href="struct.PublicKey.html" title="struct iroh_base::PublicKey">Public<wbr>Key</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>A public key.</dd><dt><a class="struct" href="struct.RelayUrl.html" title="struct iroh_base::RelayUrl">Relay<wbr>Url</a><wbr><span class="stab portability" title="Available on crate feature `relay` only"><code>relay</code></span></dt><dd>A URL identifying a relay server.</dd><dt><a class="struct" href="struct.RelayUrlParseError.html" title="struct iroh_base::RelayUrlParseError">Relay<wbr>UrlParse<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `relay` only"><code>relay</code></span></dt><dd>Can occur when parsing a string into a <a href="struct.RelayUrl.html" title="struct iroh_base::RelayUrl"><code>RelayUrl</code></a>.</dd><dt><a class="struct" href="struct.SecretKey.html" title="struct iroh_base::SecretKey">Secret<wbr>Key</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>A secret key.</dd><dt><a class="struct" href="struct.Signature.html" title="struct iroh_base::Signature">Signature</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Ed25519 signature.</dd><dt><a class="struct" href="struct.SignatureError.html" title="struct iroh_base::SignatureError">Signature<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Verification of a signature failed.</dd><dt><a class="struct" href="struct.SignatureParsingError.html" title="struct iroh_base::SignatureParsingError">Signature<wbr>Parsing<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Error generated when failed to parse an ED25519 signature.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.KeyParsingError.html" title="enum iroh_base::KeyParsingError">KeyParsing<wbr>Error</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Error returned when parsing a <a href="struct.PublicKey.html" title="struct iroh_base::PublicKey"><code>PublicKey</code></a> or a <a href="struct.SecretKey.html" title="struct iroh_base::SecretKey"><code>SecretKey</code></a>.</dd><dt><a class="enum" href="enum.TransportAddr.html" title="enum iroh_base::TransportAddr">Transport<wbr>Addr</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>Available address types.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.EndpointId.html" title="type iroh_base::EndpointId">Endpoint<wbr>Id</a><wbr><span class="stab portability" title="Available on crate feature `key` only"><code>key</code></span></dt><dd>The identifier for an endpoint in the (iroh) network.</dd></dl><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</div>"}</script></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -15,7 +15,7 @@ public DNS.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-DnsResolver" class="impl"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#327-696">Source</a><a href="#impl-DnsResolver" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.DnsResolver.html" title="struct iroh_dns::dns::DnsResolver">DnsResolver</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#333-335">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>() -> Self</h4></section></summary><div class="docblock"><p>Creates a new DNS resolver with sensible cross-platform defaults.</p>
|
||||
<p>We first try to read the system’s resolver from <code>/etc/resolv.conf</code>.
|
||||
This does not work at least on some Androids, therefore we fallback
|
||||
to the default <code>ResolverConfig</code> which uses eg. to google’s <code>8.8.8.8</code> or <code>8.8.4.4</code>.</p>
|
||||
to the default <code>ResolverConfig</code> which uses e.g. Google’s <code>8.8.8.8</code> or <code>8.8.4.4</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_nameserver" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#338-342">Source</a><h4 class="code-header">pub fn <a href="#method.with_nameserver" class="fn">with_nameserver</a>(nameserver: <a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a new DNS resolver configured with a single UDP DNS nameserver.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.builder" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#345-347">Source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fn">builder</a>() -> <a class="struct" href="struct.Builder.html" title="struct iroh_dns::dns::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Creates a builder to construct a DNS resolver with custom options.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.custom" class="method"><a class="src rightside" href="../../src/iroh_dns/dns.rs.html#354-358">Source</a><h4 class="code-header">pub fn <a href="#method.custom" class="fn">custom</a>(resolver: impl <a class="trait" href="trait.Resolver.html" title="trait iroh_dns::dns::Resolver">Resolver</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.DnsResolver.html" title="struct iroh_dns::dns::DnsResolver"><code>DnsResolver</code></a> from a struct that implements <a href="trait.Resolver.html" title="trait iroh_dns::dns::Resolver"><code>Resolver</code></a>.</p>
|
||||
|
||||
@@ -38,13 +38,13 @@ atomic swap. Build a new instance with re-bound sockets and re-read nameserver
|
||||
configuration rather than mutating in place. Must not perform IO: defer DNS
|
||||
queries and socket binds until the new resolver is first used. May be called
|
||||
concurrently, in which case all but one allocated replacement is dropped unused.</p>
|
||||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#422-457">Source</a><a href="#impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Resolver.html" title="trait iroh_dns::dns::Resolver">Resolver</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><SimpleDnsResolver></h3></section></summary><div class="impl-items"><section id="method.lookup_ipv4" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#423-430">Source</a><a href="#method.lookup_ipv4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv4" class="fn">lookup_ipv4</a>(
|
||||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#424-459">Source</a><a href="#impl-Resolver-for-Arc%3CSimpleDnsResolver%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Resolver.html" title="trait iroh_dns::dns::Resolver">Resolver</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><SimpleDnsResolver></h3></section></summary><div class="impl-items"><section id="method.lookup_ipv4" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#425-432">Source</a><a href="#method.lookup_ipv4" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv4" class="fn">lookup_ipv4</a>(
|
||||
&self,
|
||||
host: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||||
) -> BoxFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="type.BoxIter.html" title="type iroh_dns::dns::BoxIter">BoxIter</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv4Addr.html" title="struct core::net::ip_addr::Ipv4Addr">Ipv4Addr</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh_dns::dns::DnsError">DnsError</a>>></h4></section><section id="method.lookup_ipv6" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#432-439">Source</a><a href="#method.lookup_ipv6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv6" class="fn">lookup_ipv6</a>(
|
||||
) -> BoxFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="type.BoxIter.html" title="type iroh_dns::dns::BoxIter">BoxIter</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv4Addr.html" title="struct core::net::ip_addr::Ipv4Addr">Ipv4Addr</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh_dns::dns::DnsError">DnsError</a>>></h4></section><section id="method.lookup_ipv6" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#434-441">Source</a><a href="#method.lookup_ipv6" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_ipv6" class="fn">lookup_ipv6</a>(
|
||||
&self,
|
||||
host: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||||
) -> BoxFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="type.BoxIter.html" title="type iroh_dns::dns::BoxIter">BoxIter</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv6Addr.html" title="struct core::net::ip_addr::Ipv6Addr">Ipv6Addr</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh_dns::dns::DnsError">DnsError</a>>></h4></section><section id="method.lookup_txt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#441-448">Source</a><a href="#method.lookup_txt" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_txt" class="fn">lookup_txt</a>(
|
||||
) -> BoxFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="type.BoxIter.html" title="type iroh_dns::dns::BoxIter">BoxIter</a><<a class="struct" href="https://doc.rust-lang.org/nightly/core/net/ip_addr/struct.Ipv6Addr.html" title="struct core::net::ip_addr::Ipv6Addr">Ipv6Addr</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh_dns::dns::DnsError">DnsError</a>>></h4></section><section id="method.lookup_txt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#443-450">Source</a><a href="#method.lookup_txt" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.lookup_txt" class="fn">lookup_txt</a>(
|
||||
&self,
|
||||
host: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,
|
||||
) -> BoxFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="type.BoxIter.html" title="type iroh_dns::dns::BoxIter">BoxIter</a><<a class="struct" href="struct.TxtRecordData.html" title="struct iroh_dns::dns::TxtRecordData">TxtRecordData</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh_dns::dns::DnsError">DnsError</a>>></h4></section><section id="method.clear_cache" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#450-452">Source</a><a href="#method.clear_cache" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.clear_cache" class="fn">clear_cache</a>(&self)</h4></section><section id="method.reset" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#454-456">Source</a><a href="#method.reset" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.reset" class="fn">reset</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.Resolver.html" title="trait iroh_dns::dns::Resolver">Resolver</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/iroh_dns/dns/trait.Resolver.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html>
|
||||
) -> BoxFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="type.BoxIter.html" title="type iroh_dns::dns::BoxIter">BoxIter</a><<a class="struct" href="struct.TxtRecordData.html" title="struct iroh_dns::dns::TxtRecordData">TxtRecordData</a>>, <a class="enum" href="enum.DnsError.html" title="enum iroh_dns::dns::DnsError">DnsError</a>>></h4></section><section id="method.clear_cache" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#452-454">Source</a><a href="#method.clear_cache" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.clear_cache" class="fn">clear_cache</a>(&self)</h4></section><section id="method.reset" class="method trait-impl"><a class="src rightside" href="../../src/iroh_dns/dns/resolver.rs.html#456-458">Source</a><a href="#method.reset" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.reset" class="fn">reset</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.Resolver.html" title="trait iroh_dns::dns::Resolver">Resolver</a>></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/iroh_dns/dns/trait.Resolver.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html>
|
||||
@@ -1,11 +1,11 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Support for handling DNS resource records for dialing by `EndpointId`."><title>iroh_dns::endpoint_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_dns" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module endpoint_info</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_dns/index.html">iroh_<wbr>dns</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module endpoint_<wbr>info</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>dns</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_dns</a></div><h1>Module <span>endpoint_<wbr>info</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_dns/endpoint_info.rs.html#1-660">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support for handling DNS resource records for dialing by <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a>.</p>
|
||||
<p>Dialing by <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> is supported by iroh endpoints publishing <a href="https://app.pkarr.org">Pkarr</a> records to DNS
|
||||
servers or the Mainline DHT. This module supports creating and parsing these records.</p>
|
||||
<p><a href="struct.EndpointInfo.html" title="struct iroh_dns::endpoint_info::EndpointInfo"><code>EndpointInfo</code></a> combines an <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>iroh_base::EndpointId</code></a> with <a href="struct.EndpointData.html" title="struct iroh_dns::endpoint_info::EndpointData"><code>EndpointData</code></a> —
|
||||
<p><a href="struct.EndpointInfo.html" title="struct iroh_dns::endpoint_info::EndpointInfo"><code>EndpointInfo</code></a> combines an <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>iroh_base::EndpointId</code></a> with <a href="struct.EndpointData.html" title="struct iroh_dns::endpoint_info::EndpointData"><code>EndpointData</code></a>:
|
||||
the addressing and metadata that discovery services publish and resolve.
|
||||
Discovery services use <a href="struct.AddrFilter.html" title="struct iroh_dns::endpoint_info::AddrFilter"><code>AddrFilter</code></a> to control which addresses are published.</p>
|
||||
<p>This module also provides serialization to and from pkarr signed packets and
|
||||
DNS TXT records. See the [<code>crate::attrs</code>] module for the on-the-wire format.</p>
|
||||
DNS TXT records.</p>
|
||||
<p>DNS records are published under the following names:</p>
|
||||
<p><code>_iroh.<z32-endpoint-id>.<origin-domain> TXT</code></p>
|
||||
<ul>
|
||||
@@ -36,4 +36,4 @@ Each address is an IPv4 or IPv6 address with a port.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.AddrFilter.html" title="struct iroh_dns::endpoint_info::AddrFilter">Addr<wbr>Filter</a></dt><dd>A filter and/or reordering function applied to transport addresses,
|
||||
typically used by AddressLookup services in iroh before publishing.</dd><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh_dns::endpoint_info::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh_dns::endpoint_info::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.MaxLengthExceededError.html" title="struct iroh_dns::endpoint_info::MaxLengthExceededError">MaxLength<wbr>Exceeded<wbr>Error</a></dt><dd>Error returned when an input value is too long for <a href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData">User<wbr>Data</a></dt><dd>Under the hood this is a UTF-8 String is no longer than <a href="struct.UserData.html#associatedconstant.MAX_LENGTH" title="associated constant iroh_dns::endpoint_info::UserData::MAX_LENGTH"><code>UserData::MAX_LENGTH</code></a> bytes.</dd></dl></section></div></main></body></html>
|
||||
typically used by AddressLookup services in iroh before publishing.</dd><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh_dns::endpoint_info::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh_dns::endpoint_info::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.MaxLengthExceededError.html" title="struct iroh_dns::endpoint_info::MaxLengthExceededError">MaxLength<wbr>Exceeded<wbr>Error</a></dt><dd>Error returned when an input value is too long for <a href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData">User<wbr>Data</a></dt><dd>User-defined data that can be published and resolved through endpoint discovery.</dd></dl></section></div></main></body></html>
|
||||
@@ -13,15 +13,15 @@ services, should they not fit into e.g. a single DNS packet otherwise.</p>
|
||||
<p>See also <a href="struct.EndpointData.html#method.set_user_data" title="method iroh_dns::endpoint_info::EndpointData::set_user_data"><code>Self::set_user_data</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_relay_url" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#111-116">Source</a><h4 class="code-header">pub fn <a href="#method.add_relay_url" class="fn">add_relay_url</a>(&mut self, relay_url: <a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>)</h4></section></summary><div class="docblock"><p>Adds the relay URL to the end of the endpoint data, unless it already existed.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#119-121">Source</a><h4 class="code-header">pub fn <a href="#method.add_ip_addrs" class="fn">add_ip_addrs</a>(&mut self, addresses: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses in order with duplicates or already existing addresses filtered out.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#124-132">Source</a><h4 class="code-header">pub fn <a href="#method.add_addrs" class="fn">add_addrs</a>(&mut self, addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../../iroh_base/endpoint_addr/enum.TransportAddr.html" title="enum iroh_base::endpoint_addr::TransportAddr">TransportAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses to the endpoint data in the given ordered, but with duplicates filtered.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#135-137">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data" class="fn">set_user_data</a>(&mut self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the user-defined data and returns the updated endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#124-132">Source</a><h4 class="code-header">pub fn <a href="#method.add_addrs" class="fn">add_addrs</a>(&mut self, addrs: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a><Item = <a class="enum" href="../../iroh_base/endpoint_addr/enum.TransportAddr.html" title="enum iroh_base::endpoint_addr::TransportAddr">TransportAddr</a>>)</h4></section></summary><div class="docblock"><p>Adds addresses to the endpoint data in the given order, but with duplicates filtered.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#135-137">Source</a><h4 class="code-header">pub fn <a href="#method.set_user_data" class="fn">set_user_data</a>(&mut self, user_data: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData">UserData</a>>)</h4></section></summary><div class="docblock"><p>Sets the user-defined data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#140-143">Source</a><h4 class="code-header">pub fn <a href="#method.clear_ip_addrs" class="fn">clear_ip_addrs</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all direct addresses from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#146-149">Source</a><h4 class="code-header">pub fn <a href="#method.clear_relay_urls" class="fn">clear_relay_urls</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all direct addresses from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.clear_relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#146-149">Source</a><h4 class="code-header">pub fn <a href="#method.clear_relay_urls" class="fn">clear_relay_urls</a>(&mut self)</h4></section></summary><div class="docblock"><p>Removes all relay URLs from the endpoint data.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.relay_urls" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#152-157">Source</a><h4 class="code-header">pub fn <a href="#method.relay_urls" class="fn">relay_urls</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the relay URL of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.user_data" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#160-162">Source</a><h4 class="code-header">pub fn <a href="#method.user_data" class="fn">user_data</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="struct.UserData.html" title="struct iroh_dns::endpoint_info::UserData">UserData</a>></h4></section></summary><div class="docblock"><p>Returns the optional user-defined data of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.ip_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#165-170">Source</a><h4 class="code-header">pub fn <a href="#method.ip_addrs" class="fn">ip_addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>></h4></section></summary><div class="docblock"><p>Returns the direct addresses of the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173-175">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../../iroh_base/endpoint_addr/enum.TransportAddr.html" title="enum iroh_base::endpoint_addr::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178-180">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Does this have any addresses?</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#173-175">Source</a><h4 class="code-header">pub fn <a href="#method.addrs" class="fn">addrs</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &<a class="enum" href="../../iroh_base/endpoint_addr/enum.TransportAddr.html" title="enum iroh_base::endpoint_addr::TransportAddr">TransportAddr</a>></h4></section></summary><div class="docblock"><p>Returns the full list of all known addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.has_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#178-180">Source</a><h4 class="code-header">pub fn <a href="#method.has_addrs" class="fn">has_addrs</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class="docblock"><p>Returns whether this has any addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.filtered_addrs" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#185-187">Source</a><h4 class="code-header">pub fn <a href="#method.filtered_addrs" class="fn">filtered_addrs</a>(&self, filter: &<a class="struct" href="struct.AddrFilter.html" title="struct iroh_dns::endpoint_info::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="enum" href="../../iroh_base/endpoint_addr/enum.TransportAddr.html" title="enum iroh_base::endpoint_addr::TransportAddr">TransportAddr</a>>></h4></section></summary><div class="docblock"><p>Apply the given filter to the current addresses.</p>
|
||||
<p>Returns a vec to allow re-ordering of addresses.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.apply_filter" class="method"><a class="src rightside" href="../../src/iroh_dns/endpoint_info.rs.html#190-199">Source</a><h4 class="code-header">pub fn <a href="#method.apply_filter" class="fn">apply_filter</a>(&self, filter: &<a class="struct" href="struct.AddrFilter.html" title="struct iroh_dns::endpoint_info::AddrFilter">AddrFilter</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/alloc/borrow/enum.Cow.html" title="enum alloc::borrow::Cow">Cow</a><'_, Self></h4></section></summary><div class="docblock"><p>Returns the <code>EndpointData</code> with given filter applied.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -15,7 +15,7 @@ can be used during negotiation to pick the best version.</p>
|
||||
</div></div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-ProtocolVersion" class="impl"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#62-101">Source</a><a href="#impl-ProtocolVersion" class="anchor">§</a><h3 class="code-header">impl <a class="enum" href="enum.ProtocolVersion.html" title="enum iroh_relay::http::ProtocolVersion">ProtocolVersion</a></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.ALL" class="associatedconstant"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#68">Source</a><h4 class="code-header">pub const <a href="#associatedconstant.ALL" class="constant">ALL</a>: &'static [Self]</h4></section></summary><div class="docblock"><p>All supported protocol versions, in order of preference (newest first).</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.all" class="method"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#71-73">Source</a><h4 class="code-header">pub fn <a href="#method.all" class="fn">all</a>() -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>></h4></section></summary><div class="docblock"><p>Returns an iterator of all supported protocol version identifiers, in order of preference.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.all_joined" class="method"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#76-78">Source</a><h4 class="code-header">pub fn <a href="#method.all_joined" class="fn">all_joined</a>() -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Returns a comma-separated string of all supported protocol version identifiers.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.all_as_header_value" class="method"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#81-83">Source</a><h4 class="code-header">pub fn <a href="#method.all_as_header_value" class="fn">all_as_header_value</a>() -> HeaderValue</h4></section></summary><div class="docblock"><p>Returns all supported protocol versions in a comma-seperated string as an HTTP header value.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.all_as_header_value" class="method"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#81-83">Source</a><h4 class="code-header">pub fn <a href="#method.all_as_header_value" class="fn">all_as_header_value</a>() -> HeaderValue</h4></section></summary><div class="docblock"><p>Returns all supported protocol versions in a comma-separated string as an HTTP header value.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_str" class="method"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#86-88">Source</a><h4 class="code-header">pub fn <a href="#method.to_str" class="fn">to_str</a>(&self) -> &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>Returns the protocol version identifier string.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.match_from_str" class="method"><a class="src rightside" href="../../src/iroh_relay/http.rs.html#93-95">Source</a><h4 class="code-header">pub fn <a href="#method.match_from_str" class="fn">match_from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Tries to parse a <a href="enum.ProtocolVersion.html" title="enum iroh_relay::http::ProtocolVersion"><code>ProtocolVersion</code></a> from <code>s</code>.</p>
|
||||
<p>Returns <code>None</code> if <code>s</code> is not a valid protocol version string.</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Iroh’s relay is a feature within iroh, a peer-to-peer networking system designed to facilitate direct, encrypted connections between devices. Iroh aims to simplify decentralized communication by automatically handling connections through “relays” when direct connections aren’t immediately possible. The relay server helps establish connections by temporarily routing encrypted traffic until a direct, P2P connection is feasible. Once this direct path is set up, the relay server steps back, and the data flows directly between devices. This approach allows Iroh to maintain a secure, low-latency connection, even in challenging network situations."><title>iroh_relay - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate iroh_relay</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>iroh_<wbr>relay</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/iroh_relay/lib.rs.html#1-83">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Iroh’s relay is a feature within <a href="https://github.com/n0-computer/iroh">iroh</a>, a peer-to-peer
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Iroh’s relay is a feature within iroh, a peer-to-peer networking system designed to facilitate direct, encrypted connections between devices. Iroh aims to simplify decentralized communication by automatically handling connections through “relays” when direct connections aren’t immediately possible. The relay server helps establish connections by temporarily routing encrypted traffic until a direct, P2P connection is feasible. Once this direct path is set up, the relay server steps back, and the data flows directly between devices. This approach allows Iroh to maintain a secure, low-latency connection, even in challenging network situations."><title>iroh_relay - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Crate iroh_relay</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section id="rustdoc-toc"><h3><a href="#reexports">Crate Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><h1>Crate <span>iroh_<wbr>relay</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/iroh_relay/lib.rs.html#1-81">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Iroh’s relay is a feature within <a href="https://github.com/n0-computer/iroh">iroh</a>, a peer-to-peer
|
||||
networking system designed to facilitate direct, encrypted connections between devices. Iroh
|
||||
aims to simplify decentralized communication by automatically handling connections through
|
||||
“relays” when direct connections aren’t immediately possible. The relay server helps establish
|
||||
@@ -27,6 +27,4 @@ QAD support and expose metrics.</p>
|
||||
</ul>
|
||||
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.MAX_PACKET_SIZE"><code>pub use crate::protos::relay::<a class="constant" href="protos/relay/constant.MAX_PACKET_SIZE.html" title="constant iroh_relay::protos::relay::MAX_PACKET_SIZE">MAX_PACKET_SIZE</a>;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="client/index.html" title="mod iroh_relay::client">client</a></dt><dd>Exposes <a href="client/struct.Client.html" title="struct iroh_relay::client::Client"><code>Client</code></a>, which allows to establish connections to a relay server.</dd><dt><a class="mod" href="defaults/index.html" title="mod iroh_relay::defaults">defaults</a></dt><dd>Default values used in the relay.</dd><dt><a class="mod" href="http/index.html" title="mod iroh_relay::http">http</a></dt><dd>HTTP-specific constants for the relay server and client.</dd><dt><a class="mod" href="protos/index.html" title="mod iroh_relay::protos">protos</a></dt><dd>Protocols used by the iroh-relay</dd><dt><a class="mod" href="quic/index.html" title="mod iroh_relay::quic">quic</a></dt><dd>Create a QUIC server that accepts connections
|
||||
for QUIC address discovery.</dd><dt><a class="mod" href="server/index.html" title="mod iroh_relay::server">server</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>A fully-fledged iroh-relay server over HTTP or HTTPS.</dd><dt><a class="mod" href="tls/index.html" title="mod iroh_relay::tls">tls</a></dt><dd>TLS verification configuration for iroh and iroh-relay.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.KeyCache.html" title="struct iroh_relay::KeyCache">KeyCache</a></dt><dd>A cache for public keys.</dd><dt><a class="struct" href="struct.PingTracker.html" title="struct iroh_relay::PingTracker">Ping<wbr>Tracker</a></dt><dd>Tracks pings on a single relay connection.</dd><dt><a class="struct" href="struct.RelayConfig.html" title="struct iroh_relay::RelayConfig">Relay<wbr>Config</a></dt><dd>Information on a specific relay server.</dd><dt><a class="struct" href="struct.RelayMap.html" title="struct iroh_relay::RelayMap">Relay<wbr>Map</a></dt><dd>List of relay server configurations to be used in an iroh endpoint.</dd><dt><a class="struct" href="struct.RelayQuicConfig.html" title="struct iroh_relay::RelayQuicConfig">Relay<wbr>Quic<wbr>Config</a></dt><dd>Configuration for speaking to the QUIC endpoint on the relay
|
||||
server to do QUIC address discovery.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.ExportKeyingMaterial.html" title="trait iroh_relay::ExportKeyingMaterial">Export<wbr>Keying<wbr>Material</a></dt><dd>This trait allows anything that ends up potentially
|
||||
wrapping a TLS stream use the underlying <a href="rustls::ConnectionCommon::export_keying_material"><code>export_keying_material</code></a>
|
||||
function.</dd></dl><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</div>","<Arc<S> as Service<Request>>::Future":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/fs/struct.File.html\" title=\"struct std::fs::File\">File</a>></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/fs/struct.File.html\" title=\"struct std::fs::File\">File</a>></div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/fs/struct.File.html\" title=\"struct std::fs::File\">File</a>></div>"}</script></section></div></main></body></html>
|
||||
server to do QUIC address discovery.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.ExportKeyingMaterial.html" title="trait iroh_relay::ExportKeyingMaterial">Export<wbr>Keying<wbr>Material</a></dt><dd>Trait for extracting keying material from a TLS connection.</dd></dl><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</div>","<Arc<S> as Service<Request>>::Future":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/fs/struct.File.html\" title=\"struct std::fs::File\">File</a>></code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/fs/struct.File.html\" title=\"struct std::fs::File\">File</a>></div><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/std/fs/struct.File.html\" title=\"struct std::fs::File\">File</a>></div>"}</script></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Common types between the `super::handshake` and `super::relay` protocols."><title>iroh_relay::protos::common - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module common</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module common</a></h2><h3><a href="#enums">Module Items</a></h3><ul class="block"><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>protos</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">protos</a></div><h1>Module <span>common</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/protos/common.rs.html#1-119">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Common types between the <a href="../handshake/index.html" title="mod iroh_relay::protos::handshake"><code>super::handshake</code></a> and <a href="../relay/index.html" title="mod iroh_relay::protos::relay"><code>super::relay</code></a> protocols.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Common types between the `super::handshake` and `super::relay` protocols."><title>iroh_relay::protos::common - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module common</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module common</a></h2><h3><a href="#enums">Module Items</a></h3><ul class="block"><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>protos</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">protos</a></div><h1>Module <span>common</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/protos/common.rs.html#1-118">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Common types between the <a href="../handshake/index.html" title="mod iroh_relay::protos::handshake"><code>super::handshake</code></a> and <a href="../relay/index.html" title="mod iroh_relay::protos::relay"><code>super::relay</code></a> protocols.</p>
|
||||
<p>Hosts the <a href="enum.FrameType.html" title="enum iroh_relay::protos::common::FrameType"><code>FrameType</code></a> enum to make sure we’re not accidentally reusing frame type
|
||||
integers for different frames.</p>
|
||||
</div></details><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.FrameType.html" title="enum iroh_relay::protos::common::FrameType">Frame<wbr>Type</a></dt><dd>Possible frame types during handshaking</dd><dt><a class="enum" href="enum.FrameTypeError.html" title="enum iroh_relay::protos::common::FrameTypeError">Frame<wbr>Type<wbr>Error</a></dt></dl></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Runs the server side of the handshaking protocol."><title>serverside in iroh_relay::protos::handshake - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">serverside</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>relay::<wbr>protos::<wbr>handshake</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">protos</a>::<wbr><a href="index.html">handshake</a></div><h1>Function <span class="fn">serverside</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/protos/handshake.rs.html#425-478">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn serverside(
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Runs the server side of the handshaking protocol."><title>serverside in iroh_relay::protos::handshake - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">serverside</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>relay::<wbr>protos::<wbr>handshake</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">protos</a>::<wbr><a href="index.html">handshake</a></div><h1>Function <span class="fn">serverside</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/protos/handshake.rs.html#421-474">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn serverside(
|
||||
io: &mut (impl <a class="trait" href="../streams/trait.BytesStreamSink.html" title="trait iroh_relay::protos::streams::BytesStreamSink">BytesStreamSink</a> + <a class="trait" href="../../trait.ExportKeyingMaterial.html" title="trait iroh_relay::ExportKeyingMaterial">ExportKeyingMaterial</a>),
|
||||
client_auth_header: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><HeaderValue>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.SuccessfulAuthentication.html" title="struct iroh_relay::protos::handshake::SuccessfulAuthentication">SuccessfulAuthentication</a>, <a class="enum" href="enum.Error.html" title="enum iroh_relay::protos::handshake::Error">Error</a>></code></pre><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>server</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Runs the server side of the handshaking protocol.</p>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Implements the handshake protocol that authenticates and authorizes clients connecting to the relays."><title>iroh_relay::protos::handshake - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module handshake</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module handshake</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>protos</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">protos</a></div><h1>Module <span>handshake</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/protos/handshake.rs.html#1-909">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implements the handshake protocol that authenticates and authorizes clients connecting to the relays.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Implements the handshake protocol that authenticates and authorizes clients connecting to the relays."><title>iroh_relay::protos::handshake - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module handshake</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module handshake</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>protos</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">protos</a></div><h1>Module <span>handshake</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/protos/handshake.rs.html#1-905">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Implements the handshake protocol that authenticates and authorizes clients connecting to the relays.</p>
|
||||
<p>The purpose of the handshake is to</p>
|
||||
<ol>
|
||||
<li>Inform the relay of the client’s EndpointId</li>
|
||||
@@ -19,5 +19,4 @@ contains a signature of some shared keying material extracted from TLS (<a href=
|
||||
first, however, it won’t always work, as it relies on the keying material extraction feature of TLS,
|
||||
which is not available in browsers (but might be in the future?) and might break when there’s an
|
||||
HTTPS proxy that doesn’t properly deal with this TLS feature.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.SuccessfulAuthentication.html" title="struct iroh_relay::protos::handshake::SuccessfulAuthentication">Successful<wbr>Authentication</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>This represents successful authentication for the client with the <code>client_key</code> public key
|
||||
via the authentication <a href="enum.Mechanism.html" title="enum iroh_relay::protos::handshake::Mechanism"><code>Mechanism</code></a> <code>mechanism</code>.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Error.html" title="enum iroh_relay::protos::handshake::Error">Error</a></dt><dt><a class="enum" href="enum.Mechanism.html" title="enum iroh_relay::protos::handshake::Mechanism">Mechanism</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>The mechanism that was used for authentication.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.serverside.html" title="fn iroh_relay::protos::handshake::serverside">serverside</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>Runs the server side of the handshaking protocol.</dd></dl></section></div></main></body></html>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.SuccessfulAuthentication.html" title="struct iroh_relay::protos::handshake::SuccessfulAuthentication">Successful<wbr>Authentication</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>Result of a successful authentication handshake.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Error.html" title="enum iroh_relay::protos::handshake::Error">Error</a></dt><dt><a class="enum" href="enum.Mechanism.html" title="enum iroh_relay::protos::handshake::Mechanism">Mechanism</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>The mechanism that was used for authentication.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.serverside.html" title="fn iroh_relay::protos::handshake::serverside">serverside</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>Runs the server side of the handshaking protocol.</dd></dl></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The server-side representation of an ongoing client relaying connection."><title>iroh_relay::server::client - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module client</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module client</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>server</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">server</a></div><h1>Module <span>client</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/server/client.rs.html#1-861">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>server</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The server-side representation of an ongoing client relaying connection.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Config.html" title="struct iroh_relay::server::client::Config">Config</a></dt><dd>Configuration for a [<code>Client</code>].</dd><dt><a class="struct" href="struct.ForwardPacketError.html" title="struct iroh_relay::server::client::ForwardPacketError">Forward<wbr>Packet<wbr>Error</a></dt><dd>Error returned when forwarding a packet to a client fails.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.HandleFrameError.html" title="enum iroh_relay::server::client::HandleFrameError">Handle<wbr>Frame<wbr>Error</a></dt><dd>Error when handling an incoming frame from a client.</dd><dt><a class="enum" href="enum.RunError.html" title="enum iroh_relay::server::client::RunError">RunError</a></dt><dd>Run error</dd><dt><a class="enum" href="enum.WriteFrameError.html" title="enum iroh_relay::server::client::WriteFrameError">Write<wbr>Frame<wbr>Error</a></dt><dd>Error when writing a frame to a client.</dd></dl></section></div></main></body></html>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Config.html" title="struct iroh_relay::server::client::Config">Config</a></dt><dd>Configuration for a client connection.</dd><dt><a class="struct" href="struct.ForwardPacketError.html" title="struct iroh_relay::server::client::ForwardPacketError">Forward<wbr>Packet<wbr>Error</a></dt><dd>Error returned when forwarding a packet to a client fails.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.HandleFrameError.html" title="enum iroh_relay::server::client::HandleFrameError">Handle<wbr>Frame<wbr>Error</a></dt><dd>Error when handling an incoming frame from a client.</dd><dt><a class="enum" href="enum.RunError.html" title="enum iroh_relay::server::client::RunError">RunError</a></dt><dd>Run error</dd><dt><a class="enum" href="enum.WriteFrameError.html" title="enum iroh_relay::server::client::WriteFrameError">Write<wbr>Frame<wbr>Error</a></dt><dd>Error when writing a frame to a client.</dd></dl></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The “Server” side of the client. Uses the `ClientConnManager`."><title>iroh_relay::server::clients - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module clients</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module clients</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>server</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">server</a></div><h1>Module <span>clients</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/server/clients.rs.html#1-521">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>server</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The “Server” side of the client. Uses the <code>ClientConnManager</code>.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Clients.html" title="struct iroh_relay::server::clients::Clients">Clients</a></dt><dd>Manages the connections to all currently connected clients.
|
||||
Registry of connected relay clients.</dd></dl></section></div></main></body></html>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The “Server” side of the client. Uses the `ClientConnManager`."><title>iroh_relay::server::clients - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module clients</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module clients</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In iroh_<wbr>relay::<wbr>server</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">iroh_relay</a>::<wbr><a href="../index.html">server</a></div><h1>Module <span>clients</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/iroh_relay/server/clients.rs.html#1-520">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>server</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The “Server” side of the client. Uses the <code>ClientConnManager</code>.</p>
|
||||
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Clients.html" title="struct iroh_relay::server::clients::Clients">Clients</a></dt><dd>Registry of connected relay clients.</dd></dl></section></div></main></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
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A fully-fledged iroh-relay server over HTTP or HTTPS."><title>iroh_relay::server - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module server</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module server</a></h2><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a></div><h1>Module <span>server</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/server.rs.html#1-1610">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>server</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A fully-fledged iroh-relay server over HTTP or HTTPS.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A fully-fledged iroh-relay server over HTTP or HTTPS."><title>iroh_relay::server - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module server</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module server</a></h2><h3><a href="#reexports">Module Items</a></h3><ul class="block"><li><a href="#reexports" title="Re-exports">Re-exports</a></li><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a></div><h1>Module <span>server</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/server.rs.html#1-1614">Source</a> </span></div><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>server</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A fully-fledged iroh-relay server over HTTP or HTTPS.</p>
|
||||
<p>This module provides an API to run a full fledged iroh-relay server. It is primarily
|
||||
used by the <code>iroh-relay</code> binary in this crate. It can be used to run a relay server in
|
||||
other locations however.</p>
|
||||
|
||||
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
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
@@ -7,7 +7,7 @@
|
||||
<p>Since the captive portal probe has to run over plain text HTTP and TLS is used for
|
||||
the main relay server this has to be on a different port. When TLS is not enabled
|
||||
this is served on the <a href="struct.RelayConfig.html#structfield.http_bind_addr" title="field iroh_relay::server::RelayConfig::http_bind_addr"><code>RelayConfig::http_bind_addr</code></a> socket address.</p>
|
||||
<p>Normally you’d choose port <code>80</code>.</p>
|
||||
<p>Normally you’d choose port <code>443</code>.</p>
|
||||
</div><span id="structfield.cert" class="structfield section-header"><a href="#structfield.cert" class="anchor field">§</a><code>cert: <a class="enum" href="enum.CertConfig.html" title="enum iroh_relay::server::CertConfig">CertConfig</a></code></span><div class="docblock"><p>Mode for getting a cert.</p>
|
||||
</div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-TlsConfig" class="impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#474-482">Source</a><a href="#impl-TlsConfig" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.new" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#476-481">Source</a><h4 class="code-header">pub fn <a href="#method.new" class="fn">new</a>(https_bind_addr: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>>, cert: <a class="enum" href="enum.CertConfig.html" title="enum iroh_relay::server::CertConfig">CertConfig</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig"><code>TlsConfig</code></a> with the given bind address and certificate configuration.</p>
|
||||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-TlsConfig" class="impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#459">Source</a><a href="#impl-Debug-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#459">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, __derive_more_f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-TlsConfig" class="impl"><a href="#impl-Freeze-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section><section id="impl-RefUnwindSafe-for-TlsConfig" class="impl"><a href="#impl-RefUnwindSafe-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section><section id="impl-Send-for-TlsConfig" class="impl"><a href="#impl-Send-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section><section id="impl-Sync-for-TlsConfig" class="impl"><a href="#impl-Sync-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section><section id="impl-Unpin-for-TlsConfig" class="impl"><a href="#impl-Unpin-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section><section id="impl-UnwindSafe-for-TlsConfig" class="impl"><a href="#impl-UnwindSafe-for-TlsConfig" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.TlsConfig.html" title="struct iroh_relay::server::TlsConfig">TlsConfig</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Function to build a `ServerCertVerifier` from a `CryptoProvider`."><title>ServerCertVerifierBuilder in iroh_relay::tls - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc type"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">ServerCertVerifierBuilder</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Server<wbr>Cert<wbr>Verifier<wbr>Builder</a></h2><h3><a href="#aliased-type">Aliased Type</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>relay::<wbr>tls</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a>::<wbr><a href="index.html">tls</a></div><h1>Type Alias <span class="type">Server<wbr>Cert<wbr>Verifier<wbr>Builder</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/tls.rs.html#221-223">Source</a> </span></div><pre class="rust item-decl"><code>pub type ServerCertVerifierBuilder = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><CryptoProvider>) -> <a class="type" href="https://doc.rust-lang.org/nightly/std/io/error/type.Result.html" title="type std::io::error::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><dyn ServerCertVerifier>> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + 'static>;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Function to build a [<code>ServerCertVerifier</code>] from a [<code>CryptoProvider</code>].</p>
|
||||
<p>See <a href="struct.CaTlsConfig.html#method.custom_server_cert_verifier" title="associated function iroh_relay::tls::CaTlsConfig::custom_server_cert_verifier">`CaTlsConfig::custom_server_cert_verifier</a>.</p>
|
||||
<p>See <a href="struct.CaTlsConfig.html#method.custom_server_cert_verifier" title="associated function iroh_relay::tls::CaTlsConfig::custom_server_cert_verifier"><code>CaTlsConfig::custom_server_cert_verifier</code></a>.</p>
|
||||
</div></details><h2 id="aliased-type" class="section-header">Aliased Type<a href="#aliased-type" class="anchor">§</a></h2><pre class="rust item-decl"><code>pub struct ServerCertVerifierBuilder { <span class="comment">/* private fields */</span> }</code></pre><script src="../../type.impl/alloc/sync/struct.Arc.js" data-self-path="iroh_relay::tls::ServerCertVerifierBuilder" async></script></section></div></main></body></html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="This trait allows anything that ends up potentially wrapping a TLS stream use the underlying `export_keying_material` function."><title>ExportKeyingMaterial in iroh_relay - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">ExportKeyingMaterial</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Export<wbr>Keying<wbr>Material</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.export_keying_material" title="export_keying_material">export_keying_material</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate iroh_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">iroh_relay</a></div><h1>Trait <span class="trait">Export<wbr>Keying<wbr>Material</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/iroh_relay/lib.rs.html#63-83">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ExportKeyingMaterial {
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Trait for extracting keying material from a TLS connection."><title>ExportKeyingMaterial in iroh_relay - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">ExportKeyingMaterial</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">1.0.0-rc.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Export<wbr>Keying<wbr>Material</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.export_keying_material" title="export_keying_material">export_keying_material</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate iroh_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">iroh_relay</a></div><h1>Trait <span class="trait">Export<wbr>Keying<wbr>Material</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/iroh_relay/lib.rs.html#61-81">Source</a> </span></div><pre class="rust item-decl"><code>pub trait ExportKeyingMaterial {
|
||||
// Required method
|
||||
fn <a href="#tymethod.export_keying_material" class="fn">export_keying_material</a><T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>>(
|
||||
&self,
|
||||
@@ -6,13 +6,11 @@
|
||||
label: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>],
|
||||
context: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>,
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>This trait allows anything that ends up potentially
|
||||
wrapping a TLS stream use the underlying <a href="rustls::ConnectionCommon::export_keying_material"><code>export_keying_material</code></a>
|
||||
function.</p>
|
||||
<p>Trait for extracting keying material from a TLS connection.</p>
|
||||
<p>This is used during the relay handshake to establish a shared secret
|
||||
between the client and server for authentication purposes.</p>
|
||||
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.export_keying_material" class="method"><a class="src rightside" href="../src/iroh_relay/lib.rs.html#77-82">Source</a><h4 class="code-header">fn <a href="#tymethod.export_keying_material" class="fn">export_keying_material</a><T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>>(
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait for extracting keying material from a TLS connection.</p>
|
||||
<p>This allows anything that ends up potentially wrapping a TLS stream to use the
|
||||
underlying <a href="rustls::ConnectionCommon::export_keying_material"><code>export_keying_material</code></a> function. It is used during the relay handshake
|
||||
to establish a shared secret between the client and server for authentication purposes.</p>
|
||||
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.export_keying_material" class="method"><a class="src rightside" href="../src/iroh_relay/lib.rs.html#75-80">Source</a><h4 class="code-header">fn <a href="#tymethod.export_keying_material" class="fn">export_keying_material</a><T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsMut.html" title="trait core::convert::AsMut">AsMut</a><[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]>>(
|
||||
&self,
|
||||
output: T,
|
||||
label: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>],
|
||||
|
||||
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
@@ -3,10 +3,10 @@
|
||||
<a href=#3 id=3 data-nosnippet>3</a>//! To connect to an iroh endpoint a [`EndpointAddr`] is needed, which may contain a
|
||||
<a href=#4 id=4 data-nosnippet>4</a>//! [`RelayUrl`] or one or more *direct addresses* in addition to the [`EndpointId`].
|
||||
<a href=#5 id=5 data-nosnippet>5</a>//!
|
||||
<a href=#6 id=6 data-nosnippet>6</a>//! Since there is a conversion from [`EndpointId`] to [`EndpointAddr`], you can also use
|
||||
<a href=#6 id=6 data-nosnippet>6</a>//! Since there is a conversion from [`EndpointId`] to [`EndpointAddr`], you can also
|
||||
<a href=#7 id=7 data-nosnippet>7</a>//! connect directly with a [`EndpointId`].
|
||||
<a href=#8 id=8 data-nosnippet>8</a>//!
|
||||
<a href=#9 id=9 data-nosnippet>9</a>//! For this to work however, the endpoint has to get the addressing information by
|
||||
<a href=#9 id=9 data-nosnippet>9</a>//! For this to work however, the endpoint has to get the addressing information by
|
||||
<a href=#10 id=10 data-nosnippet>10</a>//! other means.
|
||||
<a href=#11 id=11 data-nosnippet>11</a>//!
|
||||
<a href=#12 id=12 data-nosnippet>12</a>//! [`AddressLookup`] is an automated system for an [`Endpoint`] to retrieve this addressing
|
||||
@@ -50,9 +50,9 @@
|
||||
<a href=#50 id=50 data-nosnippet>50</a>//! [`iroh-mdns-address-lookup`]: https://docs.rs/iroh-mdns-address-lookup
|
||||
<a href=#51 id=51 data-nosnippet>51</a>//! [`iroh-mainline-address-lookup`]: https://docs.rs/iroh-mainline-address-lookup
|
||||
<a href=#52 id=52 data-nosnippet>52</a>//!
|
||||
<a href=#53 id=53 data-nosnippet>53</a>//! To use multiple Address Lookup'ssimultaneously you can call [`Builder::address_lookup`].
|
||||
<a href=#53 id=53 data-nosnippet>53</a>//! To use multiple Address Lookups simultaneously you can call [`Builder::address_lookup`].
|
||||
<a href=#54 id=54 data-nosnippet>54</a>//! This will use [`AddressLookupServices`] under the hood, which performs lookups to all
|
||||
<a href=#55 id=55 data-nosnippet>55</a>//! Address Lookupsystems at the same time.
|
||||
<a href=#55 id=55 data-nosnippet>55</a>//! Address Lookup systems at the same time.
|
||||
<a href=#56 id=56 data-nosnippet>56</a>//!
|
||||
<a href=#57 id=57 data-nosnippet>57</a>//! [`Builder::address_lookup`] takes any type that implements [`AddressLookupBuilder`]. You can
|
||||
<a href=#58 id=58 data-nosnippet>58</a>//! implement that trait on a builder struct if your Address Lookup needs information
|
||||
@@ -60,8 +60,8 @@
|
||||
<a href=#60 id=60 data-nosnippet>60</a>//! is built by calling [`AddressLookupBuilder::into_address_lookup`], passing the finished [`Endpoint`] to your
|
||||
<a href=#61 id=61 data-nosnippet>61</a>//! builder.
|
||||
<a href=#62 id=62 data-nosnippet>62</a>//!
|
||||
<a href=#63 id=63 data-nosnippet>63</a>//! If your Address Lookupdoes not need any information from its endpoint, you can
|
||||
<a href=#64 id=64 data-nosnippet>64</a>//! pass the Address Lookupservice directly to [`Builder::address_lookup`]: All types that
|
||||
<a href=#63 id=63 data-nosnippet>63</a>//! If your Address Lookup does not need any information from its endpoint, you can
|
||||
<a href=#64 id=64 data-nosnippet>64</a>//! pass the Address Lookup service directly to [`Builder::address_lookup`]: All types that
|
||||
<a href=#65 id=65 data-nosnippet>65</a>//! implement [`AddressLookup`] also have a blanket implementation of [`AddressLookupBuilder`].
|
||||
<a href=#66 id=66 data-nosnippet>66</a>//!
|
||||
<a href=#67 id=67 data-nosnippet>67</a>//! # Examples
|
||||
@@ -334,7 +334,7 @@
|
||||
<a href=#334 id=334 data-nosnippet>334</a> <span class="doccomment">/// Publishes the given [`EndpointData`] to the Address Lookup mechanism.
|
||||
<a href=#335 id=335 data-nosnippet>335</a> ///
|
||||
<a href=#336 id=336 data-nosnippet>336</a> /// This is fire and forget, since the [`Endpoint`] can not wait for successful
|
||||
<a href=#337 id=337 data-nosnippet>337</a> /// publishing. If publishing is async, the implementation should start it's own task.
|
||||
<a href=#337 id=337 data-nosnippet>337</a> /// publishing. If publishing is async, the implementation should start its own task.
|
||||
<a href=#338 id=338 data-nosnippet>338</a> ///
|
||||
<a href=#339 id=339 data-nosnippet>339</a> /// This will be called from a tokio task, so it is safe to spawn new tasks.
|
||||
<a href=#340 id=340 data-nosnippet>340</a> /// These tasks will be run on the runtime of the [`super::Endpoint`].
|
||||
@@ -369,7 +369,7 @@
|
||||
<a href=#369 id=369 data-nosnippet>369</a>/// directly from [`Item`].
|
||||
<a href=#370 id=370 data-nosnippet>370</a></span><span class="attr">#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
<a href=#371 id=371 data-nosnippet>371</a></span><span class="kw">pub struct </span>Item {
|
||||
<a href=#372 id=372 data-nosnippet>372</a> <span class="doccomment">/// The endpoint info for the endpoint, as discovered by the the Address Lookup.
|
||||
<a href=#372 id=372 data-nosnippet>372</a> <span class="doccomment">/// The endpoint info for the endpoint, as discovered by the Address Lookup.
|
||||
<a href=#373 id=373 data-nosnippet>373</a> </span>endpoint_info: EndpointInfo,
|
||||
<a href=#374 id=374 data-nosnippet>374</a> <span class="doccomment">/// A static string to identify the Address Lookup source.
|
||||
<a href=#375 id=375 data-nosnippet>375</a> ///
|
||||
@@ -421,12 +421,12 @@
|
||||
<a href=#421 id=421 data-nosnippet>421</a> <span class="self">self</span>.last_updated
|
||||
<a href=#422 id=422 data-nosnippet>422</a> }
|
||||
<a href=#423 id=423 data-nosnippet>423</a>
|
||||
<a href=#424 id=424 data-nosnippet>424</a> <span class="doccomment">/// Converts into a [`EndpointAddr`] by cloning the needed fields.
|
||||
<a href=#424 id=424 data-nosnippet>424</a> <span class="doccomment">/// Returns an [`EndpointAddr`] by cloning the needed fields.
|
||||
<a href=#425 id=425 data-nosnippet>425</a> </span><span class="kw">pub fn </span>to_endpoint_addr(<span class="kw-2">&</span><span class="self">self</span>) -> EndpointAddr {
|
||||
<a href=#426 id=426 data-nosnippet>426</a> <span class="self">self</span>.endpoint_info.to_endpoint_addr()
|
||||
<a href=#427 id=427 data-nosnippet>427</a> }
|
||||
<a href=#428 id=428 data-nosnippet>428</a>
|
||||
<a href=#429 id=429 data-nosnippet>429</a> <span class="doccomment">/// Converts into a [`EndpointAddr`] without cloning.
|
||||
<a href=#429 id=429 data-nosnippet>429</a> <span class="doccomment">/// Converts into an [`EndpointAddr`] without cloning.
|
||||
<a href=#430 id=430 data-nosnippet>430</a> </span><span class="kw">pub fn </span>into_endpoint_addr(<span class="self">self</span>) -> EndpointAddr {
|
||||
<a href=#431 id=431 data-nosnippet>431</a> <span class="self">self</span>.endpoint_info.into_endpoint_addr()
|
||||
<a href=#432 id=432 data-nosnippet>432</a> }
|
||||
@@ -457,7 +457,7 @@
|
||||
<a href=#457 id=457 data-nosnippet>457</a>///
|
||||
<a href=#458 id=458 data-nosnippet>458</a>/// See [`AddressLookup`] and [`Self::resolve`] for details.
|
||||
<a href=#459 id=459 data-nosnippet>459</a>///
|
||||
<a href=#460 id=460 data-nosnippet>460</a>/// [`Endpoint]: crate::Endpoint
|
||||
<a href=#460 id=460 data-nosnippet>460</a>/// [`Endpoint`]: crate::Endpoint
|
||||
<a href=#461 id=461 data-nosnippet>461</a></span><span class="attr">#[derive(Debug, Default, Clone)]
|
||||
<a href=#462 id=462 data-nosnippet>462</a></span><span class="kw">pub struct </span>AddressLookupServices {
|
||||
<a href=#463 id=463 data-nosnippet>463</a> services: Arc<RwLock<Vec<Box<<span class="kw">dyn </span>AddressLookup>>>>,
|
||||
|
||||
@@ -82,57 +82,55 @@
|
||||
<a href=#82 id=82 data-nosnippet>82</a> }
|
||||
<a href=#83 id=83 data-nosnippet>83</a> }
|
||||
<a href=#84 id=84 data-nosnippet>84</a>
|
||||
<a href=#85 id=85 data-nosnippet>85</a> <span class="doccomment">/// Creates a new DNS discovery using the `iroh.link` domain.
|
||||
<a href=#85 id=85 data-nosnippet>85</a> <span class="doccomment">/// Creates a new DNS address lookup using the `iroh.link` domain.
|
||||
<a href=#86 id=86 data-nosnippet>86</a> ///
|
||||
<a href=#87 id=87 data-nosnippet>87</a> /// This uses the [`N0_DNS_ENDPOINT_ORIGIN_PROD`] domain.
|
||||
<a href=#88 id=88 data-nosnippet>88</a> ///
|
||||
<a href=#89 id=89 data-nosnippet>89</a> /// # Usage during tests
|
||||
<a href=#90 id=90 data-nosnippet>90</a> ///
|
||||
<a href=#91 id=91 data-nosnippet>91</a> /// For testing it is possible to use the [`N0_DNS_ENDPOINT_ORIGIN_STAGING`] domain
|
||||
<a href=#92 id=92 data-nosnippet>92</a> /// with [`DnsAddressLookup::builder`]. This would then use a hosted staging discovery
|
||||
<a href=#93 id=93 data-nosnippet>93</a> /// service for testing purposes.
|
||||
<a href=#94 id=94 data-nosnippet>94</a> </span><span class="kw">pub fn </span>n0_dns() -> DnsAddressLookupBuilder {
|
||||
<a href=#95 id=95 data-nosnippet>95</a> <span class="kw">if </span>force_staging_infra() {
|
||||
<a href=#96 id=96 data-nosnippet>96</a> <span class="self">Self</span>::builder(N0_DNS_ENDPOINT_ORIGIN_STAGING.to_string())
|
||||
<a href=#97 id=97 data-nosnippet>97</a> } <span class="kw">else </span>{
|
||||
<a href=#98 id=98 data-nosnippet>98</a> <span class="self">Self</span>::builder(N0_DNS_ENDPOINT_ORIGIN_PROD.to_string())
|
||||
<a href=#99 id=99 data-nosnippet>99</a> }
|
||||
<a href=#100 id=100 data-nosnippet>100</a> }
|
||||
<a href=#101 id=101 data-nosnippet>101</a>}
|
||||
<a href=#102 id=102 data-nosnippet>102</a>
|
||||
<a href=#103 id=103 data-nosnippet>103</a><span class="kw">impl </span>AddressLookupBuilder <span class="kw">for </span>DnsAddressLookupBuilder {
|
||||
<a href=#104 id=104 data-nosnippet>104</a> <span class="kw">fn </span>into_address_lookup(
|
||||
<a href=#105 id=105 data-nosnippet>105</a> <span class="kw-2">mut </span><span class="self">self</span>,
|
||||
<a href=#106 id=106 data-nosnippet>106</a> endpoint: <span class="kw-2">&</span>Endpoint,
|
||||
<a href=#107 id=107 data-nosnippet>107</a> ) -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>AddressLookup, AddressLookupBuilderError> {
|
||||
<a href=#108 id=108 data-nosnippet>108</a> <span class="kw">if </span><span class="self">self</span>.dns_resolver.is_none() {
|
||||
<a href=#109 id=109 data-nosnippet>109</a> <span class="self">self</span>.dns_resolver = <span class="prelude-val">Some</span>(endpoint.dns_resolver()<span class="question-mark">?</span>.clone());
|
||||
<a href=#110 id=110 data-nosnippet>110</a> }
|
||||
<a href=#111 id=111 data-nosnippet>111</a> <span class="prelude-val">Ok</span>(<span class="self">self</span>.build())
|
||||
<a href=#112 id=112 data-nosnippet>112</a> }
|
||||
<a href=#113 id=113 data-nosnippet>113</a>}
|
||||
<a href=#114 id=114 data-nosnippet>114</a>
|
||||
<a href=#115 id=115 data-nosnippet>115</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>DnsAddressLookup {
|
||||
<a href=#116 id=116 data-nosnippet>116</a> <span class="kw">fn </span>resolve(
|
||||
<a href=#117 id=117 data-nosnippet>117</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#118 id=118 data-nosnippet>118</a> endpoint_id: EndpointId,
|
||||
<a href=#119 id=119 data-nosnippet>119</a> ) -> <span class="prelude-ty">Option</span><BoxStream<<span class="prelude-ty">Result</span><AddressLookupItem, AddressLookupError>>> {
|
||||
<a href=#120 id=120 data-nosnippet>120</a> <span class="kw">let </span>resolver = <span class="self">self</span>.dns_resolver.clone();
|
||||
<a href=#121 id=121 data-nosnippet>121</a> <span class="kw">let </span>origin_domain = <span class="self">self</span>.origin_domain.clone();
|
||||
<a href=#122 id=122 data-nosnippet>122</a> <span class="kw">let </span>span =
|
||||
<a href=#123 id=123 data-nosnippet>123</a> <span class="macro">debug_span!</span>(<span class="string">"DnsAddressLookup"</span>, lookup_id=%endpoint_id.fmt_short(), %origin_domain);
|
||||
<a href=#124 id=124 data-nosnippet>124</a> <span class="kw">let </span>fut = <span class="kw">async move </span>{
|
||||
<a href=#125 id=125 data-nosnippet>125</a> <span class="macro">trace!</span>(<span class="string">"starting DNS lookup"</span>);
|
||||
<a href=#126 id=126 data-nosnippet>126</a> <span class="kw">let </span>endpoint_info = resolver
|
||||
<a href=#127 id=127 data-nosnippet>127</a> .lookup_endpoint_by_id_staggered(<span class="kw-2">&</span>endpoint_id, <span class="kw-2">&</span>origin_domain, DNS_STAGGERING_MS)
|
||||
<a href=#128 id=128 data-nosnippet>128</a> .<span class="kw">await
|
||||
<a href=#129 id=129 data-nosnippet>129</a> </span>.inspect_err(|err| <span class="macro">debug!</span>(<span class="string">"DNS lookup failed: {err:#}"</span>))
|
||||
<a href=#130 id=130 data-nosnippet>130</a> .map_err(|e| AddressLookupError::from_err_any(<span class="string">"dns"</span>, e))<span class="question-mark">?</span>;
|
||||
<a href=#131 id=131 data-nosnippet>131</a> <span class="macro">debug!</span>(info=<span class="question-mark">?</span>endpoint_info, <span class="string">"DNS lookup success"</span>);
|
||||
<a href=#132 id=132 data-nosnippet>132</a> <span class="prelude-val">Ok</span>(AddressLookupItem::new(endpoint_info, <span class="string">"dns"</span>, <span class="prelude-val">None</span>))
|
||||
<a href=#133 id=133 data-nosnippet>133</a> }
|
||||
<a href=#134 id=134 data-nosnippet>134</a> .instrument(span);
|
||||
<a href=#135 id=135 data-nosnippet>135</a> <span class="kw">let </span>stream = n0_future::stream::once_future(fut);
|
||||
<a href=#136 id=136 data-nosnippet>136</a> <span class="prelude-val">Some</span>(Box::pin(stream))
|
||||
<a href=#137 id=137 data-nosnippet>137</a> }
|
||||
<a href=#138 id=138 data-nosnippet>138</a>}</code></pre></div></section></main></body></html>
|
||||
<a href=#89 id=89 data-nosnippet>89</a> /// When running with the environment variable `IROH_FORCE_STAGING_RELAYS`
|
||||
<a href=#90 id=90 data-nosnippet>90</a> /// set to any non empty value the [`N0_DNS_ENDPOINT_ORIGIN_STAGING`] domain
|
||||
<a href=#91 id=91 data-nosnippet>91</a> /// is used instead.
|
||||
<a href=#92 id=92 data-nosnippet>92</a> </span><span class="kw">pub fn </span>n0_dns() -> DnsAddressLookupBuilder {
|
||||
<a href=#93 id=93 data-nosnippet>93</a> <span class="kw">if </span>force_staging_infra() {
|
||||
<a href=#94 id=94 data-nosnippet>94</a> <span class="self">Self</span>::builder(N0_DNS_ENDPOINT_ORIGIN_STAGING.to_string())
|
||||
<a href=#95 id=95 data-nosnippet>95</a> } <span class="kw">else </span>{
|
||||
<a href=#96 id=96 data-nosnippet>96</a> <span class="self">Self</span>::builder(N0_DNS_ENDPOINT_ORIGIN_PROD.to_string())
|
||||
<a href=#97 id=97 data-nosnippet>97</a> }
|
||||
<a href=#98 id=98 data-nosnippet>98</a> }
|
||||
<a href=#99 id=99 data-nosnippet>99</a>}
|
||||
<a href=#100 id=100 data-nosnippet>100</a>
|
||||
<a href=#101 id=101 data-nosnippet>101</a><span class="kw">impl </span>AddressLookupBuilder <span class="kw">for </span>DnsAddressLookupBuilder {
|
||||
<a href=#102 id=102 data-nosnippet>102</a> <span class="kw">fn </span>into_address_lookup(
|
||||
<a href=#103 id=103 data-nosnippet>103</a> <span class="kw-2">mut </span><span class="self">self</span>,
|
||||
<a href=#104 id=104 data-nosnippet>104</a> endpoint: <span class="kw-2">&</span>Endpoint,
|
||||
<a href=#105 id=105 data-nosnippet>105</a> ) -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>AddressLookup, AddressLookupBuilderError> {
|
||||
<a href=#106 id=106 data-nosnippet>106</a> <span class="kw">if </span><span class="self">self</span>.dns_resolver.is_none() {
|
||||
<a href=#107 id=107 data-nosnippet>107</a> <span class="self">self</span>.dns_resolver = <span class="prelude-val">Some</span>(endpoint.dns_resolver()<span class="question-mark">?</span>.clone());
|
||||
<a href=#108 id=108 data-nosnippet>108</a> }
|
||||
<a href=#109 id=109 data-nosnippet>109</a> <span class="prelude-val">Ok</span>(<span class="self">self</span>.build())
|
||||
<a href=#110 id=110 data-nosnippet>110</a> }
|
||||
<a href=#111 id=111 data-nosnippet>111</a>}
|
||||
<a href=#112 id=112 data-nosnippet>112</a>
|
||||
<a href=#113 id=113 data-nosnippet>113</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>DnsAddressLookup {
|
||||
<a href=#114 id=114 data-nosnippet>114</a> <span class="kw">fn </span>resolve(
|
||||
<a href=#115 id=115 data-nosnippet>115</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#116 id=116 data-nosnippet>116</a> endpoint_id: EndpointId,
|
||||
<a href=#117 id=117 data-nosnippet>117</a> ) -> <span class="prelude-ty">Option</span><BoxStream<<span class="prelude-ty">Result</span><AddressLookupItem, AddressLookupError>>> {
|
||||
<a href=#118 id=118 data-nosnippet>118</a> <span class="kw">let </span>resolver = <span class="self">self</span>.dns_resolver.clone();
|
||||
<a href=#119 id=119 data-nosnippet>119</a> <span class="kw">let </span>origin_domain = <span class="self">self</span>.origin_domain.clone();
|
||||
<a href=#120 id=120 data-nosnippet>120</a> <span class="kw">let </span>span =
|
||||
<a href=#121 id=121 data-nosnippet>121</a> <span class="macro">debug_span!</span>(<span class="string">"DnsAddressLookup"</span>, lookup_id=%endpoint_id.fmt_short(), %origin_domain);
|
||||
<a href=#122 id=122 data-nosnippet>122</a> <span class="kw">let </span>fut = <span class="kw">async move </span>{
|
||||
<a href=#123 id=123 data-nosnippet>123</a> <span class="macro">trace!</span>(<span class="string">"starting DNS lookup"</span>);
|
||||
<a href=#124 id=124 data-nosnippet>124</a> <span class="kw">let </span>endpoint_info = resolver
|
||||
<a href=#125 id=125 data-nosnippet>125</a> .lookup_endpoint_by_id_staggered(<span class="kw-2">&</span>endpoint_id, <span class="kw-2">&</span>origin_domain, DNS_STAGGERING_MS)
|
||||
<a href=#126 id=126 data-nosnippet>126</a> .<span class="kw">await
|
||||
<a href=#127 id=127 data-nosnippet>127</a> </span>.inspect_err(|err| <span class="macro">debug!</span>(<span class="string">"DNS lookup failed: {err:#}"</span>))
|
||||
<a href=#128 id=128 data-nosnippet>128</a> .map_err(|e| AddressLookupError::from_err_any(<span class="string">"dns"</span>, e))<span class="question-mark">?</span>;
|
||||
<a href=#129 id=129 data-nosnippet>129</a> <span class="macro">debug!</span>(info=<span class="question-mark">?</span>endpoint_info, <span class="string">"DNS lookup success"</span>);
|
||||
<a href=#130 id=130 data-nosnippet>130</a> <span class="prelude-val">Ok</span>(AddressLookupItem::new(endpoint_info, <span class="string">"dns"</span>, <span class="prelude-val">None</span>))
|
||||
<a href=#131 id=131 data-nosnippet>131</a> }
|
||||
<a href=#132 id=132 data-nosnippet>132</a> .instrument(span);
|
||||
<a href=#133 id=133 data-nosnippet>133</a> <span class="kw">let </span>stream = n0_future::stream::once_future(fut);
|
||||
<a href=#134 id=134 data-nosnippet>134</a> <span class="prelude-val">Some</span>(Box::pin(stream))
|
||||
<a href=#135 id=135 data-nosnippet>135</a> }
|
||||
<a href=#136 id=136 data-nosnippet>136</a>}</code></pre></div></section></main></body></html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<a href=#3 id=3 data-nosnippet>3</a>//! Often an application might get endpoint addressing information out-of-band in an
|
||||
<a href=#4 id=4 data-nosnippet>4</a>//! application-specific way. [`EndpointTicket`]'s are one common way used to achieve this.
|
||||
<a href=#5 id=5 data-nosnippet>5</a>//! This addressing information is often only usable for a limited time so needs to
|
||||
<a href=#6 id=6 data-nosnippet>6</a>//! be able to be removed again once know it is no longer useful.
|
||||
<a href=#6 id=6 data-nosnippet>6</a>//! be able to be removed again once you know it is no longer useful.
|
||||
<a href=#7 id=7 data-nosnippet>7</a>//!
|
||||
<a href=#8 id=8 data-nosnippet>8</a>//! This is where the [`MemoryLookup`] is useful: it allows applications to add and
|
||||
<a href=#9 id=9 data-nosnippet>9</a>//! retract endpoint addressing information that is otherwise out-of-band to iroh.
|
||||
@@ -29,277 +29,278 @@
|
||||
<a href=#29 id=29 data-nosnippet>29</a>/// Often an application might get endpoint addressing information out-of-band in an
|
||||
<a href=#30 id=30 data-nosnippet>30</a>/// application-specific way. [`EndpointTicket`]'s are one common way used to achieve this.
|
||||
<a href=#31 id=31 data-nosnippet>31</a>/// This addressing information is often only usable for a limited time so needs to
|
||||
<a href=#32 id=32 data-nosnippet>32</a>/// be able to be removed again once know it is no longer useful.
|
||||
<a href=#32 id=32 data-nosnippet>32</a>/// be able to be removed again once you know it is no longer useful.
|
||||
<a href=#33 id=33 data-nosnippet>33</a>///
|
||||
<a href=#34 id=34 data-nosnippet>34</a>/// This is where the [`MemoryLookup`] is useful: it allows applications to add and
|
||||
<a href=#35 id=35 data-nosnippet>35</a>/// retract endpoint addressing information that is otherwise out-of-band to iroh.
|
||||
<a href=#36 id=36 data-nosnippet>36</a>/// # Examples
|
||||
<a href=#37 id=37 data-nosnippet>37</a>///
|
||||
<a href=#38 id=38 data-nosnippet>38</a>/// ```no_run
|
||||
<a href=#39 id=39 data-nosnippet>39</a>/// # #[cfg(with_crypto_provider)] // Endpoint::bind needs a crypto provider
|
||||
<a href=#40 id=40 data-nosnippet>40</a>/// # {
|
||||
<a href=#41 id=41 data-nosnippet>41</a>/// use iroh::{
|
||||
<a href=#42 id=42 data-nosnippet>42</a>/// Endpoint, EndpointAddr, TransportAddr, address_lookup::memory::MemoryLookup,
|
||||
<a href=#43 id=43 data-nosnippet>43</a>/// endpoint::presets,
|
||||
<a href=#44 id=44 data-nosnippet>44</a>/// };
|
||||
<a href=#45 id=45 data-nosnippet>45</a>/// use iroh_base::SecretKey;
|
||||
<a href=#46 id=46 data-nosnippet>46</a>///
|
||||
<a href=#47 id=47 data-nosnippet>47</a>/// # #[tokio::main]
|
||||
<a href=#48 id=48 data-nosnippet>48</a>/// # async fn wrapper() -> n0_error::Result<()> {
|
||||
<a href=#49 id=49 data-nosnippet>49</a>/// // Create the Address Lookup and endpoint.
|
||||
<a href=#50 id=50 data-nosnippet>50</a>/// let address_lookup = MemoryLookup::new();
|
||||
<a href=#51 id=51 data-nosnippet>51</a>///
|
||||
<a href=#52 id=52 data-nosnippet>52</a>/// let _ep = Endpoint::builder(presets::N0)
|
||||
<a href=#53 id=53 data-nosnippet>53</a>/// .address_lookup(address_lookup.clone())
|
||||
<a href=#54 id=54 data-nosnippet>54</a>/// .bind()
|
||||
<a href=#55 id=55 data-nosnippet>55</a>/// .await?;
|
||||
<a href=#56 id=56 data-nosnippet>56</a>///
|
||||
<a href=#57 id=57 data-nosnippet>57</a>/// // Sometime later add a RelayUrl for our endpoint.
|
||||
<a href=#58 id=58 data-nosnippet>58</a>/// let id = SecretKey::generate().public();
|
||||
<a href=#59 id=59 data-nosnippet>59</a>/// // You can pass either `EndpointInfo` or `EndpointAddr` to `add_endpoint_info`.
|
||||
<a href=#60 id=60 data-nosnippet>60</a>/// address_lookup.add_endpoint_info(EndpointAddr {
|
||||
<a href=#61 id=61 data-nosnippet>61</a>/// id,
|
||||
<a href=#62 id=62 data-nosnippet>62</a>/// addrs: [TransportAddr::Relay("https://example.com".parse()?)]
|
||||
<a href=#63 id=63 data-nosnippet>63</a>/// .into_iter()
|
||||
<a href=#64 id=64 data-nosnippet>64</a>/// .collect(),
|
||||
<a href=#65 id=65 data-nosnippet>65</a>/// });
|
||||
<a href=#66 id=66 data-nosnippet>66</a>///
|
||||
<a href=#67 id=67 data-nosnippet>67</a>/// # Ok(())
|
||||
<a href=#68 id=68 data-nosnippet>68</a>/// # }
|
||||
<a href=#36 id=36 data-nosnippet>36</a>///
|
||||
<a href=#37 id=37 data-nosnippet>37</a>/// # Examples
|
||||
<a href=#38 id=38 data-nosnippet>38</a>///
|
||||
<a href=#39 id=39 data-nosnippet>39</a>/// ```no_run
|
||||
<a href=#40 id=40 data-nosnippet>40</a>/// # #[cfg(with_crypto_provider)] // Endpoint::bind needs a crypto provider
|
||||
<a href=#41 id=41 data-nosnippet>41</a>/// # {
|
||||
<a href=#42 id=42 data-nosnippet>42</a>/// use iroh::{
|
||||
<a href=#43 id=43 data-nosnippet>43</a>/// Endpoint, EndpointAddr, TransportAddr, address_lookup::memory::MemoryLookup,
|
||||
<a href=#44 id=44 data-nosnippet>44</a>/// endpoint::presets,
|
||||
<a href=#45 id=45 data-nosnippet>45</a>/// };
|
||||
<a href=#46 id=46 data-nosnippet>46</a>/// use iroh_base::SecretKey;
|
||||
<a href=#47 id=47 data-nosnippet>47</a>///
|
||||
<a href=#48 id=48 data-nosnippet>48</a>/// # #[tokio::main]
|
||||
<a href=#49 id=49 data-nosnippet>49</a>/// # async fn wrapper() -> n0_error::Result<()> {
|
||||
<a href=#50 id=50 data-nosnippet>50</a>/// // Create the Address Lookup and endpoint.
|
||||
<a href=#51 id=51 data-nosnippet>51</a>/// let address_lookup = MemoryLookup::new();
|
||||
<a href=#52 id=52 data-nosnippet>52</a>///
|
||||
<a href=#53 id=53 data-nosnippet>53</a>/// let _ep = Endpoint::builder(presets::N0)
|
||||
<a href=#54 id=54 data-nosnippet>54</a>/// .address_lookup(address_lookup.clone())
|
||||
<a href=#55 id=55 data-nosnippet>55</a>/// .bind()
|
||||
<a href=#56 id=56 data-nosnippet>56</a>/// .await?;
|
||||
<a href=#57 id=57 data-nosnippet>57</a>///
|
||||
<a href=#58 id=58 data-nosnippet>58</a>/// // Sometime later add a RelayUrl for our endpoint.
|
||||
<a href=#59 id=59 data-nosnippet>59</a>/// let id = SecretKey::generate().public();
|
||||
<a href=#60 id=60 data-nosnippet>60</a>/// // You can pass either `EndpointInfo` or `EndpointAddr` to `add_endpoint_info`.
|
||||
<a href=#61 id=61 data-nosnippet>61</a>/// address_lookup.add_endpoint_info(EndpointAddr {
|
||||
<a href=#62 id=62 data-nosnippet>62</a>/// id,
|
||||
<a href=#63 id=63 data-nosnippet>63</a>/// addrs: [TransportAddr::Relay("https://example.com".parse()?)]
|
||||
<a href=#64 id=64 data-nosnippet>64</a>/// .into_iter()
|
||||
<a href=#65 id=65 data-nosnippet>65</a>/// .collect(),
|
||||
<a href=#66 id=66 data-nosnippet>66</a>/// });
|
||||
<a href=#67 id=67 data-nosnippet>67</a>///
|
||||
<a href=#68 id=68 data-nosnippet>68</a>/// # Ok(())
|
||||
<a href=#69 id=69 data-nosnippet>69</a>/// # }
|
||||
<a href=#70 id=70 data-nosnippet>70</a>/// ```
|
||||
<a href=#71 id=71 data-nosnippet>71</a>///
|
||||
<a href=#72 id=72 data-nosnippet>72</a>/// [`EndpointTicket`]: https://docs.rs/iroh-tickets/latest/iroh_tickets/endpoint/struct.EndpointTicket.html
|
||||
<a href=#73 id=73 data-nosnippet>73</a></span><span class="attr">#[derive(Debug, Clone)]
|
||||
<a href=#74 id=74 data-nosnippet>74</a></span><span class="kw">pub struct </span>MemoryLookup {
|
||||
<a href=#75 id=75 data-nosnippet>75</a> endpoints: Arc<RwLock<BTreeMap<EndpointId, StoredEndpointInfo>>>,
|
||||
<a href=#76 id=76 data-nosnippet>76</a> provenance: <span class="kw-2">&</span><span class="lifetime">'static </span>str,
|
||||
<a href=#77 id=77 data-nosnippet>77</a>}
|
||||
<a href=#78 id=78 data-nosnippet>78</a>
|
||||
<a href=#79 id=79 data-nosnippet>79</a><span class="kw">impl </span>Default <span class="kw">for </span>MemoryLookup {
|
||||
<a href=#80 id=80 data-nosnippet>80</a> <span class="kw">fn </span>default() -> <span class="self">Self </span>{
|
||||
<a href=#81 id=81 data-nosnippet>81</a> <span class="self">Self </span>{
|
||||
<a href=#82 id=82 data-nosnippet>82</a> endpoints: Default::default(),
|
||||
<a href=#83 id=83 data-nosnippet>83</a> provenance: <span class="self">Self</span>::PROVENANCE,
|
||||
<a href=#84 id=84 data-nosnippet>84</a> }
|
||||
<a href=#85 id=85 data-nosnippet>85</a> }
|
||||
<a href=#86 id=86 data-nosnippet>86</a>}
|
||||
<a href=#87 id=87 data-nosnippet>87</a>
|
||||
<a href=#88 id=88 data-nosnippet>88</a><span class="attr">#[derive(Debug)]
|
||||
<a href=#89 id=89 data-nosnippet>89</a></span><span class="kw">struct </span>StoredEndpointInfo {
|
||||
<a href=#90 id=90 data-nosnippet>90</a> data: EndpointData,
|
||||
<a href=#91 id=91 data-nosnippet>91</a> last_updated: SystemTime,
|
||||
<a href=#92 id=92 data-nosnippet>92</a>}
|
||||
<a href=#93 id=93 data-nosnippet>93</a>
|
||||
<a href=#94 id=94 data-nosnippet>94</a><span class="kw">impl </span>MemoryLookup {
|
||||
<a href=#95 id=95 data-nosnippet>95</a> <span class="doccomment">/// The provenance string for this Address Lookup implementation.
|
||||
<a href=#96 id=96 data-nosnippet>96</a> ///
|
||||
<a href=#97 id=97 data-nosnippet>97</a> /// This is mostly used for debugging information and allows understanding the origin of
|
||||
<a href=#98 id=98 data-nosnippet>98</a> /// addressing information used by an iroh [`Endpoint`].
|
||||
<a href=#99 id=99 data-nosnippet>99</a> ///
|
||||
<a href=#100 id=100 data-nosnippet>100</a> /// [`Endpoint`]: crate::Endpoint
|
||||
<a href=#101 id=101 data-nosnippet>101</a> </span><span class="kw">pub const </span>PROVENANCE: <span class="kw-2">&</span><span class="lifetime">'static </span>str = <span class="string">"memory_lookup"</span>;
|
||||
<a href=#102 id=102 data-nosnippet>102</a>
|
||||
<a href=#103 id=103 data-nosnippet>103</a> <span class="doccomment">/// Creates a new static Address Lookup instance.
|
||||
<a href=#104 id=104 data-nosnippet>104</a> </span><span class="kw">pub fn </span>new() -> <span class="self">Self </span>{
|
||||
<a href=#105 id=105 data-nosnippet>105</a> <span class="self">Self</span>::default()
|
||||
<a href=#106 id=106 data-nosnippet>106</a> }
|
||||
<a href=#107 id=107 data-nosnippet>107</a>
|
||||
<a href=#108 id=108 data-nosnippet>108</a> <span class="doccomment">/// Creates a new Memory Lookup instance with the provided `provenance`.
|
||||
<a href=#109 id=109 data-nosnippet>109</a> ///
|
||||
<a href=#110 id=110 data-nosnippet>110</a> /// The provenance is part of [`address_lookup::Item`]s returned from [`Self::resolve`].
|
||||
<a href=#111 id=111 data-nosnippet>111</a> /// It is mostly used for debugging information and allows understanding the origin of
|
||||
<a href=#112 id=112 data-nosnippet>112</a> /// addressing information used by an iroh [`Endpoint`].
|
||||
<a href=#113 id=113 data-nosnippet>113</a> ///
|
||||
<a href=#114 id=114 data-nosnippet>114</a> /// [`Endpoint`]: crate::Endpoint
|
||||
<a href=#115 id=115 data-nosnippet>115</a> /// [`address_lookup::Item`]: crate::address_lookup::Item
|
||||
<a href=#116 id=116 data-nosnippet>116</a> </span><span class="kw">pub fn </span>with_provenance(provenance: <span class="kw-2">&</span><span class="lifetime">'static </span>str) -> <span class="self">Self </span>{
|
||||
<a href=#117 id=117 data-nosnippet>117</a> <span class="self">Self </span>{
|
||||
<a href=#118 id=118 data-nosnippet>118</a> endpoints: Default::default(),
|
||||
<a href=#119 id=119 data-nosnippet>119</a> provenance,
|
||||
<a href=#120 id=120 data-nosnippet>120</a> }
|
||||
<a href=#121 id=121 data-nosnippet>121</a> }
|
||||
<a href=#122 id=122 data-nosnippet>122</a>
|
||||
<a href=#123 id=123 data-nosnippet>123</a> <span class="doccomment">/// Creates a Memory Lookup instance from endpoint addresses.
|
||||
<a href=#124 id=124 data-nosnippet>124</a> ///
|
||||
<a href=#125 id=125 data-nosnippet>125</a> /// # Examples
|
||||
<a href=#126 id=126 data-nosnippet>126</a> ///
|
||||
<a href=#127 id=127 data-nosnippet>127</a> /// ```no_run
|
||||
<a href=#128 id=128 data-nosnippet>128</a> /// # #[cfg(with_crypto_provider)] // Endpoint::bind needs a crypto provider
|
||||
<a href=#129 id=129 data-nosnippet>129</a> /// # {
|
||||
<a href=#130 id=130 data-nosnippet>130</a> /// use std::{net::SocketAddr, str::FromStr};
|
||||
<a href=#131 id=131 data-nosnippet>131</a> ///
|
||||
<a href=#132 id=132 data-nosnippet>132</a> /// use iroh::{Endpoint, EndpointAddr, address_lookup::memory::MemoryLookup, endpoint::presets};
|
||||
<a href=#133 id=133 data-nosnippet>133</a> ///
|
||||
<a href=#134 id=134 data-nosnippet>134</a> /// # fn get_addrs() -> Vec<EndpointAddr> {
|
||||
<a href=#135 id=135 data-nosnippet>135</a> /// # Vec::new()
|
||||
<a href=#136 id=136 data-nosnippet>136</a> /// # }
|
||||
<a href=#137 id=137 data-nosnippet>137</a> /// # #[tokio::main]
|
||||
<a href=#138 id=138 data-nosnippet>138</a> /// # async fn wrapper() -> n0_error::Result<()> {
|
||||
<a href=#139 id=139 data-nosnippet>139</a> /// // get addrs from somewhere
|
||||
<a href=#140 id=140 data-nosnippet>140</a> /// let addrs = get_addrs();
|
||||
<a href=#141 id=141 data-nosnippet>141</a> ///
|
||||
<a href=#142 id=142 data-nosnippet>142</a> /// // create a MemoryLookup from the list of addrs.
|
||||
<a href=#143 id=143 data-nosnippet>143</a> /// let address_lookup = MemoryLookup::from_endpoint_info(addrs);
|
||||
<a href=#144 id=144 data-nosnippet>144</a> /// // create an endpoint with the memory lookup address_lookup
|
||||
<a href=#145 id=145 data-nosnippet>145</a> /// let endpoint = Endpoint::builder(presets::N0)
|
||||
<a href=#146 id=146 data-nosnippet>146</a> /// .address_lookup(address_lookup)
|
||||
<a href=#147 id=147 data-nosnippet>147</a> /// .bind()
|
||||
<a href=#148 id=148 data-nosnippet>148</a> /// .await?;
|
||||
<a href=#149 id=149 data-nosnippet>149</a> /// # Ok(())
|
||||
<a href=#150 id=150 data-nosnippet>150</a> /// # }
|
||||
<a href=#70 id=70 data-nosnippet>70</a>/// # }
|
||||
<a href=#71 id=71 data-nosnippet>71</a>/// ```
|
||||
<a href=#72 id=72 data-nosnippet>72</a>///
|
||||
<a href=#73 id=73 data-nosnippet>73</a>/// [`EndpointTicket`]: https://docs.rs/iroh-tickets/latest/iroh_tickets/endpoint/struct.EndpointTicket.html
|
||||
<a href=#74 id=74 data-nosnippet>74</a></span><span class="attr">#[derive(Debug, Clone)]
|
||||
<a href=#75 id=75 data-nosnippet>75</a></span><span class="kw">pub struct </span>MemoryLookup {
|
||||
<a href=#76 id=76 data-nosnippet>76</a> endpoints: Arc<RwLock<BTreeMap<EndpointId, StoredEndpointInfo>>>,
|
||||
<a href=#77 id=77 data-nosnippet>77</a> provenance: <span class="kw-2">&</span><span class="lifetime">'static </span>str,
|
||||
<a href=#78 id=78 data-nosnippet>78</a>}
|
||||
<a href=#79 id=79 data-nosnippet>79</a>
|
||||
<a href=#80 id=80 data-nosnippet>80</a><span class="kw">impl </span>Default <span class="kw">for </span>MemoryLookup {
|
||||
<a href=#81 id=81 data-nosnippet>81</a> <span class="kw">fn </span>default() -> <span class="self">Self </span>{
|
||||
<a href=#82 id=82 data-nosnippet>82</a> <span class="self">Self </span>{
|
||||
<a href=#83 id=83 data-nosnippet>83</a> endpoints: Default::default(),
|
||||
<a href=#84 id=84 data-nosnippet>84</a> provenance: <span class="self">Self</span>::PROVENANCE,
|
||||
<a href=#85 id=85 data-nosnippet>85</a> }
|
||||
<a href=#86 id=86 data-nosnippet>86</a> }
|
||||
<a href=#87 id=87 data-nosnippet>87</a>}
|
||||
<a href=#88 id=88 data-nosnippet>88</a>
|
||||
<a href=#89 id=89 data-nosnippet>89</a><span class="attr">#[derive(Debug)]
|
||||
<a href=#90 id=90 data-nosnippet>90</a></span><span class="kw">struct </span>StoredEndpointInfo {
|
||||
<a href=#91 id=91 data-nosnippet>91</a> data: EndpointData,
|
||||
<a href=#92 id=92 data-nosnippet>92</a> last_updated: SystemTime,
|
||||
<a href=#93 id=93 data-nosnippet>93</a>}
|
||||
<a href=#94 id=94 data-nosnippet>94</a>
|
||||
<a href=#95 id=95 data-nosnippet>95</a><span class="kw">impl </span>MemoryLookup {
|
||||
<a href=#96 id=96 data-nosnippet>96</a> <span class="doccomment">/// The provenance string for this Address Lookup implementation.
|
||||
<a href=#97 id=97 data-nosnippet>97</a> ///
|
||||
<a href=#98 id=98 data-nosnippet>98</a> /// This is mostly used for debugging information and allows understanding the origin of
|
||||
<a href=#99 id=99 data-nosnippet>99</a> /// addressing information used by an iroh [`Endpoint`].
|
||||
<a href=#100 id=100 data-nosnippet>100</a> ///
|
||||
<a href=#101 id=101 data-nosnippet>101</a> /// [`Endpoint`]: crate::Endpoint
|
||||
<a href=#102 id=102 data-nosnippet>102</a> </span><span class="kw">pub const </span>PROVENANCE: <span class="kw-2">&</span><span class="lifetime">'static </span>str = <span class="string">"memory_lookup"</span>;
|
||||
<a href=#103 id=103 data-nosnippet>103</a>
|
||||
<a href=#104 id=104 data-nosnippet>104</a> <span class="doccomment">/// Creates a new empty Memory Lookup instance.
|
||||
<a href=#105 id=105 data-nosnippet>105</a> </span><span class="kw">pub fn </span>new() -> <span class="self">Self </span>{
|
||||
<a href=#106 id=106 data-nosnippet>106</a> <span class="self">Self</span>::default()
|
||||
<a href=#107 id=107 data-nosnippet>107</a> }
|
||||
<a href=#108 id=108 data-nosnippet>108</a>
|
||||
<a href=#109 id=109 data-nosnippet>109</a> <span class="doccomment">/// Creates a new Memory Lookup instance with the provided `provenance`.
|
||||
<a href=#110 id=110 data-nosnippet>110</a> ///
|
||||
<a href=#111 id=111 data-nosnippet>111</a> /// The provenance is part of [`address_lookup::Item`]s returned from [`Self::resolve`].
|
||||
<a href=#112 id=112 data-nosnippet>112</a> /// It is mostly used for debugging information and allows understanding the origin of
|
||||
<a href=#113 id=113 data-nosnippet>113</a> /// addressing information used by an iroh [`Endpoint`].
|
||||
<a href=#114 id=114 data-nosnippet>114</a> ///
|
||||
<a href=#115 id=115 data-nosnippet>115</a> /// [`Endpoint`]: crate::Endpoint
|
||||
<a href=#116 id=116 data-nosnippet>116</a> /// [`address_lookup::Item`]: crate::address_lookup::Item
|
||||
<a href=#117 id=117 data-nosnippet>117</a> </span><span class="kw">pub fn </span>with_provenance(provenance: <span class="kw-2">&</span><span class="lifetime">'static </span>str) -> <span class="self">Self </span>{
|
||||
<a href=#118 id=118 data-nosnippet>118</a> <span class="self">Self </span>{
|
||||
<a href=#119 id=119 data-nosnippet>119</a> endpoints: Default::default(),
|
||||
<a href=#120 id=120 data-nosnippet>120</a> provenance,
|
||||
<a href=#121 id=121 data-nosnippet>121</a> }
|
||||
<a href=#122 id=122 data-nosnippet>122</a> }
|
||||
<a href=#123 id=123 data-nosnippet>123</a>
|
||||
<a href=#124 id=124 data-nosnippet>124</a> <span class="doccomment">/// Creates a Memory Lookup instance from endpoint addresses.
|
||||
<a href=#125 id=125 data-nosnippet>125</a> ///
|
||||
<a href=#126 id=126 data-nosnippet>126</a> /// # Examples
|
||||
<a href=#127 id=127 data-nosnippet>127</a> ///
|
||||
<a href=#128 id=128 data-nosnippet>128</a> /// ```no_run
|
||||
<a href=#129 id=129 data-nosnippet>129</a> /// # #[cfg(with_crypto_provider)] // Endpoint::bind needs a crypto provider
|
||||
<a href=#130 id=130 data-nosnippet>130</a> /// # {
|
||||
<a href=#131 id=131 data-nosnippet>131</a> /// use std::{net::SocketAddr, str::FromStr};
|
||||
<a href=#132 id=132 data-nosnippet>132</a> ///
|
||||
<a href=#133 id=133 data-nosnippet>133</a> /// use iroh::{Endpoint, EndpointAddr, address_lookup::memory::MemoryLookup, endpoint::presets};
|
||||
<a href=#134 id=134 data-nosnippet>134</a> ///
|
||||
<a href=#135 id=135 data-nosnippet>135</a> /// # fn get_addrs() -> Vec<EndpointAddr> {
|
||||
<a href=#136 id=136 data-nosnippet>136</a> /// # Vec::new()
|
||||
<a href=#137 id=137 data-nosnippet>137</a> /// # }
|
||||
<a href=#138 id=138 data-nosnippet>138</a> /// # #[tokio::main]
|
||||
<a href=#139 id=139 data-nosnippet>139</a> /// # async fn wrapper() -> n0_error::Result<()> {
|
||||
<a href=#140 id=140 data-nosnippet>140</a> /// // get addrs from somewhere
|
||||
<a href=#141 id=141 data-nosnippet>141</a> /// let addrs = get_addrs();
|
||||
<a href=#142 id=142 data-nosnippet>142</a> ///
|
||||
<a href=#143 id=143 data-nosnippet>143</a> /// // create a MemoryLookup from the list of addrs.
|
||||
<a href=#144 id=144 data-nosnippet>144</a> /// let address_lookup = MemoryLookup::from_endpoint_info(addrs);
|
||||
<a href=#145 id=145 data-nosnippet>145</a> /// // create an endpoint with the memory lookup address_lookup
|
||||
<a href=#146 id=146 data-nosnippet>146</a> /// let endpoint = Endpoint::builder(presets::N0)
|
||||
<a href=#147 id=147 data-nosnippet>147</a> /// .address_lookup(address_lookup)
|
||||
<a href=#148 id=148 data-nosnippet>148</a> /// .bind()
|
||||
<a href=#149 id=149 data-nosnippet>149</a> /// .await?;
|
||||
<a href=#150 id=150 data-nosnippet>150</a> /// # Ok(())
|
||||
<a href=#151 id=151 data-nosnippet>151</a> /// # }
|
||||
<a href=#152 id=152 data-nosnippet>152</a> /// ```
|
||||
<a href=#153 id=153 data-nosnippet>153</a> </span><span class="kw">pub fn </span>from_endpoint_info(infos: <span class="kw">impl </span>IntoIterator<Item = <span class="kw">impl </span>Into<EndpointInfo>>) -> <span class="self">Self </span>{
|
||||
<a href=#154 id=154 data-nosnippet>154</a> <span class="kw">let </span>res = <span class="self">Self</span>::default();
|
||||
<a href=#155 id=155 data-nosnippet>155</a> <span class="kw">for </span>info <span class="kw">in </span>infos {
|
||||
<a href=#156 id=156 data-nosnippet>156</a> res.add_endpoint_info(info);
|
||||
<a href=#157 id=157 data-nosnippet>157</a> }
|
||||
<a href=#158 id=158 data-nosnippet>158</a> res
|
||||
<a href=#159 id=159 data-nosnippet>159</a> }
|
||||
<a href=#160 id=160 data-nosnippet>160</a>
|
||||
<a href=#161 id=161 data-nosnippet>161</a> <span class="doccomment">/// Sets endpoint addressing information for the given endpoint ID.
|
||||
<a href=#162 id=162 data-nosnippet>162</a> ///
|
||||
<a href=#163 id=163 data-nosnippet>163</a> /// This will completely overwrite any existing info for the endpoint.
|
||||
<a href=#164 id=164 data-nosnippet>164</a> ///
|
||||
<a href=#165 id=165 data-nosnippet>165</a> /// Returns the [`EndpointData`] of the previous entry, or `None` if there was no previous
|
||||
<a href=#166 id=166 data-nosnippet>166</a> /// entry for this endpoint ID.
|
||||
<a href=#167 id=167 data-nosnippet>167</a> </span><span class="kw">pub fn </span>set_endpoint_info(
|
||||
<a href=#168 id=168 data-nosnippet>168</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#169 id=169 data-nosnippet>169</a> endpoint_info: <span class="kw">impl </span>Into<EndpointInfo>,
|
||||
<a href=#170 id=170 data-nosnippet>170</a> ) -> <span class="prelude-ty">Option</span><EndpointData> {
|
||||
<a href=#171 id=171 data-nosnippet>171</a> <span class="kw">let </span>last_updated = SystemTime::now();
|
||||
<a href=#172 id=172 data-nosnippet>172</a> <span class="kw">let </span>EndpointInfo { endpoint_id, data } = endpoint_info.into();
|
||||
<a href=#173 id=173 data-nosnippet>173</a> <span class="kw">let </span><span class="kw-2">mut </span>guard = <span class="self">self</span>.endpoints.write().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#174 id=174 data-nosnippet>174</a> <span class="kw">let </span>previous = guard.insert(endpoint_id, StoredEndpointInfo { data, last_updated });
|
||||
<a href=#175 id=175 data-nosnippet>175</a> previous.map(|x| x.data)
|
||||
<a href=#176 id=176 data-nosnippet>176</a> }
|
||||
<a href=#177 id=177 data-nosnippet>177</a>
|
||||
<a href=#178 id=178 data-nosnippet>178</a> <span class="doccomment">/// Augments endpoint addressing information for the given endpoint ID.
|
||||
<a href=#179 id=179 data-nosnippet>179</a> ///
|
||||
<a href=#180 id=180 data-nosnippet>180</a> /// The provided addressing information is combined with the existing info in the memory
|
||||
<a href=#181 id=181 data-nosnippet>181</a> /// lookup. Any new direct addresses are added to those already present while the
|
||||
<a href=#182 id=182 data-nosnippet>182</a> /// relay URL is overwritten.
|
||||
<a href=#183 id=183 data-nosnippet>183</a> </span><span class="kw">pub fn </span>add_endpoint_info(<span class="kw-2">&</span><span class="self">self</span>, endpoint_info: <span class="kw">impl </span>Into<EndpointInfo>) {
|
||||
<a href=#184 id=184 data-nosnippet>184</a> <span class="kw">let </span>last_updated = SystemTime::now();
|
||||
<a href=#185 id=185 data-nosnippet>185</a> <span class="kw">let </span>EndpointInfo { endpoint_id, data } = endpoint_info.into();
|
||||
<a href=#186 id=186 data-nosnippet>186</a> <span class="kw">let </span><span class="kw-2">mut </span>guard = <span class="self">self</span>.endpoints.write().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#187 id=187 data-nosnippet>187</a> <span class="kw">match </span>guard.entry(endpoint_id) {
|
||||
<a href=#188 id=188 data-nosnippet>188</a> Entry::Occupied(<span class="kw-2">mut </span>entry) => {
|
||||
<a href=#189 id=189 data-nosnippet>189</a> <span class="kw">let </span>existing = entry.get_mut();
|
||||
<a href=#190 id=190 data-nosnippet>190</a> existing.data.add_addrs(data.addrs().cloned());
|
||||
<a href=#191 id=191 data-nosnippet>191</a> existing.data.set_user_data(data.user_data().cloned());
|
||||
<a href=#192 id=192 data-nosnippet>192</a> existing.last_updated = last_updated;
|
||||
<a href=#193 id=193 data-nosnippet>193</a> }
|
||||
<a href=#194 id=194 data-nosnippet>194</a> Entry::Vacant(entry) => {
|
||||
<a href=#195 id=195 data-nosnippet>195</a> entry.insert(StoredEndpointInfo { data, last_updated });
|
||||
<a href=#196 id=196 data-nosnippet>196</a> }
|
||||
<a href=#197 id=197 data-nosnippet>197</a> }
|
||||
<a href=#198 id=198 data-nosnippet>198</a> }
|
||||
<a href=#199 id=199 data-nosnippet>199</a>
|
||||
<a href=#200 id=200 data-nosnippet>200</a> <span class="doccomment">/// Returns endpoint addressing information for the given endpoint ID.
|
||||
<a href=#201 id=201 data-nosnippet>201</a> </span><span class="kw">pub fn </span>get_endpoint_info(<span class="kw-2">&</span><span class="self">self</span>, endpoint_id: EndpointId) -> <span class="prelude-ty">Option</span><EndpointInfo> {
|
||||
<a href=#202 id=202 data-nosnippet>202</a> <span class="kw">let </span>guard = <span class="self">self</span>.endpoints.read().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#203 id=203 data-nosnippet>203</a> <span class="kw">let </span>info = guard.get(<span class="kw-2">&</span>endpoint_id)<span class="question-mark">?</span>;
|
||||
<a href=#204 id=204 data-nosnippet>204</a> <span class="prelude-val">Some</span>(EndpointInfo::from_parts(endpoint_id, info.data.clone()))
|
||||
<a href=#205 id=205 data-nosnippet>205</a> }
|
||||
<a href=#206 id=206 data-nosnippet>206</a>
|
||||
<a href=#207 id=207 data-nosnippet>207</a> <span class="doccomment">/// Removes all endpoint addressing information for the given endpoint ID.
|
||||
<a href=#208 id=208 data-nosnippet>208</a> ///
|
||||
<a href=#209 id=209 data-nosnippet>209</a> /// Any removed information is returned.
|
||||
<a href=#210 id=210 data-nosnippet>210</a> </span><span class="kw">pub fn </span>remove_endpoint_info(<span class="kw-2">&</span><span class="self">self</span>, endpoint_id: EndpointId) -> <span class="prelude-ty">Option</span><EndpointInfo> {
|
||||
<a href=#211 id=211 data-nosnippet>211</a> <span class="kw">let </span><span class="kw-2">mut </span>guard = <span class="self">self</span>.endpoints.write().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#212 id=212 data-nosnippet>212</a> <span class="kw">let </span>info = guard.remove(<span class="kw-2">&</span>endpoint_id)<span class="question-mark">?</span>;
|
||||
<a href=#213 id=213 data-nosnippet>213</a> <span class="prelude-val">Some</span>(EndpointInfo::from_parts(endpoint_id, info.data))
|
||||
<a href=#214 id=214 data-nosnippet>214</a> }
|
||||
<a href=#215 id=215 data-nosnippet>215</a>}
|
||||
<a href=#216 id=216 data-nosnippet>216</a>
|
||||
<a href=#217 id=217 data-nosnippet>217</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>MemoryLookup {
|
||||
<a href=#218 id=218 data-nosnippet>218</a> <span class="kw">fn </span>publish(<span class="kw-2">&</span><span class="self">self</span>, _data: <span class="kw-2">&</span>EndpointData) {}
|
||||
<a href=#219 id=219 data-nosnippet>219</a>
|
||||
<a href=#220 id=220 data-nosnippet>220</a> <span class="kw">fn </span>resolve(<span class="kw-2">&</span><span class="self">self</span>, endpoint_id: EndpointId) -> <span class="prelude-ty">Option</span><BoxStream<<span class="prelude-ty">Result</span><<span class="kw">super</span>::Item, Error>>> {
|
||||
<a href=#221 id=221 data-nosnippet>221</a> <span class="kw">let </span>guard = <span class="self">self</span>.endpoints.read().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#222 id=222 data-nosnippet>222</a> <span class="kw">let </span>info = guard.get(<span class="kw-2">&</span>endpoint_id);
|
||||
<a href=#223 id=223 data-nosnippet>223</a> <span class="kw">match </span>info {
|
||||
<a href=#224 id=224 data-nosnippet>224</a> <span class="prelude-val">Some</span>(endpoint_info) => {
|
||||
<a href=#225 id=225 data-nosnippet>225</a> <span class="kw">let </span>last_updated = endpoint_info
|
||||
<a href=#226 id=226 data-nosnippet>226</a> .last_updated
|
||||
<a href=#227 id=227 data-nosnippet>227</a> .duration_since(SystemTime::UNIX_EPOCH)
|
||||
<a href=#228 id=228 data-nosnippet>228</a> .expect(<span class="string">"time drift"</span>)
|
||||
<a href=#229 id=229 data-nosnippet>229</a> .as_micros() <span class="kw">as </span>u64;
|
||||
<a href=#230 id=230 data-nosnippet>230</a> <span class="kw">let </span>item = Item::new(
|
||||
<a href=#231 id=231 data-nosnippet>231</a> EndpointInfo::from_parts(endpoint_id, endpoint_info.data.clone()),
|
||||
<a href=#232 id=232 data-nosnippet>232</a> <span class="self">self</span>.provenance,
|
||||
<a href=#233 id=233 data-nosnippet>233</a> <span class="prelude-val">Some</span>(last_updated),
|
||||
<a href=#234 id=234 data-nosnippet>234</a> );
|
||||
<a href=#235 id=235 data-nosnippet>235</a> <span class="prelude-val">Some</span>(stream::iter(<span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(item))).boxed())
|
||||
<a href=#236 id=236 data-nosnippet>236</a> }
|
||||
<a href=#237 id=237 data-nosnippet>237</a> <span class="prelude-val">None </span>=> <span class="prelude-val">None</span>,
|
||||
<a href=#238 id=238 data-nosnippet>238</a> }
|
||||
<a href=#239 id=239 data-nosnippet>239</a> }
|
||||
<a href=#240 id=240 data-nosnippet>240</a>}
|
||||
<a href=#241 id=241 data-nosnippet>241</a>
|
||||
<a href=#242 id=242 data-nosnippet>242</a><span class="attr">#[cfg(all(test, with_crypto_provider))]
|
||||
<a href=#243 id=243 data-nosnippet>243</a></span><span class="kw">mod </span>tests {
|
||||
<a href=#244 id=244 data-nosnippet>244</a> <span class="kw">use </span>iroh_base::{EndpointAddr, SecretKey, TransportAddr};
|
||||
<a href=#245 id=245 data-nosnippet>245</a> <span class="kw">use </span>n0_error::{<span class="prelude-ty">Result</span>, StackResultExt};
|
||||
<a href=#246 id=246 data-nosnippet>246</a>
|
||||
<a href=#247 id=247 data-nosnippet>247</a> <span class="kw">use super</span>::<span class="kw-2">*</span>;
|
||||
<a href=#248 id=248 data-nosnippet>248</a> <span class="kw">use crate</span>::{Endpoint, endpoint::presets};
|
||||
<a href=#249 id=249 data-nosnippet>249</a>
|
||||
<a href=#250 id=250 data-nosnippet>250</a> <span class="attr">#[tokio::test]
|
||||
<a href=#251 id=251 data-nosnippet>251</a> </span><span class="kw">async fn </span>test_basic() -> <span class="prelude-ty">Result</span> {
|
||||
<a href=#252 id=252 data-nosnippet>252</a> <span class="kw">let </span>address_lookup = MemoryLookup::new();
|
||||
<a href=#253 id=253 data-nosnippet>253</a>
|
||||
<a href=#254 id=254 data-nosnippet>254</a> <span class="kw">let </span>_ep = Endpoint::builder(presets::Minimal)
|
||||
<a href=#255 id=255 data-nosnippet>255</a> .address_lookup(address_lookup.clone())
|
||||
<a href=#256 id=256 data-nosnippet>256</a> .bind()
|
||||
<a href=#257 id=257 data-nosnippet>257</a> .<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<a href=#258 id=258 data-nosnippet>258</a>
|
||||
<a href=#259 id=259 data-nosnippet>259</a> <span class="kw">let </span>key = SecretKey::from_bytes(<span class="kw-2">&</span>[<span class="number">0u8</span>; <span class="number">32</span>]);
|
||||
<a href=#260 id=260 data-nosnippet>260</a> <span class="kw">let </span>addr = EndpointAddr::from_parts(
|
||||
<a href=#261 id=261 data-nosnippet>261</a> key.public(),
|
||||
<a href=#262 id=262 data-nosnippet>262</a> [TransportAddr::Relay(<span class="string">"https://example.com"</span>.parse()<span class="question-mark">?</span>)],
|
||||
<a href=#263 id=263 data-nosnippet>263</a> );
|
||||
<a href=#264 id=264 data-nosnippet>264</a> <span class="kw">let </span>user_data = <span class="prelude-val">Some</span>(<span class="string">"foobar"</span>.parse().unwrap());
|
||||
<a href=#265 id=265 data-nosnippet>265</a> <span class="kw">let </span>endpoint_info = EndpointInfo::from(addr.clone()).with_user_data(user_data.clone());
|
||||
<a href=#266 id=266 data-nosnippet>266</a> address_lookup.add_endpoint_info(endpoint_info.clone());
|
||||
<a href=#267 id=267 data-nosnippet>267</a>
|
||||
<a href=#268 id=268 data-nosnippet>268</a> <span class="kw">let </span>back = address_lookup
|
||||
<a href=#269 id=269 data-nosnippet>269</a> .get_endpoint_info(key.public())
|
||||
<a href=#270 id=270 data-nosnippet>270</a> .context(<span class="string">"no addr"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#271 id=271 data-nosnippet>271</a>
|
||||
<a href=#272 id=272 data-nosnippet>272</a> <span class="macro">assert_eq!</span>(back, endpoint_info);
|
||||
<a href=#273 id=273 data-nosnippet>273</a> <span class="macro">assert_eq!</span>(back.user_data(), user_data.as_ref());
|
||||
<a href=#274 id=274 data-nosnippet>274</a> <span class="macro">assert_eq!</span>(back.into_endpoint_addr(), addr);
|
||||
<a href=#275 id=275 data-nosnippet>275</a>
|
||||
<a href=#276 id=276 data-nosnippet>276</a> <span class="kw">let </span>removed = address_lookup
|
||||
<a href=#277 id=277 data-nosnippet>277</a> .remove_endpoint_info(key.public())
|
||||
<a href=#278 id=278 data-nosnippet>278</a> .context(<span class="string">"nothing removed"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#279 id=279 data-nosnippet>279</a> <span class="macro">assert_eq!</span>(removed, endpoint_info);
|
||||
<a href=#280 id=280 data-nosnippet>280</a> <span class="kw">let </span>res = address_lookup.get_endpoint_info(key.public());
|
||||
<a href=#281 id=281 data-nosnippet>281</a> <span class="macro">assert!</span>(res.is_none());
|
||||
<a href=#282 id=282 data-nosnippet>282</a>
|
||||
<a href=#283 id=283 data-nosnippet>283</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#284 id=284 data-nosnippet>284</a> }
|
||||
<a href=#285 id=285 data-nosnippet>285</a>
|
||||
<a href=#286 id=286 data-nosnippet>286</a> <span class="attr">#[tokio::test]
|
||||
<a href=#287 id=287 data-nosnippet>287</a> </span><span class="kw">async fn </span>test_provenance() -> <span class="prelude-ty">Result</span> {
|
||||
<a href=#288 id=288 data-nosnippet>288</a> <span class="kw">let </span>address_lookup = MemoryLookup::with_provenance(<span class="string">"foo"</span>);
|
||||
<a href=#289 id=289 data-nosnippet>289</a> <span class="kw">let </span>key = SecretKey::from_bytes(<span class="kw-2">&</span>[<span class="number">0u8</span>; <span class="number">32</span>]);
|
||||
<a href=#290 id=290 data-nosnippet>290</a> <span class="kw">let </span>addr = EndpointAddr::from_parts(
|
||||
<a href=#291 id=291 data-nosnippet>291</a> key.public(),
|
||||
<a href=#292 id=292 data-nosnippet>292</a> [TransportAddr::Relay(<span class="string">"https://example.com"</span>.parse()<span class="question-mark">?</span>)],
|
||||
<a href=#293 id=293 data-nosnippet>293</a> );
|
||||
<a href=#294 id=294 data-nosnippet>294</a> address_lookup.add_endpoint_info(addr);
|
||||
<a href=#295 id=295 data-nosnippet>295</a> <span class="kw">let </span><span class="kw-2">mut </span>stream = address_lookup.resolve(key.public()).unwrap();
|
||||
<a href=#296 id=296 data-nosnippet>296</a> <span class="kw">let </span>item = stream.next().<span class="kw">await</span>.unwrap()<span class="question-mark">?</span>;
|
||||
<a href=#297 id=297 data-nosnippet>297</a> <span class="macro">assert_eq!</span>(item.provenance(), <span class="string">"foo"</span>);
|
||||
<a href=#298 id=298 data-nosnippet>298</a> <span class="macro">assert_eq!</span>(
|
||||
<a href=#299 id=299 data-nosnippet>299</a> item.relay_urls().next(),
|
||||
<a href=#300 id=300 data-nosnippet>300</a> <span class="prelude-val">Some</span>(<span class="kw-2">&</span>(<span class="string">"https://example.com"</span>.parse()<span class="question-mark">?</span>))
|
||||
<a href=#301 id=301 data-nosnippet>301</a> );
|
||||
<a href=#302 id=302 data-nosnippet>302</a>
|
||||
<a href=#303 id=303 data-nosnippet>303</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#304 id=304 data-nosnippet>304</a> }
|
||||
<a href=#305 id=305 data-nosnippet>305</a>}</code></pre></div></section></main></body></html>
|
||||
<a href=#152 id=152 data-nosnippet>152</a> /// # }
|
||||
<a href=#153 id=153 data-nosnippet>153</a> /// ```
|
||||
<a href=#154 id=154 data-nosnippet>154</a> </span><span class="kw">pub fn </span>from_endpoint_info(infos: <span class="kw">impl </span>IntoIterator<Item = <span class="kw">impl </span>Into<EndpointInfo>>) -> <span class="self">Self </span>{
|
||||
<a href=#155 id=155 data-nosnippet>155</a> <span class="kw">let </span>res = <span class="self">Self</span>::default();
|
||||
<a href=#156 id=156 data-nosnippet>156</a> <span class="kw">for </span>info <span class="kw">in </span>infos {
|
||||
<a href=#157 id=157 data-nosnippet>157</a> res.add_endpoint_info(info);
|
||||
<a href=#158 id=158 data-nosnippet>158</a> }
|
||||
<a href=#159 id=159 data-nosnippet>159</a> res
|
||||
<a href=#160 id=160 data-nosnippet>160</a> }
|
||||
<a href=#161 id=161 data-nosnippet>161</a>
|
||||
<a href=#162 id=162 data-nosnippet>162</a> <span class="doccomment">/// Sets endpoint addressing information for the given endpoint ID.
|
||||
<a href=#163 id=163 data-nosnippet>163</a> ///
|
||||
<a href=#164 id=164 data-nosnippet>164</a> /// This will completely overwrite any existing info for the endpoint.
|
||||
<a href=#165 id=165 data-nosnippet>165</a> ///
|
||||
<a href=#166 id=166 data-nosnippet>166</a> /// Returns the [`EndpointData`] of the previous entry, or `None` if there was no previous
|
||||
<a href=#167 id=167 data-nosnippet>167</a> /// entry for this endpoint ID.
|
||||
<a href=#168 id=168 data-nosnippet>168</a> </span><span class="kw">pub fn </span>set_endpoint_info(
|
||||
<a href=#169 id=169 data-nosnippet>169</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#170 id=170 data-nosnippet>170</a> endpoint_info: <span class="kw">impl </span>Into<EndpointInfo>,
|
||||
<a href=#171 id=171 data-nosnippet>171</a> ) -> <span class="prelude-ty">Option</span><EndpointData> {
|
||||
<a href=#172 id=172 data-nosnippet>172</a> <span class="kw">let </span>last_updated = SystemTime::now();
|
||||
<a href=#173 id=173 data-nosnippet>173</a> <span class="kw">let </span>EndpointInfo { endpoint_id, data } = endpoint_info.into();
|
||||
<a href=#174 id=174 data-nosnippet>174</a> <span class="kw">let </span><span class="kw-2">mut </span>guard = <span class="self">self</span>.endpoints.write().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#175 id=175 data-nosnippet>175</a> <span class="kw">let </span>previous = guard.insert(endpoint_id, StoredEndpointInfo { data, last_updated });
|
||||
<a href=#176 id=176 data-nosnippet>176</a> previous.map(|x| x.data)
|
||||
<a href=#177 id=177 data-nosnippet>177</a> }
|
||||
<a href=#178 id=178 data-nosnippet>178</a>
|
||||
<a href=#179 id=179 data-nosnippet>179</a> <span class="doccomment">/// Augments endpoint addressing information for the given endpoint ID.
|
||||
<a href=#180 id=180 data-nosnippet>180</a> ///
|
||||
<a href=#181 id=181 data-nosnippet>181</a> /// The provided addressing information is combined with the existing info in the memory
|
||||
<a href=#182 id=182 data-nosnippet>182</a> /// lookup. Any new direct addresses are added to those already present while the
|
||||
<a href=#183 id=183 data-nosnippet>183</a> /// relay URL is overwritten.
|
||||
<a href=#184 id=184 data-nosnippet>184</a> </span><span class="kw">pub fn </span>add_endpoint_info(<span class="kw-2">&</span><span class="self">self</span>, endpoint_info: <span class="kw">impl </span>Into<EndpointInfo>) {
|
||||
<a href=#185 id=185 data-nosnippet>185</a> <span class="kw">let </span>last_updated = SystemTime::now();
|
||||
<a href=#186 id=186 data-nosnippet>186</a> <span class="kw">let </span>EndpointInfo { endpoint_id, data } = endpoint_info.into();
|
||||
<a href=#187 id=187 data-nosnippet>187</a> <span class="kw">let </span><span class="kw-2">mut </span>guard = <span class="self">self</span>.endpoints.write().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#188 id=188 data-nosnippet>188</a> <span class="kw">match </span>guard.entry(endpoint_id) {
|
||||
<a href=#189 id=189 data-nosnippet>189</a> Entry::Occupied(<span class="kw-2">mut </span>entry) => {
|
||||
<a href=#190 id=190 data-nosnippet>190</a> <span class="kw">let </span>existing = entry.get_mut();
|
||||
<a href=#191 id=191 data-nosnippet>191</a> existing.data.add_addrs(data.addrs().cloned());
|
||||
<a href=#192 id=192 data-nosnippet>192</a> existing.data.set_user_data(data.user_data().cloned());
|
||||
<a href=#193 id=193 data-nosnippet>193</a> existing.last_updated = last_updated;
|
||||
<a href=#194 id=194 data-nosnippet>194</a> }
|
||||
<a href=#195 id=195 data-nosnippet>195</a> Entry::Vacant(entry) => {
|
||||
<a href=#196 id=196 data-nosnippet>196</a> entry.insert(StoredEndpointInfo { data, last_updated });
|
||||
<a href=#197 id=197 data-nosnippet>197</a> }
|
||||
<a href=#198 id=198 data-nosnippet>198</a> }
|
||||
<a href=#199 id=199 data-nosnippet>199</a> }
|
||||
<a href=#200 id=200 data-nosnippet>200</a>
|
||||
<a href=#201 id=201 data-nosnippet>201</a> <span class="doccomment">/// Returns endpoint addressing information for the given endpoint ID.
|
||||
<a href=#202 id=202 data-nosnippet>202</a> </span><span class="kw">pub fn </span>get_endpoint_info(<span class="kw-2">&</span><span class="self">self</span>, endpoint_id: EndpointId) -> <span class="prelude-ty">Option</span><EndpointInfo> {
|
||||
<a href=#203 id=203 data-nosnippet>203</a> <span class="kw">let </span>guard = <span class="self">self</span>.endpoints.read().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#204 id=204 data-nosnippet>204</a> <span class="kw">let </span>info = guard.get(<span class="kw-2">&</span>endpoint_id)<span class="question-mark">?</span>;
|
||||
<a href=#205 id=205 data-nosnippet>205</a> <span class="prelude-val">Some</span>(EndpointInfo::from_parts(endpoint_id, info.data.clone()))
|
||||
<a href=#206 id=206 data-nosnippet>206</a> }
|
||||
<a href=#207 id=207 data-nosnippet>207</a>
|
||||
<a href=#208 id=208 data-nosnippet>208</a> <span class="doccomment">/// Removes all endpoint addressing information for the given endpoint ID.
|
||||
<a href=#209 id=209 data-nosnippet>209</a> ///
|
||||
<a href=#210 id=210 data-nosnippet>210</a> /// Any removed information is returned.
|
||||
<a href=#211 id=211 data-nosnippet>211</a> </span><span class="kw">pub fn </span>remove_endpoint_info(<span class="kw-2">&</span><span class="self">self</span>, endpoint_id: EndpointId) -> <span class="prelude-ty">Option</span><EndpointInfo> {
|
||||
<a href=#212 id=212 data-nosnippet>212</a> <span class="kw">let </span><span class="kw-2">mut </span>guard = <span class="self">self</span>.endpoints.write().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#213 id=213 data-nosnippet>213</a> <span class="kw">let </span>info = guard.remove(<span class="kw-2">&</span>endpoint_id)<span class="question-mark">?</span>;
|
||||
<a href=#214 id=214 data-nosnippet>214</a> <span class="prelude-val">Some</span>(EndpointInfo::from_parts(endpoint_id, info.data))
|
||||
<a href=#215 id=215 data-nosnippet>215</a> }
|
||||
<a href=#216 id=216 data-nosnippet>216</a>}
|
||||
<a href=#217 id=217 data-nosnippet>217</a>
|
||||
<a href=#218 id=218 data-nosnippet>218</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>MemoryLookup {
|
||||
<a href=#219 id=219 data-nosnippet>219</a> <span class="kw">fn </span>publish(<span class="kw-2">&</span><span class="self">self</span>, _data: <span class="kw-2">&</span>EndpointData) {}
|
||||
<a href=#220 id=220 data-nosnippet>220</a>
|
||||
<a href=#221 id=221 data-nosnippet>221</a> <span class="kw">fn </span>resolve(<span class="kw-2">&</span><span class="self">self</span>, endpoint_id: EndpointId) -> <span class="prelude-ty">Option</span><BoxStream<<span class="prelude-ty">Result</span><<span class="kw">super</span>::Item, Error>>> {
|
||||
<a href=#222 id=222 data-nosnippet>222</a> <span class="kw">let </span>guard = <span class="self">self</span>.endpoints.read().expect(<span class="string">"poisoned"</span>);
|
||||
<a href=#223 id=223 data-nosnippet>223</a> <span class="kw">let </span>info = guard.get(<span class="kw-2">&</span>endpoint_id);
|
||||
<a href=#224 id=224 data-nosnippet>224</a> <span class="kw">match </span>info {
|
||||
<a href=#225 id=225 data-nosnippet>225</a> <span class="prelude-val">Some</span>(endpoint_info) => {
|
||||
<a href=#226 id=226 data-nosnippet>226</a> <span class="kw">let </span>last_updated = endpoint_info
|
||||
<a href=#227 id=227 data-nosnippet>227</a> .last_updated
|
||||
<a href=#228 id=228 data-nosnippet>228</a> .duration_since(SystemTime::UNIX_EPOCH)
|
||||
<a href=#229 id=229 data-nosnippet>229</a> .expect(<span class="string">"time drift"</span>)
|
||||
<a href=#230 id=230 data-nosnippet>230</a> .as_micros() <span class="kw">as </span>u64;
|
||||
<a href=#231 id=231 data-nosnippet>231</a> <span class="kw">let </span>item = Item::new(
|
||||
<a href=#232 id=232 data-nosnippet>232</a> EndpointInfo::from_parts(endpoint_id, endpoint_info.data.clone()),
|
||||
<a href=#233 id=233 data-nosnippet>233</a> <span class="self">self</span>.provenance,
|
||||
<a href=#234 id=234 data-nosnippet>234</a> <span class="prelude-val">Some</span>(last_updated),
|
||||
<a href=#235 id=235 data-nosnippet>235</a> );
|
||||
<a href=#236 id=236 data-nosnippet>236</a> <span class="prelude-val">Some</span>(stream::iter(<span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(item))).boxed())
|
||||
<a href=#237 id=237 data-nosnippet>237</a> }
|
||||
<a href=#238 id=238 data-nosnippet>238</a> <span class="prelude-val">None </span>=> <span class="prelude-val">None</span>,
|
||||
<a href=#239 id=239 data-nosnippet>239</a> }
|
||||
<a href=#240 id=240 data-nosnippet>240</a> }
|
||||
<a href=#241 id=241 data-nosnippet>241</a>}
|
||||
<a href=#242 id=242 data-nosnippet>242</a>
|
||||
<a href=#243 id=243 data-nosnippet>243</a><span class="attr">#[cfg(all(test, with_crypto_provider))]
|
||||
<a href=#244 id=244 data-nosnippet>244</a></span><span class="kw">mod </span>tests {
|
||||
<a href=#245 id=245 data-nosnippet>245</a> <span class="kw">use </span>iroh_base::{EndpointAddr, SecretKey, TransportAddr};
|
||||
<a href=#246 id=246 data-nosnippet>246</a> <span class="kw">use </span>n0_error::{<span class="prelude-ty">Result</span>, StackResultExt};
|
||||
<a href=#247 id=247 data-nosnippet>247</a>
|
||||
<a href=#248 id=248 data-nosnippet>248</a> <span class="kw">use super</span>::<span class="kw-2">*</span>;
|
||||
<a href=#249 id=249 data-nosnippet>249</a> <span class="kw">use crate</span>::{Endpoint, endpoint::presets};
|
||||
<a href=#250 id=250 data-nosnippet>250</a>
|
||||
<a href=#251 id=251 data-nosnippet>251</a> <span class="attr">#[tokio::test]
|
||||
<a href=#252 id=252 data-nosnippet>252</a> </span><span class="kw">async fn </span>test_basic() -> <span class="prelude-ty">Result</span> {
|
||||
<a href=#253 id=253 data-nosnippet>253</a> <span class="kw">let </span>address_lookup = MemoryLookup::new();
|
||||
<a href=#254 id=254 data-nosnippet>254</a>
|
||||
<a href=#255 id=255 data-nosnippet>255</a> <span class="kw">let </span>_ep = Endpoint::builder(presets::Minimal)
|
||||
<a href=#256 id=256 data-nosnippet>256</a> .address_lookup(address_lookup.clone())
|
||||
<a href=#257 id=257 data-nosnippet>257</a> .bind()
|
||||
<a href=#258 id=258 data-nosnippet>258</a> .<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<a href=#259 id=259 data-nosnippet>259</a>
|
||||
<a href=#260 id=260 data-nosnippet>260</a> <span class="kw">let </span>key = SecretKey::from_bytes(<span class="kw-2">&</span>[<span class="number">0u8</span>; <span class="number">32</span>]);
|
||||
<a href=#261 id=261 data-nosnippet>261</a> <span class="kw">let </span>addr = EndpointAddr::from_parts(
|
||||
<a href=#262 id=262 data-nosnippet>262</a> key.public(),
|
||||
<a href=#263 id=263 data-nosnippet>263</a> [TransportAddr::Relay(<span class="string">"https://example.com"</span>.parse()<span class="question-mark">?</span>)],
|
||||
<a href=#264 id=264 data-nosnippet>264</a> );
|
||||
<a href=#265 id=265 data-nosnippet>265</a> <span class="kw">let </span>user_data = <span class="prelude-val">Some</span>(<span class="string">"foobar"</span>.parse().unwrap());
|
||||
<a href=#266 id=266 data-nosnippet>266</a> <span class="kw">let </span>endpoint_info = EndpointInfo::from(addr.clone()).with_user_data(user_data.clone());
|
||||
<a href=#267 id=267 data-nosnippet>267</a> address_lookup.add_endpoint_info(endpoint_info.clone());
|
||||
<a href=#268 id=268 data-nosnippet>268</a>
|
||||
<a href=#269 id=269 data-nosnippet>269</a> <span class="kw">let </span>back = address_lookup
|
||||
<a href=#270 id=270 data-nosnippet>270</a> .get_endpoint_info(key.public())
|
||||
<a href=#271 id=271 data-nosnippet>271</a> .context(<span class="string">"no addr"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#272 id=272 data-nosnippet>272</a>
|
||||
<a href=#273 id=273 data-nosnippet>273</a> <span class="macro">assert_eq!</span>(back, endpoint_info);
|
||||
<a href=#274 id=274 data-nosnippet>274</a> <span class="macro">assert_eq!</span>(back.user_data(), user_data.as_ref());
|
||||
<a href=#275 id=275 data-nosnippet>275</a> <span class="macro">assert_eq!</span>(back.into_endpoint_addr(), addr);
|
||||
<a href=#276 id=276 data-nosnippet>276</a>
|
||||
<a href=#277 id=277 data-nosnippet>277</a> <span class="kw">let </span>removed = address_lookup
|
||||
<a href=#278 id=278 data-nosnippet>278</a> .remove_endpoint_info(key.public())
|
||||
<a href=#279 id=279 data-nosnippet>279</a> .context(<span class="string">"nothing removed"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#280 id=280 data-nosnippet>280</a> <span class="macro">assert_eq!</span>(removed, endpoint_info);
|
||||
<a href=#281 id=281 data-nosnippet>281</a> <span class="kw">let </span>res = address_lookup.get_endpoint_info(key.public());
|
||||
<a href=#282 id=282 data-nosnippet>282</a> <span class="macro">assert!</span>(res.is_none());
|
||||
<a href=#283 id=283 data-nosnippet>283</a>
|
||||
<a href=#284 id=284 data-nosnippet>284</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#285 id=285 data-nosnippet>285</a> }
|
||||
<a href=#286 id=286 data-nosnippet>286</a>
|
||||
<a href=#287 id=287 data-nosnippet>287</a> <span class="attr">#[tokio::test]
|
||||
<a href=#288 id=288 data-nosnippet>288</a> </span><span class="kw">async fn </span>test_provenance() -> <span class="prelude-ty">Result</span> {
|
||||
<a href=#289 id=289 data-nosnippet>289</a> <span class="kw">let </span>address_lookup = MemoryLookup::with_provenance(<span class="string">"foo"</span>);
|
||||
<a href=#290 id=290 data-nosnippet>290</a> <span class="kw">let </span>key = SecretKey::from_bytes(<span class="kw-2">&</span>[<span class="number">0u8</span>; <span class="number">32</span>]);
|
||||
<a href=#291 id=291 data-nosnippet>291</a> <span class="kw">let </span>addr = EndpointAddr::from_parts(
|
||||
<a href=#292 id=292 data-nosnippet>292</a> key.public(),
|
||||
<a href=#293 id=293 data-nosnippet>293</a> [TransportAddr::Relay(<span class="string">"https://example.com"</span>.parse()<span class="question-mark">?</span>)],
|
||||
<a href=#294 id=294 data-nosnippet>294</a> );
|
||||
<a href=#295 id=295 data-nosnippet>295</a> address_lookup.add_endpoint_info(addr);
|
||||
<a href=#296 id=296 data-nosnippet>296</a> <span class="kw">let </span><span class="kw-2">mut </span>stream = address_lookup.resolve(key.public()).unwrap();
|
||||
<a href=#297 id=297 data-nosnippet>297</a> <span class="kw">let </span>item = stream.next().<span class="kw">await</span>.unwrap()<span class="question-mark">?</span>;
|
||||
<a href=#298 id=298 data-nosnippet>298</a> <span class="macro">assert_eq!</span>(item.provenance(), <span class="string">"foo"</span>);
|
||||
<a href=#299 id=299 data-nosnippet>299</a> <span class="macro">assert_eq!</span>(
|
||||
<a href=#300 id=300 data-nosnippet>300</a> item.relay_urls().next(),
|
||||
<a href=#301 id=301 data-nosnippet>301</a> <span class="prelude-val">Some</span>(<span class="kw-2">&</span>(<span class="string">"https://example.com"</span>.parse()<span class="question-mark">?</span>))
|
||||
<a href=#302 id=302 data-nosnippet>302</a> );
|
||||
<a href=#303 id=303 data-nosnippet>303</a>
|
||||
<a href=#304 id=304 data-nosnippet>304</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#305 id=305 data-nosnippet>305</a> }
|
||||
<a href=#306 id=306 data-nosnippet>306</a>}</code></pre></div></section></main></body></html>
|
||||
@@ -259,423 +259,425 @@
|
||||
<a href=#259 id=259 data-nosnippet>259</a>/// that it only publishes address lookup information, for the corresponding resolver use
|
||||
<a href=#260 id=260 data-nosnippet>260</a>/// the [`PkarrResolver`] together with [`AddressLookupServices`].
|
||||
<a href=#261 id=261 data-nosnippet>261</a>///
|
||||
<a href=#262 id=262 data-nosnippet>262</a>/// This publisher will **only** publish the [`RelayUrl`] if it is set, otherwise the *direct addresses* are published instead.
|
||||
<a href=#263 id=263 data-nosnippet>263</a>///
|
||||
<a href=#264 id=264 data-nosnippet>264</a>/// [pkarr]: https://pkarr.org
|
||||
<a href=#265 id=265 data-nosnippet>265</a>/// [module docs]: crate::address_lookup::pkarr
|
||||
<a href=#266 id=266 data-nosnippet>266</a>/// [`RelayUrl`]: crate::RelayUrl
|
||||
<a href=#267 id=267 data-nosnippet>267</a>/// [`AddressLookupServices`]: super::AddressLookupServices
|
||||
<a href=#268 id=268 data-nosnippet>268</a></span><span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
<a href=#269 id=269 data-nosnippet>269</a></span><span class="kw">pub struct </span>PkarrPublisher {
|
||||
<a href=#270 id=270 data-nosnippet>270</a> endpoint_id: EndpointId,
|
||||
<a href=#271 id=271 data-nosnippet>271</a> watchable: Watchable<<span class="prelude-ty">Option</span><EndpointInfo>>,
|
||||
<a href=#272 id=272 data-nosnippet>272</a> addr_filter: AddrFilter,
|
||||
<a href=#273 id=273 data-nosnippet>273</a> _drop_guard: Arc<AbortOnDropHandle<()>>,
|
||||
<a href=#274 id=274 data-nosnippet>274</a>}
|
||||
<a href=#275 id=275 data-nosnippet>275</a>
|
||||
<a href=#276 id=276 data-nosnippet>276</a><span class="kw">impl </span>PkarrPublisher {
|
||||
<a href=#277 id=277 data-nosnippet>277</a> <span class="doccomment">/// Returns a [`PkarrPublisherBuilder`] that publishes endpoint info to a [pkarr] relay at `pkarr_relay`.
|
||||
<a href=#278 id=278 data-nosnippet>278</a> ///
|
||||
<a href=#279 id=279 data-nosnippet>279</a> /// If no further options are set, the pkarr publisher will use [`DEFAULT_PKARR_TTL`] as the
|
||||
<a href=#280 id=280 data-nosnippet>280</a> /// time-to-live value for the published packets, and it will republish Address Lookup information
|
||||
<a href=#281 id=281 data-nosnippet>281</a> /// every [`DEFAULT_REPUBLISH_INTERVAL`], even if the information is unchanged.
|
||||
<a href=#282 id=282 data-nosnippet>282</a> ///
|
||||
<a href=#283 id=283 data-nosnippet>283</a> /// [`PkarrPublisherBuilder`] implements [`AddressLookupBuilder`], so it can be passed to [`address_lookup`].
|
||||
<a href=#284 id=284 data-nosnippet>284</a> /// It will then use the endpoint's secret key to sign published packets.
|
||||
<a href=#285 id=285 data-nosnippet>285</a> ///
|
||||
<a href=#286 id=286 data-nosnippet>286</a> /// [`address_lookup`]: crate::endpoint::Builder::address_lookup
|
||||
<a href=#287 id=287 data-nosnippet>287</a> /// [pkarr]: https://pkarr.org
|
||||
<a href=#288 id=288 data-nosnippet>288</a> </span><span class="kw">pub fn </span>builder(pkarr_relay: Url) -> PkarrPublisherBuilder {
|
||||
<a href=#289 id=289 data-nosnippet>289</a> PkarrPublisherBuilder::new(pkarr_relay)
|
||||
<a href=#290 id=290 data-nosnippet>290</a> }
|
||||
<a href=#291 id=291 data-nosnippet>291</a>
|
||||
<a href=#292 id=292 data-nosnippet>292</a> <span class="doccomment">/// Creates a new [`PkarrPublisher`] with a custom TTL and republish intervals.
|
||||
<a href=#293 id=293 data-nosnippet>293</a> ///
|
||||
<a href=#294 id=294 data-nosnippet>294</a> /// This allows creating the publisher with custom time-to-live values of the
|
||||
<a href=#295 id=295 data-nosnippet>295</a> /// [`SignedPacket`]s as well as a custom republish interval.
|
||||
<a href=#296 id=296 data-nosnippet>296</a> </span><span class="kw">fn </span>new(
|
||||
<a href=#297 id=297 data-nosnippet>297</a> secret_key: SecretKey,
|
||||
<a href=#298 id=298 data-nosnippet>298</a> pkarr_relay: Url,
|
||||
<a href=#299 id=299 data-nosnippet>299</a> ttl: u32,
|
||||
<a href=#300 id=300 data-nosnippet>300</a> republish_interval: Duration,
|
||||
<a href=#301 id=301 data-nosnippet>301</a> <span class="attr">#[cfg(not(wasm_browser))] </span>dns_resolver: DnsResolver,
|
||||
<a href=#302 id=302 data-nosnippet>302</a> tls_config: rustls::ClientConfig,
|
||||
<a href=#303 id=303 data-nosnippet>303</a> addr_filter: AddrFilter,
|
||||
<a href=#304 id=304 data-nosnippet>304</a> ) -> <span class="self">Self </span>{
|
||||
<a href=#305 id=305 data-nosnippet>305</a> <span class="macro">debug!</span>(<span class="string">"creating pkarr publisher that publishes to {pkarr_relay}"</span>);
|
||||
<a href=#306 id=306 data-nosnippet>306</a> <span class="kw">let </span>endpoint_id = secret_key.public();
|
||||
<a href=#307 id=307 data-nosnippet>307</a>
|
||||
<a href=#308 id=308 data-nosnippet>308</a> <span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#309 id=309 data-nosnippet>309</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(pkarr_relay);
|
||||
<a href=#310 id=310 data-nosnippet>310</a>
|
||||
<a href=#311 id=311 data-nosnippet>311</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#312 id=312 data-nosnippet>312</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(pkarr_relay, tls_config, dns_resolver);
|
||||
<a href=#313 id=313 data-nosnippet>313</a>
|
||||
<a href=#314 id=314 data-nosnippet>314</a> <span class="kw">let </span>watchable = Watchable::default();
|
||||
<a href=#315 id=315 data-nosnippet>315</a> <span class="kw">let </span>service = PublisherService {
|
||||
<a href=#316 id=316 data-nosnippet>316</a> ttl,
|
||||
<a href=#317 id=317 data-nosnippet>317</a> watcher: watchable.watch(),
|
||||
<a href=#318 id=318 data-nosnippet>318</a> secret_key,
|
||||
<a href=#319 id=319 data-nosnippet>319</a> pkarr_client,
|
||||
<a href=#320 id=320 data-nosnippet>320</a> republish_interval,
|
||||
<a href=#321 id=321 data-nosnippet>321</a> };
|
||||
<a href=#322 id=322 data-nosnippet>322</a> <span class="kw">let </span>join_handle = task::spawn(service.run().instrument(<span class="macro">error_span!</span>(<span class="string">"pkarr_publish"</span>)));
|
||||
<a href=#323 id=323 data-nosnippet>323</a> <span class="self">Self </span>{
|
||||
<a href=#324 id=324 data-nosnippet>324</a> watchable,
|
||||
<a href=#325 id=325 data-nosnippet>325</a> endpoint_id,
|
||||
<a href=#326 id=326 data-nosnippet>326</a> addr_filter,
|
||||
<a href=#327 id=327 data-nosnippet>327</a> _drop_guard: Arc::new(AbortOnDropHandle::new(join_handle)),
|
||||
<a href=#328 id=328 data-nosnippet>328</a> }
|
||||
<a href=#329 id=329 data-nosnippet>329</a> }
|
||||
<a href=#330 id=330 data-nosnippet>330</a>
|
||||
<a href=#331 id=331 data-nosnippet>331</a> <span class="doccomment">/// Creates a pkarr publisher which uses the [number 0] pkarr relay server.
|
||||
<a href=#332 id=332 data-nosnippet>332</a> ///
|
||||
<a href=#333 id=333 data-nosnippet>333</a> /// This uses the pkarr relay server operated by [number 0], at
|
||||
<a href=#334 id=334 data-nosnippet>334</a> /// [`N0_DNS_PKARR_RELAY_PROD`].
|
||||
<a href=#335 id=335 data-nosnippet>335</a> ///
|
||||
<a href=#336 id=336 data-nosnippet>336</a> /// When running with the environment variable
|
||||
<a href=#337 id=337 data-nosnippet>337</a> /// `IROH_FORCE_STAGING_RELAYS` set to any non empty value [`N0_DNS_PKARR_RELAY_STAGING`]
|
||||
<a href=#338 id=338 data-nosnippet>338</a> /// server is used instead.
|
||||
<a href=#339 id=339 data-nosnippet>339</a> ///
|
||||
<a href=#340 id=340 data-nosnippet>340</a> /// [number 0]: https://n0.computer
|
||||
<a href=#341 id=341 data-nosnippet>341</a> </span><span class="kw">pub fn </span>n0_dns() -> PkarrPublisherBuilder {
|
||||
<a href=#342 id=342 data-nosnippet>342</a> PkarrPublisherBuilder::n0_dns()
|
||||
<a href=#343 id=343 data-nosnippet>343</a> }
|
||||
<a href=#344 id=344 data-nosnippet>344</a>
|
||||
<a href=#345 id=345 data-nosnippet>345</a> <span class="doccomment">/// Publishes the addressing information about this endpoint to a pkarr relay.
|
||||
<a href=#346 id=346 data-nosnippet>346</a> ///
|
||||
<a href=#347 id=347 data-nosnippet>347</a> /// This is a nonblocking function, the actual update is performed in the background.
|
||||
<a href=#348 id=348 data-nosnippet>348</a> </span><span class="kw">pub fn </span>update_endpoint_data(<span class="kw-2">&</span><span class="self">self</span>, data: <span class="kw-2">&</span>EndpointData) {
|
||||
<a href=#349 id=349 data-nosnippet>349</a> <span class="kw">let </span>data = data.apply_filter(<span class="kw-2">&</span><span class="self">self</span>.addr_filter).into_owned();
|
||||
<a href=#350 id=350 data-nosnippet>350</a> <span class="kw">let </span>info = EndpointInfo::from_parts(<span class="self">self</span>.endpoint_id, data);
|
||||
<a href=#351 id=351 data-nosnippet>351</a> <span class="self">self</span>.watchable.set(<span class="prelude-val">Some</span>(info)).ok();
|
||||
<a href=#352 id=352 data-nosnippet>352</a> }
|
||||
<a href=#353 id=353 data-nosnippet>353</a>}
|
||||
<a href=#354 id=354 data-nosnippet>354</a>
|
||||
<a href=#355 id=355 data-nosnippet>355</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>PkarrPublisher {
|
||||
<a href=#356 id=356 data-nosnippet>356</a> <span class="kw">fn </span>publish(<span class="kw-2">&</span><span class="self">self</span>, data: <span class="kw-2">&</span>EndpointData) {
|
||||
<a href=#357 id=357 data-nosnippet>357</a> <span class="self">self</span>.update_endpoint_data(data);
|
||||
<a href=#358 id=358 data-nosnippet>358</a> }
|
||||
<a href=#359 id=359 data-nosnippet>359</a>}
|
||||
<a href=#360 id=360 data-nosnippet>360</a>
|
||||
<a href=#361 id=361 data-nosnippet>361</a><span class="doccomment">/// Publish endpoint info to a pkarr relay.
|
||||
<a href=#362 id=362 data-nosnippet>362</a></span><span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
<a href=#363 id=363 data-nosnippet>363</a></span><span class="kw">struct </span>PublisherService {
|
||||
<a href=#364 id=364 data-nosnippet>364</a> <span class="attr">#[debug(<span class="string">"SecretKey"</span>)]
|
||||
<a href=#365 id=365 data-nosnippet>365</a> </span>secret_key: SecretKey,
|
||||
<a href=#366 id=366 data-nosnippet>366</a> <span class="attr">#[debug(<span class="string">"PkarrClient"</span>)]
|
||||
<a href=#367 id=367 data-nosnippet>367</a> </span>pkarr_client: PkarrRelayClient,
|
||||
<a href=#368 id=368 data-nosnippet>368</a> watcher: n0_watcher::Direct<<span class="prelude-ty">Option</span><EndpointInfo>>,
|
||||
<a href=#369 id=369 data-nosnippet>369</a> ttl: u32,
|
||||
<a href=#370 id=370 data-nosnippet>370</a> republish_interval: Duration,
|
||||
<a href=#371 id=371 data-nosnippet>371</a>}
|
||||
<a href=#372 id=372 data-nosnippet>372</a>
|
||||
<a href=#373 id=373 data-nosnippet>373</a><span class="kw">impl </span>PublisherService {
|
||||
<a href=#374 id=374 data-nosnippet>374</a> <span class="kw">async fn </span>run(<span class="kw-2">mut </span><span class="self">self</span>) {
|
||||
<a href=#375 id=375 data-nosnippet>375</a> <span class="kw">let </span><span class="kw-2">mut </span>failed_attempts = <span class="number">0</span>;
|
||||
<a href=#376 id=376 data-nosnippet>376</a> <span class="kw">let </span>republish = time::sleep(Duration::MAX);
|
||||
<a href=#377 id=377 data-nosnippet>377</a> <span class="macro">tokio::pin!</span>(republish);
|
||||
<a href=#378 id=378 data-nosnippet>378</a> <span class="kw">loop </span>{
|
||||
<a href=#379 id=379 data-nosnippet>379</a> <span class="kw">if </span>!<span class="self">self</span>.watcher.is_connected() {
|
||||
<a href=#380 id=380 data-nosnippet>380</a> <span class="kw">break</span>;
|
||||
<a href=#381 id=381 data-nosnippet>381</a> }
|
||||
<a href=#382 id=382 data-nosnippet>382</a> <span class="kw">if let </span><span class="prelude-val">Some</span>(info) = <span class="self">self</span>.watcher.get() {
|
||||
<a href=#383 id=383 data-nosnippet>383</a> <span class="kw">match </span><span class="self">self</span>.publish_current(info).<span class="kw">await </span>{
|
||||
<a href=#384 id=384 data-nosnippet>384</a> <span class="prelude-val">Err</span>(err) => {
|
||||
<a href=#385 id=385 data-nosnippet>385</a> failed_attempts += <span class="number">1</span>;
|
||||
<a href=#386 id=386 data-nosnippet>386</a> <span class="comment">// Retry after increasing timeout
|
||||
<a href=#387 id=387 data-nosnippet>387</a> </span><span class="kw">let </span>retry_after = Duration::from_secs(failed_attempts);
|
||||
<a href=#388 id=388 data-nosnippet>388</a> republish.as_mut().reset(Instant::now() + retry_after);
|
||||
<a href=#389 id=389 data-nosnippet>389</a> <span class="macro">warn!</span>(
|
||||
<a href=#390 id=390 data-nosnippet>390</a> err = %<span class="macro">format!</span>(<span class="string">"{err:#}"</span>),
|
||||
<a href=#391 id=391 data-nosnippet>391</a> url = %<span class="self">self</span>.pkarr_client.pkarr_relay_url ,
|
||||
<a href=#392 id=392 data-nosnippet>392</a> <span class="question-mark">?</span>retry_after,
|
||||
<a href=#393 id=393 data-nosnippet>393</a> %failed_attempts,
|
||||
<a href=#394 id=394 data-nosnippet>394</a> <span class="string">"Failed to publish to pkarr"</span>,
|
||||
<a href=#395 id=395 data-nosnippet>395</a> );
|
||||
<a href=#396 id=396 data-nosnippet>396</a> }
|
||||
<a href=#397 id=397 data-nosnippet>397</a> <span class="prelude-val">Ok</span>(()) => {
|
||||
<a href=#398 id=398 data-nosnippet>398</a> failed_attempts = <span class="number">0</span>;
|
||||
<a href=#399 id=399 data-nosnippet>399</a> <span class="comment">// Republish after fixed interval
|
||||
<a href=#400 id=400 data-nosnippet>400</a> </span>republish
|
||||
<a href=#401 id=401 data-nosnippet>401</a> .as_mut()
|
||||
<a href=#402 id=402 data-nosnippet>402</a> .reset(Instant::now() + <span class="self">self</span>.republish_interval);
|
||||
<a href=#403 id=403 data-nosnippet>403</a> }
|
||||
<a href=#404 id=404 data-nosnippet>404</a> }
|
||||
<a href=#405 id=405 data-nosnippet>405</a> }
|
||||
<a href=#406 id=406 data-nosnippet>406</a> <span class="comment">// Wait until either the retry/republish timeout is reached, or the endpoint info changed.
|
||||
<a href=#407 id=407 data-nosnippet>407</a> </span><span class="macro">tokio::select!</span> {
|
||||
<a href=#408 id=408 data-nosnippet>408</a> res = <span class="self">self</span>.watcher.updated() => <span class="kw">match </span>res {
|
||||
<a href=#409 id=409 data-nosnippet>409</a> <span class="prelude-val">Ok</span>(<span class="kw">_</span>) => <span class="macro">debug!</span>(<span class="string">"Publish endpoint info to pkarr (info changed)"</span>),
|
||||
<a href=#410 id=410 data-nosnippet>410</a> <span class="prelude-val">Err</span>(Disconnected { .. }) => <span class="kw">break</span>,
|
||||
<a href=#411 id=411 data-nosnippet>411</a> },
|
||||
<a href=#412 id=412 data-nosnippet>412</a> <span class="kw">_ </span>= <span class="kw-2">&mut </span>republish => <span class="macro">debug!</span>(<span class="string">"Publish endpoint info to pkarr (interval elapsed)"</span>),
|
||||
<a href=#413 id=413 data-nosnippet>413</a> }
|
||||
<a href=#414 id=414 data-nosnippet>414</a> }
|
||||
<a href=#415 id=415 data-nosnippet>415</a> }
|
||||
<a href=#416 id=416 data-nosnippet>416</a>
|
||||
<a href=#417 id=417 data-nosnippet>417</a> <span class="kw">async fn </span>publish_current(<span class="kw-2">&</span><span class="self">self</span>, info: EndpointInfo) -> <span class="prelude-ty">Result</span><(), PkarrError> {
|
||||
<a href=#418 id=418 data-nosnippet>418</a> <span class="macro">debug!</span>(
|
||||
<a href=#419 id=419 data-nosnippet>419</a> data = <span class="question-mark">?</span>info.data,
|
||||
<a href=#420 id=420 data-nosnippet>420</a> pkarr_relay = %<span class="self">self</span>.pkarr_client.pkarr_relay_url,
|
||||
<a href=#421 id=421 data-nosnippet>421</a> <span class="string">"Publishing endpoint info to pkarr"
|
||||
<a href=#422 id=422 data-nosnippet>422</a> </span>);
|
||||
<a href=#423 id=423 data-nosnippet>423</a> <span class="kw">let </span>signed_packet = info
|
||||
<a href=#424 id=424 data-nosnippet>424</a> .to_pkarr_signed_packet(<span class="kw-2">&</span><span class="self">self</span>.secret_key, <span class="self">self</span>.ttl)
|
||||
<a href=#425 id=425 data-nosnippet>425</a> .map_err(|err| <span class="macro">e!</span>(PkarrError::Encoding, err))<span class="question-mark">?</span>;
|
||||
<a href=#426 id=426 data-nosnippet>426</a> <span class="self">self</span>.pkarr_client.publish(<span class="kw-2">&</span>signed_packet).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<a href=#427 id=427 data-nosnippet>427</a> <span class="macro">trace!</span>(
|
||||
<a href=#428 id=428 data-nosnippet>428</a> data = <span class="question-mark">?</span>info.data,
|
||||
<a href=#429 id=429 data-nosnippet>429</a> pkarr_relay = %<span class="self">self</span>.pkarr_client.pkarr_relay_url,
|
||||
<a href=#430 id=430 data-nosnippet>430</a> <span class="string">"Published endpoint info to pkarr"
|
||||
<a href=#431 id=431 data-nosnippet>431</a> </span>);
|
||||
<a href=#432 id=432 data-nosnippet>432</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#433 id=433 data-nosnippet>433</a> }
|
||||
<a href=#434 id=434 data-nosnippet>434</a>}
|
||||
<a href=#435 id=435 data-nosnippet>435</a>
|
||||
<a href=#436 id=436 data-nosnippet>436</a><span class="doccomment">/// Builder for [`PkarrResolver`].
|
||||
<a href=#437 id=437 data-nosnippet>437</a>///
|
||||
<a href=#438 id=438 data-nosnippet>438</a>/// See [`PkarrResolver::builder`].
|
||||
<a href=#439 id=439 data-nosnippet>439</a></span><span class="attr">#[derive(Debug)]
|
||||
<a href=#440 id=440 data-nosnippet>440</a></span><span class="kw">pub struct </span>PkarrResolverBuilder {
|
||||
<a href=#441 id=441 data-nosnippet>441</a> pkarr_relay: Url,
|
||||
<a href=#442 id=442 data-nosnippet>442</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#443 id=443 data-nosnippet>443</a> </span>dns_resolver: <span class="prelude-ty">Option</span><DnsResolver>,
|
||||
<a href=#444 id=444 data-nosnippet>444</a>}
|
||||
<a href=#445 id=445 data-nosnippet>445</a>
|
||||
<a href=#446 id=446 data-nosnippet>446</a><span class="kw">impl </span>PkarrResolverBuilder {
|
||||
<a href=#447 id=447 data-nosnippet>447</a> <span class="doccomment">/// Sets the DNS resolver to use for resolving the pkarr relay URL.
|
||||
<a href=#448 id=448 data-nosnippet>448</a> </span><span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#449 id=449 data-nosnippet>449</a> </span><span class="kw">pub fn </span>dns_resolver(<span class="kw-2">mut </span><span class="self">self</span>, dns_resolver: DnsResolver) -> <span class="self">Self </span>{
|
||||
<a href=#450 id=450 data-nosnippet>450</a> <span class="self">self</span>.dns_resolver = <span class="prelude-val">Some</span>(dns_resolver);
|
||||
<a href=#451 id=451 data-nosnippet>451</a> <span class="self">self
|
||||
<a href=#452 id=452 data-nosnippet>452</a> </span>}
|
||||
<a href=#453 id=453 data-nosnippet>453</a>
|
||||
<a href=#454 id=454 data-nosnippet>454</a> <span class="doccomment">/// Creates a [`PkarrResolver`] from this builder.
|
||||
<a href=#455 id=455 data-nosnippet>455</a> </span><span class="kw">pub fn </span>build(<span class="self">self</span>, tls_config: rustls::ClientConfig) -> PkarrResolver {
|
||||
<a href=#456 id=456 data-nosnippet>456</a> <span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#457 id=457 data-nosnippet>457</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(<span class="self">self</span>.pkarr_relay);
|
||||
<a href=#458 id=458 data-nosnippet>458</a>
|
||||
<a href=#459 id=459 data-nosnippet>459</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#460 id=460 data-nosnippet>460</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(
|
||||
<a href=#461 id=461 data-nosnippet>461</a> <span class="self">self</span>.pkarr_relay,
|
||||
<a href=#462 id=462 data-nosnippet>462</a> tls_config,
|
||||
<a href=#463 id=463 data-nosnippet>463</a> <span class="self">self</span>.dns_resolver.unwrap_or_default(),
|
||||
<a href=#464 id=464 data-nosnippet>464</a> );
|
||||
<a href=#465 id=465 data-nosnippet>465</a>
|
||||
<a href=#466 id=466 data-nosnippet>466</a> PkarrResolver { pkarr_client }
|
||||
<a href=#467 id=467 data-nosnippet>467</a> }
|
||||
<a href=#468 id=468 data-nosnippet>468</a>}
|
||||
<a href=#469 id=469 data-nosnippet>469</a>
|
||||
<a href=#470 id=470 data-nosnippet>470</a><span class="kw">impl </span>AddressLookupBuilder <span class="kw">for </span>PkarrResolverBuilder {
|
||||
<a href=#471 id=471 data-nosnippet>471</a> <span class="kw">fn </span>into_address_lookup(
|
||||
<a href=#472 id=472 data-nosnippet>472</a> <span class="kw-2">mut </span><span class="self">self</span>,
|
||||
<a href=#473 id=473 data-nosnippet>473</a> endpoint: <span class="kw-2">&</span>Endpoint,
|
||||
<a href=#474 id=474 data-nosnippet>474</a> ) -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>AddressLookup, AddressLookupBuilderError> {
|
||||
<a href=#475 id=475 data-nosnippet>475</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#476 id=476 data-nosnippet>476</a> </span><span class="kw">if </span><span class="self">self</span>.dns_resolver.is_none() {
|
||||
<a href=#477 id=477 data-nosnippet>477</a> <span class="self">self</span>.dns_resolver = <span class="prelude-val">Some</span>(endpoint.dns_resolver()<span class="question-mark">?</span>.clone());
|
||||
<a href=#478 id=478 data-nosnippet>478</a> }
|
||||
<a href=#479 id=479 data-nosnippet>479</a> <span class="kw">let </span>tls_config = endpoint.tls_config().clone();
|
||||
<a href=#480 id=480 data-nosnippet>480</a> <span class="prelude-val">Ok</span>(<span class="self">self</span>.build(tls_config))
|
||||
<a href=#481 id=481 data-nosnippet>481</a> }
|
||||
<a href=#482 id=482 data-nosnippet>482</a>}
|
||||
<a href=#483 id=483 data-nosnippet>483</a>
|
||||
<a href=#484 id=484 data-nosnippet>484</a><span class="doccomment">/// Resolver of address lookup information from a [pkarr] relay.
|
||||
<a href=#485 id=485 data-nosnippet>485</a>///
|
||||
<a href=#486 id=486 data-nosnippet>486</a>/// The resolver uses HTTP to query address lookup information from a pkarr relay server,
|
||||
<a href=#487 id=487 data-nosnippet>487</a>/// see the [module docs] for details.
|
||||
<a href=#488 id=488 data-nosnippet>488</a>///
|
||||
<a href=#489 id=489 data-nosnippet>489</a>/// This implements the [`AddressLookup`] trait to be used as an address lookup service. Note
|
||||
<a href=#490 id=490 data-nosnippet>490</a>/// that it only resolves address lookup information, for the corresponding publisher use
|
||||
<a href=#491 id=491 data-nosnippet>491</a>/// the [`PkarrPublisher`] together with [`AddressLookupServices`].
|
||||
<a href=#492 id=492 data-nosnippet>492</a>///
|
||||
<a href=#493 id=493 data-nosnippet>493</a>/// [pkarr]: https://pkarr.org
|
||||
<a href=#494 id=494 data-nosnippet>494</a>/// [module docs]: crate::address_lookup::pkarr
|
||||
<a href=#495 id=495 data-nosnippet>495</a>/// [`AddressLookupServices`]: super::AddressLookupServices
|
||||
<a href=#496 id=496 data-nosnippet>496</a></span><span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
<a href=#497 id=497 data-nosnippet>497</a></span><span class="kw">pub struct </span>PkarrResolver {
|
||||
<a href=#498 id=498 data-nosnippet>498</a> pkarr_client: PkarrRelayClient,
|
||||
<a href=#499 id=499 data-nosnippet>499</a>}
|
||||
<a href=#500 id=500 data-nosnippet>500</a>
|
||||
<a href=#501 id=501 data-nosnippet>501</a><span class="kw">impl </span>PkarrResolver {
|
||||
<a href=#502 id=502 data-nosnippet>502</a> <span class="doccomment">/// Creates a new resolver builder using the pkarr relay server at the URL.
|
||||
<a href=#503 id=503 data-nosnippet>503</a> ///
|
||||
<a href=#504 id=504 data-nosnippet>504</a> /// The builder implements [`AddressLookupBuilder`].
|
||||
<a href=#505 id=505 data-nosnippet>505</a> </span><span class="kw">pub fn </span>builder(pkarr_relay: Url) -> PkarrResolverBuilder {
|
||||
<a href=#506 id=506 data-nosnippet>506</a> PkarrResolverBuilder {
|
||||
<a href=#507 id=507 data-nosnippet>507</a> pkarr_relay,
|
||||
<a href=#508 id=508 data-nosnippet>508</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#509 id=509 data-nosnippet>509</a> </span>dns_resolver: <span class="prelude-val">None</span>,
|
||||
<a href=#510 id=510 data-nosnippet>510</a> }
|
||||
<a href=#511 id=511 data-nosnippet>511</a> }
|
||||
<a href=#512 id=512 data-nosnippet>512</a>
|
||||
<a href=#513 id=513 data-nosnippet>513</a> <span class="doccomment">/// Creates a pkarr resolver builder which uses the [number 0] pkarr relay server.
|
||||
<a href=#514 id=514 data-nosnippet>514</a> ///
|
||||
<a href=#515 id=515 data-nosnippet>515</a> /// This uses the pkarr relay server operated by [number 0] at
|
||||
<a href=#516 id=516 data-nosnippet>516</a> /// [`N0_DNS_PKARR_RELAY_PROD`].
|
||||
<a href=#517 id=517 data-nosnippet>517</a> ///
|
||||
<a href=#518 id=518 data-nosnippet>518</a> /// When running with the environment variable `IROH_FORCE_STAGING_RELAYS`
|
||||
<a href=#519 id=519 data-nosnippet>519</a> /// set to any non empty value [`N0_DNS_PKARR_RELAY_STAGING`]
|
||||
<a href=#520 id=520 data-nosnippet>520</a> /// server is used instead.
|
||||
<a href=#521 id=521 data-nosnippet>521</a> ///
|
||||
<a href=#522 id=522 data-nosnippet>522</a> /// [number 0]: https://n0.computer
|
||||
<a href=#523 id=523 data-nosnippet>523</a> </span><span class="kw">pub fn </span>n0_dns() -> PkarrResolverBuilder {
|
||||
<a href=#524 id=524 data-nosnippet>524</a> <span class="kw">let </span>pkarr_relay = <span class="kw">match </span>force_staging_infra() {
|
||||
<a href=#525 id=525 data-nosnippet>525</a> <span class="bool-val">true </span>=> N0_DNS_PKARR_RELAY_STAGING,
|
||||
<a href=#526 id=526 data-nosnippet>526</a> <span class="bool-val">false </span>=> N0_DNS_PKARR_RELAY_PROD,
|
||||
<a href=#527 id=527 data-nosnippet>527</a> };
|
||||
<a href=#528 id=528 data-nosnippet>528</a>
|
||||
<a href=#529 id=529 data-nosnippet>529</a> <span class="kw">let </span>pkarr_relay: Url = pkarr_relay.parse().expect(<span class="string">"url is valid"</span>);
|
||||
<a href=#530 id=530 data-nosnippet>530</a> <span class="self">Self</span>::builder(pkarr_relay)
|
||||
<a href=#531 id=531 data-nosnippet>531</a> }
|
||||
<a href=#532 id=532 data-nosnippet>532</a>}
|
||||
<a href=#533 id=533 data-nosnippet>533</a>
|
||||
<a href=#534 id=534 data-nosnippet>534</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>PkarrResolver {
|
||||
<a href=#535 id=535 data-nosnippet>535</a> <span class="kw">fn </span>resolve(
|
||||
<a href=#536 id=536 data-nosnippet>536</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#537 id=537 data-nosnippet>537</a> endpoint_id: EndpointId,
|
||||
<a href=#538 id=538 data-nosnippet>538</a> ) -> <span class="prelude-ty">Option</span><BoxStream<<span class="prelude-ty">Result</span><AddressLookupItem, AddressLookupError>>> {
|
||||
<a href=#539 id=539 data-nosnippet>539</a> <span class="kw">let </span>pkarr_client = <span class="self">self</span>.pkarr_client.clone();
|
||||
<a href=#540 id=540 data-nosnippet>540</a> <span class="kw">let </span>fut = <span class="kw">async move </span>{
|
||||
<a href=#541 id=541 data-nosnippet>541</a> <span class="kw">let </span>signed_packet = pkarr_client.resolve(endpoint_id).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<a href=#542 id=542 data-nosnippet>542</a> <span class="kw">let </span>info = EndpointInfo::from_pkarr_signed_packet(<span class="kw-2">&</span>signed_packet)
|
||||
<a href=#543 id=543 data-nosnippet>543</a> .map_err(|err| AddressLookupError::from_err_any(<span class="string">"pkarr"</span>, err))<span class="question-mark">?</span>;
|
||||
<a href=#544 id=544 data-nosnippet>544</a> <span class="kw">let </span>item = AddressLookupItem::new(info, <span class="string">"pkarr"</span>, <span class="prelude-val">None</span>);
|
||||
<a href=#545 id=545 data-nosnippet>545</a> <span class="prelude-val">Ok</span>(item)
|
||||
<a href=#546 id=546 data-nosnippet>546</a> };
|
||||
<a href=#547 id=547 data-nosnippet>547</a> <span class="kw">let </span>stream = n0_future::stream::once_future(fut);
|
||||
<a href=#548 id=548 data-nosnippet>548</a> <span class="prelude-val">Some</span>(Box::pin(stream))
|
||||
<a href=#549 id=549 data-nosnippet>549</a> }
|
||||
<a href=#550 id=550 data-nosnippet>550</a>}
|
||||
<a href=#551 id=551 data-nosnippet>551</a>
|
||||
<a href=#552 id=552 data-nosnippet>552</a><span class="doccomment">/// A [pkarr](https://pkarr.org) client to publish [`SignedPacket`]s to a pkarr relay.
|
||||
<a href=#553 id=553 data-nosnippet>553</a>///
|
||||
<a href=#554 id=554 data-nosnippet>554</a>/// [pkarr]: https://pkarr.org
|
||||
<a href=#555 id=555 data-nosnippet>555</a></span><span class="attr">#[derive(Debug, Clone)]
|
||||
<a href=#556 id=556 data-nosnippet>556</a></span><span class="kw">pub struct </span>PkarrRelayClient {
|
||||
<a href=#557 id=557 data-nosnippet>557</a> http_client: reqwest::Client,
|
||||
<a href=#558 id=558 data-nosnippet>558</a> pkarr_relay_url: Url,
|
||||
<a href=#559 id=559 data-nosnippet>559</a>}
|
||||
<a href=#560 id=560 data-nosnippet>560</a>
|
||||
<a href=#561 id=561 data-nosnippet>561</a><span class="doccomment">/// A builder for the [`PkarrRelayClient`]
|
||||
<a href=#562 id=562 data-nosnippet>562</a></span><span class="attr">#[derive(Debug, Clone)]
|
||||
<a href=#563 id=563 data-nosnippet>563</a></span><span class="kw">pub struct </span>PkarrRelayClientBuilder {
|
||||
<a href=#564 id=564 data-nosnippet>564</a> pkarr_relay_url: Url,
|
||||
<a href=#565 id=565 data-nosnippet>565</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#566 id=566 data-nosnippet>566</a> </span>dns_resolver: DnsResolver,
|
||||
<a href=#262 id=262 data-nosnippet>262</a>/// By default this publisher only publishes the [`RelayUrl`], to avoid leaking IP addresses to
|
||||
<a href=#263 id=263 data-nosnippet>263</a>/// the public pkarr server. Which addresses are published is controlled by the [`AddrFilter`]
|
||||
<a href=#264 id=264 data-nosnippet>264</a>/// set via [`PkarrPublisherBuilder::addr_filter`].
|
||||
<a href=#265 id=265 data-nosnippet>265</a>///
|
||||
<a href=#266 id=266 data-nosnippet>266</a>/// [pkarr]: https://pkarr.org
|
||||
<a href=#267 id=267 data-nosnippet>267</a>/// [module docs]: crate::address_lookup::pkarr
|
||||
<a href=#268 id=268 data-nosnippet>268</a>/// [`RelayUrl`]: crate::RelayUrl
|
||||
<a href=#269 id=269 data-nosnippet>269</a>/// [`AddressLookupServices`]: super::AddressLookupServices
|
||||
<a href=#270 id=270 data-nosnippet>270</a></span><span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
<a href=#271 id=271 data-nosnippet>271</a></span><span class="kw">pub struct </span>PkarrPublisher {
|
||||
<a href=#272 id=272 data-nosnippet>272</a> endpoint_id: EndpointId,
|
||||
<a href=#273 id=273 data-nosnippet>273</a> watchable: Watchable<<span class="prelude-ty">Option</span><EndpointInfo>>,
|
||||
<a href=#274 id=274 data-nosnippet>274</a> addr_filter: AddrFilter,
|
||||
<a href=#275 id=275 data-nosnippet>275</a> _drop_guard: Arc<AbortOnDropHandle<()>>,
|
||||
<a href=#276 id=276 data-nosnippet>276</a>}
|
||||
<a href=#277 id=277 data-nosnippet>277</a>
|
||||
<a href=#278 id=278 data-nosnippet>278</a><span class="kw">impl </span>PkarrPublisher {
|
||||
<a href=#279 id=279 data-nosnippet>279</a> <span class="doccomment">/// Returns a [`PkarrPublisherBuilder`] that publishes endpoint info to a [pkarr] relay at `pkarr_relay`.
|
||||
<a href=#280 id=280 data-nosnippet>280</a> ///
|
||||
<a href=#281 id=281 data-nosnippet>281</a> /// If no further options are set, the pkarr publisher will use [`DEFAULT_PKARR_TTL`] as the
|
||||
<a href=#282 id=282 data-nosnippet>282</a> /// time-to-live value for the published packets, and it will republish Address Lookup information
|
||||
<a href=#283 id=283 data-nosnippet>283</a> /// every [`DEFAULT_REPUBLISH_INTERVAL`], even if the information is unchanged.
|
||||
<a href=#284 id=284 data-nosnippet>284</a> ///
|
||||
<a href=#285 id=285 data-nosnippet>285</a> /// [`PkarrPublisherBuilder`] implements [`AddressLookupBuilder`], so it can be passed to [`address_lookup`].
|
||||
<a href=#286 id=286 data-nosnippet>286</a> /// It will then use the endpoint's secret key to sign published packets.
|
||||
<a href=#287 id=287 data-nosnippet>287</a> ///
|
||||
<a href=#288 id=288 data-nosnippet>288</a> /// [`address_lookup`]: crate::endpoint::Builder::address_lookup
|
||||
<a href=#289 id=289 data-nosnippet>289</a> /// [pkarr]: https://pkarr.org
|
||||
<a href=#290 id=290 data-nosnippet>290</a> </span><span class="kw">pub fn </span>builder(pkarr_relay: Url) -> PkarrPublisherBuilder {
|
||||
<a href=#291 id=291 data-nosnippet>291</a> PkarrPublisherBuilder::new(pkarr_relay)
|
||||
<a href=#292 id=292 data-nosnippet>292</a> }
|
||||
<a href=#293 id=293 data-nosnippet>293</a>
|
||||
<a href=#294 id=294 data-nosnippet>294</a> <span class="doccomment">/// Creates a new [`PkarrPublisher`] with a custom TTL and republish intervals.
|
||||
<a href=#295 id=295 data-nosnippet>295</a> ///
|
||||
<a href=#296 id=296 data-nosnippet>296</a> /// This allows creating the publisher with custom time-to-live values of the
|
||||
<a href=#297 id=297 data-nosnippet>297</a> /// [`SignedPacket`]s as well as a custom republish interval.
|
||||
<a href=#298 id=298 data-nosnippet>298</a> </span><span class="kw">fn </span>new(
|
||||
<a href=#299 id=299 data-nosnippet>299</a> secret_key: SecretKey,
|
||||
<a href=#300 id=300 data-nosnippet>300</a> pkarr_relay: Url,
|
||||
<a href=#301 id=301 data-nosnippet>301</a> ttl: u32,
|
||||
<a href=#302 id=302 data-nosnippet>302</a> republish_interval: Duration,
|
||||
<a href=#303 id=303 data-nosnippet>303</a> <span class="attr">#[cfg(not(wasm_browser))] </span>dns_resolver: DnsResolver,
|
||||
<a href=#304 id=304 data-nosnippet>304</a> tls_config: rustls::ClientConfig,
|
||||
<a href=#305 id=305 data-nosnippet>305</a> addr_filter: AddrFilter,
|
||||
<a href=#306 id=306 data-nosnippet>306</a> ) -> <span class="self">Self </span>{
|
||||
<a href=#307 id=307 data-nosnippet>307</a> <span class="macro">debug!</span>(<span class="string">"creating pkarr publisher that publishes to {pkarr_relay}"</span>);
|
||||
<a href=#308 id=308 data-nosnippet>308</a> <span class="kw">let </span>endpoint_id = secret_key.public();
|
||||
<a href=#309 id=309 data-nosnippet>309</a>
|
||||
<a href=#310 id=310 data-nosnippet>310</a> <span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#311 id=311 data-nosnippet>311</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(pkarr_relay);
|
||||
<a href=#312 id=312 data-nosnippet>312</a>
|
||||
<a href=#313 id=313 data-nosnippet>313</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#314 id=314 data-nosnippet>314</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(pkarr_relay, tls_config, dns_resolver);
|
||||
<a href=#315 id=315 data-nosnippet>315</a>
|
||||
<a href=#316 id=316 data-nosnippet>316</a> <span class="kw">let </span>watchable = Watchable::default();
|
||||
<a href=#317 id=317 data-nosnippet>317</a> <span class="kw">let </span>service = PublisherService {
|
||||
<a href=#318 id=318 data-nosnippet>318</a> ttl,
|
||||
<a href=#319 id=319 data-nosnippet>319</a> watcher: watchable.watch(),
|
||||
<a href=#320 id=320 data-nosnippet>320</a> secret_key,
|
||||
<a href=#321 id=321 data-nosnippet>321</a> pkarr_client,
|
||||
<a href=#322 id=322 data-nosnippet>322</a> republish_interval,
|
||||
<a href=#323 id=323 data-nosnippet>323</a> };
|
||||
<a href=#324 id=324 data-nosnippet>324</a> <span class="kw">let </span>join_handle = task::spawn(service.run().instrument(<span class="macro">error_span!</span>(<span class="string">"pkarr_publish"</span>)));
|
||||
<a href=#325 id=325 data-nosnippet>325</a> <span class="self">Self </span>{
|
||||
<a href=#326 id=326 data-nosnippet>326</a> watchable,
|
||||
<a href=#327 id=327 data-nosnippet>327</a> endpoint_id,
|
||||
<a href=#328 id=328 data-nosnippet>328</a> addr_filter,
|
||||
<a href=#329 id=329 data-nosnippet>329</a> _drop_guard: Arc::new(AbortOnDropHandle::new(join_handle)),
|
||||
<a href=#330 id=330 data-nosnippet>330</a> }
|
||||
<a href=#331 id=331 data-nosnippet>331</a> }
|
||||
<a href=#332 id=332 data-nosnippet>332</a>
|
||||
<a href=#333 id=333 data-nosnippet>333</a> <span class="doccomment">/// Creates a pkarr publisher which uses the [number 0] pkarr relay server.
|
||||
<a href=#334 id=334 data-nosnippet>334</a> ///
|
||||
<a href=#335 id=335 data-nosnippet>335</a> /// This uses the pkarr relay server operated by [number 0], at
|
||||
<a href=#336 id=336 data-nosnippet>336</a> /// [`N0_DNS_PKARR_RELAY_PROD`].
|
||||
<a href=#337 id=337 data-nosnippet>337</a> ///
|
||||
<a href=#338 id=338 data-nosnippet>338</a> /// When running with the environment variable
|
||||
<a href=#339 id=339 data-nosnippet>339</a> /// `IROH_FORCE_STAGING_RELAYS` set to any non empty value [`N0_DNS_PKARR_RELAY_STAGING`]
|
||||
<a href=#340 id=340 data-nosnippet>340</a> /// server is used instead.
|
||||
<a href=#341 id=341 data-nosnippet>341</a> ///
|
||||
<a href=#342 id=342 data-nosnippet>342</a> /// [number 0]: https://n0.computer
|
||||
<a href=#343 id=343 data-nosnippet>343</a> </span><span class="kw">pub fn </span>n0_dns() -> PkarrPublisherBuilder {
|
||||
<a href=#344 id=344 data-nosnippet>344</a> PkarrPublisherBuilder::n0_dns()
|
||||
<a href=#345 id=345 data-nosnippet>345</a> }
|
||||
<a href=#346 id=346 data-nosnippet>346</a>
|
||||
<a href=#347 id=347 data-nosnippet>347</a> <span class="doccomment">/// Publishes the addressing information about this endpoint to a pkarr relay.
|
||||
<a href=#348 id=348 data-nosnippet>348</a> ///
|
||||
<a href=#349 id=349 data-nosnippet>349</a> /// This is a nonblocking function, the actual update is performed in the background.
|
||||
<a href=#350 id=350 data-nosnippet>350</a> </span><span class="kw">pub fn </span>update_endpoint_data(<span class="kw-2">&</span><span class="self">self</span>, data: <span class="kw-2">&</span>EndpointData) {
|
||||
<a href=#351 id=351 data-nosnippet>351</a> <span class="kw">let </span>data = data.apply_filter(<span class="kw-2">&</span><span class="self">self</span>.addr_filter).into_owned();
|
||||
<a href=#352 id=352 data-nosnippet>352</a> <span class="kw">let </span>info = EndpointInfo::from_parts(<span class="self">self</span>.endpoint_id, data);
|
||||
<a href=#353 id=353 data-nosnippet>353</a> <span class="self">self</span>.watchable.set(<span class="prelude-val">Some</span>(info)).ok();
|
||||
<a href=#354 id=354 data-nosnippet>354</a> }
|
||||
<a href=#355 id=355 data-nosnippet>355</a>}
|
||||
<a href=#356 id=356 data-nosnippet>356</a>
|
||||
<a href=#357 id=357 data-nosnippet>357</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>PkarrPublisher {
|
||||
<a href=#358 id=358 data-nosnippet>358</a> <span class="kw">fn </span>publish(<span class="kw-2">&</span><span class="self">self</span>, data: <span class="kw-2">&</span>EndpointData) {
|
||||
<a href=#359 id=359 data-nosnippet>359</a> <span class="self">self</span>.update_endpoint_data(data);
|
||||
<a href=#360 id=360 data-nosnippet>360</a> }
|
||||
<a href=#361 id=361 data-nosnippet>361</a>}
|
||||
<a href=#362 id=362 data-nosnippet>362</a>
|
||||
<a href=#363 id=363 data-nosnippet>363</a><span class="doccomment">/// Publish endpoint info to a pkarr relay.
|
||||
<a href=#364 id=364 data-nosnippet>364</a></span><span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
<a href=#365 id=365 data-nosnippet>365</a></span><span class="kw">struct </span>PublisherService {
|
||||
<a href=#366 id=366 data-nosnippet>366</a> <span class="attr">#[debug(<span class="string">"SecretKey"</span>)]
|
||||
<a href=#367 id=367 data-nosnippet>367</a> </span>secret_key: SecretKey,
|
||||
<a href=#368 id=368 data-nosnippet>368</a> <span class="attr">#[debug(<span class="string">"PkarrClient"</span>)]
|
||||
<a href=#369 id=369 data-nosnippet>369</a> </span>pkarr_client: PkarrRelayClient,
|
||||
<a href=#370 id=370 data-nosnippet>370</a> watcher: n0_watcher::Direct<<span class="prelude-ty">Option</span><EndpointInfo>>,
|
||||
<a href=#371 id=371 data-nosnippet>371</a> ttl: u32,
|
||||
<a href=#372 id=372 data-nosnippet>372</a> republish_interval: Duration,
|
||||
<a href=#373 id=373 data-nosnippet>373</a>}
|
||||
<a href=#374 id=374 data-nosnippet>374</a>
|
||||
<a href=#375 id=375 data-nosnippet>375</a><span class="kw">impl </span>PublisherService {
|
||||
<a href=#376 id=376 data-nosnippet>376</a> <span class="kw">async fn </span>run(<span class="kw-2">mut </span><span class="self">self</span>) {
|
||||
<a href=#377 id=377 data-nosnippet>377</a> <span class="kw">let </span><span class="kw-2">mut </span>failed_attempts = <span class="number">0</span>;
|
||||
<a href=#378 id=378 data-nosnippet>378</a> <span class="kw">let </span>republish = time::sleep(Duration::MAX);
|
||||
<a href=#379 id=379 data-nosnippet>379</a> <span class="macro">tokio::pin!</span>(republish);
|
||||
<a href=#380 id=380 data-nosnippet>380</a> <span class="kw">loop </span>{
|
||||
<a href=#381 id=381 data-nosnippet>381</a> <span class="kw">if </span>!<span class="self">self</span>.watcher.is_connected() {
|
||||
<a href=#382 id=382 data-nosnippet>382</a> <span class="kw">break</span>;
|
||||
<a href=#383 id=383 data-nosnippet>383</a> }
|
||||
<a href=#384 id=384 data-nosnippet>384</a> <span class="kw">if let </span><span class="prelude-val">Some</span>(info) = <span class="self">self</span>.watcher.get() {
|
||||
<a href=#385 id=385 data-nosnippet>385</a> <span class="kw">match </span><span class="self">self</span>.publish_current(info).<span class="kw">await </span>{
|
||||
<a href=#386 id=386 data-nosnippet>386</a> <span class="prelude-val">Err</span>(err) => {
|
||||
<a href=#387 id=387 data-nosnippet>387</a> failed_attempts += <span class="number">1</span>;
|
||||
<a href=#388 id=388 data-nosnippet>388</a> <span class="comment">// Retry after increasing timeout
|
||||
<a href=#389 id=389 data-nosnippet>389</a> </span><span class="kw">let </span>retry_after = Duration::from_secs(failed_attempts);
|
||||
<a href=#390 id=390 data-nosnippet>390</a> republish.as_mut().reset(Instant::now() + retry_after);
|
||||
<a href=#391 id=391 data-nosnippet>391</a> <span class="macro">warn!</span>(
|
||||
<a href=#392 id=392 data-nosnippet>392</a> err = %<span class="macro">format!</span>(<span class="string">"{err:#}"</span>),
|
||||
<a href=#393 id=393 data-nosnippet>393</a> url = %<span class="self">self</span>.pkarr_client.pkarr_relay_url ,
|
||||
<a href=#394 id=394 data-nosnippet>394</a> <span class="question-mark">?</span>retry_after,
|
||||
<a href=#395 id=395 data-nosnippet>395</a> %failed_attempts,
|
||||
<a href=#396 id=396 data-nosnippet>396</a> <span class="string">"Failed to publish to pkarr"</span>,
|
||||
<a href=#397 id=397 data-nosnippet>397</a> );
|
||||
<a href=#398 id=398 data-nosnippet>398</a> }
|
||||
<a href=#399 id=399 data-nosnippet>399</a> <span class="prelude-val">Ok</span>(()) => {
|
||||
<a href=#400 id=400 data-nosnippet>400</a> failed_attempts = <span class="number">0</span>;
|
||||
<a href=#401 id=401 data-nosnippet>401</a> <span class="comment">// Republish after fixed interval
|
||||
<a href=#402 id=402 data-nosnippet>402</a> </span>republish
|
||||
<a href=#403 id=403 data-nosnippet>403</a> .as_mut()
|
||||
<a href=#404 id=404 data-nosnippet>404</a> .reset(Instant::now() + <span class="self">self</span>.republish_interval);
|
||||
<a href=#405 id=405 data-nosnippet>405</a> }
|
||||
<a href=#406 id=406 data-nosnippet>406</a> }
|
||||
<a href=#407 id=407 data-nosnippet>407</a> }
|
||||
<a href=#408 id=408 data-nosnippet>408</a> <span class="comment">// Wait until either the retry/republish timeout is reached, or the endpoint info changed.
|
||||
<a href=#409 id=409 data-nosnippet>409</a> </span><span class="macro">tokio::select!</span> {
|
||||
<a href=#410 id=410 data-nosnippet>410</a> res = <span class="self">self</span>.watcher.updated() => <span class="kw">match </span>res {
|
||||
<a href=#411 id=411 data-nosnippet>411</a> <span class="prelude-val">Ok</span>(<span class="kw">_</span>) => <span class="macro">debug!</span>(<span class="string">"Publish endpoint info to pkarr (info changed)"</span>),
|
||||
<a href=#412 id=412 data-nosnippet>412</a> <span class="prelude-val">Err</span>(Disconnected { .. }) => <span class="kw">break</span>,
|
||||
<a href=#413 id=413 data-nosnippet>413</a> },
|
||||
<a href=#414 id=414 data-nosnippet>414</a> <span class="kw">_ </span>= <span class="kw-2">&mut </span>republish => <span class="macro">debug!</span>(<span class="string">"Publish endpoint info to pkarr (interval elapsed)"</span>),
|
||||
<a href=#415 id=415 data-nosnippet>415</a> }
|
||||
<a href=#416 id=416 data-nosnippet>416</a> }
|
||||
<a href=#417 id=417 data-nosnippet>417</a> }
|
||||
<a href=#418 id=418 data-nosnippet>418</a>
|
||||
<a href=#419 id=419 data-nosnippet>419</a> <span class="kw">async fn </span>publish_current(<span class="kw-2">&</span><span class="self">self</span>, info: EndpointInfo) -> <span class="prelude-ty">Result</span><(), PkarrError> {
|
||||
<a href=#420 id=420 data-nosnippet>420</a> <span class="macro">debug!</span>(
|
||||
<a href=#421 id=421 data-nosnippet>421</a> data = <span class="question-mark">?</span>info.data,
|
||||
<a href=#422 id=422 data-nosnippet>422</a> pkarr_relay = %<span class="self">self</span>.pkarr_client.pkarr_relay_url,
|
||||
<a href=#423 id=423 data-nosnippet>423</a> <span class="string">"Publishing endpoint info to pkarr"
|
||||
<a href=#424 id=424 data-nosnippet>424</a> </span>);
|
||||
<a href=#425 id=425 data-nosnippet>425</a> <span class="kw">let </span>signed_packet = info
|
||||
<a href=#426 id=426 data-nosnippet>426</a> .to_pkarr_signed_packet(<span class="kw-2">&</span><span class="self">self</span>.secret_key, <span class="self">self</span>.ttl)
|
||||
<a href=#427 id=427 data-nosnippet>427</a> .map_err(|err| <span class="macro">e!</span>(PkarrError::Encoding, err))<span class="question-mark">?</span>;
|
||||
<a href=#428 id=428 data-nosnippet>428</a> <span class="self">self</span>.pkarr_client.publish(<span class="kw-2">&</span>signed_packet).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<a href=#429 id=429 data-nosnippet>429</a> <span class="macro">trace!</span>(
|
||||
<a href=#430 id=430 data-nosnippet>430</a> data = <span class="question-mark">?</span>info.data,
|
||||
<a href=#431 id=431 data-nosnippet>431</a> pkarr_relay = %<span class="self">self</span>.pkarr_client.pkarr_relay_url,
|
||||
<a href=#432 id=432 data-nosnippet>432</a> <span class="string">"Published endpoint info to pkarr"
|
||||
<a href=#433 id=433 data-nosnippet>433</a> </span>);
|
||||
<a href=#434 id=434 data-nosnippet>434</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#435 id=435 data-nosnippet>435</a> }
|
||||
<a href=#436 id=436 data-nosnippet>436</a>}
|
||||
<a href=#437 id=437 data-nosnippet>437</a>
|
||||
<a href=#438 id=438 data-nosnippet>438</a><span class="doccomment">/// Builder for [`PkarrResolver`].
|
||||
<a href=#439 id=439 data-nosnippet>439</a>///
|
||||
<a href=#440 id=440 data-nosnippet>440</a>/// See [`PkarrResolver::builder`].
|
||||
<a href=#441 id=441 data-nosnippet>441</a></span><span class="attr">#[derive(Debug)]
|
||||
<a href=#442 id=442 data-nosnippet>442</a></span><span class="kw">pub struct </span>PkarrResolverBuilder {
|
||||
<a href=#443 id=443 data-nosnippet>443</a> pkarr_relay: Url,
|
||||
<a href=#444 id=444 data-nosnippet>444</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#445 id=445 data-nosnippet>445</a> </span>dns_resolver: <span class="prelude-ty">Option</span><DnsResolver>,
|
||||
<a href=#446 id=446 data-nosnippet>446</a>}
|
||||
<a href=#447 id=447 data-nosnippet>447</a>
|
||||
<a href=#448 id=448 data-nosnippet>448</a><span class="kw">impl </span>PkarrResolverBuilder {
|
||||
<a href=#449 id=449 data-nosnippet>449</a> <span class="doccomment">/// Sets the DNS resolver to use for resolving the pkarr relay URL.
|
||||
<a href=#450 id=450 data-nosnippet>450</a> </span><span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#451 id=451 data-nosnippet>451</a> </span><span class="kw">pub fn </span>dns_resolver(<span class="kw-2">mut </span><span class="self">self</span>, dns_resolver: DnsResolver) -> <span class="self">Self </span>{
|
||||
<a href=#452 id=452 data-nosnippet>452</a> <span class="self">self</span>.dns_resolver = <span class="prelude-val">Some</span>(dns_resolver);
|
||||
<a href=#453 id=453 data-nosnippet>453</a> <span class="self">self
|
||||
<a href=#454 id=454 data-nosnippet>454</a> </span>}
|
||||
<a href=#455 id=455 data-nosnippet>455</a>
|
||||
<a href=#456 id=456 data-nosnippet>456</a> <span class="doccomment">/// Creates a [`PkarrResolver`] from this builder.
|
||||
<a href=#457 id=457 data-nosnippet>457</a> </span><span class="kw">pub fn </span>build(<span class="self">self</span>, tls_config: rustls::ClientConfig) -> PkarrResolver {
|
||||
<a href=#458 id=458 data-nosnippet>458</a> <span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#459 id=459 data-nosnippet>459</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(<span class="self">self</span>.pkarr_relay);
|
||||
<a href=#460 id=460 data-nosnippet>460</a>
|
||||
<a href=#461 id=461 data-nosnippet>461</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#462 id=462 data-nosnippet>462</a> </span><span class="kw">let </span>pkarr_client = PkarrRelayClient::new(
|
||||
<a href=#463 id=463 data-nosnippet>463</a> <span class="self">self</span>.pkarr_relay,
|
||||
<a href=#464 id=464 data-nosnippet>464</a> tls_config,
|
||||
<a href=#465 id=465 data-nosnippet>465</a> <span class="self">self</span>.dns_resolver.unwrap_or_default(),
|
||||
<a href=#466 id=466 data-nosnippet>466</a> );
|
||||
<a href=#467 id=467 data-nosnippet>467</a>
|
||||
<a href=#468 id=468 data-nosnippet>468</a> PkarrResolver { pkarr_client }
|
||||
<a href=#469 id=469 data-nosnippet>469</a> }
|
||||
<a href=#470 id=470 data-nosnippet>470</a>}
|
||||
<a href=#471 id=471 data-nosnippet>471</a>
|
||||
<a href=#472 id=472 data-nosnippet>472</a><span class="kw">impl </span>AddressLookupBuilder <span class="kw">for </span>PkarrResolverBuilder {
|
||||
<a href=#473 id=473 data-nosnippet>473</a> <span class="kw">fn </span>into_address_lookup(
|
||||
<a href=#474 id=474 data-nosnippet>474</a> <span class="kw-2">mut </span><span class="self">self</span>,
|
||||
<a href=#475 id=475 data-nosnippet>475</a> endpoint: <span class="kw-2">&</span>Endpoint,
|
||||
<a href=#476 id=476 data-nosnippet>476</a> ) -> <span class="prelude-ty">Result</span><<span class="kw">impl </span>AddressLookup, AddressLookupBuilderError> {
|
||||
<a href=#477 id=477 data-nosnippet>477</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#478 id=478 data-nosnippet>478</a> </span><span class="kw">if </span><span class="self">self</span>.dns_resolver.is_none() {
|
||||
<a href=#479 id=479 data-nosnippet>479</a> <span class="self">self</span>.dns_resolver = <span class="prelude-val">Some</span>(endpoint.dns_resolver()<span class="question-mark">?</span>.clone());
|
||||
<a href=#480 id=480 data-nosnippet>480</a> }
|
||||
<a href=#481 id=481 data-nosnippet>481</a> <span class="kw">let </span>tls_config = endpoint.tls_config().clone();
|
||||
<a href=#482 id=482 data-nosnippet>482</a> <span class="prelude-val">Ok</span>(<span class="self">self</span>.build(tls_config))
|
||||
<a href=#483 id=483 data-nosnippet>483</a> }
|
||||
<a href=#484 id=484 data-nosnippet>484</a>}
|
||||
<a href=#485 id=485 data-nosnippet>485</a>
|
||||
<a href=#486 id=486 data-nosnippet>486</a><span class="doccomment">/// Resolver of address lookup information from a [pkarr] relay.
|
||||
<a href=#487 id=487 data-nosnippet>487</a>///
|
||||
<a href=#488 id=488 data-nosnippet>488</a>/// The resolver uses HTTP to query address lookup information from a pkarr relay server,
|
||||
<a href=#489 id=489 data-nosnippet>489</a>/// see the [module docs] for details.
|
||||
<a href=#490 id=490 data-nosnippet>490</a>///
|
||||
<a href=#491 id=491 data-nosnippet>491</a>/// This implements the [`AddressLookup`] trait to be used as an address lookup service. Note
|
||||
<a href=#492 id=492 data-nosnippet>492</a>/// that it only resolves address lookup information, for the corresponding publisher use
|
||||
<a href=#493 id=493 data-nosnippet>493</a>/// the [`PkarrPublisher`] together with [`AddressLookupServices`].
|
||||
<a href=#494 id=494 data-nosnippet>494</a>///
|
||||
<a href=#495 id=495 data-nosnippet>495</a>/// [pkarr]: https://pkarr.org
|
||||
<a href=#496 id=496 data-nosnippet>496</a>/// [module docs]: crate::address_lookup::pkarr
|
||||
<a href=#497 id=497 data-nosnippet>497</a>/// [`AddressLookupServices`]: super::AddressLookupServices
|
||||
<a href=#498 id=498 data-nosnippet>498</a></span><span class="attr">#[derive(derive_more::Debug, Clone)]
|
||||
<a href=#499 id=499 data-nosnippet>499</a></span><span class="kw">pub struct </span>PkarrResolver {
|
||||
<a href=#500 id=500 data-nosnippet>500</a> pkarr_client: PkarrRelayClient,
|
||||
<a href=#501 id=501 data-nosnippet>501</a>}
|
||||
<a href=#502 id=502 data-nosnippet>502</a>
|
||||
<a href=#503 id=503 data-nosnippet>503</a><span class="kw">impl </span>PkarrResolver {
|
||||
<a href=#504 id=504 data-nosnippet>504</a> <span class="doccomment">/// Creates a new resolver builder using the pkarr relay server at the URL.
|
||||
<a href=#505 id=505 data-nosnippet>505</a> ///
|
||||
<a href=#506 id=506 data-nosnippet>506</a> /// The builder implements [`AddressLookupBuilder`].
|
||||
<a href=#507 id=507 data-nosnippet>507</a> </span><span class="kw">pub fn </span>builder(pkarr_relay: Url) -> PkarrResolverBuilder {
|
||||
<a href=#508 id=508 data-nosnippet>508</a> PkarrResolverBuilder {
|
||||
<a href=#509 id=509 data-nosnippet>509</a> pkarr_relay,
|
||||
<a href=#510 id=510 data-nosnippet>510</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#511 id=511 data-nosnippet>511</a> </span>dns_resolver: <span class="prelude-val">None</span>,
|
||||
<a href=#512 id=512 data-nosnippet>512</a> }
|
||||
<a href=#513 id=513 data-nosnippet>513</a> }
|
||||
<a href=#514 id=514 data-nosnippet>514</a>
|
||||
<a href=#515 id=515 data-nosnippet>515</a> <span class="doccomment">/// Creates a pkarr resolver builder which uses the [number 0] pkarr relay server.
|
||||
<a href=#516 id=516 data-nosnippet>516</a> ///
|
||||
<a href=#517 id=517 data-nosnippet>517</a> /// This uses the pkarr relay server operated by [number 0] at
|
||||
<a href=#518 id=518 data-nosnippet>518</a> /// [`N0_DNS_PKARR_RELAY_PROD`].
|
||||
<a href=#519 id=519 data-nosnippet>519</a> ///
|
||||
<a href=#520 id=520 data-nosnippet>520</a> /// When running with the environment variable `IROH_FORCE_STAGING_RELAYS`
|
||||
<a href=#521 id=521 data-nosnippet>521</a> /// set to any non empty value [`N0_DNS_PKARR_RELAY_STAGING`]
|
||||
<a href=#522 id=522 data-nosnippet>522</a> /// server is used instead.
|
||||
<a href=#523 id=523 data-nosnippet>523</a> ///
|
||||
<a href=#524 id=524 data-nosnippet>524</a> /// [number 0]: https://n0.computer
|
||||
<a href=#525 id=525 data-nosnippet>525</a> </span><span class="kw">pub fn </span>n0_dns() -> PkarrResolverBuilder {
|
||||
<a href=#526 id=526 data-nosnippet>526</a> <span class="kw">let </span>pkarr_relay = <span class="kw">match </span>force_staging_infra() {
|
||||
<a href=#527 id=527 data-nosnippet>527</a> <span class="bool-val">true </span>=> N0_DNS_PKARR_RELAY_STAGING,
|
||||
<a href=#528 id=528 data-nosnippet>528</a> <span class="bool-val">false </span>=> N0_DNS_PKARR_RELAY_PROD,
|
||||
<a href=#529 id=529 data-nosnippet>529</a> };
|
||||
<a href=#530 id=530 data-nosnippet>530</a>
|
||||
<a href=#531 id=531 data-nosnippet>531</a> <span class="kw">let </span>pkarr_relay: Url = pkarr_relay.parse().expect(<span class="string">"url is valid"</span>);
|
||||
<a href=#532 id=532 data-nosnippet>532</a> <span class="self">Self</span>::builder(pkarr_relay)
|
||||
<a href=#533 id=533 data-nosnippet>533</a> }
|
||||
<a href=#534 id=534 data-nosnippet>534</a>}
|
||||
<a href=#535 id=535 data-nosnippet>535</a>
|
||||
<a href=#536 id=536 data-nosnippet>536</a><span class="kw">impl </span>AddressLookup <span class="kw">for </span>PkarrResolver {
|
||||
<a href=#537 id=537 data-nosnippet>537</a> <span class="kw">fn </span>resolve(
|
||||
<a href=#538 id=538 data-nosnippet>538</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#539 id=539 data-nosnippet>539</a> endpoint_id: EndpointId,
|
||||
<a href=#540 id=540 data-nosnippet>540</a> ) -> <span class="prelude-ty">Option</span><BoxStream<<span class="prelude-ty">Result</span><AddressLookupItem, AddressLookupError>>> {
|
||||
<a href=#541 id=541 data-nosnippet>541</a> <span class="kw">let </span>pkarr_client = <span class="self">self</span>.pkarr_client.clone();
|
||||
<a href=#542 id=542 data-nosnippet>542</a> <span class="kw">let </span>fut = <span class="kw">async move </span>{
|
||||
<a href=#543 id=543 data-nosnippet>543</a> <span class="kw">let </span>signed_packet = pkarr_client.resolve(endpoint_id).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<a href=#544 id=544 data-nosnippet>544</a> <span class="kw">let </span>info = EndpointInfo::from_pkarr_signed_packet(<span class="kw-2">&</span>signed_packet)
|
||||
<a href=#545 id=545 data-nosnippet>545</a> .map_err(|err| AddressLookupError::from_err_any(<span class="string">"pkarr"</span>, err))<span class="question-mark">?</span>;
|
||||
<a href=#546 id=546 data-nosnippet>546</a> <span class="kw">let </span>item = AddressLookupItem::new(info, <span class="string">"pkarr"</span>, <span class="prelude-val">None</span>);
|
||||
<a href=#547 id=547 data-nosnippet>547</a> <span class="prelude-val">Ok</span>(item)
|
||||
<a href=#548 id=548 data-nosnippet>548</a> };
|
||||
<a href=#549 id=549 data-nosnippet>549</a> <span class="kw">let </span>stream = n0_future::stream::once_future(fut);
|
||||
<a href=#550 id=550 data-nosnippet>550</a> <span class="prelude-val">Some</span>(Box::pin(stream))
|
||||
<a href=#551 id=551 data-nosnippet>551</a> }
|
||||
<a href=#552 id=552 data-nosnippet>552</a>}
|
||||
<a href=#553 id=553 data-nosnippet>553</a>
|
||||
<a href=#554 id=554 data-nosnippet>554</a><span class="doccomment">/// A [pkarr](https://pkarr.org) client to publish [`SignedPacket`]s to a pkarr relay.
|
||||
<a href=#555 id=555 data-nosnippet>555</a>///
|
||||
<a href=#556 id=556 data-nosnippet>556</a>/// [pkarr]: https://pkarr.org
|
||||
<a href=#557 id=557 data-nosnippet>557</a></span><span class="attr">#[derive(Debug, Clone)]
|
||||
<a href=#558 id=558 data-nosnippet>558</a></span><span class="kw">pub struct </span>PkarrRelayClient {
|
||||
<a href=#559 id=559 data-nosnippet>559</a> http_client: reqwest::Client,
|
||||
<a href=#560 id=560 data-nosnippet>560</a> pkarr_relay_url: Url,
|
||||
<a href=#561 id=561 data-nosnippet>561</a>}
|
||||
<a href=#562 id=562 data-nosnippet>562</a>
|
||||
<a href=#563 id=563 data-nosnippet>563</a><span class="doccomment">/// A builder for the [`PkarrRelayClient`]
|
||||
<a href=#564 id=564 data-nosnippet>564</a></span><span class="attr">#[derive(Debug, Clone)]
|
||||
<a href=#565 id=565 data-nosnippet>565</a></span><span class="kw">pub struct </span>PkarrRelayClientBuilder {
|
||||
<a href=#566 id=566 data-nosnippet>566</a> pkarr_relay_url: Url,
|
||||
<a href=#567 id=567 data-nosnippet>567</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#568 id=568 data-nosnippet>568</a> </span>tls_config: rustls::ClientConfig,
|
||||
<a href=#569 id=569 data-nosnippet>569</a>}
|
||||
<a href=#570 id=570 data-nosnippet>570</a>
|
||||
<a href=#571 id=571 data-nosnippet>571</a><span class="kw">impl </span>PkarrRelayClientBuilder {
|
||||
<a href=#572 id=572 data-nosnippet>572</a> <span class="doccomment">/// Build a [`PkarrRelayClient`].
|
||||
<a href=#573 id=573 data-nosnippet>573</a> </span><span class="kw">pub fn </span>build(<span class="self">self</span>) -> PkarrRelayClient {
|
||||
<a href=#574 id=574 data-nosnippet>574</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#575 id=575 data-nosnippet>575</a> </span><span class="kw">let </span>builder = reqwest_client_builder(<span class="self">self</span>.tls_config, <span class="self">self</span>.dns_resolver);
|
||||
<a href=#576 id=576 data-nosnippet>576</a>
|
||||
<a href=#577 id=577 data-nosnippet>577</a> <span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#578 id=578 data-nosnippet>578</a> </span><span class="kw">let </span>builder = reqwest_client_builder();
|
||||
<a href=#579 id=579 data-nosnippet>579</a>
|
||||
<a href=#580 id=580 data-nosnippet>580</a> <span class="kw">let </span>http_client = builder.build().expect(<span class="string">"failed to create reqwest client"</span>);
|
||||
<a href=#581 id=581 data-nosnippet>581</a> PkarrRelayClient {
|
||||
<a href=#582 id=582 data-nosnippet>582</a> http_client,
|
||||
<a href=#583 id=583 data-nosnippet>583</a> pkarr_relay_url: <span class="self">self</span>.pkarr_relay_url,
|
||||
<a href=#584 id=584 data-nosnippet>584</a> }
|
||||
<a href=#585 id=585 data-nosnippet>585</a> }
|
||||
<a href=#586 id=586 data-nosnippet>586</a>}
|
||||
<a href=#587 id=587 data-nosnippet>587</a>
|
||||
<a href=#588 id=588 data-nosnippet>588</a><span class="kw">impl </span>PkarrRelayClient {
|
||||
<a href=#589 id=589 data-nosnippet>589</a> <span class="doccomment">/// Creates a [`PkarrRelayClient`].
|
||||
<a href=#590 id=590 data-nosnippet>590</a> </span><span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#591 id=591 data-nosnippet>591</a> </span><span class="kw">pub fn </span>new(
|
||||
<a href=#592 id=592 data-nosnippet>592</a> pkarr_relay_url: Url,
|
||||
<a href=#593 id=593 data-nosnippet>593</a> tls_config: rustls::ClientConfig,
|
||||
<a href=#594 id=594 data-nosnippet>594</a> dns_resolver: DnsResolver,
|
||||
<a href=#595 id=595 data-nosnippet>595</a> ) -> <span class="self">Self </span>{
|
||||
<a href=#596 id=596 data-nosnippet>596</a> <span class="kw">let </span>http_client = reqwest_client_builder(tls_config, dns_resolver)
|
||||
<a href=#597 id=597 data-nosnippet>597</a> .build()
|
||||
<a href=#598 id=598 data-nosnippet>598</a> .expect(<span class="string">"failed to create reqwest client"</span>);
|
||||
<a href=#599 id=599 data-nosnippet>599</a> <span class="self">Self </span>{
|
||||
<a href=#600 id=600 data-nosnippet>600</a> http_client,
|
||||
<a href=#601 id=601 data-nosnippet>601</a> pkarr_relay_url,
|
||||
<a href=#602 id=602 data-nosnippet>602</a> }
|
||||
<a href=#603 id=603 data-nosnippet>603</a> }
|
||||
<a href=#604 id=604 data-nosnippet>604</a>
|
||||
<a href=#605 id=605 data-nosnippet>605</a> <span class="doccomment">/// Creates a [`PkarrRelayClient`].
|
||||
<a href=#606 id=606 data-nosnippet>606</a> </span><span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#607 id=607 data-nosnippet>607</a> </span><span class="kw">pub fn </span>new(pkarr_relay_url: Url) -> <span class="self">Self </span>{
|
||||
<a href=#608 id=608 data-nosnippet>608</a> <span class="kw">let </span>http_client = reqwest_client_builder()
|
||||
<a href=#609 id=609 data-nosnippet>609</a> .build()
|
||||
<a href=#610 id=610 data-nosnippet>610</a> .expect(<span class="string">"failed to create reqwest client"</span>);
|
||||
<a href=#611 id=611 data-nosnippet>611</a> <span class="self">Self </span>{
|
||||
<a href=#612 id=612 data-nosnippet>612</a> http_client,
|
||||
<a href=#613 id=613 data-nosnippet>613</a> pkarr_relay_url,
|
||||
<a href=#614 id=614 data-nosnippet>614</a> }
|
||||
<a href=#615 id=615 data-nosnippet>615</a> }
|
||||
<a href=#616 id=616 data-nosnippet>616</a>
|
||||
<a href=#617 id=617 data-nosnippet>617</a> <span class="doccomment">/// Resolves a [`SignedPacket`] for the given [`EndpointId`].
|
||||
<a href=#618 id=618 data-nosnippet>618</a> </span><span class="kw">pub async fn </span>resolve(
|
||||
<a href=#619 id=619 data-nosnippet>619</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#620 id=620 data-nosnippet>620</a> endpoint_id: EndpointId,
|
||||
<a href=#621 id=621 data-nosnippet>621</a> ) -> <span class="prelude-ty">Result</span><SignedPacket, AddressLookupError> {
|
||||
<a href=#622 id=622 data-nosnippet>622</a> <span class="kw">let </span><span class="kw-2">mut </span>url = <span class="self">self</span>.pkarr_relay_url.clone();
|
||||
<a href=#623 id=623 data-nosnippet>623</a> url.path_segments_mut()
|
||||
<a href=#624 id=624 data-nosnippet>624</a> .map_err(|<span class="kw">_</span>| {
|
||||
<a href=#625 id=625 data-nosnippet>625</a> <span class="macro">e!</span>(PkarrError::InvalidRelayUrl {
|
||||
<a href=#626 id=626 data-nosnippet>626</a> url: <span class="self">self</span>.pkarr_relay_url.clone().into()
|
||||
<a href=#627 id=627 data-nosnippet>627</a> })
|
||||
<a href=#628 id=628 data-nosnippet>628</a> })<span class="question-mark">?
|
||||
<a href=#629 id=629 data-nosnippet>629</a> </span>.push(<span class="kw-2">&</span>endpoint_id.to_z32());
|
||||
<a href=#630 id=630 data-nosnippet>630</a>
|
||||
<a href=#631 id=631 data-nosnippet>631</a> <span class="kw">let </span>response = <span class="self">self
|
||||
<a href=#632 id=632 data-nosnippet>632</a> </span>.http_client
|
||||
<a href=#633 id=633 data-nosnippet>633</a> .get(url)
|
||||
<a href=#634 id=634 data-nosnippet>634</a> .send()
|
||||
<a href=#635 id=635 data-nosnippet>635</a> .<span class="kw">await
|
||||
<a href=#636 id=636 data-nosnippet>636</a> </span>.map_err(|err| <span class="macro">e!</span>(PkarrError::HttpSend, <span class="macro">anyerr!</span>(err)))<span class="question-mark">?</span>;
|
||||
<a href=#637 id=637 data-nosnippet>637</a>
|
||||
<a href=#638 id=638 data-nosnippet>638</a> <span class="kw">if </span>!response.status().is_success() {
|
||||
<a href=#639 id=639 data-nosnippet>639</a> <span class="kw">return </span><span class="prelude-val">Err</span>(<span class="macro">e!</span>(PkarrError::HttpRequest {
|
||||
<a href=#640 id=640 data-nosnippet>640</a> status: response.status()
|
||||
<a href=#641 id=641 data-nosnippet>641</a> })
|
||||
<a href=#642 id=642 data-nosnippet>642</a> .into());
|
||||
<a href=#643 id=643 data-nosnippet>643</a> }
|
||||
<a href=#644 id=644 data-nosnippet>644</a>
|
||||
<a href=#645 id=645 data-nosnippet>645</a> <span class="kw">let </span>payload = response
|
||||
<a href=#646 id=646 data-nosnippet>646</a> .bytes()
|
||||
<a href=#647 id=647 data-nosnippet>647</a> .<span class="kw">await
|
||||
<a href=#648 id=648 data-nosnippet>648</a> </span>.map_err(|err| <span class="macro">e!</span>(PkarrError::HttpPayload, <span class="macro">anyerr!</span>(err)))<span class="question-mark">?</span>;
|
||||
<a href=#649 id=649 data-nosnippet>649</a> <span class="kw">let </span>packet = SignedPacket::from_relay_payload(<span class="kw-2">&</span>endpoint_id, <span class="kw-2">&</span>payload)
|
||||
<a href=#650 id=650 data-nosnippet>650</a> .map_err(|err| <span class="macro">e!</span>(PkarrError::Verify, err))<span class="question-mark">?</span>;
|
||||
<a href=#651 id=651 data-nosnippet>651</a> <span class="prelude-val">Ok</span>(packet)
|
||||
<a href=#652 id=652 data-nosnippet>652</a> }
|
||||
<a href=#653 id=653 data-nosnippet>653</a>
|
||||
<a href=#654 id=654 data-nosnippet>654</a> <span class="doccomment">/// Publishes a [`SignedPacket`].
|
||||
<a href=#655 id=655 data-nosnippet>655</a> </span><span class="kw">pub async fn </span>publish(<span class="kw-2">&</span><span class="self">self</span>, signed_packet: <span class="kw-2">&</span>SignedPacket) -> <span class="prelude-ty">Result</span><(), PkarrError> {
|
||||
<a href=#656 id=656 data-nosnippet>656</a> <span class="kw">let </span><span class="kw-2">mut </span>url = <span class="self">self</span>.pkarr_relay_url.clone();
|
||||
<a href=#657 id=657 data-nosnippet>657</a> url.path_segments_mut()
|
||||
<a href=#658 id=658 data-nosnippet>658</a> .map_err(|<span class="kw">_</span>| {
|
||||
<a href=#659 id=659 data-nosnippet>659</a> <span class="macro">e!</span>(PkarrError::InvalidRelayUrl {
|
||||
<a href=#660 id=660 data-nosnippet>660</a> url: <span class="self">self</span>.pkarr_relay_url.clone().into()
|
||||
<a href=#661 id=661 data-nosnippet>661</a> })
|
||||
<a href=#662 id=662 data-nosnippet>662</a> })<span class="question-mark">?
|
||||
<a href=#663 id=663 data-nosnippet>663</a> </span>.push(<span class="kw-2">&</span>signed_packet.public_key().to_z32());
|
||||
<a href=#664 id=664 data-nosnippet>664</a>
|
||||
<a href=#665 id=665 data-nosnippet>665</a> <span class="kw">let </span>response = <span class="self">self
|
||||
<a href=#666 id=666 data-nosnippet>666</a> </span>.http_client
|
||||
<a href=#667 id=667 data-nosnippet>667</a> .put(url)
|
||||
<a href=#668 id=668 data-nosnippet>668</a> .body(signed_packet.to_relay_payload())
|
||||
<a href=#669 id=669 data-nosnippet>669</a> .send()
|
||||
<a href=#670 id=670 data-nosnippet>670</a> .<span class="kw">await
|
||||
<a href=#671 id=671 data-nosnippet>671</a> </span>.map_err(|err| <span class="macro">e!</span>(PkarrError::HttpSend, <span class="macro">anyerr!</span>(err)))<span class="question-mark">?</span>;
|
||||
<a href=#672 id=672 data-nosnippet>672</a>
|
||||
<a href=#673 id=673 data-nosnippet>673</a> <span class="kw">if </span>!response.status().is_success() {
|
||||
<a href=#674 id=674 data-nosnippet>674</a> <span class="kw">return </span><span class="prelude-val">Err</span>(<span class="macro">e!</span>(PkarrError::HttpRequest {
|
||||
<a href=#675 id=675 data-nosnippet>675</a> status: response.status()
|
||||
<a href=#676 id=676 data-nosnippet>676</a> }));
|
||||
<a href=#677 id=677 data-nosnippet>677</a> }
|
||||
<a href=#678 id=678 data-nosnippet>678</a>
|
||||
<a href=#679 id=679 data-nosnippet>679</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#680 id=680 data-nosnippet>680</a> }
|
||||
<a href=#681 id=681 data-nosnippet>681</a>}</code></pre></div></section></main></body></html>
|
||||
<a href=#568 id=568 data-nosnippet>568</a> </span>dns_resolver: DnsResolver,
|
||||
<a href=#569 id=569 data-nosnippet>569</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#570 id=570 data-nosnippet>570</a> </span>tls_config: rustls::ClientConfig,
|
||||
<a href=#571 id=571 data-nosnippet>571</a>}
|
||||
<a href=#572 id=572 data-nosnippet>572</a>
|
||||
<a href=#573 id=573 data-nosnippet>573</a><span class="kw">impl </span>PkarrRelayClientBuilder {
|
||||
<a href=#574 id=574 data-nosnippet>574</a> <span class="doccomment">/// Build a [`PkarrRelayClient`].
|
||||
<a href=#575 id=575 data-nosnippet>575</a> </span><span class="kw">pub fn </span>build(<span class="self">self</span>) -> PkarrRelayClient {
|
||||
<a href=#576 id=576 data-nosnippet>576</a> <span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#577 id=577 data-nosnippet>577</a> </span><span class="kw">let </span>builder = reqwest_client_builder(<span class="self">self</span>.tls_config, <span class="self">self</span>.dns_resolver);
|
||||
<a href=#578 id=578 data-nosnippet>578</a>
|
||||
<a href=#579 id=579 data-nosnippet>579</a> <span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#580 id=580 data-nosnippet>580</a> </span><span class="kw">let </span>builder = reqwest_client_builder();
|
||||
<a href=#581 id=581 data-nosnippet>581</a>
|
||||
<a href=#582 id=582 data-nosnippet>582</a> <span class="kw">let </span>http_client = builder.build().expect(<span class="string">"failed to create reqwest client"</span>);
|
||||
<a href=#583 id=583 data-nosnippet>583</a> PkarrRelayClient {
|
||||
<a href=#584 id=584 data-nosnippet>584</a> http_client,
|
||||
<a href=#585 id=585 data-nosnippet>585</a> pkarr_relay_url: <span class="self">self</span>.pkarr_relay_url,
|
||||
<a href=#586 id=586 data-nosnippet>586</a> }
|
||||
<a href=#587 id=587 data-nosnippet>587</a> }
|
||||
<a href=#588 id=588 data-nosnippet>588</a>}
|
||||
<a href=#589 id=589 data-nosnippet>589</a>
|
||||
<a href=#590 id=590 data-nosnippet>590</a><span class="kw">impl </span>PkarrRelayClient {
|
||||
<a href=#591 id=591 data-nosnippet>591</a> <span class="doccomment">/// Creates a [`PkarrRelayClient`].
|
||||
<a href=#592 id=592 data-nosnippet>592</a> </span><span class="attr">#[cfg(not(wasm_browser))]
|
||||
<a href=#593 id=593 data-nosnippet>593</a> </span><span class="kw">pub fn </span>new(
|
||||
<a href=#594 id=594 data-nosnippet>594</a> pkarr_relay_url: Url,
|
||||
<a href=#595 id=595 data-nosnippet>595</a> tls_config: rustls::ClientConfig,
|
||||
<a href=#596 id=596 data-nosnippet>596</a> dns_resolver: DnsResolver,
|
||||
<a href=#597 id=597 data-nosnippet>597</a> ) -> <span class="self">Self </span>{
|
||||
<a href=#598 id=598 data-nosnippet>598</a> <span class="kw">let </span>http_client = reqwest_client_builder(tls_config, dns_resolver)
|
||||
<a href=#599 id=599 data-nosnippet>599</a> .build()
|
||||
<a href=#600 id=600 data-nosnippet>600</a> .expect(<span class="string">"failed to create reqwest client"</span>);
|
||||
<a href=#601 id=601 data-nosnippet>601</a> <span class="self">Self </span>{
|
||||
<a href=#602 id=602 data-nosnippet>602</a> http_client,
|
||||
<a href=#603 id=603 data-nosnippet>603</a> pkarr_relay_url,
|
||||
<a href=#604 id=604 data-nosnippet>604</a> }
|
||||
<a href=#605 id=605 data-nosnippet>605</a> }
|
||||
<a href=#606 id=606 data-nosnippet>606</a>
|
||||
<a href=#607 id=607 data-nosnippet>607</a> <span class="doccomment">/// Creates a [`PkarrRelayClient`].
|
||||
<a href=#608 id=608 data-nosnippet>608</a> </span><span class="attr">#[cfg(wasm_browser)]
|
||||
<a href=#609 id=609 data-nosnippet>609</a> </span><span class="kw">pub fn </span>new(pkarr_relay_url: Url) -> <span class="self">Self </span>{
|
||||
<a href=#610 id=610 data-nosnippet>610</a> <span class="kw">let </span>http_client = reqwest_client_builder()
|
||||
<a href=#611 id=611 data-nosnippet>611</a> .build()
|
||||
<a href=#612 id=612 data-nosnippet>612</a> .expect(<span class="string">"failed to create reqwest client"</span>);
|
||||
<a href=#613 id=613 data-nosnippet>613</a> <span class="self">Self </span>{
|
||||
<a href=#614 id=614 data-nosnippet>614</a> http_client,
|
||||
<a href=#615 id=615 data-nosnippet>615</a> pkarr_relay_url,
|
||||
<a href=#616 id=616 data-nosnippet>616</a> }
|
||||
<a href=#617 id=617 data-nosnippet>617</a> }
|
||||
<a href=#618 id=618 data-nosnippet>618</a>
|
||||
<a href=#619 id=619 data-nosnippet>619</a> <span class="doccomment">/// Resolves a [`SignedPacket`] for the given [`EndpointId`].
|
||||
<a href=#620 id=620 data-nosnippet>620</a> </span><span class="kw">pub async fn </span>resolve(
|
||||
<a href=#621 id=621 data-nosnippet>621</a> <span class="kw-2">&</span><span class="self">self</span>,
|
||||
<a href=#622 id=622 data-nosnippet>622</a> endpoint_id: EndpointId,
|
||||
<a href=#623 id=623 data-nosnippet>623</a> ) -> <span class="prelude-ty">Result</span><SignedPacket, AddressLookupError> {
|
||||
<a href=#624 id=624 data-nosnippet>624</a> <span class="kw">let </span><span class="kw-2">mut </span>url = <span class="self">self</span>.pkarr_relay_url.clone();
|
||||
<a href=#625 id=625 data-nosnippet>625</a> url.path_segments_mut()
|
||||
<a href=#626 id=626 data-nosnippet>626</a> .map_err(|<span class="kw">_</span>| {
|
||||
<a href=#627 id=627 data-nosnippet>627</a> <span class="macro">e!</span>(PkarrError::InvalidRelayUrl {
|
||||
<a href=#628 id=628 data-nosnippet>628</a> url: <span class="self">self</span>.pkarr_relay_url.clone().into()
|
||||
<a href=#629 id=629 data-nosnippet>629</a> })
|
||||
<a href=#630 id=630 data-nosnippet>630</a> })<span class="question-mark">?
|
||||
<a href=#631 id=631 data-nosnippet>631</a> </span>.push(<span class="kw-2">&</span>endpoint_id.to_z32());
|
||||
<a href=#632 id=632 data-nosnippet>632</a>
|
||||
<a href=#633 id=633 data-nosnippet>633</a> <span class="kw">let </span>response = <span class="self">self
|
||||
<a href=#634 id=634 data-nosnippet>634</a> </span>.http_client
|
||||
<a href=#635 id=635 data-nosnippet>635</a> .get(url)
|
||||
<a href=#636 id=636 data-nosnippet>636</a> .send()
|
||||
<a href=#637 id=637 data-nosnippet>637</a> .<span class="kw">await
|
||||
<a href=#638 id=638 data-nosnippet>638</a> </span>.map_err(|err| <span class="macro">e!</span>(PkarrError::HttpSend, <span class="macro">anyerr!</span>(err)))<span class="question-mark">?</span>;
|
||||
<a href=#639 id=639 data-nosnippet>639</a>
|
||||
<a href=#640 id=640 data-nosnippet>640</a> <span class="kw">if </span>!response.status().is_success() {
|
||||
<a href=#641 id=641 data-nosnippet>641</a> <span class="kw">return </span><span class="prelude-val">Err</span>(<span class="macro">e!</span>(PkarrError::HttpRequest {
|
||||
<a href=#642 id=642 data-nosnippet>642</a> status: response.status()
|
||||
<a href=#643 id=643 data-nosnippet>643</a> })
|
||||
<a href=#644 id=644 data-nosnippet>644</a> .into());
|
||||
<a href=#645 id=645 data-nosnippet>645</a> }
|
||||
<a href=#646 id=646 data-nosnippet>646</a>
|
||||
<a href=#647 id=647 data-nosnippet>647</a> <span class="kw">let </span>payload = response
|
||||
<a href=#648 id=648 data-nosnippet>648</a> .bytes()
|
||||
<a href=#649 id=649 data-nosnippet>649</a> .<span class="kw">await
|
||||
<a href=#650 id=650 data-nosnippet>650</a> </span>.map_err(|err| <span class="macro">e!</span>(PkarrError::HttpPayload, <span class="macro">anyerr!</span>(err)))<span class="question-mark">?</span>;
|
||||
<a href=#651 id=651 data-nosnippet>651</a> <span class="kw">let </span>packet = SignedPacket::from_relay_payload(<span class="kw-2">&</span>endpoint_id, <span class="kw-2">&</span>payload)
|
||||
<a href=#652 id=652 data-nosnippet>652</a> .map_err(|err| <span class="macro">e!</span>(PkarrError::Verify, err))<span class="question-mark">?</span>;
|
||||
<a href=#653 id=653 data-nosnippet>653</a> <span class="prelude-val">Ok</span>(packet)
|
||||
<a href=#654 id=654 data-nosnippet>654</a> }
|
||||
<a href=#655 id=655 data-nosnippet>655</a>
|
||||
<a href=#656 id=656 data-nosnippet>656</a> <span class="doccomment">/// Publishes a [`SignedPacket`].
|
||||
<a href=#657 id=657 data-nosnippet>657</a> </span><span class="kw">pub async fn </span>publish(<span class="kw-2">&</span><span class="self">self</span>, signed_packet: <span class="kw-2">&</span>SignedPacket) -> <span class="prelude-ty">Result</span><(), PkarrError> {
|
||||
<a href=#658 id=658 data-nosnippet>658</a> <span class="kw">let </span><span class="kw-2">mut </span>url = <span class="self">self</span>.pkarr_relay_url.clone();
|
||||
<a href=#659 id=659 data-nosnippet>659</a> url.path_segments_mut()
|
||||
<a href=#660 id=660 data-nosnippet>660</a> .map_err(|<span class="kw">_</span>| {
|
||||
<a href=#661 id=661 data-nosnippet>661</a> <span class="macro">e!</span>(PkarrError::InvalidRelayUrl {
|
||||
<a href=#662 id=662 data-nosnippet>662</a> url: <span class="self">self</span>.pkarr_relay_url.clone().into()
|
||||
<a href=#663 id=663 data-nosnippet>663</a> })
|
||||
<a href=#664 id=664 data-nosnippet>664</a> })<span class="question-mark">?
|
||||
<a href=#665 id=665 data-nosnippet>665</a> </span>.push(<span class="kw-2">&</span>signed_packet.public_key().to_z32());
|
||||
<a href=#666 id=666 data-nosnippet>666</a>
|
||||
<a href=#667 id=667 data-nosnippet>667</a> <span class="kw">let </span>response = <span class="self">self
|
||||
<a href=#668 id=668 data-nosnippet>668</a> </span>.http_client
|
||||
<a href=#669 id=669 data-nosnippet>669</a> .put(url)
|
||||
<a href=#670 id=670 data-nosnippet>670</a> .body(signed_packet.to_relay_payload())
|
||||
<a href=#671 id=671 data-nosnippet>671</a> .send()
|
||||
<a href=#672 id=672 data-nosnippet>672</a> .<span class="kw">await
|
||||
<a href=#673 id=673 data-nosnippet>673</a> </span>.map_err(|err| <span class="macro">e!</span>(PkarrError::HttpSend, <span class="macro">anyerr!</span>(err)))<span class="question-mark">?</span>;
|
||||
<a href=#674 id=674 data-nosnippet>674</a>
|
||||
<a href=#675 id=675 data-nosnippet>675</a> <span class="kw">if </span>!response.status().is_success() {
|
||||
<a href=#676 id=676 data-nosnippet>676</a> <span class="kw">return </span><span class="prelude-val">Err</span>(<span class="macro">e!</span>(PkarrError::HttpRequest {
|
||||
<a href=#677 id=677 data-nosnippet>677</a> status: response.status()
|
||||
<a href=#678 id=678 data-nosnippet>678</a> }));
|
||||
<a href=#679 id=679 data-nosnippet>679</a> }
|
||||
<a href=#680 id=680 data-nosnippet>680</a>
|
||||
<a href=#681 id=681 data-nosnippet>681</a> <span class="prelude-val">Ok</span>(())
|
||||
<a href=#682 id=682 data-nosnippet>682</a> }
|
||||
<a href=#683 id=683 data-nosnippet>683</a>}</code></pre></div></section></main></body></html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user