deploy: 09b0c49adb023a5cc0acd5084e48ef1f7404f7da

This commit is contained in:
Frando
2025-05-15 12:35:16 +00:00
parent 9c4c55b84d
commit 2f6d61981e
78 changed files with 1429 additions and 507 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -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="Node address discovery."><title>iroh::discovery - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 discovery</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>discovery</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/discovery.rs.html#1-1074">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Node address discovery.</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="Node address discovery."><title>iroh::discovery - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 discovery</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#examples" title="Examples">Examples</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>discovery</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/discovery.rs.html#1-1077">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Node address discovery.</p>
<p>To connect to an iroh node a <a href="../struct.NodeAddr.html" title="struct iroh::NodeAddr"><code>NodeAddr</code></a> is needed, which may contain a
<a href="../struct.RelayUrl.html" title="struct iroh::RelayUrl"><code>RelayUrl</code></a> or one or more <em>direct addresses</em> in addition to the <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a>.</p>
<p>Since there is a conversion from <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> to <a href="../struct.NodeAddr.html" title="struct iroh::NodeAddr"><code>NodeAddr</code></a>, you can also use
@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Environment variable to force the use of staging relays."><title>ENV_FORCE_STAGING_RELAYS in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 constant"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Constant <span class="constant">ENV_FORCE_STAGING_RELAYS</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#2146">Source</a> </span></div><pre class="rust item-decl"><code>pub const ENV_FORCE_STAGING_RELAYS: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;IROH_FORCE_STAGING_RELAYS&quot;;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Environment variable to force the use of staging relays.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Environment variable to force the use of staging relays."><title>ENV_FORCE_STAGING_RELAYS in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 constant"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Constant <span class="constant">ENV_FORCE_STAGING_RELAYS</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#2201">Source</a> </span></div><pre class="rust item-decl"><code>pub const ENV_FORCE_STAGING_RELAYS: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;IROH_FORCE_STAGING_RELAYS&quot;;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Environment variable to force the use of staging relays.</p>
</div></details></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Function <span class="fn">default_relay_mode</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#2157-2163">Source</a> </span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -&gt; <a class="enum" href="enum.RelayMode.html" title="enum iroh::endpoint::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Function <span class="fn">default_relay_mode</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#2212-2218">Source</a> </span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -&gt; <a class="enum" href="enum.RelayMode.html" title="enum iroh::endpoint::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
<p>If the <code>IROH_FORCE_STAGING_RELAYS</code> environment variable is non empty, it will return <code>RelayMode::Staging</code>.
Otherwise, it will return <code>RelayMode::Default</code>.</p>
</div></details></section></div></main></body></html>
@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns `true` if the use of staging relays is forced."><title>force_staging_infra in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Function <span class="fn">force_staging_infra</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#2149-2151">Source</a> </span></div><pre class="rust item-decl"><code>pub fn force_staging_infra() -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns <code>true</code> if the use of staging relays is forced.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns `true` if the use of staging relays is forced."><title>force_staging_infra in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Function <span class="fn">force_staging_infra</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#2204-2206">Source</a> </span></div><pre class="rust item-decl"><code>pub fn force_staging_infra() -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns <code>true</code> if the use of staging relays is forced.</p>
</div></details></section></div></main></body></html>
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
window.SIDEBAR_ITEMS = {"constant":["ENV_FORCE_STAGING_RELAYS"],"enum":["ConnectionError","ConnectionType","ControlMsg","DirectAddrType","PathSelection","ReadError","ReadExactError","ReadToEndError","RelayMode","ResetError","SendDatagramError","Source","StoppedError","WriteError"],"fn":["default_relay_mode","force_staging_infra"],"struct":["Accept","AcceptBi","AcceptUni","AckFrequencyConfig","ApplicationClose","Builder","Chunk","ClosedStream","ConnectOptions","Connecting","Connection","ConnectionClose","ConnectionStats","CryptoError","DirectAddr","DirectAddrInfo","Endpoint","ExportKeyingMaterialError","FrameStats","Incoming","IncomingFuture","MtuDiscoveryConfig","OpenBi","OpenUni","PathStats","ReadDatagram","RecvStream","RemoteInfo","RetryError","SendStream","ServerConfig","StreamId","TransportConfig","TransportError","TransportErrorCode","UdpStats","UnsupportedVersion","VarInt","WeakConnectionHandle","Written","ZeroRttAccepted"],"trait":["AeadKey","Controller","ControllerFactory","CryptoServerConfig","HandshakeTokenKey"]};
window.SIDEBAR_ITEMS = {"constant":["ENV_FORCE_STAGING_RELAYS"],"enum":["ConnectionError","ConnectionType","ControlMsg","DirectAddrType","PathSelection","ReadError","ReadExactError","ReadToEndError","RelayMode","ResetError","SendDatagramError","Source","StoppedError","WriteError"],"fn":["default_relay_mode","force_staging_infra"],"struct":["Accept","AcceptBi","AcceptUni","AckFrequencyConfig","ApplicationClose","Builder","Chunk","ClosedStream","ConnectOptions","Connecting","Connection","ConnectionClose","ConnectionStats","CryptoError","DirectAddr","DirectAddrInfo","Endpoint","ExportKeyingMaterialError","FrameStats","Incoming","IncomingFuture","MtuDiscoveryConfig","OpenBi","OpenUni","PathStats","ReadDatagram","RecvStream","RemoteInfo","RetryError","SendStream","ServerConfig","StreamId","TransportConfig","TransportError","TransportErrorCode","UdpStats","UnsupportedVersion","VarInt","WeakConnectionHandle","Written","ZeroRttAccepted"],"trait":["AeadKey","Controller","ControllerFactory","CryptoServerConfig","HandshakeTokenKey"],"type":["NodeAddrWatcher"]};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +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="A type alias for the return value of `Endpoint::node_addr`."><title>NodeAddrWatcher in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 type"><!--[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="#">Node<wbr>Addr<wbr>Watcher</a></h2><h3><a href="#aliased-type">Aliased type</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></span><h1>Type Alias <span class="type">NodeAddrWatcher</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/endpoint.rs.html#90-96">Source</a> </span></div><pre class="rust item-decl"><code>pub type NodeAddrWatcher = <a class="struct" href="../watcher/struct.Map.html" title="struct iroh::watcher::Map">Map</a>&lt;(<a class="struct" href="../watcher/struct.Direct.html" title="struct iroh::watcher::Direct">Direct</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/collections/btree/set/struct.BTreeSet.html" title="struct alloc::collections::btree::set::BTreeSet">BTreeSet</a>&lt;<a class="struct" href="struct.DirectAddr.html" title="struct iroh::endpoint::DirectAddr">DirectAddr</a>&gt;&gt;&gt;, <a class="struct" href="../watcher/struct.Direct.html" title="struct iroh::watcher::Direct">Direct</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../struct.RelayUrl.html" title="struct iroh::RelayUrl">RelayUrl</a>&gt;&gt;), <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../struct.NodeAddr.html" title="struct iroh::NodeAddr">NodeAddr</a>&gt;&gt;;</code></pre><span class="item-info"><div class="stab portability">Available on <strong>non-<code>wasm_browser</code></strong> only.</div></span><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A type alias for the return value of <a href="struct.Endpoint.html#method.node_addr" title="method iroh::endpoint::Endpoint::node_addr"><code>Endpoint::node_addr</code></a>.</p>
<p>This type implements <a href="../watcher/trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a> with <code>Value</code> being an optional <a href="../struct.NodeAddr.html" title="struct iroh::NodeAddr"><code>NodeAddr</code></a>.</p>
<p>We return a named type instead of <code>impl Watcher&lt;Value = NodeAddr&gt;</code>, as this allows
you to e.g. store the watcher in a struct.</p>
</div></details><h2 id="aliased-type" class="section-header">Aliased Type<a href="#aliased-type" class="anchor">§</a></h2><pre class="rust item-decl"><code>struct NodeAddrWatcher { <span class="comment">/* private fields */</span> }</code></pre><script src="../../type.impl/iroh/watcher/struct.Map.js" data-self-path="iroh::endpoint::NodeAddrWatcher" async></script></section></div></main></body></html>
+1 -1
View File
@@ -163,4 +163,4 @@ connecting using only the <a href="type.NodeId.html" title="type iroh::NodeId"><
}</code></pre></div>
<p>Please see the examples directory for more nuanced examples.</p>
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name" id="reexport.Endpoint"><code>pub use endpoint::<a class="struct" href="endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>;</code></div></li><li><div class="item-name" id="reexport.RelayMode"><code>pub use endpoint::<a class="enum" href="endpoint/enum.RelayMode.html" title="enum iroh::endpoint::RelayMode">RelayMode</a>;</code></div></li></ul><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="mod" href="defaults/index.html" title="mod iroh::defaults">defaults</a></div><div class="desc docblock-short">Default values used in <a href="index.html" title="mod iroh"><code>iroh</code></a></div></li><li><div class="item-name"><a class="mod" href="discovery/index.html" title="mod iroh::discovery">discovery</a></div><div class="desc docblock-short">Node address discovery.</div></li><li><div class="item-name"><a class="mod" href="dns/index.html" title="mod iroh::dns">dns</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></div><div class="desc docblock-short">This module exports a DNS resolver, which is also the default resolver used in the
<a href="endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>crate::Endpoint</code></a> if no custom resolver is configured.</div></li><li><div class="item-name"><a class="mod" href="endpoint/index.html" title="mod iroh::endpoint">endpoint</a></div><div class="desc docblock-short">The <a href="endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> allows establishing connections to other iroh nodes.</div></li><li><div class="item-name"><a class="mod" href="metrics/index.html" title="mod iroh::metrics">metrics</a></div><div class="desc docblock-short">Co-locating all of the iroh metrics structs</div></li><li><div class="item-name"><a class="mod" href="net_report/index.html" title="mod iroh::net_report">net_<wbr>report</a></div><div class="desc docblock-short">Checks the network conditions from the current host.</div></li><li><div class="item-name"><a class="mod" href="node_info/index.html" title="mod iroh::node_info">node_<wbr>info</a></div><div class="desc docblock-short">Support for handling DNS resource records for dialing by <a href="type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a>.</div></li><li><div class="item-name"><a class="mod" href="protocol/index.html" title="mod iroh::protocol">protocol</a></div><div class="desc docblock-short">Tools for spawning an accept loop that routes incoming requests to the right protocol.</div></li><li><div class="item-name"><a class="mod" href="test_utils/index.html" title="mod iroh::test_utils">test_<wbr>utils</a><wbr><span class="stab portability" title="Available on crate feature `test-utils` only"><code>test-utils</code></span></div><div class="desc docblock-short">Internal utilities to support testing.</div></li><li><div class="item-name"><a class="mod" href="watchable/index.html" title="mod iroh::watchable">watchable</a></div><div class="desc docblock-short">Watchable values.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.NodeAddr.html" title="struct iroh::NodeAddr">Node<wbr>Addr</a></div><div class="desc docblock-short">Network-level addressing information for an iroh node.</div></li><li><div class="item-name"><a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">Public<wbr>Key</a></div><div class="desc docblock-short">A public key.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayMap.html" title="struct iroh::RelayMap">Relay<wbr>Map</a></div><div class="desc docblock-short">Configuration of all the relay servers that can be used.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayNode.html" title="struct iroh::RelayNode">Relay<wbr>Node</a></div><div class="desc docblock-short">Information on a specific relay server.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayUrl.html" title="struct iroh::RelayUrl">Relay<wbr>Url</a></div><div class="desc docblock-short">A URL identifying a relay server.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayUrlParseError.html" title="struct iroh::RelayUrlParseError">Relay<wbr>UrlParse<wbr>Error</a></div><div class="desc docblock-short">Can occur when parsing a string into a <a href="struct.RelayUrl.html" title="struct iroh::RelayUrl"><code>RelayUrl</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.SecretKey.html" title="struct iroh::SecretKey">Secret<wbr>Key</a></div><div class="desc docblock-short">A secret key.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.KeyParsingError.html" title="enum iroh::KeyParsingError">KeyParsing<wbr>Error</a></div><div class="desc docblock-short">Error when deserialising a <a href="struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> or a <a href="struct.SecretKey.html" title="struct iroh::SecretKey"><code>SecretKey</code></a>.</div></li><li><div class="item-name"><a class="enum" href="enum.RelayProtocol.html" title="enum iroh::RelayProtocol">Relay<wbr>Protocol</a></div><div class="desc docblock-short">The HTTP upgrade protocol used for relaying.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.NodeId.html" title="type iroh::NodeId">NodeId</a></div><div class="desc docblock-short">The identifier for a node in the (iroh) network.</div></li></ul></section></div></main></body></html>
<a href="endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>crate::Endpoint</code></a> if no custom resolver is configured.</div></li><li><div class="item-name"><a class="mod" href="endpoint/index.html" title="mod iroh::endpoint">endpoint</a></div><div class="desc docblock-short">The <a href="endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint"><code>Endpoint</code></a> allows establishing connections to other iroh nodes.</div></li><li><div class="item-name"><a class="mod" href="metrics/index.html" title="mod iroh::metrics">metrics</a></div><div class="desc docblock-short">Co-locating all of the iroh metrics structs</div></li><li><div class="item-name"><a class="mod" href="net_report/index.html" title="mod iroh::net_report">net_<wbr>report</a></div><div class="desc docblock-short">Checks the network conditions from the current host.</div></li><li><div class="item-name"><a class="mod" href="node_info/index.html" title="mod iroh::node_info">node_<wbr>info</a></div><div class="desc docblock-short">Support for handling DNS resource records for dialing by <a href="type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a>.</div></li><li><div class="item-name"><a class="mod" href="protocol/index.html" title="mod iroh::protocol">protocol</a></div><div class="desc docblock-short">Tools for spawning an accept loop that routes incoming requests to the right protocol.</div></li><li><div class="item-name"><a class="mod" href="test_utils/index.html" title="mod iroh::test_utils">test_<wbr>utils</a><wbr><span class="stab portability" title="Available on crate feature `test-utils` only"><code>test-utils</code></span></div><div class="desc docblock-short">Internal utilities to support testing.</div></li><li><div class="item-name"><a class="mod" href="watcher/index.html" title="mod iroh::watcher">watcher</a></div><div class="desc docblock-short">Watchable values.</div></li></ul><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.NodeAddr.html" title="struct iroh::NodeAddr">Node<wbr>Addr</a></div><div class="desc docblock-short">Network-level addressing information for an iroh node.</div></li><li><div class="item-name"><a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">Public<wbr>Key</a></div><div class="desc docblock-short">A public key.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayMap.html" title="struct iroh::RelayMap">Relay<wbr>Map</a></div><div class="desc docblock-short">Configuration of all the relay servers that can be used.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayNode.html" title="struct iroh::RelayNode">Relay<wbr>Node</a></div><div class="desc docblock-short">Information on a specific relay server.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayUrl.html" title="struct iroh::RelayUrl">Relay<wbr>Url</a></div><div class="desc docblock-short">A URL identifying a relay server.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayUrlParseError.html" title="struct iroh::RelayUrlParseError">Relay<wbr>UrlParse<wbr>Error</a></div><div class="desc docblock-short">Can occur when parsing a string into a <a href="struct.RelayUrl.html" title="struct iroh::RelayUrl"><code>RelayUrl</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.SecretKey.html" title="struct iroh::SecretKey">Secret<wbr>Key</a></div><div class="desc docblock-short">A secret key.</div></li></ul><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="enum" href="enum.KeyParsingError.html" title="enum iroh::KeyParsingError">KeyParsing<wbr>Error</a></div><div class="desc docblock-short">Error when deserialising a <a href="struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> or a <a href="struct.SecretKey.html" title="struct iroh::SecretKey"><code>SecretKey</code></a>.</div></li><li><div class="item-name"><a class="enum" href="enum.RelayProtocol.html" title="enum iroh::RelayProtocol">Relay<wbr>Protocol</a></div><div class="desc docblock-short">The HTTP upgrade protocol used for relaying.</div></li></ul><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="type" href="type.NodeId.html" title="type iroh::NodeId">NodeId</a></div><div class="desc docblock-short">The identifier for a node in the (iroh) network.</div></li></ul></section></div></main></body></html>
+1 -1
View File
@@ -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="Tools for spawning an accept loop that routes incoming requests to the right protocol."><title>iroh::protocol - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 protocol</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>protocol</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/protocol.rs.html#1-497">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Tools for spawning an accept loop that routes incoming requests to the right protocol.</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="Tools for spawning an accept loop that routes incoming requests to the right protocol."><title>iroh::protocol - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 protocol</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>protocol</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/protocol.rs.html#1-498">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Tools for spawning an accept loop that routes incoming requests to the right protocol.</p>
<h3 id="example"><a class="doc-anchor" href="#example">§</a>Example</h3>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>endpoint = Endpoint::builder().discovery_n0().bind().<span class="kw">await</span><span class="question-mark">?</span>;
+1 -1
View File
@@ -1 +1 @@
window.SIDEBAR_ITEMS = {"enum":["KeyParsingError","RelayProtocol"],"mod":["defaults","discovery","dns","endpoint","metrics","net_report","node_info","protocol","test_utils","watchable"],"struct":["NodeAddr","PublicKey","RelayMap","RelayNode","RelayUrl","RelayUrlParseError","SecretKey"],"type":["NodeId"]};
window.SIDEBAR_ITEMS = {"enum":["KeyParsingError","RelayProtocol"],"mod":["defaults","discovery","dns","endpoint","metrics","net_report","node_info","protocol","test_utils","watcher"],"struct":["NodeAddr","PublicKey","RelayMap","RelayNode","RelayUrl","RelayUrlParseError","SecretKey"],"type":["NodeId"]};
-10
View File
@@ -1,10 +0,0 @@
<!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="Watchable values."><title>iroh::watchable - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 watchable</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>watchable</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/watchable.rs.html#1-549">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Watchable values.</p>
<p>A <a href="struct.Watchable.html" title="struct iroh::watchable::Watchable"><code>Watchable</code></a> exists to keep track of a value which may change over time. It allows
observers to be notified of changes to the value. The aim is to always be aware of the
<strong>last</strong> value, not to observe <em>every</em> value change.</p>
<p>In that way, a <a href="struct.Watchable.html" title="struct iroh::watchable::Watchable"><code>Watchable</code></a> is like a [<code>tokio::sync::broadcast::Sender</code>] (and a
<a href="struct.Watcher.html" title="struct iroh::watchable::Watcher"><code>Watcher</code></a> is like a [<code>tokio::sync::broadcast::Receiver</code>]), except that there’s no risk
of the channel filling up, but instead you might miss items.</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Disconnected.html" title="struct iroh::watchable::Disconnected">Disconnected</a></div><div class="desc docblock-short">The error for when a <a href="struct.Watcher.html" title="struct iroh::watchable::Watcher"><code>Watcher</code></a> is disconnected from its underlying
<a href="struct.Watchable.html" title="struct iroh::watchable::Watchable"><code>Watchable</code></a> value, because of that watchable having been dropped.</div></li><li><div class="item-name"><a class="struct" href="struct.WatchInitializedFut.html" title="struct iroh::watchable::WatchInitializedFut">Watch<wbr>Initialized<wbr>Fut</a></div><div class="desc docblock-short">Future returning the current or next value that’s <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.Some" title="variant core::option::Option::Some"><code>Some</code></a> value.
in a <a href="struct.Watcher.html" title="struct iroh::watchable::Watcher"><code>Watcher</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.WatchNextFut.html" title="struct iroh::watchable::WatchNextFut">Watch<wbr>Next<wbr>Fut</a></div><div class="desc docblock-short">Future returning the next item after the current one in a <a href="struct.Watcher.html" title="struct iroh::watchable::Watcher"><code>Watcher</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Watchable.html" title="struct iroh::watchable::Watchable">Watchable</a></div><div class="desc docblock-short">A wrapper around a value that notifies <a href="struct.Watcher.html" title="struct iroh::watchable::Watcher"><code>Watcher</code></a>s when the value is modified.</div></li><li><div class="item-name"><a class="struct" href="struct.Watcher.html" title="struct iroh::watchable::Watcher">Watcher</a></div><div class="desc docblock-short">An observer for a value.</div></li><li><div class="item-name"><a class="struct" href="struct.WatcherStream.html" title="struct iroh::watchable::WatcherStream">Watcher<wbr>Stream</a></div><div class="desc docblock-short">A stream for a <a href="struct.Watcher.html" title="struct iroh::watchable::Watcher"><code>Watcher</code></a>’s next values.</div></li></ul></section></div></main></body></html>
@@ -1 +0,0 @@
window.SIDEBAR_ITEMS = {"struct":["Disconnected","WatchInitializedFut","WatchNextFut","Watchable","Watcher","WatcherStream"]};
+13
View File
@@ -0,0 +1,13 @@
<!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="Watchable values."><title>iroh::watcher - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 watcher</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="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>watcher</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/watcher.rs.html#1-694">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Watchable values.</p>
<p>A <a href="struct.Watchable.html" title="struct iroh::watcher::Watchable"><code>Watchable</code></a> exists to keep track of a value which may change over time. It allows
observers to be notified of changes to the value. The aim is to always be aware of the
<strong>last</strong> value, not to observe <em>every</em> value change.</p>
<p>In that way, a <a href="struct.Watchable.html" title="struct iroh::watcher::Watchable"><code>Watchable</code></a> is like a [<code>tokio::sync::broadcast::Sender</code>] (and a
<a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a> is like a [<code>tokio::sync::broadcast::Receiver</code>]), except that there’s no risk
of the channel filling up, but instead you might miss items.</p>
<p>This module is meant to be imported like this (if you use all of these things):</p>
<div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">use </span>iroh::watcher::{<span class="self">self</span>, Watchable, Watcher <span class="kw">as _</span>};</code></pre></div>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Direct.html" title="struct iroh::watcher::Direct">Direct</a></div><div class="desc docblock-short">The immediate, direct observer of a <a href="struct.Watchable.html" title="struct iroh::watcher::Watchable"><code>Watchable</code></a> value.</div></li><li><div class="item-name"><a class="struct" href="struct.Disconnected.html" title="struct iroh::watcher::Disconnected">Disconnected</a></div><div class="desc docblock-short">The error for when a <a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a> is disconnected from its underlying
<a href="struct.Watchable.html" title="struct iroh::watcher::Watchable"><code>Watchable</code></a> value, because of that watchable having been dropped.</div></li><li><div class="item-name"><a class="struct" href="struct.InitializedFut.html" title="struct iroh::watcher::InitializedFut">Initialized<wbr>Fut</a></div><div class="desc docblock-short">Future returning the current or next value that’s <a href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html#variant.Some" title="variant core::option::Option::Some"><code>Some</code></a> value.
in a <a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Map.html" title="struct iroh::watcher::Map">Map</a></div><div class="desc docblock-short">Wraps a <a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a> to allow observing a derived value.</div></li><li><div class="item-name"><a class="struct" href="struct.NextFut.html" title="struct iroh::watcher::NextFut">NextFut</a></div><div class="desc docblock-short">Future returning the next item after the current one in a <a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Stream.html" title="struct iroh::watcher::Stream">Stream</a></div><div class="desc docblock-short">A stream for a <a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a>’s next values.</div></li><li><div class="item-name"><a class="struct" href="struct.Watchable.html" title="struct iroh::watcher::Watchable">Watchable</a></div><div class="desc docblock-short">A wrapper around a value that notifies <a href="trait.Watcher.html" title="trait iroh::watcher::Watcher"><code>Watcher</code></a>s when the value is modified.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.Watcher.html" title="trait iroh::watcher::Watcher">Watcher</a></div><div class="desc docblock-short">A handle to a value that’s represented by one or more underlying <a href="struct.Watchable.html" title="struct iroh::watcher::Watchable"><code>Watchable</code></a>s.</div></li></ul></section></div></main></body></html>
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {"struct":["Direct","Disconnected","InitializedFut","Map","NextFut","Stream","Watchable"],"trait":["Watcher"]};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
<!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="API documentation for the Rust `ALPN` constant in crate `iroh_bench`."><title>ALPN in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 constant"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Constant <span class="constant">ALPN</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_bench/iroh.rs.html#18">Source</a> </span></div><pre class="rust item-decl"><code>pub const ALPN: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>] = b&quot;n0/iroh-bench/0&quot;;</code></pre></section></div></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ALPN` constant in crate `iroh_bench`."><title>ALPN in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 constant"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Constant <span class="constant">ALPN</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_bench/iroh.rs.html#19">Source</a> </span></div><pre class="rust item-decl"><code>pub const ALPN: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>] = b&quot;n0/iroh-bench/0&quot;;</code></pre></section></div></main></body></html>
+1 -1
View File
@@ -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="Create and run a client"><title>client in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">client</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#66-82">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn client(
<!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="Create and run a client"><title>client in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">client</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#67-83">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn client(
server_addr: <a class="struct" href="../../iroh_base/node_addr/struct.NodeAddr.html" title="struct iroh_base::node_addr::NodeAddr">NodeAddr</a>,
relay_url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;,
opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>,
@@ -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="Create a client endpoint and client connection"><title>connect_client in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">connect_client</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#85-127">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn connect_client(
<!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="Create a client endpoint and client connection"><title>connect_client in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">connect_client</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#86-128">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn connect_client(
server_addr: <a class="struct" href="../../iroh_base/node_addr/struct.NodeAddr.html" title="struct iroh_base::node_addr::NodeAddr">NodeAddr</a>,
relay_url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;,
opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>,
@@ -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="API documentation for the Rust `handle_client_stream` fn in crate `iroh_bench`."><title>handle_client_stream in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">handle_client_stream</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_bench/iroh.rs.html#222-243">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn handle_client_stream(
<!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="API documentation for the Rust `handle_client_stream` fn in crate `iroh_bench`."><title>handle_client_stream in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">handle_client_stream</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_bench/iroh.rs.html#223-244">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn handle_client_stream(
connection: &amp;<a class="struct" href="../../iroh/endpoint/struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a>,
upload_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
read_unordered: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
+1 -1
View File
@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Take the provided endpoint and run the server"><title>server in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">server</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#246-297">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn server(endpoint: <a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>, opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.98/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Take the provided endpoint and run the server</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="Take the provided endpoint and run the server"><title>server in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">server</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#247-298">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn server(endpoint: <a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>, opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.98/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Take the provided endpoint and run the server</p>
</div></details></section></div></main></body></html>
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Creates a server endpoint which runs on the given runtime"><title>server_endpoint in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">server_endpoint</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#21-63">Source</a> </span></div><pre class="rust item-decl"><code>pub fn server_endpoint(
<!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="Creates a server endpoint which runs on the given runtime"><title>server_endpoint in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">server_endpoint</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#22-64">Source</a> </span></div><pre class="rust item-decl"><code>pub fn server_endpoint(
rt: &amp;Runtime,
relay_url: &amp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;,
opt: &amp;<a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>,
@@ -1 +1 @@
<!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="API documentation for the Rust `transport_config` fn in crate `iroh_bench`."><title>transport_config in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">transport_config</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_bench/iroh.rs.html#129-142">Source</a> </span></div><pre class="rust item-decl"><code>pub fn transport_config(max_streams: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, initial_mtu: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; TransportConfig</code></pre></section></div></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `transport_config` fn in crate `iroh_bench`."><title>transport_config in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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 fn"><!--[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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></span><h1>Function <span class="fn">transport_config</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_bench/iroh.rs.html#130-143">Source</a> </span></div><pre class="rust item-decl"><code>pub fn transport_config(max_streams: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>, initial_mtu: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>) -&gt; TransportConfig</code></pre></section></div></main></body></html>
+1 -1
View File
@@ -1 +1 @@
<!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="API documentation for the Rust `iroh` mod in crate `iroh_bench`."><title>iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module iroh</a></h2><h3><a href="#constants">Module Items</a></h3><ul class="block"><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>bench</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a></span><h1>Module <span>iroh</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_bench/iroh.rs.html#1-297">Source</a> </span></div><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.ALPN.html" title="constant iroh_bench::iroh::ALPN">ALPN</a></div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.client.html" title="fn iroh_bench::iroh::client">client</a></div><div class="desc docblock-short">Create and run a client</div></li><li><div class="item-name"><a class="fn" href="fn.connect_client.html" title="fn iroh_bench::iroh::connect_client">connect_<wbr>client</a></div><div class="desc docblock-short">Create a client endpoint and client connection</div></li><li><div class="item-name"><a class="fn" href="fn.handle_client_stream.html" title="fn iroh_bench::iroh::handle_client_stream">handle_<wbr>client_<wbr>stream</a></div></li><li><div class="item-name"><a class="fn" href="fn.server.html" title="fn iroh_bench::iroh::server">server</a></div><div class="desc docblock-short">Take the provided endpoint and run the server</div></li><li><div class="item-name"><a class="fn" href="fn.server_endpoint.html" title="fn iroh_bench::iroh::server_endpoint">server_<wbr>endpoint</a></div><div class="desc docblock-short">Creates a server endpoint which runs on the given runtime</div></li><li><div class="item-name"><a class="fn" href="fn.transport_config.html" title="fn iroh_bench::iroh::transport_config">transport_<wbr>config</a></div></li></ul></section></div></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `iroh` mod in crate `iroh_bench`."><title>iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.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_bench/index.html">iroh_<wbr>bench</a><span class="version">0.35.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module iroh</a></h2><h3><a href="#constants">Module Items</a></h3><ul class="block"><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>bench</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"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a></span><h1>Module <span>iroh</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_bench/iroh.rs.html#1-298">Source</a> </span></div><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="constant" href="constant.ALPN.html" title="constant iroh_bench::iroh::ALPN">ALPN</a></div></li></ul><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="fn" href="fn.client.html" title="fn iroh_bench::iroh::client">client</a></div><div class="desc docblock-short">Create and run a client</div></li><li><div class="item-name"><a class="fn" href="fn.connect_client.html" title="fn iroh_bench::iroh::connect_client">connect_<wbr>client</a></div><div class="desc docblock-short">Create a client endpoint and client connection</div></li><li><div class="item-name"><a class="fn" href="fn.handle_client_stream.html" title="fn iroh_bench::iroh::handle_client_stream">handle_<wbr>client_<wbr>stream</a></div></li><li><div class="item-name"><a class="fn" href="fn.server.html" title="fn iroh_bench::iroh::server">server</a></div><div class="desc docblock-short">Take the provided endpoint and run the server</div></li><li><div class="item-name"><a class="fn" href="fn.server_endpoint.html" title="fn iroh_bench::iroh::server_endpoint">server_<wbr>endpoint</a></div><div class="desc docblock-short">Creates a server endpoint which runs on the given runtime</div></li><li><div class="item-name"><a class="fn" href="fn.transport_config.html" title="fn iroh_bench::iroh::transport_config">transport_<wbr>config</a></div></li></ul></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
+2 -2
View File
@@ -1,3 +1,3 @@
var srcIndex = new Map(JSON.parse('[["bulk",["",[],["bulk.rs"]]],["iroh",["",[["discovery",[["pkarr",[],["dht.rs"]]],["dns.rs","mdns.rs","pkarr.rs","static_provider.rs"]],["endpoint",[],["rtt_actor.rs"]],["magicsock",[["node_map",[],["best_addr.rs","node_state.rs","path_state.rs","udp_paths.rs"]]],["metrics.rs","node_map.rs","relay_actor.rs","udp_conn.rs"]],["net_report",[["reportgen",[],["hairpin.rs","probes.rs"]]],["defaults.rs","dns.rs","ip_mapped_addrs.rs","metrics.rs","options.rs","ping.rs","reportgen.rs"]],["tls",[],["certificate.rs","name.rs","resolver.rs","verifier.rs"]]],["defaults.rs","disco.rs","discovery.rs","dns.rs","endpoint.rs","key.rs","lib.rs","magicsock.rs","metrics.rs","net_report.rs","protocol.rs","test_utils.rs","tls.rs","util.rs","watchable.rs"]]],["iroh_base",["",[["ticket",[],["node.rs"]]],["key.rs","lib.rs","node_addr.rs","relay_url.rs","ticket.rs"]]],["iroh_bench",["",[],["iroh.rs","lib.rs","quinn.rs","s2n.rs","stats.rs"]]],["iroh_dns_server",["",[["dns",[],["node_authority.rs"]],["http",[["doh",[],["extract.rs","response.rs"]]],["doh.rs","error.rs","pkarr.rs","rate_limiting.rs","tls.rs"]],["store",[],["signed_packets.rs"]]],["config.rs","dns.rs","http.rs","lib.rs","metrics.rs","server.rs","state.rs","store.rs","util.rs"]]],["iroh_relay",["",[["client",[],["conn.rs","streams.rs","tls.rs","util.rs"]],["protos",[],["disco.rs","relay.rs","stun.rs"]],["server",[],["client.rs","clients.rs","http_server.rs","metrics.rs","resolver.rs","streams.rs","testing.rs"]]],["client.rs","defaults.rs","dns.rs","http.rs","key_cache.rs","lib.rs","node_info.rs","ping_tracker.rs","protos.rs","quic.rs","relay_map.rs","server.rs"]]]]'));
var srcIndex = new Map(JSON.parse('[["bulk",["",[],["bulk.rs"]]],["iroh",["",[["discovery",[["pkarr",[],["dht.rs"]]],["dns.rs","mdns.rs","pkarr.rs","static_provider.rs"]],["endpoint",[],["rtt_actor.rs"]],["magicsock",[["node_map",[],["best_addr.rs","node_state.rs","path_state.rs","udp_paths.rs"]]],["metrics.rs","node_map.rs","relay_actor.rs","udp_conn.rs"]],["net_report",[["reportgen",[],["hairpin.rs","probes.rs"]]],["defaults.rs","dns.rs","ip_mapped_addrs.rs","metrics.rs","options.rs","ping.rs","reportgen.rs"]],["tls",[],["certificate.rs","name.rs","resolver.rs","verifier.rs"]]],["defaults.rs","disco.rs","discovery.rs","dns.rs","endpoint.rs","key.rs","lib.rs","magicsock.rs","metrics.rs","net_report.rs","protocol.rs","test_utils.rs","tls.rs","util.rs","watcher.rs"]]],["iroh_base",["",[["ticket",[],["node.rs"]]],["key.rs","lib.rs","node_addr.rs","relay_url.rs","ticket.rs"]]],["iroh_bench",["",[],["iroh.rs","lib.rs","quinn.rs","s2n.rs","stats.rs"]]],["iroh_dns_server",["",[["dns",[],["node_authority.rs"]],["http",[["doh",[],["extract.rs","response.rs"]]],["doh.rs","error.rs","pkarr.rs","rate_limiting.rs","tls.rs"]],["store",[],["signed_packets.rs"]]],["config.rs","dns.rs","http.rs","lib.rs","metrics.rs","server.rs","state.rs","store.rs","util.rs"]]],["iroh_relay",["",[["client",[],["conn.rs","streams.rs","tls.rs","util.rs"]],["protos",[],["disco.rs","relay.rs","stun.rs"]],["server",[],["client.rs","clients.rs","http_server.rs","metrics.rs","resolver.rs","streams.rs","testing.rs"]]],["client.rs","defaults.rs","dns.rs","http.rs","key_cache.rs","lib.rs","node_info.rs","ping_tracker.rs","protos.rs","quic.rs","relay_map.rs","server.rs"]]]]'));
createSrcSidebar();
//{"start":36,"fragment_lengths":[28,715,109,75,306,392]}
//{"start":36,"fragment_lengths":[28,713,109,75,306,392]}
+14 -8
View File
@@ -1072,7 +1072,10 @@
<a href="#1071" id="1071">1071</a>
<a href="#1072" id="1072">1072</a>
<a href="#1073" id="1073">1073</a>
<a href="#1074" id="1074">1074</a></pre></div><pre class="rust"><code><span class="doccomment">//! Node address discovery.
<a href="#1074" id="1074">1074</a>
<a href="#1075" id="1075">1075</a>
<a href="#1076" id="1076">1076</a>
<a href="#1077" id="1077">1077</a></pre></div><pre class="rust"><code><span class="doccomment">//! Node address discovery.
//!
//! To connect to an iroh node a [`NodeAddr`] is needed, which may contain a
//! [`RelayUrl`] or one or more *direct addresses* in addition to the [`NodeId`].
@@ -1639,7 +1642,7 @@
<span class="kw">use </span>tracing_test::traced_test;
<span class="kw">use super</span>::<span class="kw-2">*</span>;
<span class="kw">use crate</span>::{endpoint::ConnectOptions, RelayMode};
<span class="kw">use crate</span>::{endpoint::ConnectOptions, watcher::Watcher <span class="kw">as _</span>, RelayMode};
<span class="kw">type </span>InfoStore = HashMap&lt;NodeId, (NodeData, u64)&gt;;
@@ -1786,7 +1789,7 @@
</span>};
<span class="kw">let </span>ep1_addr = NodeAddr::new(ep1.node_id());
<span class="comment">// wait for our address to be updated and thus published at least once
</span>ep1.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
</span>ep1.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>_conn = ep2.connect(ep1_addr, TEST_ALPN).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}
@@ -1812,7 +1815,10 @@
</span>};
<span class="kw">let </span>ep1_addr = NodeAddr::new(ep1.node_id());
<span class="comment">// wait for out address to be updated and thus published at least once
</span>ep1.node_addr().<span class="kw">await</span>.context(<span class="string">"waiting for NodeAddr"</span>)<span class="question-mark">?</span>;
</span>ep1.node_addr()
.initialized()
.<span class="kw">await
</span>.context(<span class="string">"waiting for NodeAddr"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>_conn = ep2
.connect(ep1_addr, TEST_ALPN)
.<span class="kw">await
@@ -1844,7 +1850,7 @@
new_endpoint(secret, disco).<span class="kw">await
</span>};
<span class="comment">// wait for out address to be updated and thus published at least once
</span>ep1.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
</span>ep1.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>_conn = ep2.connect(ep1.node_id(), TEST_ALPN).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}
@@ -1866,7 +1872,7 @@
new_endpoint(secret, disco).<span class="kw">await
</span>};
<span class="comment">// wait for out address to be updated and thus published at least once
</span>ep1.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
</span>ep1.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="comment">// 10x faster test via a 3s idle timeout instead of the 30s default
</span><span class="kw">let </span><span class="kw-2">mut </span>config = TransportConfig::default();
@@ -1899,7 +1905,7 @@
new_endpoint(secret, disco).<span class="kw">await
</span>};
<span class="comment">// wait for out address to be updated and thus published at least once
</span>ep1.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
</span>ep1.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>ep1_wrong_addr = NodeAddr {
node_id: ep1.node_id(),
relay_url: <span class="prelude-val">None</span>,
@@ -1927,7 +1933,7 @@
<span class="kw">let </span><span class="kw-2">mut </span>stream = ep1.discovery_stream();
<span class="comment">// wait for ep2 node addr to be updated and connect from ep1 -&gt; discovery via resolve
</span>ep2.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
</span>ep2.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let _ </span>= ep1.connect(ep2.node_id(), TEST_ALPN).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>item = tokio::time::timeout(Duration::from_secs(<span class="number">1</span>), stream.next())
+1 -1
View File
@@ -552,7 +552,7 @@
<span class="kw">use crate</span>::{
discovery::{Discovery, DiscoveryItem, NodeData, NodeInfo},
watchable::Watchable,
watcher::{Watchable, Watcher <span class="kw">as _</span>},
Endpoint,
};
@@ -470,7 +470,7 @@
<span class="kw">use crate</span>::{
discovery::{Discovery, DiscoveryItem, NodeData},
endpoint::force_staging_infra,
watchable::{Disconnected, Watchable, Watcher},
watcher::{<span class="self">self</span>, Disconnected, Watchable, Watcher <span class="kw">as _</span>},
Endpoint,
};
@@ -626,7 +626,7 @@
</span>secret_key: SecretKey,
<span class="attr">#[debug(<span class="string">"PkarrClient"</span>)]
</span>pkarr_client: PkarrRelayClient,
watcher: Watcher&lt;<span class="prelude-ty">Option</span>&lt;NodeInfo&gt;&gt;,
watcher: watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;NodeInfo&gt;&gt;,
ttl: u32,
republish_interval: Duration,
}
+223 -79
View File
@@ -3112,7 +3112,79 @@
<a href="#3111" id="3111">3111</a>
<a href="#3112" id="3112">3112</a>
<a href="#3113" id="3113">3113</a>
<a href="#3114" id="3114">3114</a></pre></div><pre class="rust"><code><span class="doccomment">//! The [`Endpoint`] allows establishing connections to other iroh nodes.
<a href="#3114" id="3114">3114</a>
<a href="#3115" id="3115">3115</a>
<a href="#3116" id="3116">3116</a>
<a href="#3117" id="3117">3117</a>
<a href="#3118" id="3118">3118</a>
<a href="#3119" id="3119">3119</a>
<a href="#3120" id="3120">3120</a>
<a href="#3121" id="3121">3121</a>
<a href="#3122" id="3122">3122</a>
<a href="#3123" id="3123">3123</a>
<a href="#3124" id="3124">3124</a>
<a href="#3125" id="3125">3125</a>
<a href="#3126" id="3126">3126</a>
<a href="#3127" id="3127">3127</a>
<a href="#3128" id="3128">3128</a>
<a href="#3129" id="3129">3129</a>
<a href="#3130" id="3130">3130</a>
<a href="#3131" id="3131">3131</a>
<a href="#3132" id="3132">3132</a>
<a href="#3133" id="3133">3133</a>
<a href="#3134" id="3134">3134</a>
<a href="#3135" id="3135">3135</a>
<a href="#3136" id="3136">3136</a>
<a href="#3137" id="3137">3137</a>
<a href="#3138" id="3138">3138</a>
<a href="#3139" id="3139">3139</a>
<a href="#3140" id="3140">3140</a>
<a href="#3141" id="3141">3141</a>
<a href="#3142" id="3142">3142</a>
<a href="#3143" id="3143">3143</a>
<a href="#3144" id="3144">3144</a>
<a href="#3145" id="3145">3145</a>
<a href="#3146" id="3146">3146</a>
<a href="#3147" id="3147">3147</a>
<a href="#3148" id="3148">3148</a>
<a href="#3149" id="3149">3149</a>
<a href="#3150" id="3150">3150</a>
<a href="#3151" id="3151">3151</a>
<a href="#3152" id="3152">3152</a>
<a href="#3153" id="3153">3153</a>
<a href="#3154" id="3154">3154</a>
<a href="#3155" id="3155">3155</a>
<a href="#3156" id="3156">3156</a>
<a href="#3157" id="3157">3157</a>
<a href="#3158" id="3158">3158</a>
<a href="#3159" id="3159">3159</a>
<a href="#3160" id="3160">3160</a>
<a href="#3161" id="3161">3161</a>
<a href="#3162" id="3162">3162</a>
<a href="#3163" id="3163">3163</a>
<a href="#3164" id="3164">3164</a>
<a href="#3165" id="3165">3165</a>
<a href="#3166" id="3166">3166</a>
<a href="#3167" id="3167">3167</a>
<a href="#3168" id="3168">3168</a>
<a href="#3169" id="3169">3169</a>
<a href="#3170" id="3170">3170</a>
<a href="#3171" id="3171">3171</a>
<a href="#3172" id="3172">3172</a>
<a href="#3173" id="3173">3173</a>
<a href="#3174" id="3174">3174</a>
<a href="#3175" id="3175">3175</a>
<a href="#3176" id="3176">3176</a>
<a href="#3177" id="3177">3177</a>
<a href="#3178" id="3178">3178</a>
<a href="#3179" id="3179">3179</a>
<a href="#3180" id="3180">3180</a>
<a href="#3181" id="3181">3181</a>
<a href="#3182" id="3182">3182</a>
<a href="#3183" id="3183">3183</a>
<a href="#3184" id="3184">3184</a>
<a href="#3185" id="3185">3185</a>
<a href="#3186" id="3186">3186</a></pre></div><pre class="rust"><code><span class="doccomment">//! The [`Endpoint`] allows establishing connections to other iroh nodes.
//!
//! The [`Endpoint`] is the main API interface to manage a local iroh node. It allows
//! connecting to and accepting connections from other nodes. See the [module docs] for
@@ -3157,7 +3229,7 @@
metrics::EndpointMetrics,
net_report::Report,
tls,
watchable::Watcher,
watcher::{<span class="self">self</span>, Watcher},
RelayProtocol,
};
@@ -3194,6 +3266,29 @@
<span class="kw">type </span>DiscoveryBuilder = Box&lt;<span class="kw">dyn </span>FnOnce(<span class="kw-2">&amp;</span>SecretKey) -&gt; <span class="prelude-ty">Option</span>&lt;Box&lt;<span class="kw">dyn </span>Discovery&gt;&gt; + Send + Sync&gt;;
<span class="doccomment">/// A type alias for the return value of [`Endpoint::node_addr`].
///
/// This type implements [`Watcher`] with `Value` being an optional [`NodeAddr`].
///
/// We return a named type instead of `impl Watcher&lt;Value = NodeAddr&gt;`, as this allows
/// you to e.g. store the watcher in a struct.
</span><span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">pub type </span>NodeAddrWatcher = watcher::Map&lt;
(
watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;BTreeSet&lt;DirectAddr&gt;&gt;&gt;,
watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;RelayUrl&gt;&gt;,
),
<span class="prelude-ty">Option</span>&lt;NodeAddr&gt;,
&gt;;
<span class="doccomment">/// A type alias for the return value of [`Endpoint::node_addr`].
///
/// This type implements [`Watcher`] with `Value` being an optional [`NodeAddr`].
///
/// We return a named type instead of `impl Watcher&lt;Value = NodeAddr&gt;`, as this allows
/// you to e.g. store the watcher in a struct.
</span><span class="attr">#[cfg(wasm_browser)]
</span><span class="kw">pub type </span>NodeAddrWatcher = watcher::Map&lt;watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;RelayUrl&gt;&gt;, <span class="prelude-ty">Option</span>&lt;NodeAddr&gt;&gt;;
<span class="doccomment">/// Defines the mode of path selection for all traffic flowing through
/// the endpoint.
</span><span class="attr">#[cfg(any(test, feature = <span class="string">"test-utils"</span>))]
@@ -3978,35 +4073,67 @@
<span class="self">self</span>.static_config.tls_config.secret_key.public()
}
<span class="doccomment">/// Returns the current [`NodeAddr`] for this endpoint.
<span class="doccomment">/// Returns a [`Watcher`] for the current [`NodeAddr`] for this endpoint.
///
/// The returned [`NodeAddr`] will have the current [`RelayUrl`] and direct addresses
/// as they would be returned by [`Endpoint::home_relay`] and
/// [`Endpoint::direct_addresses`].
/// The observed [`NodeAddr`] will have the current [`RelayUrl`] and direct addresses
/// as they would be returned by [`Endpoint::home_relay`] and [`Endpoint::direct_addresses`].
///
/// In browsers, because direct addresses are unavailable, this will only wait for
/// the home relay to be available before returning.
</span><span class="kw">pub async fn </span>node_addr(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;NodeAddr&gt; {
<span class="attr">#[cfg(not(wasm_browser))]
</span>{
<span class="comment">// Outside browsers, we preserve the "old" behavior of waiting for direct
// addresses and then adding the relay URL (should we have it)
</span><span class="kw">let </span>addrs = <span class="self">self</span>.direct_addresses().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>relay = <span class="self">self</span>.home_relay().get()<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(NodeAddr::from_parts(
<span class="self">self</span>.node_id(),
relay,
addrs.into_iter().map(|x| x.addr),
))
}
<span class="attr">#[cfg(wasm_browser)]
</span>{
<span class="comment">// In browsers, there will never be any direct addresses, so we wait
// for the home relay instead. This make the `NodeAddr` have *some* way
// of connecting to us.
</span><span class="kw">let </span>relay = <span class="self">self</span>.home_relay().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(NodeAddr::new(<span class="self">self</span>.node_id()).with_relay_url(relay))
}
/// Use [`Watcher::initialized`] to wait for a [`NodeAddr`] that is ready to be connected to:
///
/// ```no_run
/// # async fn wrapper() -&gt; testresult::TestResult {
/// use iroh::{watcher::Watcher, Endpoint};
///
/// let endpoint = Endpoint::builder()
/// .alpns(vec![b"my-alpn".to_vec()])
/// .bind()
/// .await?;
/// let node_addr = endpoint.node_addr().initialized().await?;
/// # let _ = node_addr;
/// # Ok(())
/// # }
/// ```
</span><span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">pub fn </span>node_addr(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; NodeAddrWatcher {
<span class="kw">let </span>watch_addrs = <span class="self">self</span>.direct_addresses();
<span class="kw">let </span>watch_relay = <span class="self">self</span>.home_relay();
<span class="kw">let </span>node_id = <span class="self">self</span>.node_id();
watch_addrs
.or(watch_relay)
.map(<span class="kw">move </span>|(addrs, relay)| <span class="kw">match </span>(addrs, relay) {
(<span class="prelude-val">Some</span>(addrs), relay) =&gt; <span class="prelude-val">Some</span>(NodeAddr::from_parts(
node_id,
relay,
addrs.into_iter().map(|x| x.addr),
)),
(<span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(relay)) =&gt; <span class="prelude-val">Some</span>(NodeAddr::from_parts(
node_id,
<span class="prelude-val">Some</span>(relay),
std::iter::empty(),
)),
(<span class="prelude-val">None</span>, <span class="prelude-val">None</span>) =&gt; <span class="prelude-val">None</span>,
})
.expect(<span class="string">"watchable is alive - cannot be disconnected yet"</span>)
}
<span class="doccomment">/// Returns a [`Watcher`] for the current [`NodeAddr`] for this endpoint.
///
/// When compiled to Wasm, this function returns a watcher that initializes
/// with a [`NodeAddr`] that only contains a relay URL, but no direct addresses,
/// as there are no APIs for directly using sockets in browsers.
</span><span class="attr">#[cfg(wasm_browser)]
</span><span class="kw">pub fn </span>node_addr(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; NodeAddrWatcher {
<span class="comment">// In browsers, there will never be any direct addresses, so we wait
// for the home relay instead. This makes the `NodeAddr` have *some* way
// of connecting to us.
</span><span class="kw">let </span>watch_relay = <span class="self">self</span>.home_relay();
<span class="kw">let </span>node_id = <span class="self">self</span>.node_id();
watch_relay
.map(<span class="kw">move </span>|relay| {
relay.map(|relay| NodeAddr::from_parts(node_id, <span class="prelude-val">Some</span>(relay), std::iter::empty()))
})
.expect(<span class="string">"watchable is alive - cannot be disconnected yet"</span>)
}
<span class="doccomment">/// Returns a [`Watcher`] for the [`RelayUrl`] of the Relay server used as home relay.
@@ -4026,7 +4153,7 @@
/// To wait for a home relay connection to be established, use [`Watcher::initialized`]:
/// ```no_run
/// use futures_lite::StreamExt;
/// use iroh::Endpoint;
/// use iroh::{watcher::Watcher, Endpoint};
///
/// # let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
/// # rt.block_on(async move {
@@ -4034,7 +4161,7 @@
/// let _relay_url = mep.home_relay().initialized().await.unwrap();
/// # });
/// ```
</span><span class="kw">pub fn </span>home_relay(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;RelayUrl&gt;&gt; {
</span><span class="kw">pub fn </span>home_relay(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;RelayUrl&gt;&gt; {
<span class="self">self</span>.msock.home_relay()
}
@@ -4062,7 +4189,7 @@
/// To get the first set of direct addresses use [`Watcher::initialized`]:
/// ```no_run
/// use futures_lite::StreamExt;
/// use iroh::Endpoint;
/// use iroh::{watcher::Watcher, Endpoint};
///
/// # let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
/// # rt.block_on(async move {
@@ -4072,7 +4199,7 @@
/// ```
///
/// [STUN]: https://en.wikipedia.org/wiki/STUN
</span><span class="kw">pub fn </span>direct_addresses(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;BTreeSet&lt;DirectAddr&gt;&gt;&gt; {
</span><span class="kw">pub fn </span>direct_addresses(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;BTreeSet&lt;DirectAddr&gt;&gt;&gt; {
<span class="self">self</span>.msock.direct_addresses()
}
@@ -4097,7 +4224,7 @@
/// To get the first report use [`Watcher::initialized`]:
/// ```no_run
/// use futures_lite::StreamExt;
/// use iroh::Endpoint;
/// use iroh::{watcher::Watcher, Endpoint};
///
/// # let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
/// # rt.block_on(async move {
@@ -4106,7 +4233,7 @@
/// # });
/// ```
</span><span class="attr">#[doc(hidden)]
</span><span class="kw">pub fn </span>net_report(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;Arc&lt;Report&gt;&gt;&gt; {
</span><span class="kw">pub fn </span>net_report(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;Arc&lt;Report&gt;&gt;&gt; {
<span class="self">self</span>.msock.net_report()
}
@@ -4207,7 +4334,7 @@
/// # Errors
///
/// Will error if we do not have any address information for the given `node_id`.
</span><span class="kw">pub fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; <span class="prelude-ty">Result</span>&lt;Watcher&lt;ConnectionType&gt;&gt; {
</span><span class="kw">pub fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; <span class="prelude-ty">Result</span>&lt;watcher::Direct&lt;ConnectionType&gt;&gt; {
<span class="self">self</span>.msock.conn_type(node_id)
}
@@ -5293,7 +5420,7 @@
<span class="kw">use </span>iroh_metrics::MetricsSource;
<span class="kw">use </span>iroh_relay::http::Protocol;
<span class="kw">use </span>n0_future::StreamExt;
<span class="kw">use </span>n0_future::{task::AbortOnDropHandle, StreamExt};
<span class="kw">use </span>rand::SeedableRng;
<span class="kw">use </span>testresult::TestResult;
<span class="kw">use </span>tracing::{error_span, info, info_span, Instrument};
@@ -5312,7 +5439,7 @@
.bind()
.<span class="kw">await
</span>.unwrap();
<span class="kw">let </span>my_addr = ep.node_addr().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>my_addr = ep.node_addr().initialized().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>res = ep.connect(my_addr.clone(), TEST_ALPN).<span class="kw">await</span>;
<span class="macro">assert!</span>(res.is_err());
<span class="kw">let </span>err = res.err().unwrap();
@@ -5580,11 +5707,13 @@
<span class="kw">let </span>(relay_map, _relay_url, _guard) = run_relay_server().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>client = Endpoint::builder()
.relay_conn_protocol(Protocol::Websocket)
.insecure_skip_relay_cert_verify(<span class="bool-val">true</span>)
.relay_mode(RelayMode::Custom(relay_map.clone()))
.bind()
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server = Endpoint::builder()
.relay_conn_protocol(Protocol::Websocket)
.insecure_skip_relay_cert_verify(<span class="bool-val">true</span>)
.relay_mode(RelayMode::Custom(relay_map))
.alpns(<span class="macro">vec!</span>[TEST_ALPN.to_vec()])
.bind()
@@ -5607,7 +5736,7 @@
}
});
<span class="kw">let </span>addr = server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>addr = server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>conn = client.connect(addr, TEST_ALPN).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>(<span class="kw-2">mut </span>send, <span class="kw-2">mut </span>recv) = conn.open_bi().<span class="kw">await</span><span class="question-mark">?</span>;
send.write_all(<span class="string">b"Hello, world!"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
@@ -5657,8 +5786,8 @@
};
<span class="kw">let </span>ep2 = ep2.bind().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>ep1_nodeaddr = ep1.node_addr().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>ep2_nodeaddr = ep2.node_addr().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>ep1_nodeaddr = ep1.node_addr().initialized().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>ep2_nodeaddr = ep2.node_addr().initialized().<span class="kw">await</span>.unwrap();
ep1.add_node_addr(ep2_nodeaddr.clone()).unwrap();
ep2.add_node_addr(ep1_nodeaddr.clone()).unwrap();
<span class="kw">let </span>ep1_nodeid = ep1.node_id();
@@ -5734,9 +5863,9 @@
<span class="attr">#[tokio::test]
#[traced_test]
</span><span class="kw">async fn </span>endpoint_conn_type_stream() {
</span><span class="kw">async fn </span>endpoint_conn_type_becomes_direct() -&gt; TestResult {
<span class="kw">const </span>TIMEOUT: Duration = std::time::Duration::from_secs(<span class="number">15</span>);
<span class="kw">let </span>(relay_map, _relay_url, _relay_guard) = run_relay_server().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>(relay_map, _relay_url, _relay_guard) = run_relay_server().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>rng = rand_chacha::ChaCha8Rng::seed_from_u64(<span class="number">42</span>);
<span class="kw">let </span>ep1_secret_key = SecretKey::generate(<span class="kw-2">&amp;mut </span>rng);
<span class="kw">let </span>ep2_secret_key = SecretKey::generate(<span class="kw-2">&amp;mut </span>rng);
@@ -5746,18 +5875,16 @@
.alpns(<span class="macro">vec!</span>[TEST_ALPN.to_vec()])
.relay_mode(RelayMode::Custom(relay_map.clone()))
.bind()
.<span class="kw">await
</span>.unwrap();
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>ep2 = Endpoint::builder()
.secret_key(ep2_secret_key)
.insecure_skip_relay_cert_verify(<span class="bool-val">true</span>)
.alpns(<span class="macro">vec!</span>[TEST_ALPN.to_vec()])
.relay_mode(RelayMode::Custom(relay_map))
.bind()
.<span class="kw">await
</span>.unwrap();
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">async fn </span>handle_direct_conn(ep: <span class="kw-2">&amp;</span>Endpoint, node_id: NodeId) -&gt; <span class="prelude-ty">Result</span>&lt;()&gt; {
<span class="kw">async fn </span>wait_for_conn_type_direct(ep: <span class="kw-2">&amp;</span>Endpoint, node_id: NodeId) -&gt; TestResult {
<span class="kw">let </span><span class="kw-2">mut </span>stream = ep.conn_type(node_id)<span class="question-mark">?</span>.stream();
<span class="kw">let </span>src = ep.node_id().fmt_short();
<span class="kw">let </span>dst = node_id.fmt_short();
@@ -5767,43 +5894,56 @@
<span class="kw">return </span><span class="prelude-val">Ok</span>(());
}
}
<span class="macro">anyhow::bail!</span>(<span class="string">"conn_type stream ended before `ConnectionType::Direct`"</span>);
<span class="macro">panic!</span>(<span class="string">"conn_type stream ended before `ConnectionType::Direct`"</span>);
}
<span class="kw">async fn </span>accept(ep: <span class="kw-2">&amp;</span>Endpoint) -&gt; NodeId {
<span class="kw">let </span>incoming = ep.accept().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>conn = incoming.<span class="kw">await</span>.unwrap();
<span class="kw">let </span>node_id = conn.remote_node_id().unwrap();
<span class="kw">async fn </span>accept(ep: <span class="kw-2">&amp;</span>Endpoint) -&gt; TestResult&lt;Connection&gt; {
<span class="kw">let </span>incoming = ep.accept().<span class="kw">await</span>.expect(<span class="string">"ep closed"</span>);
<span class="kw">let </span>conn = incoming.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>node_id = conn.remote_node_id()<span class="question-mark">?</span>;
<span class="macro">tracing::info!</span>(node_id=%node_id.fmt_short(), <span class="string">"accepted connection"</span>);
node_id
<span class="prelude-val">Ok</span>(conn)
}
<span class="kw">let </span>ep1_nodeid = ep1.node_id();
<span class="kw">let </span>ep2_nodeid = ep2.node_id();
<span class="kw">let </span>ep1_nodeaddr = ep1.node_addr().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>ep1_nodeaddr = ep1.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">tracing::info!</span>(
<span class="string">"node id 1 {ep1_nodeid}, relay URL {:?}"</span>,
ep1_nodeaddr.relay_url()
);
<span class="macro">tracing::info!</span>(<span class="string">"node id 2 {ep2_nodeid}"</span>);
<span class="kw">let </span>ep1_side = <span class="kw">async move </span>{
accept(<span class="kw-2">&amp;</span>ep1).<span class="kw">await</span>;
handle_direct_conn(<span class="kw-2">&amp;</span>ep1, ep2_nodeid).<span class="kw">await
</span>};
<span class="kw">let </span>ep1_side = tokio::time::timeout(TIMEOUT, <span class="kw">async move </span>{
<span class="kw">let </span>conn = accept(<span class="kw-2">&amp;</span>ep1).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>send = conn.open_uni().<span class="kw">await</span><span class="question-mark">?</span>;
wait_for_conn_type_direct(<span class="kw-2">&amp;</span>ep1, ep2_nodeid).<span class="kw">await</span><span class="question-mark">?</span>;
send.write_all(<span class="string">b"Conn is direct"</span>).<span class="kw">await</span><span class="question-mark">?</span>;
send.finish()<span class="question-mark">?</span>;
conn.closed().<span class="kw">await</span>;
TestResult::Ok(())
});
<span class="kw">let </span>ep2_side = <span class="kw">async move </span>{
ep2.connect(ep1_nodeaddr, TEST_ALPN).<span class="kw">await</span>.unwrap();
handle_direct_conn(<span class="kw-2">&amp;</span>ep2, ep1_nodeid).<span class="kw">await
</span>};
<span class="kw">let </span>ep2_side = tokio::time::timeout(TIMEOUT, <span class="kw">async move </span>{
<span class="kw">let </span>conn = ep2.connect(ep1_nodeaddr, TEST_ALPN).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>recv = conn.accept_uni().<span class="kw">await</span><span class="question-mark">?</span>;
wait_for_conn_type_direct(<span class="kw-2">&amp;</span>ep2, ep1_nodeid).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>read = recv.read_to_end(<span class="number">100</span>).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(read, <span class="string">b"Conn is direct"</span>.to_vec());
conn.close(<span class="number">0u32</span>.into(), <span class="string">b"done"</span>);
conn.closed().<span class="kw">await</span>;
TestResult::Ok(())
});
<span class="kw">let </span>res_ep1 = tokio::spawn(tokio::time::timeout(TIMEOUT, ep1_side));
<span class="kw">let </span>res_ep2 = tokio::spawn(tokio::time::timeout(TIMEOUT, ep2_side));
<span class="kw">let </span>res_ep1 = AbortOnDropHandle::new(tokio::spawn(ep1_side));
<span class="kw">let </span>res_ep2 = AbortOnDropHandle::new(tokio::spawn(ep2_side));
<span class="kw">let </span>(r1, r2) = <span class="macro">tokio::try_join!</span>(res_ep1, res_ep2).unwrap();
r1.expect(<span class="string">"ep1 timeout"</span>).unwrap();
r2.expect(<span class="string">"ep2 timeout"</span>).unwrap();
<span class="kw">let </span>(r1, r2) = <span class="macro">tokio::try_join!</span>(res_ep1, res_ep2)<span class="question-mark">?</span>;
r1<span class="question-mark">??</span>;
r2<span class="question-mark">??</span>;
<span class="prelude-val">Ok</span>(())
}
<span class="attr">#[tokio::test]
@@ -5933,9 +6073,10 @@
)
.<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="comment">// The second 0rtt attempt should work
</span>connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">true</span>).<span class="kw">await</span><span class="question-mark">?</span>;
</span>connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">true</span>)
.<span class="kw">await</span><span class="question-mark">?</span>;
client.close().<span class="kw">await</span>;
server.close().<span class="kw">await</span>;
@@ -5959,7 +6100,7 @@
)
.<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="comment">// connecting with another endpoint should not interfere with our
// TLS session ticket cache for the first endpoint:
@@ -5968,10 +6109,11 @@
<span class="macro">info_span!</span>(<span class="string">"another"</span>),
)
.<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, another.node_addr().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, another.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
another.close().<span class="kw">await</span>;
connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">true</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">true</span>)
.<span class="kw">await</span><span class="question-mark">?</span>;
client.close().<span class="kw">await</span>;
server.close().<span class="kw">await</span>;
@@ -5990,8 +6132,9 @@
<span class="kw">let </span>server_key = SecretKey::generate(rand::thread_rng());
<span class="kw">let </span>server = spawn_0rtt_server(server_key.clone(), <span class="macro">info_span!</span>(<span class="string">"server-initial"</span>)).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">true</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_err(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>).<span class="kw">await</span><span class="question-mark">?</span>;
connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">true</span>)
.<span class="kw">await</span><span class="question-mark">?</span>;
server.close().<span class="kw">await</span>;
@@ -6000,7 +6143,8 @@
<span class="comment">// we expect the client to *believe* it can 0-RTT connect to the server (hence expect_ok),
// but the server will reject the early data because it discarded necessary state
// to decrypt it when restarting.
</span>connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">false</span>).<span class="kw">await</span><span class="question-mark">?</span>;
</span>connect_client_0rtt_expect_ok(<span class="kw-2">&amp;</span>client, server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>, <span class="bool-val">false</span>)
.<span class="kw">await</span><span class="question-mark">?</span>;
client.close().<span class="kw">await</span>;
@@ -6015,7 +6159,7 @@
.alpns(<span class="macro">vec!</span>[TEST_ALPN.to_vec()])
.bind()
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_addr = server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_addr = server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_task = tokio::spawn(<span class="kw">async move </span>{
<span class="kw">let </span>incoming = server.accept().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>conn = incoming.<span class="kw">await</span><span class="question-mark">?</span>;
@@ -6064,7 +6208,7 @@
.alpns(<span class="macro">vec!</span>[TEST_ALPN.to_vec()])
.bind()
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_addr = server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_addr = server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_task = tokio::task::spawn(<span class="kw">async move </span>{
<span class="kw">let </span>conn = server
.accept()
@@ -6130,7 +6274,7 @@
.alpns(accept_alpns)
.bind()
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_addr = server.node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_addr = server.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>server_task = tokio::spawn({
<span class="kw">let </span>server = server.clone();
<span class="kw">async move </span>{
@@ -181,7 +181,7 @@
<span class="kw">use </span>tokio::sync::mpsc;
<span class="kw">use </span>tracing::{debug, info_span, Instrument};
<span class="kw">use crate</span>::{magicsock::ConnectionType, metrics::MagicsockMetrics, watchable::WatcherStream};
<span class="kw">use crate</span>::{magicsock::ConnectionType, metrics::MagicsockMetrics, watcher};
<span class="attr">#[derive(Debug)]
</span><span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">struct </span>RttHandle {
@@ -218,7 +218,7 @@
<span class="doccomment">/// The connection.
</span>connection: quinn::WeakConnectionHandle,
<span class="doccomment">/// Path changes for this connection from the magic socket.
</span>conn_type_changes: WatcherStream&lt;ConnectionType&gt;,
</span>conn_type_changes: watcher::Stream&lt;watcher::Direct&lt;ConnectionType&gt;&gt;,
<span class="doccomment">/// For reporting-only, the Node ID of this connection.
</span>node_id: NodeId,
},
@@ -238,7 +238,7 @@
<span class="attr">#[derive(Debug)]
</span><span class="kw">struct </span>MappedStream {
stream: WatcherStream&lt;ConnectionType&gt;,
stream: watcher::Stream&lt;watcher::Direct&lt;ConnectionType&gt;&gt;,
node_id: NodeId,
<span class="doccomment">/// Reference to the connection.
</span>connection: quinn::WeakConnectionHandle,
@@ -328,7 +328,7 @@
</span><span class="kw">fn </span>handle_new_connection(
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
connection: quinn::WeakConnectionHandle,
conn_type_changes: WatcherStream&lt;ConnectionType&gt;,
conn_type_changes: watcher::Stream&lt;watcher::Direct&lt;ConnectionType&gt;&gt;,
node_id: NodeId,
) {
<span class="self">self</span>.connection_events.push(MappedStream {
+1 -1
View File
@@ -514,7 +514,7 @@
<span class="kw">pub mod </span>metrics;
<span class="kw">pub mod </span>net_report;
<span class="kw">pub mod </span>protocol;
<span class="kw">pub mod </span>watchable;
<span class="kw">pub mod </span>watcher;
<span class="kw">pub use </span>endpoint::{Endpoint, RelayMode};
<span class="kw">pub use </span>iroh_base::{
+84 -16
View File
@@ -4467,7 +4467,41 @@
<a href="#4466" id="4466">4466</a>
<a href="#4467" id="4467">4467</a>
<a href="#4468" id="4468">4468</a>
<a href="#4469" id="4469">4469</a></pre></div><pre class="rust"><code><span class="doccomment">//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
<a href="#4469" id="4469">4469</a>
<a href="#4470" id="4470">4470</a>
<a href="#4471" id="4471">4471</a>
<a href="#4472" id="4472">4472</a>
<a href="#4473" id="4473">4473</a>
<a href="#4474" id="4474">4474</a>
<a href="#4475" id="4475">4475</a>
<a href="#4476" id="4476">4476</a>
<a href="#4477" id="4477">4477</a>
<a href="#4478" id="4478">4478</a>
<a href="#4479" id="4479">4479</a>
<a href="#4480" id="4480">4480</a>
<a href="#4481" id="4481">4481</a>
<a href="#4482" id="4482">4482</a>
<a href="#4483" id="4483">4483</a>
<a href="#4484" id="4484">4484</a>
<a href="#4485" id="4485">4485</a>
<a href="#4486" id="4486">4486</a>
<a href="#4487" id="4487">4487</a>
<a href="#4488" id="4488">4488</a>
<a href="#4489" id="4489">4489</a>
<a href="#4490" id="4490">4490</a>
<a href="#4491" id="4491">4491</a>
<a href="#4492" id="4492">4492</a>
<a href="#4493" id="4493">4493</a>
<a href="#4494" id="4494">4494</a>
<a href="#4495" id="4495">4495</a>
<a href="#4496" id="4496">4496</a>
<a href="#4497" id="4497">4497</a>
<a href="#4498" id="4498">4498</a>
<a href="#4499" id="4499">4499</a>
<a href="#4500" id="4500">4500</a>
<a href="#4501" id="4501">4501</a>
<a href="#4502" id="4502">4502</a>
<a href="#4503" id="4503">4503</a></pre></div><pre class="rust"><code><span class="doccomment">//! Implements a socket that can change its communication path while in use, actively searching for the best way to communicate.
//!
//! Based on tailscale/wgengine/magicsock
//!
@@ -4545,7 +4579,7 @@
key::{public_ed_box, secret_ed_box, DecryptionError, SharedSecret},
metrics::EndpointMetrics,
net_report::{<span class="self">self</span>, IpMappedAddresses, Report},
watchable::{Watchable, Watcher},
watcher::{<span class="self">self</span>, Watchable},
};
<span class="kw">mod </span>metrics;
@@ -4821,7 +4855,10 @@
/// store [`Some`] set of addresses.
///
/// To get the current direct addresses, use [`Watcher::initialized`].
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>direct_addresses(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;BTreeSet&lt;DirectAddr&gt;&gt;&gt; {
///
/// [`Watcher`]: crate::watcher::Watcher
/// [`Watcher::initialized`]: crate::watcher::Watcher::initialized
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>direct_addresses(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;BTreeSet&lt;DirectAddr&gt;&gt;&gt; {
<span class="self">self</span>.direct_addrs.addrs.watch()
}
@@ -4836,7 +4873,10 @@
/// store [`Some`] report.
///
/// To get the current `net-report`, use [`Watcher::initialized`].
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>net_report(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;Arc&lt;Report&gt;&gt;&gt; {
///
/// [`Watcher`]: crate::watcher::Watcher
/// [`Watcher::initialized`]: crate::watcher::Watcher::initialized
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>net_report(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;Arc&lt;Report&gt;&gt;&gt; {
<span class="self">self</span>.net_report.watch()
}
@@ -4844,7 +4884,10 @@
///
/// Note that this can be used to wait for the initial home relay to be known using
/// [`Watcher::initialized`].
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>home_relay(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;RelayUrl&gt;&gt; {
///
/// [`Watcher`]: crate::watcher::Watcher
/// [`Watcher::initialized`]: crate::watcher::Watcher::initialized
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>home_relay(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;<span class="prelude-ty">Option</span>&lt;RelayUrl&gt;&gt; {
<span class="self">self</span>.my_relay.watch()
}
@@ -4858,7 +4901,9 @@
///
/// Will return an error if there is no address information known about the
/// given `node_id`.
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; <span class="prelude-ty">Result</span>&lt;Watcher&lt;ConnectionType&gt;&gt; {
///
/// [`Watcher`]: crate::watcher::Watcher
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; <span class="prelude-ty">Result</span>&lt;watcher::Direct&lt;ConnectionType&gt;&gt; {
<span class="self">self</span>.node_map.conn_type(node_id)
}
@@ -6573,7 +6618,8 @@
</span><span class="attr">#[derive(Debug)]
</span><span class="kw">struct </span>RelayDatagramRecvQueue {
queue: ConcurrentQueue&lt;RelayRecvDatagram&gt;,
waker: AtomicWaker,
recv_waker: AtomicWaker,
send_waker: AtomicWaker,
}
<span class="kw">impl </span>RelayDatagramRecvQueue {
@@ -6581,7 +6627,8 @@
</span><span class="kw">fn </span>new() -&gt; <span class="self">Self </span>{
<span class="self">Self </span>{
queue: ConcurrentQueue::bounded(<span class="number">512</span>),
waker: AtomicWaker::new(),
recv_waker: AtomicWaker::new(),
send_waker: AtomicWaker::new(),
}
}
@@ -6594,10 +6641,21 @@
item: RelayRecvDatagram,
) -&gt; <span class="prelude-ty">Result</span>&lt;(), concurrent_queue::PushError&lt;RelayRecvDatagram&gt;&gt; {
<span class="self">self</span>.queue.push(item).inspect(|<span class="kw">_</span>| {
<span class="self">self</span>.waker.wake();
<span class="self">self</span>.recv_waker.wake();
})
}
<span class="kw">fn </span>poll_send_ready(<span class="kw-2">&amp;</span><span class="self">self</span>, cx: <span class="kw-2">&amp;mut </span>Context&lt;<span class="lifetime">'_</span>&gt;) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;()&gt;&gt; {
<span class="kw">if </span><span class="self">self</span>.queue.is_closed() {
Poll::Ready(<span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Queue closed"</span>)))
} <span class="kw">else if </span>!<span class="self">self</span>.queue.is_full() {
Poll::Ready(<span class="prelude-val">Ok</span>(()))
} <span class="kw">else </span>{
<span class="self">self</span>.send_waker.register(cx.waker());
Poll::Pending
}
}
<span class="doccomment">/// Polls for new items in the queue.
///
/// Although this method is available from `&amp;self`, it must not be
@@ -6612,23 +6670,31 @@
/// to be able to poll from `&amp;self`.
</span><span class="kw">fn </span>poll_recv(<span class="kw-2">&amp;</span><span class="self">self</span>, cx: <span class="kw-2">&amp;mut </span>Context) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;RelayRecvDatagram&gt;&gt; {
<span class="kw">match </span><span class="self">self</span>.queue.pop() {
<span class="prelude-val">Ok</span>(value) =&gt; Poll::Ready(<span class="prelude-val">Ok</span>(value)),
<span class="prelude-val">Ok</span>(value) =&gt; {
<span class="self">self</span>.send_waker.wake();
Poll::Ready(<span class="prelude-val">Ok</span>(value))
}
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Empty) =&gt; {
<span class="self">self</span>.waker.register(cx.waker());
<span class="self">self</span>.recv_waker.register(cx.waker());
<span class="kw">match </span><span class="self">self</span>.queue.pop() {
<span class="prelude-val">Ok</span>(value) =&gt; {
<span class="self">self</span>.waker.take();
<span class="self">self</span>.send_waker.wake();
<span class="self">self</span>.recv_waker.take();
Poll::Ready(<span class="prelude-val">Ok</span>(value))
}
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Empty) =&gt; Poll::Pending,
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Closed) =&gt; {
<span class="self">self</span>.waker.take();
<span class="self">self</span>.recv_waker.take();
<span class="self">self</span>.send_waker.wake();
Poll::Ready(<span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Queue closed"</span>)))
}
}
}
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Closed) =&gt; Poll::Ready(<span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Queue closed"</span>))),
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Closed) =&gt; {
<span class="self">self</span>.send_waker.wake();
Poll::Ready(<span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Queue closed"</span>)))
}
}
}
}
@@ -7906,7 +7972,9 @@
<span class="kw">use crate</span>::{
defaults::staging::{<span class="self">self</span>, EU_RELAY_HOSTNAME},
dns::DnsResolver,
tls, Endpoint, RelayMode,
tls,
watcher::Watcher <span class="kw">as _</span>,
Endpoint, RelayMode,
};
<span class="kw">const </span>ALPN: <span class="kw-2">&amp;</span>[u8] = <span class="string">b"n0/test/1"</span>;
@@ -8285,7 +8353,7 @@
<span class="macro">println!</span>(<span class="string">"first conn!"</span>);
<span class="kw">let </span>conn = m1
.endpoint
.connect(m2.endpoint.node_addr().<span class="kw">await</span><span class="question-mark">?</span>, ALPN)
.connect(m2.endpoint.node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>, ALPN)
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">println!</span>(<span class="string">"Closing first conn"</span>);
conn.close(<span class="number">0u32</span>.into(), <span class="string">b"bye lolz"</span>);
@@ -901,7 +901,12 @@
<a href="#900" id="900">900</a>
<a href="#901" id="901">901</a>
<a href="#902" id="902">902</a>
<a href="#903" id="903">903</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{
<a href="#903" id="903">903</a>
<a href="#904" id="904">904</a>
<a href="#905" id="905">905</a>
<a href="#906" id="906">906</a>
<a href="#907" id="907">907</a>
<a href="#908" id="908">908</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{
collections::{hash_map::Entry, BTreeSet, HashMap},
hash::Hash,
net::{IpAddr, SocketAddr},
@@ -923,7 +928,7 @@
</span><span class="kw">use </span><span class="kw">crate</span>::endpoint::PathSelection;
<span class="kw">use crate</span>::{
disco::{CallMeMaybe, Pong, SendAddr},
watchable::Watcher,
watcher,
};
<span class="kw">mod </span>best_addr;
@@ -1212,7 +1217,12 @@
///
/// Will return an error if there is not an entry in the [`NodeMap`] for
/// the `node_id`
</span><span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; anyhow::Result&lt;Watcher&lt;ConnectionType&gt;&gt; {
///
/// [`Watcher`]: crate::watcher::Watcher
</span><span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>conn_type(
<span class="kw-2">&amp;</span><span class="self">self</span>,
node_id: NodeId,
) -&gt; anyhow::Result&lt;watcher::Direct&lt;ConnectionType&gt;&gt; {
<span class="self">self</span>.inner.lock().expect(<span class="string">"poisoned"</span>).conn_type(node_id)
}
@@ -1408,7 +1418,7 @@
///
/// Will return an error if there is not an entry in the [`NodeMap`] for
/// the `public_key`
</span><span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; anyhow::Result&lt;Watcher&lt;ConnectionType&gt;&gt; {
</span><span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>, node_id: NodeId) -&gt; anyhow::Result&lt;watcher::Direct&lt;ConnectionType&gt;&gt; {
<span class="kw">match </span><span class="self">self</span>.get(NodeStateKey::NodeId(node_id)) {
<span class="prelude-val">Some</span>(ep) =&gt; <span class="prelude-val">Ok</span>(ep.conn_type()),
<span class="prelude-val">None </span>=&gt; <span class="macro">anyhow::bail!</span>(<span class="string">"No endpoint for {node_id:?} found"</span>),
@@ -1786,7 +1786,7 @@
<span class="kw">use crate</span>::{
disco::{<span class="self">self</span>, SendAddr},
magicsock::{ActorMessage, MagicsockMetrics, NodeIdMappedAddr, HEARTBEAT_INTERVAL},
watchable::{Watchable, Watcher},
watcher::{<span class="self">self</span>, Watchable},
};
<span class="doccomment">/// Number of addresses that are not active that we keep around per node.
@@ -1962,7 +1962,7 @@
<span class="self">self</span>.id
}
<span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;ConnectionType&gt; {
<span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>conn_type(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; watcher::Direct&lt;ConnectionType&gt; {
<span class="self">self</span>.conn_type.watch()
}
@@ -1676,7 +1676,118 @@
<a href="#1675" id="1675">1675</a>
<a href="#1676" id="1676">1676</a>
<a href="#1677" id="1677">1677</a>
<a href="#1678" id="1678">1678</a></pre></div><pre class="rust"><code><span class="doccomment">//! The relay actor.
<a href="#1678" id="1678">1678</a>
<a href="#1679" id="1679">1679</a>
<a href="#1680" id="1680">1680</a>
<a href="#1681" id="1681">1681</a>
<a href="#1682" id="1682">1682</a>
<a href="#1683" id="1683">1683</a>
<a href="#1684" id="1684">1684</a>
<a href="#1685" id="1685">1685</a>
<a href="#1686" id="1686">1686</a>
<a href="#1687" id="1687">1687</a>
<a href="#1688" id="1688">1688</a>
<a href="#1689" id="1689">1689</a>
<a href="#1690" id="1690">1690</a>
<a href="#1691" id="1691">1691</a>
<a href="#1692" id="1692">1692</a>
<a href="#1693" id="1693">1693</a>
<a href="#1694" id="1694">1694</a>
<a href="#1695" id="1695">1695</a>
<a href="#1696" id="1696">1696</a>
<a href="#1697" id="1697">1697</a>
<a href="#1698" id="1698">1698</a>
<a href="#1699" id="1699">1699</a>
<a href="#1700" id="1700">1700</a>
<a href="#1701" id="1701">1701</a>
<a href="#1702" id="1702">1702</a>
<a href="#1703" id="1703">1703</a>
<a href="#1704" id="1704">1704</a>
<a href="#1705" id="1705">1705</a>
<a href="#1706" id="1706">1706</a>
<a href="#1707" id="1707">1707</a>
<a href="#1708" id="1708">1708</a>
<a href="#1709" id="1709">1709</a>
<a href="#1710" id="1710">1710</a>
<a href="#1711" id="1711">1711</a>
<a href="#1712" id="1712">1712</a>
<a href="#1713" id="1713">1713</a>
<a href="#1714" id="1714">1714</a>
<a href="#1715" id="1715">1715</a>
<a href="#1716" id="1716">1716</a>
<a href="#1717" id="1717">1717</a>
<a href="#1718" id="1718">1718</a>
<a href="#1719" id="1719">1719</a>
<a href="#1720" id="1720">1720</a>
<a href="#1721" id="1721">1721</a>
<a href="#1722" id="1722">1722</a>
<a href="#1723" id="1723">1723</a>
<a href="#1724" id="1724">1724</a>
<a href="#1725" id="1725">1725</a>
<a href="#1726" id="1726">1726</a>
<a href="#1727" id="1727">1727</a>
<a href="#1728" id="1728">1728</a>
<a href="#1729" id="1729">1729</a>
<a href="#1730" id="1730">1730</a>
<a href="#1731" id="1731">1731</a>
<a href="#1732" id="1732">1732</a>
<a href="#1733" id="1733">1733</a>
<a href="#1734" id="1734">1734</a>
<a href="#1735" id="1735">1735</a>
<a href="#1736" id="1736">1736</a>
<a href="#1737" id="1737">1737</a>
<a href="#1738" id="1738">1738</a>
<a href="#1739" id="1739">1739</a>
<a href="#1740" id="1740">1740</a>
<a href="#1741" id="1741">1741</a>
<a href="#1742" id="1742">1742</a>
<a href="#1743" id="1743">1743</a>
<a href="#1744" id="1744">1744</a>
<a href="#1745" id="1745">1745</a>
<a href="#1746" id="1746">1746</a>
<a href="#1747" id="1747">1747</a>
<a href="#1748" id="1748">1748</a>
<a href="#1749" id="1749">1749</a>
<a href="#1750" id="1750">1750</a>
<a href="#1751" id="1751">1751</a>
<a href="#1752" id="1752">1752</a>
<a href="#1753" id="1753">1753</a>
<a href="#1754" id="1754">1754</a>
<a href="#1755" id="1755">1755</a>
<a href="#1756" id="1756">1756</a>
<a href="#1757" id="1757">1757</a>
<a href="#1758" id="1758">1758</a>
<a href="#1759" id="1759">1759</a>
<a href="#1760" id="1760">1760</a>
<a href="#1761" id="1761">1761</a>
<a href="#1762" id="1762">1762</a>
<a href="#1763" id="1763">1763</a>
<a href="#1764" id="1764">1764</a>
<a href="#1765" id="1765">1765</a>
<a href="#1766" id="1766">1766</a>
<a href="#1767" id="1767">1767</a>
<a href="#1768" id="1768">1768</a>
<a href="#1769" id="1769">1769</a>
<a href="#1770" id="1770">1770</a>
<a href="#1771" id="1771">1771</a>
<a href="#1772" id="1772">1772</a>
<a href="#1773" id="1773">1773</a>
<a href="#1774" id="1774">1774</a>
<a href="#1775" id="1775">1775</a>
<a href="#1776" id="1776">1776</a>
<a href="#1777" id="1777">1777</a>
<a href="#1778" id="1778">1778</a>
<a href="#1779" id="1779">1779</a>
<a href="#1780" id="1780">1780</a>
<a href="#1781" id="1781">1781</a>
<a href="#1782" id="1782">1782</a>
<a href="#1783" id="1783">1783</a>
<a href="#1784" id="1784">1784</a>
<a href="#1785" id="1785">1785</a>
<a href="#1786" id="1786">1786</a>
<a href="#1787" id="1787">1787</a>
<a href="#1788" id="1788">1788</a>
<a href="#1789" id="1789">1789</a></pre></div><pre class="rust"><code><span class="doccomment">//! The relay actor.
//!
//! The [`RelayActor`] handles all the relay connections. It is helped by the
//! [`ActiveRelayActor`] which handles a single relay connection.
@@ -1729,7 +1840,10 @@
time::{<span class="self">self</span>, Duration, Instant, MissedTickBehavior},
FuturesUnorderedBounded, SinkExt, StreamExt,
};
<span class="kw">use </span>tokio::sync::{mpsc, oneshot};
<span class="kw">use </span>tokio::sync::{
mpsc::{<span class="self">self</span>, OwnedPermit},
oneshot,
};
<span class="kw">use </span>tokio_util::sync::CancellationToken;
<span class="kw">use </span>tracing::{debug, error, event, info_span, instrument, trace, warn, Instrument, Level};
<span class="kw">use </span>url::Url;
@@ -1837,6 +1951,20 @@
<span class="doccomment">/// Token indicating the [`ActiveRelayActor`] should stop.
</span>stop_token: CancellationToken,
metrics: Arc&lt;MagicsockMetrics&gt;,
<span class="doccomment">/// Received relay packets that could not yet be forwarded to the magicsocket.
</span>pending_received: <span class="prelude-ty">Option</span>&lt;PendingRecv&gt;,
}
<span class="attr">#[derive(Debug)]
</span><span class="kw">struct </span>PendingRecv {
packet_iter: PacketSplitIter,
blocked_on: RecvPath,
}
<span class="attr">#[derive(Debug)]
</span><span class="kw">enum </span>RecvPath {
Data,
Disco,
}
<span class="attr">#[derive(Debug)]
@@ -1941,6 +2069,7 @@
inactive_timeout: Box::pin(time::sleep(RELAY_INACTIVE_CLEANUP_TIME)),
stop_token,
metrics,
pending_received: <span class="prelude-val">None</span>,
}
}
@@ -2290,7 +2419,8 @@
<span class="kw">let </span>fut = client_sink.send_all(<span class="kw-2">&amp;mut </span>packet_stream);
<span class="self">self</span>.run_sending(fut, <span class="kw-2">&amp;mut </span>state, <span class="kw-2">&amp;mut </span>client_stream).<span class="kw">await</span><span class="question-mark">?</span>;
}
msg = client_stream.next() =&gt; {
<span class="kw">_ </span>= forward_pending(<span class="kw-2">&amp;mut </span><span class="self">self</span>.pending_received, <span class="kw-2">&amp;</span><span class="self">self</span>.relay_datagrams_recv, <span class="kw-2">&amp;mut </span><span class="self">self</span>.relay_disco_recv), <span class="kw">if </span><span class="self">self</span>.pending_received.is_some() =&gt; {}
msg = client_stream.next(), <span class="kw">if </span><span class="self">self</span>.pending_received.is_none() =&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(msg) = msg <span class="kw">else </span>{
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Stream closed by server."</span>));
};
@@ -2337,33 +2467,14 @@
</span>state.last_packet_src = <span class="prelude-val">Some</span>(remote_node_id);
state.nodes_present.insert(remote_node_id);
}
<span class="kw">for </span>datagram <span class="kw">in </span>PacketSplitIter::new(<span class="self">self</span>.url.clone(), remote_node_id, data) {
<span class="kw">let </span><span class="prelude-val">Ok</span>(datagram) = datagram <span class="kw">else </span>{
<span class="macro">warn!</span>(<span class="string">"Invalid packet split"</span>);
<span class="kw">break</span>;
};
<span class="kw">match </span><span class="kw">crate</span>::disco::source_and_box_bytes(<span class="kw-2">&amp;</span>datagram.buf) {
<span class="prelude-val">Some</span>((source, sealed_box)) =&gt; {
<span class="kw">if </span>remote_node_id != source {
<span class="comment">// TODO: return here?
</span><span class="macro">warn!</span>(<span class="string">"Received relay disco message from connection for {}, but with message from {}"</span>, remote_node_id.fmt_short(), source.fmt_short());
}
<span class="kw">let </span>message = RelayDiscoMessage {
source,
sealed_box,
relay_url: datagram.url.clone(),
relay_remote_node_id: datagram.src,
};
<span class="kw">if let </span><span class="prelude-val">Err</span>(err) = <span class="self">self</span>.relay_disco_recv.try_send(message) {
<span class="macro">warn!</span>(<span class="string">"Dropping received relay disco packet: {err:#}"</span>);
}
}
<span class="prelude-val">None </span>=&gt; {
<span class="kw">if let </span><span class="prelude-val">Err</span>(err) = <span class="self">self</span>.relay_datagrams_recv.try_send(datagram) {
<span class="macro">warn!</span>(<span class="string">"Dropping received relay data packet: {err:#}"</span>);
}
}
}
<span class="kw">let </span>packet_iter = PacketSplitIter::new(<span class="self">self</span>.url.clone(), remote_node_id, data);
<span class="kw">if let </span><span class="prelude-val">Some</span>(pending) = handle_received_packet_iter(
packet_iter,
<span class="prelude-val">None</span>,
<span class="kw-2">&amp;</span><span class="self">self</span>.relay_datagrams_recv,
<span class="kw-2">&amp;mut </span><span class="self">self</span>.relay_disco_recv,
) {
<span class="self">self</span>.pending_received = <span class="prelude-val">Some</span>(pending);
}
}
ReceivedMessage::NodeGone(node_id) =&gt; {
@@ -2447,7 +2558,8 @@
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Ping timeout"</span>));
}
<span class="comment">// No need to read the inbox or datagrams to send.
</span>msg = client_stream.next() =&gt; {
</span><span class="kw">_ </span>= forward_pending(<span class="kw-2">&amp;mut </span><span class="self">self</span>.pending_received, <span class="kw-2">&amp;</span><span class="self">self</span>.relay_datagrams_recv, <span class="kw-2">&amp;mut </span><span class="self">self</span>.relay_disco_recv), <span class="kw">if </span><span class="self">self</span>.pending_received.is_some() =&gt; {}
msg = client_stream.next(), <span class="kw">if </span><span class="self">self</span>.pending_received.is_none() =&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(msg) = msg <span class="kw">else </span>{
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Stream closed by server."</span>));
};
@@ -2466,6 +2578,99 @@
}
}
<span class="doccomment">/// Forward pending received packets to their queues.
///
/// If `maybe_pending` is not empty, this will wait for the path the last received item
/// is blocked on (via [`PendingRecv::blocked_on`]) to become unblocked. It will then forward
/// the pending items, until a queue is blocked again. In that case, the remaining items will
/// be put back into `maybe_pending`. If all items could be sent, `maybe_pending` will be set
/// to `None`.
///
/// This function is cancellation-safe: If the future is dropped at any point, all items are guaranteed
/// to either be sent into their respective queues, or are still in `maybe_pending`.
</span><span class="kw">async fn </span>forward_pending(
maybe_pending: <span class="kw-2">&amp;mut </span><span class="prelude-ty">Option</span>&lt;PendingRecv&gt;,
relay_datagrams_recv: <span class="kw-2">&amp;</span>RelayDatagramRecvQueue,
relay_disco_recv: <span class="kw-2">&amp;mut </span>mpsc::Sender&lt;RelayDiscoMessage&gt;,
) {
<span class="kw">let </span><span class="prelude-val">Some</span>(<span class="kw-2">ref mut </span>pending) = maybe_pending <span class="kw">else </span>{
<span class="kw">return</span>;
};
<span class="kw">let </span>disco_permit = <span class="kw">match </span>pending.blocked_on {
RecvPath::Data =&gt; {
std::future::poll_fn(|cx| relay_datagrams_recv.poll_send_ready(cx))
.<span class="kw">await
</span>.ok();
<span class="prelude-val">None
</span>}
RecvPath::Disco =&gt; {
<span class="kw">let </span><span class="prelude-val">Ok</span>(permit) = relay_disco_recv.clone().reserve_owned().<span class="kw">await else </span>{
<span class="kw">return</span>;
};
<span class="prelude-val">Some</span>(permit)
}
};
<span class="kw">let </span>pending = maybe_pending.take().unwrap();
<span class="kw">if let </span><span class="prelude-val">Some</span>(pending) = handle_received_packet_iter(
pending.packet_iter,
disco_permit,
relay_datagrams_recv,
relay_disco_recv,
) {
<span class="kw-2">*</span>maybe_pending = <span class="prelude-val">Some</span>(pending);
}
}
<span class="kw">fn </span>handle_received_packet_iter(
<span class="kw-2">mut </span>packet_iter: PacketSplitIter,
<span class="kw-2">mut </span>disco_permit: <span class="prelude-ty">Option</span>&lt;OwnedPermit&lt;RelayDiscoMessage&gt;&gt;,
relay_datagrams_recv: <span class="kw-2">&amp;</span>RelayDatagramRecvQueue,
relay_disco_recv: <span class="kw-2">&amp;mut </span>mpsc::Sender&lt;RelayDiscoMessage&gt;,
) -&gt; <span class="prelude-ty">Option</span>&lt;PendingRecv&gt; {
<span class="kw">let </span>remote_node_id = packet_iter.remote_node_id();
<span class="kw">for </span>datagram <span class="kw">in </span><span class="kw-2">&amp;mut </span>packet_iter {
<span class="kw">let </span><span class="prelude-val">Ok</span>(datagram) = datagram <span class="kw">else </span>{
<span class="macro">warn!</span>(<span class="string">"Invalid packet split"</span>);
<span class="kw">return </span><span class="prelude-val">None</span>;
};
<span class="kw">match </span><span class="kw">crate</span>::disco::source_and_box_bytes(<span class="kw-2">&amp;</span>datagram.buf) {
<span class="prelude-val">Some</span>((source, sealed_box)) =&gt; {
<span class="kw">if </span>remote_node_id != source {
<span class="comment">// TODO: return here?
</span><span class="macro">warn!</span>(<span class="string">"Received relay disco message from connection for {}, but with message from {}"</span>, remote_node_id.fmt_short(), source.fmt_short());
}
<span class="kw">let </span>message = RelayDiscoMessage {
source,
sealed_box,
relay_url: datagram.url.clone(),
relay_remote_node_id: datagram.src,
};
<span class="kw">if let </span><span class="prelude-val">Some</span>(permit) = disco_permit.take() {
permit.send(message);
} <span class="kw">else if let </span><span class="prelude-val">Err</span>(err) = relay_disco_recv.try_send(message) {
<span class="macro">warn!</span>(<span class="string">"Dropping received relay disco packet: {err:#}"</span>);
packet_iter.push_front(datagram);
<span class="kw">return </span><span class="prelude-val">Some</span>(PendingRecv {
packet_iter,
blocked_on: RecvPath::Disco,
});
}
}
<span class="prelude-val">None </span>=&gt; {
<span class="kw">if let </span><span class="prelude-val">Err</span>(err) = relay_datagrams_recv.try_send(datagram) {
<span class="macro">warn!</span>(<span class="string">"Dropping received relay data packet: {err:#}"</span>);
packet_iter.push_front(err.into_inner());
<span class="kw">return </span><span class="prelude-val">Some</span>(PendingRecv {
packet_iter,
blocked_on: RecvPath::Data,
});
}
}
}
}
<span class="prelude-val">None
</span>}
<span class="doccomment">/// Shared state when the [`ActiveRelayActor`] is connected to a relay server.
///
/// Common state between [`ActiveRelayActor::run_connected`] and
@@ -2948,12 +3153,22 @@
url: RelayUrl,
src: NodeId,
bytes: Bytes,
next: <span class="prelude-ty">Option</span>&lt;RelayRecvDatagram&gt;,
}
<span class="kw">impl </span>PacketSplitIter {
<span class="doccomment">/// Create a new PacketSplitIter from a packet.
</span><span class="kw">fn </span>new(url: RelayUrl, src: NodeId, bytes: Bytes) -&gt; <span class="self">Self </span>{
<span class="self">Self </span>{ url, src, bytes }
<span class="self">Self </span>{
url,
src,
bytes,
next: <span class="prelude-val">None</span>,
}
}
<span class="kw">fn </span>remote_node_id(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; NodeId {
<span class="self">self</span>.src
}
<span class="kw">fn </span>fail(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;std::io::Result&lt;RelayRecvDatagram&gt;&gt; {
@@ -2963,6 +3178,10 @@
<span class="string">""</span>,
)))
}
<span class="kw">fn </span>push_front(<span class="kw-2">&amp;mut </span><span class="self">self</span>, item: RelayRecvDatagram) {
<span class="self">self</span>.next = <span class="prelude-val">Some</span>(item);
}
}
<span class="kw">impl </span>Iterator <span class="kw">for </span>PacketSplitIter {
@@ -2970,6 +3189,9 @@
<span class="kw">fn </span>next(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;<span class="self">Self</span>::Item&gt; {
<span class="kw">use </span>bytes::Buf;
<span class="kw">if let </span><span class="prelude-val">Some</span>(item) = <span class="self">self</span>.next.take() {
<span class="kw">return </span><span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(item));
}
<span class="kw">if </span><span class="self">self</span>.bytes.has_remaining() {
<span class="kw">if </span><span class="self">self</span>.bytes.remaining() &lt; <span class="number">2 </span>{
<span class="kw">return </span><span class="self">self</span>.fail();
+4 -2
View File
@@ -495,7 +495,8 @@
<a href="#494" id="494">494</a>
<a href="#495" id="495">495</a>
<a href="#496" id="496">496</a>
<a href="#497" id="497">497</a></pre></div><pre class="rust"><code><span class="doccomment">//! Tools for spawning an accept loop that routes incoming requests to the right protocol.
<a href="#497" id="497">497</a>
<a href="#498" id="498">498</a></pre></div><pre class="rust"><code><span class="doccomment">//! Tools for spawning an accept loop that routes incoming requests to the right protocol.
//!
//! ## Example
//!
@@ -929,6 +930,7 @@
<span class="attr">#[cfg(test)]
</span><span class="kw">mod </span>tests {
<span class="kw">use super</span>::<span class="kw-2">*</span>;
<span class="kw">use </span><span class="kw">crate</span>::watcher::Watcher;
<span class="attr">#[tokio::test]
</span><span class="kw">async fn </span>test_shutdown() -&gt; <span class="prelude-ty">Result</span>&lt;()&gt; {
@@ -975,7 +977,7 @@
</span><span class="kw">let </span>proto = AccessLimit::new(Echo, |_node_id| <span class="bool-val">false</span>);
<span class="kw">let </span>r1 = Router::builder(e1.clone()).accept(ECHO_ALPN, proto).spawn();
<span class="kw">let </span>addr1 = r1.endpoint().node_addr().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>addr1 = r1.endpoint().node_addr().initialized().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>e2 = Endpoint::builder().bind().<span class="kw">await</span><span class="question-mark">?</span>;
+1 -1
View File
@@ -105,7 +105,7 @@
<span class="kw">use </span>ed25519_dalek::pkcs8::{spki::der::pem::LineEnding, EncodePrivateKey};
<span class="kw">use </span>iroh_base::SecretKey;
<span class="kw">use </span>webpki::types::{pem::PemObject, CertificateDer, PrivatePkcs8KeyDer};
<span class="kw">use </span>webpki_types::{pem::PemObject, CertificateDer, PrivatePkcs8KeyDer};
<span class="kw">use </span><span class="kw">super</span>::certificate;
<span class="kw">use </span><span class="kw">crate</span>::tls::Authentication;
+4 -2
View File
@@ -346,7 +346,8 @@
<a href="#345" id="345">345</a>
<a href="#346" id="346">346</a>
<a href="#347" id="347">347</a>
<a href="#348" id="348">348</a></pre></div><pre class="rust"><code><span class="doccomment">//! TLS 1.3 certificates and handshakes handling.
<a href="#348" id="348">348</a>
<a href="#349" id="349">349</a></pre></div><pre class="rust"><code><span class="doccomment">//! TLS 1.3 certificates and handshakes handling.
//!
//! This module handles a verification of a client/server certificate chain
//! and signatures allegedly by the given certificates, or using raw public keys.
@@ -367,7 +368,8 @@
CertificateError, DigitallySignedStruct, DistinguishedName, OtherError, PeerMisbehaved,
SignatureScheme, SupportedProtocolVersion,
};
<span class="kw">use </span>webpki::{ring <span class="kw">as </span>webpki_algs, types::SubjectPublicKeyInfoDer};
<span class="kw">use </span>webpki::ring <span class="kw">as </span>webpki_algs;
<span class="kw">use </span>webpki_types::SubjectPublicKeyInfoDer;
<span class="kw">use super</span>::{certificate, Authentication};
@@ -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="Source of the Rust file `iroh/src/watchable.rs`."><title>watchable.rs - source</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../../static.files/src-script-56102188.js"></script><script defer src="../../src-files.js"></script><script defer src="../../static.files/main-5f194d8c.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="src-sidebar-title"><h2>Files</h2></div></nav><div class="sidebar-resizer"></div><main><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1><div class="sub-heading">iroh/</div>watchable.rs</h1><rustdoc-toolbar></rustdoc-toolbar></div><div class="example-wrap"><div data-nosnippet><pre class="src-line-numbers">
<!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="Source of the Rust file `iroh/src/watcher.rs`."><title>watcher.rs - source</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.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-dbdb5eec.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.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../../static.files/src-script-56102188.js"></script><script defer src="../../src-files.js"></script><script defer src="../../static.files/main-5f194d8c.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 src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="src-sidebar-title"><h2>Files</h2></div></nav><div class="sidebar-resizer"></div><main><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1><div class="sub-heading">iroh/</div>watcher.rs</h1><rustdoc-toolbar></rustdoc-toolbar></div><div class="example-wrap"><div data-nosnippet><pre class="src-line-numbers">
<a href="#1" id="1">1</a>
<a href="#2" id="2">2</a>
<a href="#3" id="3">3</a>
@@ -547,7 +547,152 @@
<a href="#546" id="546">546</a>
<a href="#547" id="547">547</a>
<a href="#548" id="548">548</a>
<a href="#549" id="549">549</a></pre></div><pre class="rust"><code><span class="doccomment">//! Watchable values.
<a href="#549" id="549">549</a>
<a href="#550" id="550">550</a>
<a href="#551" id="551">551</a>
<a href="#552" id="552">552</a>
<a href="#553" id="553">553</a>
<a href="#554" id="554">554</a>
<a href="#555" id="555">555</a>
<a href="#556" id="556">556</a>
<a href="#557" id="557">557</a>
<a href="#558" id="558">558</a>
<a href="#559" id="559">559</a>
<a href="#560" id="560">560</a>
<a href="#561" id="561">561</a>
<a href="#562" id="562">562</a>
<a href="#563" id="563">563</a>
<a href="#564" id="564">564</a>
<a href="#565" id="565">565</a>
<a href="#566" id="566">566</a>
<a href="#567" id="567">567</a>
<a href="#568" id="568">568</a>
<a href="#569" id="569">569</a>
<a href="#570" id="570">570</a>
<a href="#571" id="571">571</a>
<a href="#572" id="572">572</a>
<a href="#573" id="573">573</a>
<a href="#574" id="574">574</a>
<a href="#575" id="575">575</a>
<a href="#576" id="576">576</a>
<a href="#577" id="577">577</a>
<a href="#578" id="578">578</a>
<a href="#579" id="579">579</a>
<a href="#580" id="580">580</a>
<a href="#581" id="581">581</a>
<a href="#582" id="582">582</a>
<a href="#583" id="583">583</a>
<a href="#584" id="584">584</a>
<a href="#585" id="585">585</a>
<a href="#586" id="586">586</a>
<a href="#587" id="587">587</a>
<a href="#588" id="588">588</a>
<a href="#589" id="589">589</a>
<a href="#590" id="590">590</a>
<a href="#591" id="591">591</a>
<a href="#592" id="592">592</a>
<a href="#593" id="593">593</a>
<a href="#594" id="594">594</a>
<a href="#595" id="595">595</a>
<a href="#596" id="596">596</a>
<a href="#597" id="597">597</a>
<a href="#598" id="598">598</a>
<a href="#599" id="599">599</a>
<a href="#600" id="600">600</a>
<a href="#601" id="601">601</a>
<a href="#602" id="602">602</a>
<a href="#603" id="603">603</a>
<a href="#604" id="604">604</a>
<a href="#605" id="605">605</a>
<a href="#606" id="606">606</a>
<a href="#607" id="607">607</a>
<a href="#608" id="608">608</a>
<a href="#609" id="609">609</a>
<a href="#610" id="610">610</a>
<a href="#611" id="611">611</a>
<a href="#612" id="612">612</a>
<a href="#613" id="613">613</a>
<a href="#614" id="614">614</a>
<a href="#615" id="615">615</a>
<a href="#616" id="616">616</a>
<a href="#617" id="617">617</a>
<a href="#618" id="618">618</a>
<a href="#619" id="619">619</a>
<a href="#620" id="620">620</a>
<a href="#621" id="621">621</a>
<a href="#622" id="622">622</a>
<a href="#623" id="623">623</a>
<a href="#624" id="624">624</a>
<a href="#625" id="625">625</a>
<a href="#626" id="626">626</a>
<a href="#627" id="627">627</a>
<a href="#628" id="628">628</a>
<a href="#629" id="629">629</a>
<a href="#630" id="630">630</a>
<a href="#631" id="631">631</a>
<a href="#632" id="632">632</a>
<a href="#633" id="633">633</a>
<a href="#634" id="634">634</a>
<a href="#635" id="635">635</a>
<a href="#636" id="636">636</a>
<a href="#637" id="637">637</a>
<a href="#638" id="638">638</a>
<a href="#639" id="639">639</a>
<a href="#640" id="640">640</a>
<a href="#641" id="641">641</a>
<a href="#642" id="642">642</a>
<a href="#643" id="643">643</a>
<a href="#644" id="644">644</a>
<a href="#645" id="645">645</a>
<a href="#646" id="646">646</a>
<a href="#647" id="647">647</a>
<a href="#648" id="648">648</a>
<a href="#649" id="649">649</a>
<a href="#650" id="650">650</a>
<a href="#651" id="651">651</a>
<a href="#652" id="652">652</a>
<a href="#653" id="653">653</a>
<a href="#654" id="654">654</a>
<a href="#655" id="655">655</a>
<a href="#656" id="656">656</a>
<a href="#657" id="657">657</a>
<a href="#658" id="658">658</a>
<a href="#659" id="659">659</a>
<a href="#660" id="660">660</a>
<a href="#661" id="661">661</a>
<a href="#662" id="662">662</a>
<a href="#663" id="663">663</a>
<a href="#664" id="664">664</a>
<a href="#665" id="665">665</a>
<a href="#666" id="666">666</a>
<a href="#667" id="667">667</a>
<a href="#668" id="668">668</a>
<a href="#669" id="669">669</a>
<a href="#670" id="670">670</a>
<a href="#671" id="671">671</a>
<a href="#672" id="672">672</a>
<a href="#673" id="673">673</a>
<a href="#674" id="674">674</a>
<a href="#675" id="675">675</a>
<a href="#676" id="676">676</a>
<a href="#677" id="677">677</a>
<a href="#678" id="678">678</a>
<a href="#679" id="679">679</a>
<a href="#680" id="680">680</a>
<a href="#681" id="681">681</a>
<a href="#682" id="682">682</a>
<a href="#683" id="683">683</a>
<a href="#684" id="684">684</a>
<a href="#685" id="685">685</a>
<a href="#686" id="686">686</a>
<a href="#687" id="687">687</a>
<a href="#688" id="688">688</a>
<a href="#689" id="689">689</a>
<a href="#690" id="690">690</a>
<a href="#691" id="691">691</a>
<a href="#692" id="692">692</a>
<a href="#693" id="693">693</a>
<a href="#694" id="694">694</a></pre></div><pre class="rust"><code><span class="doccomment">//! Watchable values.
//!
//! A [`Watchable`] exists to keep track of a value which may change over time. It allows
//! observers to be notified of changes to the value. The aim is to always be aware of the
@@ -556,6 +701,11 @@
//! In that way, a [`Watchable`] is like a [`tokio::sync::broadcast::Sender`] (and a
//! [`Watcher`] is like a [`tokio::sync::broadcast::Receiver`]), except that there's no risk
//! of the channel filling up, but instead you might miss items.
//!
//! This module is meant to be imported like this (if you use all of these things):
//! ```ignore
//! use iroh::watcher::{self, Watchable, Watcher as _};
//! ```
</span><span class="attr">#[cfg(not(iroh_loom))]
</span><span class="kw">use </span>std::sync;
@@ -569,12 +719,11 @@
<span class="attr">#[cfg(iroh_loom)]
</span><span class="kw">use </span>loom::sync;
<span class="kw">use </span>n0_future::stream::Stream;
<span class="kw">use </span>sync::{Mutex, RwLock};
<span class="doccomment">/// A wrapper around a value that notifies [`Watcher`]s when the value is modified.
///
/// Only the most recent value is available to any observer, but but observer is guaranteed
/// Only the most recent value is available to any observer, but the observer is guaranteed
/// to be notified of the most recent value.
</span><span class="attr">#[derive(Debug, Default)]
</span><span class="kw">pub struct </span>Watchable&lt;T&gt; {
@@ -636,9 +785,9 @@
ret
}
<span class="doccomment">/// Creates a [`Watcher`] allowing the value to be observed, but not modified.
</span><span class="kw">pub fn </span>watch(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Watcher&lt;T&gt; {
Watcher {
<span class="doccomment">/// Creates a [`Direct`] [`Watcher`], allowing the value to be observed, but not modified.
</span><span class="kw">pub fn </span>watch(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Direct&lt;T&gt; {
Direct {
epoch: <span class="self">self</span>.shared.state.read().expect(<span class="string">"poisoned"</span>).epoch,
shared: Arc::downgrade(<span class="kw-2">&amp;</span><span class="self">self</span>.shared),
}
@@ -650,29 +799,45 @@
}
}
<span class="doccomment">/// An observer for a value.
<span class="doccomment">/// A handle to a value that's represented by one or more underlying [`Watchable`]s.
///
/// The [`Watcher`] can get the current value, and will be notified when the value changes.
/// Only the most recent value is accessible, and if the thread with the [`Watchable`]
/// changes the value faster than the thread with the [`Watcher`] can keep up with, then
/// A [`Watcher`] can get the current value, and will be notified when the value changes.
/// Only the most recent value is accessible, and if the threads with the underlying [`Watchable`]s
/// change the value faster than the threads with the [`Watcher`] can keep up with, then
/// it'll miss in-between values.
/// When the thread changing the [`Watchable`] pauses updating, the [`Watcher`] will always
/// end up reporting the most recent state eventually.
</span><span class="attr">#[derive(Debug, Clone)]
</span><span class="kw">pub struct </span>Watcher&lt;T&gt; {
epoch: u64,
shared: Weak&lt;Shared&lt;T&gt;&gt;,
}
<span class="kw">impl</span>&lt;T: Clone + Eq&gt; Watcher&lt;T&gt; {
<span class="doccomment">/// Returns the currently held value.
///
/// Watchers can be modified via [`Watcher::map`] to observe a value derived from the original
/// value via a function.
///
/// Watchers can be combined via [`Watcher::or`] to allow observing multiple values at once and
/// getting an update in case any of the values updates.
///
/// One of the underlying [`Watchable`]s might already be dropped. In that case,
/// the watcher will be "disconnected" and return [`Err(Disconnected)`](Disconnected)
/// on some function calls or, when turned into a stream, that stream will end.
</span><span class="kw">pub trait </span>Watcher: Clone {
<span class="doccomment">/// The type of value that can change.
///
/// Returns [`Err(Disconnected)`](Disconnected) if the original
/// [`Watchable`] was dropped.
</span><span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;T, Disconnected&gt; {
<span class="kw">let </span>shared = <span class="self">self</span>.shared.upgrade().ok_or(Disconnected)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(shared.get())
}
/// We require `Clone`, because we need to be able to make
/// the values have a lifetime that's detached from the original [`Watchable`]'s
/// lifetime.
///
/// We require `Eq`, to be able to check whether the value actually changed or
/// not, so we can notify or not notify accordingly.
</span><span class="kw">type </span>Value: Clone + Eq;
<span class="doccomment">/// Returns the current state of the underlying value, or errors out with
/// [`Disconnected`], if one of the underlying [`Watchable`]s has been dropped.
</span><span class="kw">fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt;;
<span class="doccomment">/// Polls for the next value, or returns [`Disconnected`] if one of the underlying
/// [`Watchable`]s has been dropped.
</span><span class="kw">fn </span>poll_updated(
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;,
) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt;&gt;;
<span class="doccomment">/// Returns a future completing with `Ok(value)` once a new value is set, or with
/// [`Err(Disconnected)`](Disconnected) if the connected [`Watchable`] was dropped.
@@ -680,8 +845,32 @@
/// # Cancel Safety
///
/// The returned future is cancel-safe.
</span><span class="kw">pub fn </span>updated(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; WatchNextFut&lt;T&gt; {
WatchNextFut { watcher: <span class="self">self </span>}
</span><span class="kw">fn </span>updated(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; NextFut&lt;<span class="self">Self</span>&gt; {
NextFut { watcher: <span class="self">self </span>}
}
<span class="doccomment">/// Returns a future completing once the value is set to [`Some`] value.
///
/// If the current value is [`Some`] value, this future will resolve immediately.
///
/// This is a utility for the common case of storing an [`Option`] inside a
/// [`Watchable`].
///
/// # Cancel Safety
///
/// The returned future is cancel-safe.
</span><span class="kw">fn </span>initialized&lt;T&gt;(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; InitializedFut&lt;T, <span class="self">Self</span>&gt;
<span class="kw">where
</span><span class="self">Self</span>: Watcher&lt;Value = <span class="prelude-ty">Option</span>&lt;T&gt;&gt;,
{
InitializedFut {
initial: <span class="kw">match </span><span class="self">self</span>.get() {
<span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>(value)) =&gt; <span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(value)),
<span class="prelude-val">Ok</span>(<span class="prelude-val">None</span>) =&gt; <span class="prelude-val">None</span>,
<span class="prelude-val">Err</span>(Disconnected) =&gt; <span class="prelude-val">Some</span>(<span class="prelude-val">Err</span>(Disconnected)),
},
watcher: <span class="self">self</span>,
}
}
<span class="doccomment">/// Returns a stream which will yield the most recent values as items.
@@ -697,10 +886,14 @@
/// # Cancel Safety
///
/// The returned stream is cancel-safe.
</span><span class="kw">pub fn </span>stream(<span class="kw-2">mut </span><span class="self">self</span>) -&gt; WatcherStream&lt;T&gt; {
<span class="macro">debug_assert!</span>(<span class="self">self</span>.epoch &gt; <span class="number">0</span>);
<span class="self">self</span>.epoch -= <span class="number">1</span>;
WatcherStream { watcher: <span class="self">self </span>}
</span><span class="kw">fn </span>stream(<span class="self">self</span>) -&gt; Stream&lt;<span class="self">Self</span>&gt;
<span class="kw">where
</span><span class="self">Self</span>: Unpin,
{
Stream {
initial: <span class="self">self</span>.get().ok(),
watcher: <span class="self">self</span>,
}
}
<span class="doccomment">/// Returns a stream which will yield the most recent values as items, starting from
@@ -717,21 +910,126 @@
/// # Cancel Safety
///
/// The returned stream is cancel-safe.
</span><span class="kw">pub fn </span>stream_updates_only(<span class="self">self</span>) -&gt; WatcherStream&lt;T&gt; {
WatcherStream { watcher: <span class="self">self </span>}
</span><span class="kw">fn </span>stream_updates_only(<span class="self">self</span>) -&gt; Stream&lt;<span class="self">Self</span>&gt;
<span class="kw">where
</span><span class="self">Self</span>: Unpin,
{
Stream {
initial: <span class="prelude-val">None</span>,
watcher: <span class="self">self</span>,
}
}
<span class="doccomment">/// Maps this watcher with a function that transforms the observed values.
///
/// The returned watcher will only register updates, when the *mapped* value
/// observably changes. For this, it needs to store a clone of `T` in the watcher.
</span><span class="kw">fn </span>map&lt;T: Clone + Eq&gt;(
<span class="self">self</span>,
map: <span class="kw">impl </span>Fn(<span class="self">Self</span>::Value) -&gt; T + <span class="lifetime">'static</span>,
) -&gt; <span class="prelude-ty">Result</span>&lt;Map&lt;<span class="self">Self</span>, T&gt;, Disconnected&gt; {
<span class="prelude-val">Ok</span>(Map {
current: (map)(<span class="self">self</span>.get()<span class="question-mark">?</span>),
map: Arc::new(map),
watcher: <span class="self">self</span>,
})
}
<span class="doccomment">/// Returns a watcher that updates every time this or the other watcher
/// updates, and yields both watcher's items together when that happens.
</span><span class="kw">fn </span>or&lt;W: Watcher&gt;(<span class="self">self</span>, other: W) -&gt; (<span class="self">Self</span>, W) {
(<span class="self">self</span>, other)
}
}
<span class="kw">impl</span>&lt;T: Clone + Eq&gt; Watcher&lt;<span class="prelude-ty">Option</span>&lt;T&gt;&gt; {
<span class="doccomment">/// Returns a future completing once the value is set to [`Some`] value.
///
/// If the current value is [`Some`] value, this future will resolve immediately.
///
/// This is a utility for the common case of storing an [`Option`] inside a
/// [`Watchable`].
</span><span class="kw">pub fn </span>initialized(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; WatchInitializedFut&lt;T&gt; {
<span class="self">self</span>.epoch = PRE_INITIAL_EPOCH;
WatchInitializedFut { watcher: <span class="self">self </span>}
<span class="doccomment">/// The immediate, direct observer of a [`Watchable`] value.
///
/// This type is mainly used via the [`Watcher`] interface.
</span><span class="attr">#[derive(Debug, Clone)]
</span><span class="kw">pub struct </span>Direct&lt;T&gt; {
epoch: u64,
shared: Weak&lt;Shared&lt;T&gt;&gt;,
}
<span class="kw">impl</span>&lt;T: Clone + Eq&gt; Watcher <span class="kw">for </span>Direct&lt;T&gt; {
<span class="kw">type </span>Value = T;
<span class="kw">fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt; {
<span class="kw">let </span>shared = <span class="self">self</span>.shared.upgrade().ok_or(Disconnected)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(shared.get())
}
<span class="kw">fn </span>poll_updated(
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;,
) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt;&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(shared) = <span class="self">self</span>.shared.upgrade() <span class="kw">else </span>{
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">Err</span>(Disconnected));
};
<span class="kw">match </span>shared.poll_updated(cx, <span class="self">self</span>.epoch) {
Poll::Pending =&gt; Poll::Pending,
Poll::Ready((current_epoch, value)) =&gt; {
<span class="self">self</span>.epoch = current_epoch;
Poll::Ready(<span class="prelude-val">Ok</span>(value))
}
}
}
}
<span class="kw">impl</span>&lt;S: Watcher, T: Watcher&gt; Watcher <span class="kw">for </span>(S, T) {
<span class="kw">type </span>Value = (S::Value, T::Value);
<span class="kw">fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt; {
<span class="prelude-val">Ok</span>((<span class="self">self</span>.<span class="number">0</span>.get()<span class="question-mark">?</span>, <span class="self">self</span>.<span class="number">1</span>.get()<span class="question-mark">?</span>))
}
<span class="kw">fn </span>poll_updated(
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;,
) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt;&gt; {
<span class="kw">let </span>poll_0 = <span class="self">self</span>.<span class="number">0</span>.poll_updated(cx)<span class="question-mark">?</span>;
<span class="kw">let </span>poll_1 = <span class="self">self</span>.<span class="number">1</span>.poll_updated(cx)<span class="question-mark">?</span>;
<span class="kw">match </span>(poll_0, poll_1) {
(Poll::Ready(s), Poll::Ready(t)) =&gt; Poll::Ready(<span class="prelude-val">Ok</span>((s, t))),
(Poll::Ready(s), Poll::Pending) =&gt; Poll::Ready(<span class="self">self</span>.<span class="number">1</span>.get().map(<span class="kw">move </span>|t| (s, t))),
(Poll::Pending, Poll::Ready(t)) =&gt; Poll::Ready(<span class="self">self</span>.<span class="number">0</span>.get().map(<span class="kw">move </span>|s| (s, t))),
(Poll::Pending, Poll::Pending) =&gt; Poll::Pending,
}
}
}
<span class="doccomment">/// Wraps a [`Watcher`] to allow observing a derived value.
///
/// See [`Watcher::map`].
</span><span class="attr">#[derive(derive_more::Debug, Clone)]
</span><span class="kw">pub struct </span>Map&lt;W: Watcher, T: Clone + Eq&gt; {
<span class="attr">#[debug(<span class="string">"Arc&lt;dyn Fn(W::Value) -&gt; T + 'static&gt;"</span>)]
</span>map: Arc&lt;<span class="kw">dyn </span>Fn(W::Value) -&gt; T + <span class="lifetime">'static</span>&gt;,
watcher: W,
current: T,
}
<span class="kw">impl</span>&lt;W: Watcher, T: Clone + Eq&gt; Watcher <span class="kw">for </span>Map&lt;W, T&gt; {
<span class="kw">type </span>Value = T;
<span class="kw">fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt; {
<span class="prelude-val">Ok</span>((<span class="self">self</span>.map)(<span class="self">self</span>.watcher.get()<span class="question-mark">?</span>))
}
<span class="kw">fn </span>poll_updated(
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;,
) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>::Value, Disconnected&gt;&gt; {
<span class="kw">loop </span>{
<span class="kw">let </span>value = <span class="macro">n0_future::ready!</span>(<span class="self">self</span>.watcher.poll_updated(cx)<span class="question-mark">?</span>);
<span class="kw">let </span>mapped = (<span class="self">self</span>.map)(value);
<span class="kw">if </span>mapped != <span class="self">self</span>.current {
<span class="self">self</span>.current = mapped.clone();
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">Ok</span>(mapped));
} <span class="kw">else </span>{
<span class="self">self</span>.current = mapped;
}
}
}
}
@@ -743,24 +1041,15 @@
///
/// This future is cancel-safe.
</span><span class="attr">#[derive(Debug)]
</span><span class="kw">pub struct </span>WatchNextFut&lt;<span class="lifetime">'a</span>, T&gt; {
watcher: <span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="kw-2">mut </span>Watcher&lt;T&gt;,
</span><span class="kw">pub struct </span>NextFut&lt;<span class="lifetime">'a</span>, W: Watcher&gt; {
watcher: <span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="kw-2">mut </span>W,
}
<span class="kw">impl</span>&lt;T: Clone + Eq&gt; Future <span class="kw">for </span>WatchNextFut&lt;<span class="lifetime">'_</span>, T&gt; {
<span class="kw">type </span>Output = <span class="prelude-ty">Result</span>&lt;T, Disconnected&gt;;
<span class="kw">impl</span>&lt;W: Watcher&gt; Future <span class="kw">for </span>NextFut&lt;<span class="lifetime">'_</span>, W&gt; {
<span class="kw">type </span>Output = <span class="prelude-ty">Result</span>&lt;W::Value, Disconnected&gt;;
<span class="kw">fn </span>poll(<span class="kw-2">mut </span><span class="self">self</span>: Pin&lt;<span class="kw-2">&amp;mut </span><span class="self">Self</span>&gt;, cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;) -&gt; Poll&lt;<span class="self">Self</span>::Output&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(shared) = <span class="self">self</span>.watcher.shared.upgrade() <span class="kw">else </span>{
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">Err</span>(Disconnected));
};
<span class="kw">match </span>shared.poll_next(cx, <span class="self">self</span>.watcher.epoch) {
Poll::Pending =&gt; Poll::Pending,
Poll::Ready((current_epoch, value)) =&gt; {
<span class="self">self</span>.watcher.epoch = current_epoch;
Poll::Ready(<span class="prelude-val">Ok</span>(value))
}
}
<span class="self">self</span>.watcher.poll_updated(cx)
}
}
@@ -773,22 +1062,22 @@
///
/// This Future is cancel-safe.
</span><span class="attr">#[derive(Debug)]
</span><span class="kw">pub struct </span>WatchInitializedFut&lt;<span class="lifetime">'a</span>, T&gt; {
watcher: <span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="kw-2">mut </span>Watcher&lt;<span class="prelude-ty">Option</span>&lt;T&gt;&gt;,
</span><span class="kw">pub struct </span>InitializedFut&lt;<span class="lifetime">'a</span>, T, W: Watcher&lt;Value = <span class="prelude-ty">Option</span>&lt;T&gt;&gt;&gt; {
initial: <span class="prelude-ty">Option</span>&lt;<span class="prelude-ty">Result</span>&lt;T, Disconnected&gt;&gt;,
watcher: <span class="kw-2">&amp;</span><span class="lifetime">'a </span><span class="kw-2">mut </span>W,
}
<span class="kw">impl</span>&lt;T: Clone + Eq&gt; Future <span class="kw">for </span>WatchInitializedFut&lt;<span class="lifetime">'_</span>, T&gt; {
<span class="kw">impl</span>&lt;T: Clone + Eq + Unpin, W: Watcher&lt;Value = <span class="prelude-ty">Option</span>&lt;T&gt;&gt; + Unpin&gt; Future
<span class="kw">for </span>InitializedFut&lt;<span class="lifetime">'_</span>, T, W&gt;
{
<span class="kw">type </span>Output = <span class="prelude-ty">Result</span>&lt;T, Disconnected&gt;;
<span class="kw">fn </span>poll(<span class="kw-2">mut </span><span class="self">self</span>: Pin&lt;<span class="kw-2">&amp;mut </span><span class="self">Self</span>&gt;, cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;) -&gt; Poll&lt;<span class="self">Self</span>::Output&gt; {
<span class="kw">if let </span><span class="prelude-val">Some</span>(value) = <span class="self">self</span>.as_mut().initial.take() {
<span class="kw">return </span>Poll::Ready(value);
}
<span class="kw">loop </span>{
<span class="kw">let </span><span class="prelude-val">Some</span>(shared) = <span class="self">self</span>.watcher.shared.upgrade() <span class="kw">else </span>{
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">Err</span>(Disconnected));
};
<span class="kw">let </span>(epoch, value) = <span class="macro">n0_future::ready!</span>(shared.poll_next(cx, <span class="self">self</span>.watcher.epoch));
<span class="self">self</span>.watcher.epoch = epoch;
<span class="kw">if let </span><span class="prelude-val">Some</span>(value) = value {
<span class="kw">if let </span><span class="prelude-val">Some</span>(value) = <span class="macro">n0_future::ready!</span>(<span class="self">self</span>.as_mut().watcher.poll_updated(cx)<span class="question-mark">?</span>) {
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">Ok</span>(value));
}
}
@@ -803,23 +1092,25 @@
///
/// This stream is cancel-safe.
</span><span class="attr">#[derive(Debug, Clone)]
</span><span class="kw">pub struct </span>WatcherStream&lt;T&gt; {
watcher: Watcher&lt;T&gt;,
</span><span class="kw">pub struct </span>Stream&lt;W: Watcher + Unpin&gt; {
initial: <span class="prelude-ty">Option</span>&lt;W::Value&gt;,
watcher: W,
}
<span class="kw">impl</span>&lt;T: Clone + Eq&gt; Stream <span class="kw">for </span>WatcherStream&lt;T&gt; {
<span class="kw">type </span>Item = T;
<span class="kw">impl</span>&lt;W: Watcher + Unpin&gt; n0_future::stream::Stream <span class="kw">for </span>Stream&lt;W&gt;
<span class="kw">where
</span>W::Value: Unpin,
{
<span class="kw">type </span>Item = W::Value;
<span class="kw">fn </span>poll_next(<span class="kw-2">mut </span><span class="self">self</span>: Pin&lt;<span class="kw-2">&amp;mut </span><span class="self">Self</span>&gt;, cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;) -&gt; Poll&lt;<span class="prelude-ty">Option</span>&lt;<span class="self">Self</span>::Item&gt;&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(shared) = <span class="self">self</span>.watcher.shared.upgrade() <span class="kw">else </span>{
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">None</span>);
};
<span class="kw">match </span>shared.poll_next(cx, <span class="self">self</span>.watcher.epoch) {
<span class="kw">if let </span><span class="prelude-val">Some</span>(value) = <span class="self">self</span>.as_mut().initial.take() {
<span class="kw">return </span>Poll::Ready(<span class="prelude-val">Some</span>(value));
}
<span class="kw">match </span><span class="self">self</span>.as_mut().watcher.poll_updated(cx) {
Poll::Ready(<span class="prelude-val">Ok</span>(value)) =&gt; Poll::Ready(<span class="prelude-val">Some</span>(value)),
Poll::Ready(<span class="prelude-val">Err</span>(Disconnected)) =&gt; Poll::Ready(<span class="prelude-val">None</span>),
Poll::Pending =&gt; Poll::Pending,
Poll::Ready((epoch, value)) =&gt; {
<span class="self">self</span>.watcher.epoch = epoch;
Poll::Ready(<span class="prelude-val">Some</span>(value))
}
}
}
}
@@ -827,13 +1118,12 @@
<span class="doccomment">/// The error for when a [`Watcher`] is disconnected from its underlying
/// [`Watchable`] value, because of that watchable having been dropped.
</span><span class="attr">#[derive(thiserror::Error, Debug)]
#[error(<span class="string">"Watch lost connection to underlying Watchable, it was dropped"</span>)]
#[error(<span class="string">"Watcher lost connection to underlying Watchable, it was dropped"</span>)]
</span><span class="kw">pub struct </span>Disconnected;
<span class="comment">// Private:
</span><span class="kw">const </span>INITIAL_EPOCH: u64 = <span class="number">1</span>;
<span class="kw">const </span>PRE_INITIAL_EPOCH: u64 = <span class="number">0</span>;
<span class="doccomment">/// The shared state for a [`Watchable`].
</span><span class="attr">#[derive(Debug, Default)]
@@ -864,7 +1154,7 @@
<span class="self">self</span>.state.read().expect(<span class="string">"poisoned"</span>).value.clone()
}
<span class="kw">fn </span>poll_next(<span class="kw-2">&amp;</span><span class="self">self</span>, cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;, last_epoch: u64) -&gt; Poll&lt;(u64, T)&gt; {
<span class="kw">fn </span>poll_updated(<span class="kw-2">&amp;</span><span class="self">self</span>, cx: <span class="kw-2">&amp;mut </span>task::Context&lt;<span class="lifetime">'_</span>&gt;, last_epoch: u64) -&gt; Poll&lt;(u64, T)&gt; {
{
<span class="kw">let </span>state = <span class="self">self</span>.state.read().expect(<span class="string">"poisoned"</span>);
<span class="kw">let </span>epoch = state.epoch;
+3 -1
View File
@@ -295,7 +295,8 @@
<a href="#294" id="294">294</a>
<a href="#295" id="295">295</a>
<a href="#296" id="296">296</a>
<a href="#297" id="297">297</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{
<a href="#297" id="297">297</a>
<a href="#298" id="298">298</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{
net::SocketAddr,
time::{Duration, Instant},
};
@@ -304,6 +305,7 @@
<span class="kw">use </span>bytes::Bytes;
<span class="kw">use </span>iroh::{
endpoint::{Connection, ConnectionError, RecvStream, SendStream, TransportConfig},
watcher::Watcher <span class="kw">as _</span>,
Endpoint, NodeAddr, RelayMode, RelayUrl,
};
<span class="kw">use </span>tracing::{trace, warn};
+1 -1
View File
@@ -752,7 +752,7 @@
<span class="kw">use </span>tokio::time::Instant;
<span class="kw">use </span>tracing::{debug, info, info_span, Instrument};
<span class="kw">use </span>tracing_test::traced_test;
<span class="kw">use </span>webpki::types::PrivatePkcs8KeyDer;
<span class="kw">use </span>webpki_types::PrivatePkcs8KeyDer;
<span class="kw">use super</span>::{
server::{QuicConfig, QuicServer},
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 @@
(function() {
var implementors = Object.fromEntries([["iroh",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh/discovery/struct.Lagged.html\" title=\"struct iroh::discovery::Lagged\">Lagged</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh/watchable/struct.Disconnected.html\" title=\"struct iroh::watchable::Disconnected\">Disconnected</a>"]]],["iroh_base",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_base/enum.KeyParsingError.html\" title=\"enum iroh_base::KeyParsingError\">KeyParsingError</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_base/ticket/enum.Error.html\" title=\"enum iroh_base::ticket::Error\">Error</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh_base/struct.RelayUrlParseError.html\" title=\"struct iroh_base::RelayUrlParseError\">RelayUrlParseError</a>"]]],["iroh_relay",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_relay/client/enum.ConnSendError.html\" title=\"enum iroh_relay::client::ConnSendError\">ConnSendError</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_relay/protos/stun/enum.Error.html\" title=\"enum iroh_relay::protos::stun::Error\">Error</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh_relay/node_info/struct.MaxLengthExceededError.html\" title=\"struct iroh_relay::node_info::MaxLengthExceededError\">MaxLengthExceededError</a>"]]]]);
var implementors = Object.fromEntries([["iroh",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh/discovery/struct.Lagged.html\" title=\"struct iroh::discovery::Lagged\">Lagged</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh/watcher/struct.Disconnected.html\" title=\"struct iroh::watcher::Disconnected\">Disconnected</a>"]]],["iroh_base",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_base/enum.KeyParsingError.html\" title=\"enum iroh_base::KeyParsingError\">KeyParsingError</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_base/ticket/enum.Error.html\" title=\"enum iroh_base::ticket::Error\">Error</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh_base/struct.RelayUrlParseError.html\" title=\"struct iroh_base::RelayUrlParseError\">RelayUrlParseError</a>"]]],["iroh_relay",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_relay/client/enum.ConnSendError.html\" title=\"enum iroh_relay::client::ConnSendError\">ConnSendError</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"enum\" href=\"iroh_relay/protos/stun/enum.Error.html\" title=\"enum iroh_relay::protos::stun::Error\">Error</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/error/trait.Error.html\" title=\"trait core::error::Error\">Error</a> for <a class=\"struct\" href=\"iroh_relay/node_info/struct.MaxLengthExceededError.html\" title=\"struct iroh_relay::node_info::MaxLengthExceededError\">MaxLengthExceededError</a>"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
//{"start":57,"fragment_lengths":[554,835,895]}
//{"start":57,"fragment_lengths":[550,835,895]}
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 @@
(function() {
var implementors = Object.fromEntries([["iroh",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.Accept.html\" title=\"struct iroh::endpoint::Accept\">Accept</a>&lt;'_&gt;"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.Connecting.html\" title=\"struct iroh::endpoint::Connecting\">Connecting</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.IncomingFuture.html\" title=\"struct iroh::endpoint::IncomingFuture\">IncomingFuture</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.ZeroRttAccepted.html\" title=\"struct iroh::endpoint::ZeroRttAccepted\">ZeroRttAccepted</a>"],["impl&lt;T: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/watchable/struct.WatchInitializedFut.html\" title=\"struct iroh::watchable::WatchInitializedFut\">WatchInitializedFut</a>&lt;'_, T&gt;"],["impl&lt;T: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/watchable/struct.WatchNextFut.html\" title=\"struct iroh::watchable::WatchNextFut\">WatchNextFut</a>&lt;'_, T&gt;"]]]]);
var implementors = Object.fromEntries([["iroh",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.Accept.html\" title=\"struct iroh::endpoint::Accept\">Accept</a>&lt;'_&gt;"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.Connecting.html\" title=\"struct iroh::endpoint::Connecting\">Connecting</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.IncomingFuture.html\" title=\"struct iroh::endpoint::IncomingFuture\">IncomingFuture</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/endpoint/struct.ZeroRttAccepted.html\" title=\"struct iroh::endpoint::ZeroRttAccepted\">ZeroRttAccepted</a>"],["impl&lt;T: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html\" title=\"trait core::marker::Unpin\">Unpin</a>, W: <a class=\"trait\" href=\"iroh/watcher/trait.Watcher.html\" title=\"trait iroh::watcher::Watcher\">Watcher</a>&lt;Value = <a class=\"enum\" href=\"https://doc.rust-lang.org/nightly/core/option/enum.Option.html\" title=\"enum core::option::Option\">Option</a>&lt;T&gt;&gt; + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html\" title=\"trait core::marker::Unpin\">Unpin</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/watcher/struct.InitializedFut.html\" title=\"struct iroh::watcher::InitializedFut\">InitializedFut</a>&lt;'_, T, W&gt;"],["impl&lt;W: <a class=\"trait\" href=\"iroh/watcher/trait.Watcher.html\" title=\"trait iroh::watcher::Watcher\">Watcher</a>&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html\" title=\"trait core::future::future::Future\">Future</a> for <a class=\"struct\" href=\"iroh/watcher/struct.NextFut.html\" title=\"struct iroh::watcher::NextFut\">NextFut</a>&lt;'_, W&gt;"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
//{"start":57,"fragment_lengths":[2394]}
//{"start":57,"fragment_lengths":[2765]}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
(function() {
var implementors = Object.fromEntries([["iroh",[["impl&lt;T: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html\" title=\"trait core::clone::Clone\">Clone</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html\" title=\"trait core::cmp::Eq\">Eq</a>&gt; Stream for <a class=\"struct\" href=\"iroh/watchable/struct.WatcherStream.html\" title=\"struct iroh::watchable::WatcherStream\">WatcherStream</a>&lt;T&gt;"]]],["iroh_relay",[["impl Stream for <a class=\"struct\" href=\"iroh_relay/client/struct.Client.html\" title=\"struct iroh_relay::client::Client\">Client</a>"],["impl Stream for <a class=\"struct\" href=\"iroh_relay/client/struct.ClientStream.html\" title=\"struct iroh_relay::client::ClientStream\">ClientStream</a>"]]]]);
var implementors = Object.fromEntries([["iroh",[["impl&lt;W: <a class=\"trait\" href=\"iroh/watcher/trait.Watcher.html\" title=\"trait iroh::watcher::Watcher\">Watcher</a> + <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html\" title=\"trait core::marker::Unpin\">Unpin</a>&gt; Stream for <a class=\"struct\" href=\"iroh/watcher/struct.Stream.html\" title=\"struct iroh::watcher::Stream\">Stream</a>&lt;W&gt;<div class=\"where\">where\n W::<a class=\"associatedtype\" href=\"iroh/watcher/trait.Watcher.html#associatedtype.Value\" title=\"type iroh::watcher::Watcher::Value\">Value</a>: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html\" title=\"trait core::marker::Unpin\">Unpin</a>,</div>"]]],["iroh_relay",[["impl Stream for <a class=\"struct\" href=\"iroh_relay/client/struct.Client.html\" title=\"struct iroh_relay::client::Client\">Client</a>"],["impl Stream for <a class=\"struct\" href=\"iroh_relay/client/struct.ClientStream.html\" title=\"struct iroh_relay::client::ClientStream\">ClientStream</a>"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
//{"start":57,"fragment_lengths":[444,317]}
//{"start":57,"fragment_lengths":[734,317]}
@@ -0,0 +1,9 @@
(function() {
var implementors = Object.fromEntries([["iroh",[]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
//{"start":57,"fragment_lengths":[11]}
File diff suppressed because one or more lines are too long