mirror of
https://github.com/n0-computer/iroh.git
synced 2026-12-03 16:01:53 +00:00
deploy: 35e8f3f2d96858fc6c2a04852746eb412d3a0e7a
This commit is contained in:
@@ -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="Checks the network conditions from the current host."><title>iroh::net_report - 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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-6c3ea77c.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.87.0-nightly (f280acf4c 2025-02-19)" data-channel="nightly" data-search-js="search-f7327375.js" data-settings-js="settings-6dad6058.js" ><script src="../../static.files/storage-3a5871a4.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5332ae0c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module net_<wbr>report</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 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>net_report</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/net_report.rs.html#1-1069">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Checks the network conditions from the current host.</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="Checks the network conditions from the current host."><title>iroh::net_report - 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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-6c3ea77c.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.87.0-nightly (f280acf4c 2025-02-19)" data-channel="nightly" data-search-js="search-f7327375.js" data-settings-js="settings-6dad6058.js" ><script src="../../static.files/storage-3a5871a4.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5332ae0c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module net_<wbr>report</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 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></div><h1>Module <span>net_report</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/net_report.rs.html#1-1086">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Checks the network conditions from the current host.</p>
|
||||
<p>NetReport is responsible for finding out the network conditions of the current host, like
|
||||
whether it is connected to the internet via IPv4 and/or IPv6, what the NAT situation is
|
||||
etc and reachability to the configured relays.</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
@@ -68,9 +68,9 @@ at T+0ms, T+200ms and T+300ms. The <code>timeout</code> is applied as stated in
|
||||
summary of all errors otherwise.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_node_by_id" class="method"><a class="src rightside" href="../../src/iroh_relay/dns.rs.html#326-337">Source</a><h4 class="code-header">pub async fn <a href="#method.lookup_node_by_id" class="fn">lookup_node_by_id</a>(
|
||||
&self,
|
||||
node_id: &<a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>,
|
||||
node_id: &NodeId,
|
||||
origin: &<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/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../node_info/struct.NodeInfo.html" title="struct iroh_relay::node_info::NodeInfo">NodeInfo</a>, <a class="enum" href="../node_info/enum.LookupError.html" title="enum iroh_relay::node_info::LookupError">LookupError</a>></h4></section></summary><div class="docblock"><p>Looks up node info by <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> and origin domain name.</p>
|
||||
) -> <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="../node_info/struct.NodeInfo.html" title="struct iroh_relay::node_info::NodeInfo">NodeInfo</a>, <a class="enum" href="../node_info/enum.LookupError.html" title="enum iroh_relay::node_info::LookupError">LookupError</a>></h4></section></summary><div class="docblock"><p>Looks up node info by [<code>NodeId</code>] and origin domain name.</p>
|
||||
<p>To lookup nodes that published their node info to the DNS servers run by n0,
|
||||
pass <a href="constant.N0_DNS_NODE_ORIGIN_PROD.html" title="constant iroh_relay::dns::N0_DNS_NODE_ORIGIN_PROD"><code>N0_DNS_NODE_ORIGIN_PROD</code></a> as <code>origin</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_node_by_domain_name" class="method"><a class="src rightside" href="../../src/iroh_relay/dns.rs.html#340-346">Source</a><h4 class="code-header">pub async fn <a href="#method.lookup_node_by_domain_name" class="fn">lookup_node_by_domain_name</a>(
|
||||
@@ -88,10 +88,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return
|
||||
summary of all errors otherwise.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_node_by_id_staggered" class="method"><a class="src rightside" href="../../src/iroh_relay/dns.rs.html#369-377">Source</a><h4 class="code-header">pub async fn <a href="#method.lookup_node_by_id_staggered" class="fn">lookup_node_by_id_staggered</a>(
|
||||
&self,
|
||||
node_id: &<a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>,
|
||||
node_id: &NodeId,
|
||||
origin: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
|
||||
delays_ms: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</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="struct" href="../node_info/struct.NodeInfo.html" title="struct iroh_relay::node_info::NodeInfo">NodeInfo</a>, <a class="struct" href="struct.StaggeredError.html" title="struct iroh_relay::dns::StaggeredError">StaggeredError</a><<a class="enum" href="../node_info/enum.LookupError.html" title="enum iroh_relay::node_info::LookupError">LookupError</a>>></h4></section></summary><div class="docblock"><p>Looks up node info by <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> and origin domain name.</p>
|
||||
) -> <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="../node_info/struct.NodeInfo.html" title="struct iroh_relay::node_info::NodeInfo">NodeInfo</a>, <a class="struct" href="struct.StaggeredError.html" title="struct iroh_relay::dns::StaggeredError">StaggeredError</a><<a class="enum" href="../node_info/enum.LookupError.html" title="enum iroh_relay::node_info::LookupError">LookupError</a>>></h4></section></summary><div class="docblock"><p>Looks up node info by [<code>NodeId</code>] and origin domain name.</p>
|
||||
<p>From the moment this function is called, each lookup is scheduled after the delays in
|
||||
<code>delays_ms</code> with the first call being done immediately. <code>[200ms, 300ms]</code> results in calls
|
||||
at T+0ms, T+200ms and T+300ms. The result of the first successful call is returned, or a
|
||||
|
||||
@@ -25,6 +25,6 @@ Tailscale.</p>
|
||||
STUN support and expose metrics.</p>
|
||||
</li>
|
||||
</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 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="dns/index.html" title="mod iroh_relay::dns">dns</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dd>DNS resolver</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="node_info/index.html" title="mod iroh_relay::node_info">node_<wbr>info</a></dt><dd>Support for handling DNS resource records for dialing by <a href="../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a>.</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
|
||||
</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 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="dns/index.html" title="mod iroh_relay::dns">dns</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dd>DNS resolver</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="node_info/index.html" title="mod iroh_relay::node_info">node_<wbr>info</a></dt><dd>Support for handling DNS resource records for dialing by [<code>NodeId</code>].</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></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.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.RelayMap.html" title="struct iroh_relay::RelayMap">Relay<wbr>Map</a></dt><dd>Configuration of all the relay servers that can be used.</dd><dt><a class="struct" href="struct.RelayNode.html" title="struct iroh_relay::RelayNode">Relay<wbr>Node</a></dt><dd>Information on a specific relay server.</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></section></div></main></body></html>
|
||||
@@ -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="Support for handling DNS resource records for dialing by `NodeId`."><title>iroh_relay::node_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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-6c3ea77c.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.87.0-nightly (f280acf4c 2025-02-19)" data-channel="nightly" data-search-js="search-f7327375.js" data-settings-js="settings-6dad6058.js" ><script src="../../static.files/storage-3a5871a4.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5332ae0c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module node_<wbr>info</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><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_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><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>node_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_relay/node_info.rs.html#1-865">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.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a>.</p>
|
||||
<p>Dialing by <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> is supported by iroh nodes publishing <a href="https://app.pkarr.org">Pkarr</a> records to DNS
|
||||
<!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 `NodeId`."><title>iroh_relay::node_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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-6c3ea77c.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.87.0-nightly (f280acf4c 2025-02-19)" data-channel="nightly" data-search-js="search-f7327375.js" data-settings-js="settings-6dad6058.js" ><script src="../../static.files/storage-3a5871a4.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5332ae0c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module node_<wbr>info</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><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_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><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>node_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_relay/node_info.rs.html#1-865">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 [<code>NodeId</code>].</p>
|
||||
<p>Dialing by [<code>NodeId</code>] is supported by iroh nodes 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>DNS records are published under the following names:</p>
|
||||
<p><code>_iroh.<z32-node-id>.<origin-domain> TXT</code></p>
|
||||
@@ -8,7 +8,7 @@ servers or the Mainline DHT. This module supports creating and parsing these re
|
||||
<p><code>_iroh</code> is the record name as defined by <a href="constant.IROH_TXT_NAME.html" title="constant iroh_relay::node_info::IROH_TXT_NAME"><code>IROH_TXT_NAME</code></a>.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code><z32-node-id></code> is the <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt">z-base-32</a> encoding of the <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a>.</p>
|
||||
<p><code><z32-node-id></code> is the <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt">z-base-32</a> encoding of the [<code>NodeId</code>].</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code><origin-domain></code> is the domain name of the publishing DNS server,
|
||||
@@ -23,12 +23,12 @@ servers or the Mainline DHT. This module supports creating and parsing these re
|
||||
in <a href="https://www.rfc-editor.org/rfc/rfc1464">RFC1464</a>. The following attributes are defined:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p><code>relay=<url></code>: The home <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a> of this node.</p>
|
||||
<p><code>relay=<url></code>: The home <a href="iroh_base::RelayUrl"><code>RelayUrl</code></a> of this node.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code>addr=<addr> <addr></code>: A space-separated list of sockets addresses for this iroh node.
|
||||
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.MaxLengthExceededError.html" title="struct iroh_relay::node_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_relay::node_info::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.NodeData.html" title="struct iroh_relay::node_info::NodeData">Node<wbr>Data</a></dt><dd>Data about a node that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.NodeInfo.html" title="struct iroh_relay::node_info::NodeInfo">Node<wbr>Info</a></dt><dd>Information about a node that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh_relay::node_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_relay::node_info::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.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">Decoding<wbr>Error</a></dt><dt><a class="enum" href="enum.EncodingError.html" title="enum iroh_relay::node_info::EncodingError">Encoding<wbr>Error</a></dt><dt><a class="enum" href="enum.LookupError.html" title="enum iroh_relay::node_info::LookupError">Lookup<wbr>Error</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dt><a class="enum" href="enum.ParseError.html" title="enum iroh_relay::node_info::ParseError">Parse<wbr>Error</a></dt></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.IROH_TXT_NAME.html" title="constant iroh_relay::node_info::IROH_TXT_NAME">IROH_<wbr>TXT_<wbr>NAME</a></dt><dd>The DNS name for the iroh TXT record.</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.NodeIdExt.html" title="trait iroh_relay::node_info::NodeIdExt">Node<wbr>IdExt</a></dt><dd>Extension methods for <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> to encode to and decode from [<code>z32</code>],
|
||||
</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.MaxLengthExceededError.html" title="struct iroh_relay::node_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_relay::node_info::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.NodeData.html" title="struct iroh_relay::node_info::NodeData">Node<wbr>Data</a></dt><dd>Data about a node that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.NodeInfo.html" title="struct iroh_relay::node_info::NodeInfo">Node<wbr>Info</a></dt><dd>Information about a node that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh_relay::node_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_relay::node_info::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.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">Decoding<wbr>Error</a></dt><dt><a class="enum" href="enum.EncodingError.html" title="enum iroh_relay::node_info::EncodingError">Encoding<wbr>Error</a></dt><dt><a class="enum" href="enum.LookupError.html" title="enum iroh_relay::node_info::LookupError">Lookup<wbr>Error</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dt><a class="enum" href="enum.ParseError.html" title="enum iroh_relay::node_info::ParseError">Parse<wbr>Error</a></dt></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.IROH_TXT_NAME.html" title="constant iroh_relay::node_info::IROH_TXT_NAME">IROH_<wbr>TXT_<wbr>NAME</a></dt><dd>The DNS name for the iroh TXT record.</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.NodeIdExt.html" title="trait iroh_relay::node_info::NodeIdExt">Node<wbr>IdExt</a></dt><dd>Extension methods for [<code>NodeId</code>] to encode to and decode from [<code>z32</code>],
|
||||
which is the encoding used in [<code>pkarr</code>] domain names.</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="Extension methods for `NodeId` to encode to and decode from `z32`, which is the encoding used in `pkarr` domain names."><title>NodeIdExt in iroh_relay::node_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" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-6c3ea77c.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.87.0-nightly (f280acf4c 2025-02-19)" data-channel="nightly" data-search-js="search-f7327375.js" data-settings-js="settings-6dad6058.js" ><script src="../../static.files/storage-3a5871a4.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5332ae0c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Node<wbr>IdExt</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_z32" title="from_z32">from_z32</a></li><li><a href="#tymethod.to_z32" title="to_z32">to_z32</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-NodeIdExt-for-PublicKey" title="NodeId">NodeId</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><a href="index.html">In iroh_<wbr>relay::<wbr>node_<wbr>info</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><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">node_info</a></div><h1>Trait <span class="trait">NodeIdExt</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/node_info.rs.html#99-109">Source</a> </span></div><pre class="rust item-decl"><code>pub trait NodeIdExt {
|
||||
// Required methods
|
||||
fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>;
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.from_z32" class="fn">from_z32</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/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">DecodingError</a>>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extension methods for <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> to encode to and decode from [<code>z32</code>],
|
||||
<span class="item-spacer"></span> fn <a href="#tymethod.from_z32" class="fn">from_z32</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/result/enum.Result.html" title="enum core::result::Result">Result</a><NodeId, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">DecodingError</a>>;
|
||||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extension methods for [<code>NodeId</code>] to encode to and decode from [<code>z32</code>],
|
||||
which is the encoding used in [<code>pkarr</code>] domain names.</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.to_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#103">Source</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&self) -> <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>Encodes a <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#108">Source</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</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/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">DecodingError</a>></h4></section></summary><div class="docblock"><p>Parses a <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</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="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-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#111-124">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.NodeIdExt.html" title="trait iroh_relay::node_info::NodeIdExt">NodeIdExt</a> for <a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a></h3></section></summary><div class="impl-items"><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#112-114">Source</a><a href="#method.to_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><section id="method.from_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#116-123">Source</a><a href="#method.from_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</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/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">DecodingError</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_relay/node_info/trait.NodeIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
|
||||
</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.to_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#103">Source</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&self) -> <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>Encodes a [<code>NodeId</code>] in [<code>z-base-32</code>] encoding.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#108">Source</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</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/result/enum.Result.html" title="enum core::result::Result">Result</a><NodeId, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">DecodingError</a>></h4></section></summary><div class="docblock"><p>Parses a [<code>NodeId</code>] from [<code>z-base-32</code>] encoding.</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="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-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#111-124">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.NodeIdExt.html" title="trait iroh_relay::node_info::NodeIdExt">NodeIdExt</a> for NodeId</h3></section></summary><div class="impl-items"><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#112-114">Source</a><a href="#method.to_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><section id="method.from_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#116-123">Source</a><a href="#method.from_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</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/result/enum.Result.html" title="enum core::result::Result">Result</a><NodeId, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::node_info::DecodingError">DecodingError</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_relay/node_info/trait.NodeIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -17,9 +17,9 @@ case there is an error in the server before it is shut down.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_addr" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#494-496">Source</a><h4 class="code-header">pub fn <a href="#method.http_addr" class="fn">http_addr</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="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>The socket address the HTTP server is listening on.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.quic_addr" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#499-501">Source</a><h4 class="code-header">pub fn <a href="#method.quic_addr" class="fn">quic_addr</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="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>The socket address the QUIC server is listening on.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.certificates" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#504-506">Source</a><h4 class="code-header">pub fn <a href="#method.certificates" class="fn">certificates</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><CertificateDer<'static>>></h4></section></summary><div class="docblock"><p>The certificates chain if configured with manual TLS certificates.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.https_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#512-518">Source</a><h4 class="code-header">pub fn <a href="#method.https_url" class="fn">https_url</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="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s https <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.https_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#512-518">Source</a><h4 class="code-header">pub fn <a href="#method.https_url" class="fn">https_url</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><RelayUrl></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s https [<code>RelayUrl</code>].</p>
|
||||
<p>This uses <a href="struct.Server.html#method.https_addr" title="method iroh_relay::server::Server::https_addr"><code>Self::https_addr</code></a> so it’s mostly useful for local development.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#524-530">Source</a><h4 class="code-header">pub fn <a href="#method.http_url" class="fn">http_url</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="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s http <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#524-530">Source</a><h4 class="code-header">pub fn <a href="#method.http_url" class="fn">http_url</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><RelayUrl></h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s http [<code>RelayUrl</code>].</p>
|
||||
<p>This uses <a href="struct.Server.html#method.http_addr" title="method iroh_relay::server::Server::http_addr"><code>Self::http_addr</code></a> so it’s mostly useful for local development.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.metrics" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#533-535">Source</a><h4 class="code-header">pub fn <a href="#method.metrics" class="fn">metrics</a>(&self) -> &<a class="struct" href="struct.RelayMetrics.html" title="struct iroh_relay::server::RelayMetrics">RelayMetrics</a></h4></section></summary><div class="docblock"><p>Returns the metrics collected in the relay server.</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-Server" class="impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#236">Source</a><a href="#impl-Debug-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</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#236">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-Server" class="impl"><a href="#impl-Freeze-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-RefUnwindSafe-for-Server" class="impl"><a href="#impl-RefUnwindSafe-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Send-for-Server" class="impl"><a href="#impl-Send-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Sync-for-Server" class="impl"><a href="#impl-Sync-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Unpin-for-Server" class="impl"><a href="#impl-Unpin-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-UnwindSafe-for-Server" class="impl"><a href="#impl-UnwindSafe-for-Server" 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.Server.html" title="struct iroh_relay::server::Server">Server</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
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1038
-1021
File diff suppressed because it is too large
Load Diff
@@ -128,259 +128,145 @@
|
||||
<a href=#128 id=128 data-nosnippet>128</a> <span class="kw">if </span>last_report.relay_latency.is_empty() {
|
||||
<a href=#129 id=129 data-nosnippet>129</a> <span class="kw">return </span><span class="self">Self</span>::initial(relay_map, protocols);
|
||||
<a href=#130 id=130 data-nosnippet>130</a> }
|
||||
<a href=#131 id=131 data-nosnippet>131</a> <span class="self">Self</span>::default()
|
||||
<a href=#132 id=132 data-nosnippet>132</a> }
|
||||
<a href=#133 id=133 data-nosnippet>133</a>
|
||||
<a href=#134 id=134 data-nosnippet>134</a> <span class="doccomment">/// Returns an iterator over the [`ProbeSet`]s in this plan.
|
||||
<a href=#135 id=135 data-nosnippet>135</a> </span><span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>iter(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw">impl </span>Iterator<Item = <span class="kw-2">&</span>ProbeSet> {
|
||||
<a href=#136 id=136 data-nosnippet>136</a> <span class="self">self</span>.set.iter()
|
||||
<a href=#137 id=137 data-nosnippet>137</a> }
|
||||
<a href=#138 id=138 data-nosnippet>138</a>
|
||||
<a href=#139 id=139 data-nosnippet>139</a> <span class="doccomment">/// Adds a [`ProbeSet`] if it contains probes and the protocol indicated in
|
||||
<a href=#140 id=140 data-nosnippet>140</a> /// the [`ProbeSet] matches a protocol in our set of [`Probe`]s.
|
||||
<a href=#141 id=141 data-nosnippet>141</a> </span><span class="kw">fn </span>add_if_enabled(<span class="kw-2">&mut </span><span class="self">self</span>, protocols: <span class="kw-2">&</span>BTreeSet<Probe>, set: ProbeSet) {
|
||||
<a href=#142 id=142 data-nosnippet>142</a> <span class="kw">if </span>!set.is_empty() && protocols.contains(<span class="kw-2">&</span>set.proto) {
|
||||
<a href=#143 id=143 data-nosnippet>143</a> <span class="self">self</span>.set.insert(set);
|
||||
<a href=#144 id=144 data-nosnippet>144</a> }
|
||||
<a href=#145 id=145 data-nosnippet>145</a> }
|
||||
<a href=#146 id=146 data-nosnippet>146</a>}
|
||||
<a href=#147 id=147 data-nosnippet>147</a>
|
||||
<a href=#148 id=148 data-nosnippet>148</a><span class="kw">impl </span>fmt::Display <span class="kw">for </span>ProbePlan {
|
||||
<a href=#149 id=149 data-nosnippet>149</a> <span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>fmt::Formatter<<span class="lifetime">'_</span>>) -> fmt::Result {
|
||||
<a href=#150 id=150 data-nosnippet>150</a> <span class="macro">writeln!</span>(f, <span class="string">"ProbePlan {{"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#151 id=151 data-nosnippet>151</a> <span class="kw">for </span>probe_set <span class="kw">in </span><span class="self">self</span>.set.iter() {
|
||||
<a href=#152 id=152 data-nosnippet>152</a> <span class="macro">writeln!</span>(f, <span class="string">r#" ProbeSet("{}") {{"#</span>, probe_set.proto)<span class="question-mark">?</span>;
|
||||
<a href=#153 id=153 data-nosnippet>153</a> <span class="kw">for </span>(delay, node) <span class="kw">in </span>probe_set.probes.iter() {
|
||||
<a href=#154 id=154 data-nosnippet>154</a> <span class="macro">writeln!</span>(f, <span class="string">" {delay:?} to {node},"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#155 id=155 data-nosnippet>155</a> }
|
||||
<a href=#156 id=156 data-nosnippet>156</a> <span class="macro">writeln!</span>(f, <span class="string">" }}"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#157 id=157 data-nosnippet>157</a> }
|
||||
<a href=#158 id=158 data-nosnippet>158</a> <span class="macro">writeln!</span>(f, <span class="string">"}}"</span>)
|
||||
<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>
|
||||
<a href=#162 id=162 data-nosnippet>162</a><span class="kw">impl </span>FromIterator<ProbeSet> <span class="kw">for </span>ProbePlan {
|
||||
<a href=#163 id=163 data-nosnippet>163</a> <span class="kw">fn </span>from_iter<T: IntoIterator<Item = ProbeSet>>(iter: T) -> <span class="self">Self </span>{
|
||||
<a href=#164 id=164 data-nosnippet>164</a> <span class="self">Self </span>{
|
||||
<a href=#165 id=165 data-nosnippet>165</a> set: iter.into_iter().collect(),
|
||||
<a href=#166 id=166 data-nosnippet>166</a> }
|
||||
<a href=#167 id=167 data-nosnippet>167</a> }
|
||||
<a href=#168 id=168 data-nosnippet>168</a>}
|
||||
<a href=#169 id=169 data-nosnippet>169</a>
|
||||
<a href=#170 id=170 data-nosnippet>170</a><span class="attr">#[cfg(test)]
|
||||
<a href=#171 id=171 data-nosnippet>171</a></span><span class="kw">mod </span>tests {
|
||||
<a href=#172 id=172 data-nosnippet>172</a> <span class="kw">use </span>pretty_assertions::assert_eq;
|
||||
<a href=#173 id=173 data-nosnippet>173</a> <span class="kw">use </span>tracing_test::traced_test;
|
||||
<a href=#174 id=174 data-nosnippet>174</a>
|
||||
<a href=#175 id=175 data-nosnippet>175</a> <span class="kw">use super</span>::<span class="kw-2">*</span>;
|
||||
<a href=#176 id=176 data-nosnippet>176</a> <span class="kw">use </span><span class="kw">crate</span>::net_report::{test_utils, RelayLatencies};
|
||||
<a href=#177 id=177 data-nosnippet>177</a>
|
||||
<a href=#178 id=178 data-nosnippet>178</a> <span class="doccomment">/// Shorthand which declares a new ProbeSet.
|
||||
<a href=#179 id=179 data-nosnippet>179</a> ///
|
||||
<a href=#180 id=180 data-nosnippet>180</a> /// `$kind`: The `Probe`.
|
||||
<a href=#181 id=181 data-nosnippet>181</a> /// `$node`: Expression which will be an `Arc<RelayNode>`.
|
||||
<a href=#182 id=182 data-nosnippet>182</a> /// `$delays`: A `Vec` of the delays for this probe.
|
||||
<a href=#183 id=183 data-nosnippet>183</a> </span><span class="macro">macro_rules!</span> probeset {
|
||||
<a href=#184 id=184 data-nosnippet>184</a> (proto: Probe::<span class="macro-nonterminal">$kind</span>:ident, relay: <span class="macro-nonterminal">$node</span>:expr, delays: <span class="macro-nonterminal">$delays</span>:expr,) => {
|
||||
<a href=#185 id=185 data-nosnippet>185</a> ProbeSet {
|
||||
<a href=#186 id=186 data-nosnippet>186</a> proto: Probe::<span class="macro-nonterminal">$kind</span>,
|
||||
<a href=#187 id=187 data-nosnippet>187</a> probes: <span class="macro-nonterminal">$delays</span>.iter().map(|delay| (<span class="kw-2">*</span>delay, <span class="macro-nonterminal">$node</span>)).collect(),
|
||||
<a href=#188 id=188 data-nosnippet>188</a> }
|
||||
<a href=#189 id=189 data-nosnippet>189</a> };
|
||||
<a href=#190 id=190 data-nosnippet>190</a> }
|
||||
<a href=#191 id=191 data-nosnippet>191</a>
|
||||
<a href=#192 id=192 data-nosnippet>192</a> <span class="kw">fn </span>default_protocols() -> BTreeSet<Probe> {
|
||||
<a href=#193 id=193 data-nosnippet>193</a> BTreeSet::from([Probe::QadIpv4, Probe::QadIpv6, Probe::Https])
|
||||
<a href=#194 id=194 data-nosnippet>194</a> }
|
||||
<a href=#195 id=195 data-nosnippet>195</a>
|
||||
<a href=#196 id=196 data-nosnippet>196</a> <span class="attr">#[tokio::test]
|
||||
<a href=#197 id=197 data-nosnippet>197</a> </span><span class="kw">async fn </span>test_initial_probeplan() {
|
||||
<a href=#198 id=198 data-nosnippet>198</a> <span class="kw">let </span>(_servers, relay_map) = test_utils::relay_map(<span class="number">2</span>).<span class="kw">await</span>;
|
||||
<a href=#199 id=199 data-nosnippet>199</a> <span class="kw">let </span>relay_node_1 = relay_map.nodes().next().unwrap();
|
||||
<a href=#200 id=200 data-nosnippet>200</a> <span class="kw">let </span>relay_node_2 = relay_map.nodes().nth(<span class="number">1</span>).unwrap();
|
||||
<a href=#201 id=201 data-nosnippet>201</a> <span class="kw">let </span>plan = ProbePlan::initial(<span class="kw-2">&</span>relay_map, <span class="kw-2">&</span>default_protocols());
|
||||
<a href=#202 id=202 data-nosnippet>202</a>
|
||||
<a href=#203 id=203 data-nosnippet>203</a> <span class="kw">let </span>expected_plan: ProbePlan = [
|
||||
<a href=#204 id=204 data-nosnippet>204</a> <span class="macro">probeset!</span> {
|
||||
<a href=#205 id=205 data-nosnippet>205</a> proto: Probe::QadIpv4,
|
||||
<a href=#206 id=206 data-nosnippet>206</a> relay: relay_node_1.clone(),
|
||||
<a href=#207 id=207 data-nosnippet>207</a> delays: [Duration::ZERO,
|
||||
<a href=#208 id=208 data-nosnippet>208</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#209 id=209 data-nosnippet>209</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#210 id=210 data-nosnippet>210</a> },
|
||||
<a href=#211 id=211 data-nosnippet>211</a> <span class="macro">probeset!</span> {
|
||||
<a href=#212 id=212 data-nosnippet>212</a> proto: Probe::QadIpv6,
|
||||
<a href=#213 id=213 data-nosnippet>213</a> relay: relay_node_1.clone(),
|
||||
<a href=#214 id=214 data-nosnippet>214</a> delays: [Duration::ZERO,
|
||||
<a href=#215 id=215 data-nosnippet>215</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#216 id=216 data-nosnippet>216</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#217 id=217 data-nosnippet>217</a> },
|
||||
<a href=#218 id=218 data-nosnippet>218</a> <span class="macro">probeset!</span> {
|
||||
<a href=#219 id=219 data-nosnippet>219</a> proto: Probe::Https,
|
||||
<a href=#220 id=220 data-nosnippet>220</a> relay: relay_node_1.clone(),
|
||||
<a href=#221 id=221 data-nosnippet>221</a> delays: [Duration::from_millis(<span class="number">300</span>),
|
||||
<a href=#222 id=222 data-nosnippet>222</a> Duration::from_millis(<span class="number">400</span>),
|
||||
<a href=#223 id=223 data-nosnippet>223</a> Duration::from_millis(<span class="number">500</span>)],
|
||||
<a href=#224 id=224 data-nosnippet>224</a> },
|
||||
<a href=#225 id=225 data-nosnippet>225</a> <span class="macro">probeset!</span> {
|
||||
<a href=#226 id=226 data-nosnippet>226</a> proto: Probe::QadIpv4,
|
||||
<a href=#227 id=227 data-nosnippet>227</a> relay: relay_node_2.clone(),
|
||||
<a href=#228 id=228 data-nosnippet>228</a> delays: [Duration::ZERO,
|
||||
<a href=#229 id=229 data-nosnippet>229</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#230 id=230 data-nosnippet>230</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#231 id=231 data-nosnippet>231</a> },
|
||||
<a href=#232 id=232 data-nosnippet>232</a> <span class="macro">probeset!</span> {
|
||||
<a href=#233 id=233 data-nosnippet>233</a> proto: Probe::QadIpv6,
|
||||
<a href=#234 id=234 data-nosnippet>234</a> relay: relay_node_2.clone(),
|
||||
<a href=#235 id=235 data-nosnippet>235</a> delays: [Duration::ZERO,
|
||||
<a href=#236 id=236 data-nosnippet>236</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#237 id=237 data-nosnippet>237</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#238 id=238 data-nosnippet>238</a> },
|
||||
<a href=#239 id=239 data-nosnippet>239</a> <span class="macro">probeset!</span> {
|
||||
<a href=#240 id=240 data-nosnippet>240</a> proto: Probe::Https,
|
||||
<a href=#241 id=241 data-nosnippet>241</a> relay: relay_node_2.clone(),
|
||||
<a href=#242 id=242 data-nosnippet>242</a> delays: [Duration::from_millis(<span class="number">300</span>),
|
||||
<a href=#243 id=243 data-nosnippet>243</a> Duration::from_millis(<span class="number">400</span>),
|
||||
<a href=#244 id=244 data-nosnippet>244</a> Duration::from_millis(<span class="number">500</span>)],
|
||||
<a href=#245 id=245 data-nosnippet>245</a> },
|
||||
<a href=#246 id=246 data-nosnippet>246</a> ]
|
||||
<a href=#247 id=247 data-nosnippet>247</a> .into_iter()
|
||||
<a href=#248 id=248 data-nosnippet>248</a> .collect();
|
||||
<a href=#249 id=249 data-nosnippet>249</a>
|
||||
<a href=#250 id=250 data-nosnippet>250</a> <span class="macro">println!</span>(<span class="string">"expected:"</span>);
|
||||
<a href=#251 id=251 data-nosnippet>251</a> <span class="macro">println!</span>(<span class="string">"{expected_plan}"</span>);
|
||||
<a href=#252 id=252 data-nosnippet>252</a> <span class="macro">println!</span>(<span class="string">"actual:"</span>);
|
||||
<a href=#253 id=253 data-nosnippet>253</a> <span class="macro">println!</span>(<span class="string">"{plan}"</span>);
|
||||
<a href=#254 id=254 data-nosnippet>254</a> <span class="comment">// The readable error:
|
||||
<a href=#255 id=255 data-nosnippet>255</a> </span><span class="macro">assert_eq!</span>(plan.to_string(), expected_plan.to_string());
|
||||
<a href=#256 id=256 data-nosnippet>256</a> <span class="comment">// Just in case there's a bug in the Display impl:
|
||||
<a href=#257 id=257 data-nosnippet>257</a> </span><span class="macro">assert_eq!</span>(plan, expected_plan);
|
||||
<a href=#258 id=258 data-nosnippet>258</a> }
|
||||
<a href=#259 id=259 data-nosnippet>259</a>
|
||||
<a href=#260 id=260 data-nosnippet>260</a> <span class="attr">#[tokio::test]
|
||||
<a href=#261 id=261 data-nosnippet>261</a> </span><span class="kw">async fn </span>test_initial_probeplan_some_protocols() {
|
||||
<a href=#262 id=262 data-nosnippet>262</a> <span class="kw">let </span>(_servers, relay_map) = test_utils::relay_map(<span class="number">2</span>).<span class="kw">await</span>;
|
||||
<a href=#263 id=263 data-nosnippet>263</a> <span class="kw">let </span>relay_node_1 = relay_map.nodes().next().unwrap();
|
||||
<a href=#264 id=264 data-nosnippet>264</a> <span class="kw">let </span>relay_node_2 = relay_map.nodes().nth(<span class="number">1</span>).unwrap();
|
||||
<a href=#265 id=265 data-nosnippet>265</a> <span class="kw">let </span>plan = ProbePlan::initial(<span class="kw-2">&</span>relay_map, <span class="kw-2">&</span>BTreeSet::from([Probe::Https]));
|
||||
<a href=#266 id=266 data-nosnippet>266</a>
|
||||
<a href=#267 id=267 data-nosnippet>267</a> <span class="kw">let </span>expected_plan: ProbePlan = [
|
||||
<a href=#268 id=268 data-nosnippet>268</a> <span class="macro">probeset!</span> {
|
||||
<a href=#269 id=269 data-nosnippet>269</a> proto: Probe::Https,
|
||||
<a href=#270 id=270 data-nosnippet>270</a> relay: relay_node_1.clone(),
|
||||
<a href=#271 id=271 data-nosnippet>271</a> delays: [Duration::ZERO,
|
||||
<a href=#272 id=272 data-nosnippet>272</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#273 id=273 data-nosnippet>273</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#274 id=274 data-nosnippet>274</a> },
|
||||
<a href=#275 id=275 data-nosnippet>275</a> <span class="macro">probeset!</span> {
|
||||
<a href=#276 id=276 data-nosnippet>276</a> proto: Probe::Https,
|
||||
<a href=#277 id=277 data-nosnippet>277</a> relay: relay_node_2.clone(),
|
||||
<a href=#278 id=278 data-nosnippet>278</a> delays: [Duration::ZERO,
|
||||
<a href=#279 id=279 data-nosnippet>279</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#280 id=280 data-nosnippet>280</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#281 id=281 data-nosnippet>281</a> },
|
||||
<a href=#282 id=282 data-nosnippet>282</a> ]
|
||||
<a href=#283 id=283 data-nosnippet>283</a> .into_iter()
|
||||
<a href=#284 id=284 data-nosnippet>284</a> .collect();
|
||||
<a href=#285 id=285 data-nosnippet>285</a>
|
||||
<a href=#286 id=286 data-nosnippet>286</a> <span class="macro">println!</span>(<span class="string">"expected:"</span>);
|
||||
<a href=#287 id=287 data-nosnippet>287</a> <span class="macro">println!</span>(<span class="string">"{expected_plan}"</span>);
|
||||
<a href=#288 id=288 data-nosnippet>288</a> <span class="macro">println!</span>(<span class="string">"actual:"</span>);
|
||||
<a href=#289 id=289 data-nosnippet>289</a> <span class="macro">println!</span>(<span class="string">"{plan}"</span>);
|
||||
<a href=#290 id=290 data-nosnippet>290</a> <span class="comment">// The readable error:
|
||||
<a href=#291 id=291 data-nosnippet>291</a> </span><span class="macro">assert_eq!</span>(plan.to_string(), expected_plan.to_string());
|
||||
<a href=#292 id=292 data-nosnippet>292</a> <span class="comment">// Just in case there's a bug in the Display impl:
|
||||
<a href=#293 id=293 data-nosnippet>293</a> </span><span class="macro">assert_eq!</span>(plan, expected_plan);
|
||||
<a href=#294 id=294 data-nosnippet>294</a> }
|
||||
<a href=#295 id=295 data-nosnippet>295</a>
|
||||
<a href=#296 id=296 data-nosnippet>296</a> <span class="attr">#[tokio::test]
|
||||
<a href=#297 id=297 data-nosnippet>297</a> #[traced_test]
|
||||
<a href=#298 id=298 data-nosnippet>298</a> </span><span class="kw">async fn </span>test_plan_with_report() {
|
||||
<a href=#299 id=299 data-nosnippet>299</a> <span class="kw">let </span>(_servers, relay_map) = test_utils::relay_map(<span class="number">2</span>).<span class="kw">await</span>;
|
||||
<a href=#300 id=300 data-nosnippet>300</a> <span class="kw">let </span>relay_node_1 = relay_map.nodes().next().unwrap().clone();
|
||||
<a href=#301 id=301 data-nosnippet>301</a> <span class="kw">let </span>relay_node_2 = relay_map.nodes().nth(<span class="number">1</span>).unwrap().clone();
|
||||
<a href=#302 id=302 data-nosnippet>302</a>
|
||||
<a href=#303 id=303 data-nosnippet>303</a> <span class="kw">for </span>i <span class="kw">in </span><span class="number">0</span>..<span class="number">10 </span>{
|
||||
<a href=#304 id=304 data-nosnippet>304</a> <span class="macro">println!</span>(<span class="string">"round {}"</span>, i);
|
||||
<a href=#305 id=305 data-nosnippet>305</a> <span class="kw">let </span><span class="kw-2">mut </span>latencies = RelayLatencies::default();
|
||||
<a href=#306 id=306 data-nosnippet>306</a> latencies.update_relay(
|
||||
<a href=#307 id=307 data-nosnippet>307</a> relay_node_1.url.clone(),
|
||||
<a href=#308 id=308 data-nosnippet>308</a> Duration::from_millis(<span class="number">2</span>),
|
||||
<a href=#309 id=309 data-nosnippet>309</a> Probe::QadIpv4,
|
||||
<a href=#310 id=310 data-nosnippet>310</a> );
|
||||
<a href=#311 id=311 data-nosnippet>311</a> latencies.update_relay(
|
||||
<a href=#312 id=312 data-nosnippet>312</a> relay_node_2.url.clone(),
|
||||
<a href=#313 id=313 data-nosnippet>313</a> Duration::from_millis(<span class="number">2</span>),
|
||||
<a href=#314 id=314 data-nosnippet>314</a> Probe::QadIpv4,
|
||||
<a href=#315 id=315 data-nosnippet>315</a> );
|
||||
<a href=#316 id=316 data-nosnippet>316</a> <span class="kw">let </span>last_report = Report {
|
||||
<a href=#317 id=317 data-nosnippet>317</a> udp_v6: <span class="bool-val">true</span>,
|
||||
<a href=#318 id=318 data-nosnippet>318</a> udp_v4: <span class="bool-val">true</span>,
|
||||
<a href=#319 id=319 data-nosnippet>319</a> mapping_varies_by_dest_ipv4: <span class="prelude-val">Some</span>(<span class="bool-val">false</span>),
|
||||
<a href=#320 id=320 data-nosnippet>320</a> mapping_varies_by_dest_ipv6: <span class="prelude-val">Some</span>(<span class="bool-val">false</span>),
|
||||
<a href=#321 id=321 data-nosnippet>321</a> preferred_relay: <span class="prelude-val">Some</span>(relay_node_1.url.clone()),
|
||||
<a href=#322 id=322 data-nosnippet>322</a> relay_latency: latencies.clone(),
|
||||
<a href=#323 id=323 data-nosnippet>323</a> global_v4: <span class="prelude-val">None</span>,
|
||||
<a href=#324 id=324 data-nosnippet>324</a> global_v6: <span class="prelude-val">None</span>,
|
||||
<a href=#325 id=325 data-nosnippet>325</a> captive_portal: <span class="prelude-val">None</span>,
|
||||
<a href=#326 id=326 data-nosnippet>326</a> };
|
||||
<a href=#327 id=327 data-nosnippet>327</a> <span class="kw">let </span>plan = ProbePlan::with_last_report(<span class="kw-2">&</span>relay_map, <span class="kw-2">&</span>last_report, <span class="kw-2">&</span>default_protocols());
|
||||
<a href=#328 id=328 data-nosnippet>328</a> <span class="kw">let </span>expected_plan: ProbePlan = [
|
||||
<a href=#329 id=329 data-nosnippet>329</a> <span class="macro">probeset!</span> {
|
||||
<a href=#330 id=330 data-nosnippet>330</a> proto: Probe::QadIpv4,
|
||||
<a href=#331 id=331 data-nosnippet>331</a> relay: relay_node_1.clone(),
|
||||
<a href=#332 id=332 data-nosnippet>332</a> delays: [Duration::ZERO,
|
||||
<a href=#333 id=333 data-nosnippet>333</a> Duration::from_micros(<span class="number">52_400</span>),
|
||||
<a href=#334 id=334 data-nosnippet>334</a> Duration::from_micros(<span class="number">104_800</span>),
|
||||
<a href=#335 id=335 data-nosnippet>335</a> Duration::from_micros(<span class="number">157_200</span>)],
|
||||
<a href=#336 id=336 data-nosnippet>336</a> },
|
||||
<a href=#337 id=337 data-nosnippet>337</a> <span class="macro">probeset!</span> {
|
||||
<a href=#338 id=338 data-nosnippet>338</a> proto: Probe::QadIpv6,
|
||||
<a href=#339 id=339 data-nosnippet>339</a> relay: relay_node_1.clone(),
|
||||
<a href=#340 id=340 data-nosnippet>340</a> delays: [Duration::ZERO,
|
||||
<a href=#341 id=341 data-nosnippet>341</a> Duration::from_micros(<span class="number">52_400</span>),
|
||||
<a href=#342 id=342 data-nosnippet>342</a> Duration::from_micros(<span class="number">104_800</span>),
|
||||
<a href=#343 id=343 data-nosnippet>343</a> Duration::from_micros(<span class="number">157_200</span>)],
|
||||
<a href=#344 id=344 data-nosnippet>344</a> },
|
||||
<a href=#345 id=345 data-nosnippet>345</a> <span class="macro">probeset!</span> {
|
||||
<a href=#346 id=346 data-nosnippet>346</a> proto: Probe::Https,
|
||||
<a href=#347 id=347 data-nosnippet>347</a> relay: relay_node_1.clone(),
|
||||
<a href=#348 id=348 data-nosnippet>348</a> delays: [Duration::from_micros(<span class="number">207_200</span>),
|
||||
<a href=#349 id=349 data-nosnippet>349</a> Duration::from_micros(<span class="number">259_600</span>),
|
||||
<a href=#350 id=350 data-nosnippet>350</a> Duration::from_micros(<span class="number">312_000</span>),
|
||||
<a href=#351 id=351 data-nosnippet>351</a> Duration::from_micros(<span class="number">364_400</span>)],
|
||||
<a href=#352 id=352 data-nosnippet>352</a> },
|
||||
<a href=#353 id=353 data-nosnippet>353</a> <span class="macro">probeset!</span> {
|
||||
<a href=#354 id=354 data-nosnippet>354</a> proto: Probe::QadIpv4,
|
||||
<a href=#355 id=355 data-nosnippet>355</a> relay: relay_node_2.clone(),
|
||||
<a href=#356 id=356 data-nosnippet>356</a> delays: [Duration::ZERO,
|
||||
<a href=#357 id=357 data-nosnippet>357</a> Duration::from_micros(<span class="number">52_400</span>)],
|
||||
<a href=#358 id=358 data-nosnippet>358</a> },
|
||||
<a href=#359 id=359 data-nosnippet>359</a> <span class="macro">probeset!</span> {
|
||||
<a href=#360 id=360 data-nosnippet>360</a> proto: Probe::QadIpv6,
|
||||
<a href=#361 id=361 data-nosnippet>361</a> relay: relay_node_2.clone(),
|
||||
<a href=#362 id=362 data-nosnippet>362</a> delays: [Duration::ZERO,
|
||||
<a href=#363 id=363 data-nosnippet>363</a> Duration::from_micros(<span class="number">52_400</span>)],
|
||||
<a href=#364 id=364 data-nosnippet>364</a> },
|
||||
<a href=#365 id=365 data-nosnippet>365</a> <span class="macro">probeset!</span> {
|
||||
<a href=#366 id=366 data-nosnippet>366</a> proto: Probe::Https,
|
||||
<a href=#367 id=367 data-nosnippet>367</a> relay: relay_node_2.clone(),
|
||||
<a href=#368 id=368 data-nosnippet>368</a> delays: [Duration::from_micros(<span class="number">207_200</span>),
|
||||
<a href=#369 id=369 data-nosnippet>369</a> Duration::from_micros(<span class="number">259_600</span>)],
|
||||
<a href=#370 id=370 data-nosnippet>370</a> },
|
||||
<a href=#371 id=371 data-nosnippet>371</a> ]
|
||||
<a href=#372 id=372 data-nosnippet>372</a> .into_iter()
|
||||
<a href=#373 id=373 data-nosnippet>373</a> .collect();
|
||||
<a href=#374 id=374 data-nosnippet>374</a>
|
||||
<a href=#375 id=375 data-nosnippet>375</a> <span class="macro">println!</span>(<span class="string">"{} round"</span>, i);
|
||||
<a href=#376 id=376 data-nosnippet>376</a> <span class="macro">println!</span>(<span class="string">"expected:"</span>);
|
||||
<a href=#377 id=377 data-nosnippet>377</a> <span class="macro">println!</span>(<span class="string">"{expected_plan}"</span>);
|
||||
<a href=#378 id=378 data-nosnippet>378</a> <span class="macro">println!</span>(<span class="string">"actual:"</span>);
|
||||
<a href=#379 id=379 data-nosnippet>379</a> <span class="macro">println!</span>(<span class="string">"{plan}"</span>);
|
||||
<a href=#380 id=380 data-nosnippet>380</a> <span class="comment">// The readable error:
|
||||
<a href=#381 id=381 data-nosnippet>381</a> </span><span class="macro">assert_eq!</span>(plan.to_string(), expected_plan.to_string(), <span class="string">"{}"</span>, i);
|
||||
<a href=#382 id=382 data-nosnippet>382</a> <span class="comment">// Just in case there's a bug in the Display impl:
|
||||
<a href=#383 id=383 data-nosnippet>383</a> </span><span class="macro">assert_eq!</span>(plan, expected_plan, <span class="string">"{}"</span>, i);
|
||||
<a href=#384 id=384 data-nosnippet>384</a> }
|
||||
<a href=#385 id=385 data-nosnippet>385</a> }
|
||||
<a href=#386 id=386 data-nosnippet>386</a>}</code></pre></div></section></main></body></html>
|
||||
<a href=#131 id=131 data-nosnippet>131</a>
|
||||
<a href=#132 id=132 data-nosnippet>132</a> <span class="comment">// TODO: is this good?
|
||||
<a href=#133 id=133 data-nosnippet>133</a> </span><span class="self">Self</span>::default()
|
||||
<a href=#134 id=134 data-nosnippet>134</a> }
|
||||
<a href=#135 id=135 data-nosnippet>135</a>
|
||||
<a href=#136 id=136 data-nosnippet>136</a> <span class="doccomment">/// Returns an iterator over the [`ProbeSet`]s in this plan.
|
||||
<a href=#137 id=137 data-nosnippet>137</a> </span><span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>iter(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw">impl </span>Iterator<Item = <span class="kw-2">&</span>ProbeSet> {
|
||||
<a href=#138 id=138 data-nosnippet>138</a> <span class="self">self</span>.set.iter()
|
||||
<a href=#139 id=139 data-nosnippet>139</a> }
|
||||
<a href=#140 id=140 data-nosnippet>140</a>
|
||||
<a href=#141 id=141 data-nosnippet>141</a> <span class="doccomment">/// Adds a [`ProbeSet`] if it contains probes and the protocol indicated in
|
||||
<a href=#142 id=142 data-nosnippet>142</a> /// the [`ProbeSet] matches a protocol in our set of [`Probe`]s.
|
||||
<a href=#143 id=143 data-nosnippet>143</a> </span><span class="kw">fn </span>add_if_enabled(<span class="kw-2">&mut </span><span class="self">self</span>, protocols: <span class="kw-2">&</span>BTreeSet<Probe>, set: ProbeSet) {
|
||||
<a href=#144 id=144 data-nosnippet>144</a> <span class="kw">if </span>!set.is_empty() && protocols.contains(<span class="kw-2">&</span>set.proto) {
|
||||
<a href=#145 id=145 data-nosnippet>145</a> <span class="self">self</span>.set.insert(set);
|
||||
<a href=#146 id=146 data-nosnippet>146</a> }
|
||||
<a href=#147 id=147 data-nosnippet>147</a> }
|
||||
<a href=#148 id=148 data-nosnippet>148</a>}
|
||||
<a href=#149 id=149 data-nosnippet>149</a>
|
||||
<a href=#150 id=150 data-nosnippet>150</a><span class="kw">impl </span>fmt::Display <span class="kw">for </span>ProbePlan {
|
||||
<a href=#151 id=151 data-nosnippet>151</a> <span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>fmt::Formatter<<span class="lifetime">'_</span>>) -> fmt::Result {
|
||||
<a href=#152 id=152 data-nosnippet>152</a> <span class="macro">writeln!</span>(f, <span class="string">"ProbePlan {{"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#153 id=153 data-nosnippet>153</a> <span class="kw">for </span>probe_set <span class="kw">in </span><span class="self">self</span>.set.iter() {
|
||||
<a href=#154 id=154 data-nosnippet>154</a> <span class="macro">writeln!</span>(f, <span class="string">r#" ProbeSet("{}") {{"#</span>, probe_set.proto)<span class="question-mark">?</span>;
|
||||
<a href=#155 id=155 data-nosnippet>155</a> <span class="kw">for </span>(delay, node) <span class="kw">in </span>probe_set.probes.iter() {
|
||||
<a href=#156 id=156 data-nosnippet>156</a> <span class="macro">writeln!</span>(f, <span class="string">" {delay:?} to {node},"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#157 id=157 data-nosnippet>157</a> }
|
||||
<a href=#158 id=158 data-nosnippet>158</a> <span class="macro">writeln!</span>(f, <span class="string">" }}"</span>)<span class="question-mark">?</span>;
|
||||
<a href=#159 id=159 data-nosnippet>159</a> }
|
||||
<a href=#160 id=160 data-nosnippet>160</a> <span class="macro">writeln!</span>(f, <span class="string">"}}"</span>)
|
||||
<a href=#161 id=161 data-nosnippet>161</a> }
|
||||
<a href=#162 id=162 data-nosnippet>162</a>}
|
||||
<a href=#163 id=163 data-nosnippet>163</a>
|
||||
<a href=#164 id=164 data-nosnippet>164</a><span class="kw">impl </span>FromIterator<ProbeSet> <span class="kw">for </span>ProbePlan {
|
||||
<a href=#165 id=165 data-nosnippet>165</a> <span class="kw">fn </span>from_iter<T: IntoIterator<Item = ProbeSet>>(iter: T) -> <span class="self">Self </span>{
|
||||
<a href=#166 id=166 data-nosnippet>166</a> <span class="self">Self </span>{
|
||||
<a href=#167 id=167 data-nosnippet>167</a> set: iter.into_iter().collect(),
|
||||
<a href=#168 id=168 data-nosnippet>168</a> }
|
||||
<a href=#169 id=169 data-nosnippet>169</a> }
|
||||
<a href=#170 id=170 data-nosnippet>170</a>}
|
||||
<a href=#171 id=171 data-nosnippet>171</a>
|
||||
<a href=#172 id=172 data-nosnippet>172</a><span class="attr">#[cfg(test)]
|
||||
<a href=#173 id=173 data-nosnippet>173</a></span><span class="kw">mod </span>tests {
|
||||
<a href=#174 id=174 data-nosnippet>174</a> <span class="kw">use </span>pretty_assertions::assert_eq;
|
||||
<a href=#175 id=175 data-nosnippet>175</a>
|
||||
<a href=#176 id=176 data-nosnippet>176</a> <span class="kw">use super</span>::<span class="kw-2">*</span>;
|
||||
<a href=#177 id=177 data-nosnippet>177</a> <span class="kw">use </span><span class="kw">crate</span>::net_report::test_utils;
|
||||
<a href=#178 id=178 data-nosnippet>178</a>
|
||||
<a href=#179 id=179 data-nosnippet>179</a> <span class="doccomment">/// Shorthand which declares a new ProbeSet.
|
||||
<a href=#180 id=180 data-nosnippet>180</a> ///
|
||||
<a href=#181 id=181 data-nosnippet>181</a> /// `$kind`: The `Probe`.
|
||||
<a href=#182 id=182 data-nosnippet>182</a> /// `$node`: Expression which will be an `Arc<RelayNode>`.
|
||||
<a href=#183 id=183 data-nosnippet>183</a> /// `$delays`: A `Vec` of the delays for this probe.
|
||||
<a href=#184 id=184 data-nosnippet>184</a> </span><span class="macro">macro_rules!</span> probeset {
|
||||
<a href=#185 id=185 data-nosnippet>185</a> (proto: Probe::<span class="macro-nonterminal">$kind</span>:ident, relay: <span class="macro-nonterminal">$node</span>:expr, delays: <span class="macro-nonterminal">$delays</span>:expr,) => {
|
||||
<a href=#186 id=186 data-nosnippet>186</a> ProbeSet {
|
||||
<a href=#187 id=187 data-nosnippet>187</a> proto: Probe::<span class="macro-nonterminal">$kind</span>,
|
||||
<a href=#188 id=188 data-nosnippet>188</a> probes: <span class="macro-nonterminal">$delays</span>.iter().map(|delay| (<span class="kw-2">*</span>delay, <span class="macro-nonterminal">$node</span>)).collect(),
|
||||
<a href=#189 id=189 data-nosnippet>189</a> }
|
||||
<a href=#190 id=190 data-nosnippet>190</a> };
|
||||
<a href=#191 id=191 data-nosnippet>191</a> }
|
||||
<a href=#192 id=192 data-nosnippet>192</a>
|
||||
<a href=#193 id=193 data-nosnippet>193</a> <span class="kw">fn </span>default_protocols() -> BTreeSet<Probe> {
|
||||
<a href=#194 id=194 data-nosnippet>194</a> BTreeSet::from([Probe::QadIpv4, Probe::QadIpv6, Probe::Https])
|
||||
<a href=#195 id=195 data-nosnippet>195</a> }
|
||||
<a href=#196 id=196 data-nosnippet>196</a>
|
||||
<a href=#197 id=197 data-nosnippet>197</a> <span class="attr">#[tokio::test]
|
||||
<a href=#198 id=198 data-nosnippet>198</a> </span><span class="kw">async fn </span>test_initial_probeplan() {
|
||||
<a href=#199 id=199 data-nosnippet>199</a> <span class="kw">let </span>(_servers, relay_map) = test_utils::relay_map(<span class="number">2</span>).<span class="kw">await</span>;
|
||||
<a href=#200 id=200 data-nosnippet>200</a> <span class="kw">let </span>relay_node_1 = relay_map.nodes().next().unwrap();
|
||||
<a href=#201 id=201 data-nosnippet>201</a> <span class="kw">let </span>relay_node_2 = relay_map.nodes().nth(<span class="number">1</span>).unwrap();
|
||||
<a href=#202 id=202 data-nosnippet>202</a> <span class="kw">let </span>plan = ProbePlan::initial(<span class="kw-2">&</span>relay_map, <span class="kw-2">&</span>default_protocols());
|
||||
<a href=#203 id=203 data-nosnippet>203</a>
|
||||
<a href=#204 id=204 data-nosnippet>204</a> <span class="kw">let </span>expected_plan: ProbePlan = [
|
||||
<a href=#205 id=205 data-nosnippet>205</a> <span class="macro">probeset!</span> {
|
||||
<a href=#206 id=206 data-nosnippet>206</a> proto: Probe::Https,
|
||||
<a href=#207 id=207 data-nosnippet>207</a> relay: relay_node_1.clone(),
|
||||
<a href=#208 id=208 data-nosnippet>208</a> delays: [
|
||||
<a href=#209 id=209 data-nosnippet>209</a> Duration::from_millis(<span class="number">0</span>),
|
||||
<a href=#210 id=210 data-nosnippet>210</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#211 id=211 data-nosnippet>211</a> Duration::from_millis(<span class="number">200</span>)
|
||||
<a href=#212 id=212 data-nosnippet>212</a> ],
|
||||
<a href=#213 id=213 data-nosnippet>213</a> },
|
||||
<a href=#214 id=214 data-nosnippet>214</a> <span class="macro">probeset!</span> {
|
||||
<a href=#215 id=215 data-nosnippet>215</a> proto: Probe::Https,
|
||||
<a href=#216 id=216 data-nosnippet>216</a> relay: relay_node_2.clone(),
|
||||
<a href=#217 id=217 data-nosnippet>217</a> delays: [
|
||||
<a href=#218 id=218 data-nosnippet>218</a> Duration::from_millis(<span class="number">0</span>),
|
||||
<a href=#219 id=219 data-nosnippet>219</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#220 id=220 data-nosnippet>220</a> Duration::from_millis(<span class="number">200</span>)
|
||||
<a href=#221 id=221 data-nosnippet>221</a> ],
|
||||
<a href=#222 id=222 data-nosnippet>222</a> },
|
||||
<a href=#223 id=223 data-nosnippet>223</a> ]
|
||||
<a href=#224 id=224 data-nosnippet>224</a> .into_iter()
|
||||
<a href=#225 id=225 data-nosnippet>225</a> .collect();
|
||||
<a href=#226 id=226 data-nosnippet>226</a>
|
||||
<a href=#227 id=227 data-nosnippet>227</a> <span class="macro">println!</span>(<span class="string">"expected:"</span>);
|
||||
<a href=#228 id=228 data-nosnippet>228</a> <span class="macro">println!</span>(<span class="string">"{expected_plan}"</span>);
|
||||
<a href=#229 id=229 data-nosnippet>229</a> <span class="macro">println!</span>(<span class="string">"actual:"</span>);
|
||||
<a href=#230 id=230 data-nosnippet>230</a> <span class="macro">println!</span>(<span class="string">"{plan}"</span>);
|
||||
<a href=#231 id=231 data-nosnippet>231</a> <span class="comment">// The readable error:
|
||||
<a href=#232 id=232 data-nosnippet>232</a> </span><span class="macro">assert_eq!</span>(plan.to_string(), expected_plan.to_string());
|
||||
<a href=#233 id=233 data-nosnippet>233</a> <span class="comment">// Just in case there's a bug in the Display impl:
|
||||
<a href=#234 id=234 data-nosnippet>234</a> </span><span class="macro">assert_eq!</span>(plan, expected_plan);
|
||||
<a href=#235 id=235 data-nosnippet>235</a> }
|
||||
<a href=#236 id=236 data-nosnippet>236</a>
|
||||
<a href=#237 id=237 data-nosnippet>237</a> <span class="attr">#[tokio::test]
|
||||
<a href=#238 id=238 data-nosnippet>238</a> </span><span class="kw">async fn </span>test_initial_probeplan_some_protocols() {
|
||||
<a href=#239 id=239 data-nosnippet>239</a> <span class="kw">let </span>(_servers, relay_map) = test_utils::relay_map(<span class="number">2</span>).<span class="kw">await</span>;
|
||||
<a href=#240 id=240 data-nosnippet>240</a> <span class="kw">let </span>relay_node_1 = relay_map.nodes().next().unwrap();
|
||||
<a href=#241 id=241 data-nosnippet>241</a> <span class="kw">let </span>relay_node_2 = relay_map.nodes().nth(<span class="number">1</span>).unwrap();
|
||||
<a href=#242 id=242 data-nosnippet>242</a> <span class="kw">let </span>plan = ProbePlan::initial(<span class="kw-2">&</span>relay_map, <span class="kw-2">&</span>BTreeSet::from([Probe::Https]));
|
||||
<a href=#243 id=243 data-nosnippet>243</a>
|
||||
<a href=#244 id=244 data-nosnippet>244</a> <span class="kw">let </span>expected_plan: ProbePlan = [
|
||||
<a href=#245 id=245 data-nosnippet>245</a> <span class="macro">probeset!</span> {
|
||||
<a href=#246 id=246 data-nosnippet>246</a> proto: Probe::Https,
|
||||
<a href=#247 id=247 data-nosnippet>247</a> relay: relay_node_1.clone(),
|
||||
<a href=#248 id=248 data-nosnippet>248</a> delays: [Duration::ZERO,
|
||||
<a href=#249 id=249 data-nosnippet>249</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#250 id=250 data-nosnippet>250</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#251 id=251 data-nosnippet>251</a> },
|
||||
<a href=#252 id=252 data-nosnippet>252</a> <span class="macro">probeset!</span> {
|
||||
<a href=#253 id=253 data-nosnippet>253</a> proto: Probe::Https,
|
||||
<a href=#254 id=254 data-nosnippet>254</a> relay: relay_node_2.clone(),
|
||||
<a href=#255 id=255 data-nosnippet>255</a> delays: [Duration::ZERO,
|
||||
<a href=#256 id=256 data-nosnippet>256</a> Duration::from_millis(<span class="number">100</span>),
|
||||
<a href=#257 id=257 data-nosnippet>257</a> Duration::from_millis(<span class="number">200</span>)],
|
||||
<a href=#258 id=258 data-nosnippet>258</a> },
|
||||
<a href=#259 id=259 data-nosnippet>259</a> ]
|
||||
<a href=#260 id=260 data-nosnippet>260</a> .into_iter()
|
||||
<a href=#261 id=261 data-nosnippet>261</a> .collect();
|
||||
<a href=#262 id=262 data-nosnippet>262</a>
|
||||
<a href=#263 id=263 data-nosnippet>263</a> <span class="macro">println!</span>(<span class="string">"expected:"</span>);
|
||||
<a href=#264 id=264 data-nosnippet>264</a> <span class="macro">println!</span>(<span class="string">"{expected_plan}"</span>);
|
||||
<a href=#265 id=265 data-nosnippet>265</a> <span class="macro">println!</span>(<span class="string">"actual:"</span>);
|
||||
<a href=#266 id=266 data-nosnippet>266</a> <span class="macro">println!</span>(<span class="string">"{plan}"</span>);
|
||||
<a href=#267 id=267 data-nosnippet>267</a> <span class="comment">// The readable error:
|
||||
<a href=#268 id=268 data-nosnippet>268</a> </span><span class="macro">assert_eq!</span>(plan.to_string(), expected_plan.to_string());
|
||||
<a href=#269 id=269 data-nosnippet>269</a> <span class="comment">// Just in case there's a bug in the Display impl:
|
||||
<a href=#270 id=270 data-nosnippet>270</a> </span><span class="macro">assert_eq!</span>(plan, expected_plan);
|
||||
<a href=#271 id=271 data-nosnippet>271</a> }
|
||||
<a href=#272 id=272 data-nosnippet>272</a>}</code></pre></div></section></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
|
||||
(function() {
|
||||
var implementors = Object.fromEntries([["iroh_relay",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a><<a class=\"struct\" href=\"iroh_base/relay_url/struct.RelayUrl.html\" title=\"struct iroh_base::relay_url::RelayUrl\">RelayUrl</a>> for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a><<a class=\"struct\" href=\"iroh_relay/struct.RelayNode.html\" title=\"struct iroh_relay::RelayNode\">RelayNode</a>> for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"]]]]);
|
||||
var implementors = Object.fromEntries([["iroh_relay",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a><<a class=\"struct\" href=\"iroh_relay/struct.RelayNode.html\" title=\"struct iroh_relay::RelayNode\">RelayNode</a>> for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a><RelayUrl> for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"]]]]);
|
||||
if (window.register_implementors) {
|
||||
window.register_implementors(implementors);
|
||||
} else {
|
||||
window.pending_implementors = implementors;
|
||||
}
|
||||
})()
|
||||
//{"start":57,"fragment_lengths":[898]}
|
||||
//{"start":57,"fragment_lengths":[776]}
|
||||
Reference in New Issue
Block a user