deploy: fd108c73c58a060b67c1c82b5d56a0ff360ebac4

This commit is contained in:
ramfox
2025-01-24 03:00:53 +00:00
parent 53b0e5a22c
commit 7dd83d50d4
58 changed files with 1035 additions and 531 deletions
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="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.31.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#1385">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.31.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#1725">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
@@ -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.31.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#1396-1402">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.31.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#1736-1742">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.31.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#1388-1390">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.31.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#1728-1730">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>
@@ -1,2 +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="Extract the `PublicKey` from the peer’s TLS certificate."><title>get_remote_node_id 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.31.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">get_remote_node_id</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#1274-1292">Source</a> </span></div><pre class="rust item-decl"><code>pub fn get_remote_node_id(connection: &amp;<a class="struct" href="struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a>) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;<a class="struct" href="../struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extract the <a href="../struct.PublicKey.html" title="struct iroh::PublicKey"><code>PublicKey</code></a> from the peer’s TLS certificate.</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 `ServerConfig` with the given secret key and limits."><title>make_server_config 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.31.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">make_server_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/endpoint.rs.html#474-485">Source</a> </span></div><pre class="rust item-decl"><code>pub fn make_server_config(
<!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 `ServerConfig` with the given secret key and limits."><title>make_server_config 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.31.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">make_server_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/endpoint.rs.html#481-492">Source</a> </span></div><pre class="rust item-decl"><code>pub fn make_server_config(
secret_key: &amp;<a class="struct" href="../struct.SecretKey.html" title="struct iroh::SecretKey">SecretKey</a>,
alpn_protocols: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;&gt;,
transport_config: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="struct" href="struct.TransportConfig.html" title="struct iroh::endpoint::TransportConfig">TransportConfig</a>&gt;,
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","get_remote_node_id","make_server_config"],"struct":["Accept","AcceptBi","AcceptUni","AckFrequencyConfig","ApplicationClose","Builder","Chunk","ClosedStream","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","make_server_config"],"struct":["Accept","AcceptBi","AcceptUni","AckFrequencyConfig","ApplicationClose","Builder","Chunk","ClosedStream","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"]};
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
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
@@ -18,7 +18,7 @@ transmit on a stream to be the endpoint responsible for opening it.</p>
<p>Verify that the stream you are receiving is the same one that the server is sending on, e.g. by
logging the <a href="struct.RecvStream.html#method.id" title="method iroh::endpoint::RecvStream::id"><code>id</code></a> of each. Streams are always accepted in the same order as they are created,
i.e. ascending order by <a href="struct.StreamId.html" title="struct iroh::endpoint::StreamId"><code>StreamId</code></a>. For example, even if a sender first transmits on
bidirectional stream 1, the first stream yielded by <a href="struct.Connection.html#method.accept_bi" title="method iroh::endpoint::Connection::accept_bi"><code>Connection::accept_bi</code></a> on the receiver
bidirectional stream 1, the first stream yielded by <a href="crate::Connection::accept_bi"><code>Connection::accept_bi</code></a> on the receiver
will be bidirectional stream 0.</p>
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-RecvStream" class="impl"><a href="#impl-RecvStream" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.RecvStream.html" title="struct iroh::endpoint::RecvStream">RecvStream</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.read" class="method"><h4 class="code-header">pub async fn <a href="#method.read" class="fn">read</a>(&amp;mut self, buf: &amp;mut [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;, <a class="enum" href="enum.ReadError.html" title="enum iroh::endpoint::ReadError">ReadError</a>&gt;</h4></section></summary><div class="docblock"><p>Read data contiguously from the stream.</p>
<p>Yields the number of bytes read into <code>buf</code> on success, or <code>None</code> if the stream was finished.</p>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,5 +2,5 @@
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>,
) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;(<a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>, Connection)&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Create a client endpoint and client connection</p>
) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;(<a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>, <a class="struct" href="../../iroh/endpoint/struct.Connection.html" title="struct iroh::endpoint::Connection">Connection</a>)&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Create a client endpoint and client connection</p>
</div></details></section></div></main></body></html>
@@ -1,5 +1,5 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="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.31.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(
connection: &amp;Connection,
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>,
) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;(<a class="struct" href="../stats/struct.TransferResult.html" title="struct iroh_bench::stats::TransferResult">TransferResult</a>, <a class="struct" href="../stats/struct.TransferResult.html" title="struct iroh_bench::stats::TransferResult">TransferResult</a>)&gt;</code></pre></section></div></main></body></html>
+1 -1
View File
@@ -2,4 +2,4 @@
<p>NetReport is responsible for finding out the network conditions of the current host, like
whether it is connected to the internet via IPv4 and/or IPv6, what the NAT situation is
etc and reachability to the configured relays.</p>
</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.Addr.html" title="struct iroh_net_report::Addr">Addr</a></div><div class="desc docblock-short">Sender to the main service.</div></li><li><div class="item-name"><a class="struct" href="struct.Client.html" title="struct iroh_net_report::Client">Client</a></div><div class="desc docblock-short">Client to run net_reports.</div></li><li><div class="item-name"><a class="struct" href="struct.IpMappedAddr.html" title="struct iroh_net_report::IpMappedAddr">IpMapped<wbr>Addr</a></div><div class="desc docblock-short">A mirror for the <code>NodeIdMappedAddr</code>, mapping a fake Ipv6 address with an actual IP address.</div></li><li><div class="item-name"><a class="struct" href="struct.IpMappedAddrError.html" title="struct iroh_net_report::IpMappedAddrError">IpMapped<wbr>Addr<wbr>Error</a></div><div class="desc docblock-short">Can occur when converting a <a href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr"><code>SocketAddr</code></a> to an <a href="struct.IpMappedAddr.html" title="struct iroh_net_report::IpMappedAddr"><code>IpMappedAddr</code></a></div></li><li><div class="item-name"><a class="struct" href="struct.IpMappedAddrs.html" title="struct iroh_net_report::IpMappedAddrs">IpMapped<wbr>Addrs</a></div><div class="desc docblock-short">A Map of <a href="struct.IpMappedAddrs.html" title="struct iroh_net_report::IpMappedAddrs"><code>IpMappedAddrs</code></a> to <a href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr"><code>SocketAddr</code></a></div></li><li><div class="item-name"><a class="struct" href="struct.Metrics.html" title="struct iroh_net_report::Metrics">Metrics</a></div><div class="desc docblock-short">Enum of metrics for the module</div></li><li><div class="item-name"><a class="struct" href="struct.Options.html" title="struct iroh_net_report::Options">Options</a></div><div class="desc docblock-short">Options for running probes</div></li><li><div class="item-name"><a class="struct" href="struct.QuicConfig.html" title="struct iroh_net_report::QuicConfig">Quic<wbr>Config</a></div><div class="desc docblock-short">Pieces needed to do QUIC address discovery.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">Relay<wbr>Latencies</a></div><div class="desc docblock-short">Latencies per relay node.</div></li><li><div class="item-name"><a class="struct" href="struct.Report.html" title="struct iroh_net_report::Report">Report</a></div><div class="desc docblock-short">A net_report report.</div></li></ul><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.MAPPED_ADDR_PORT.html" title="constant iroh_net_report::MAPPED_ADDR_PORT">MAPPED_<wbr>ADDR_<wbr>PORT</a></div><div class="desc docblock-short">The dummy port used for all mapped addresses</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.bind_local_stun_socket.html" title="fn iroh_net_report::bind_local_stun_socket">bind_<wbr>local_<wbr>stun_<wbr>socket</a><wbr><span class="stab portability" title="Available on crate feature `stun-utils` only"><code>stun-utils</code></span></div><div class="desc docblock-short">Attempts to bind a local socket to send STUN packets from.</div></li><li><div class="item-name"><a class="fn" href="fn.os_has_ipv6.html" title="fn iroh_net_report::os_has_ipv6">os_<wbr>has_<wbr>ipv6</a></div><div class="desc docblock-short">Test if IPv6 works at all, or if it’s been hard disabled at the OS level.</div></li></ul></section></div></main></body></html>
</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.Addr.html" title="struct iroh_net_report::Addr">Addr</a></div><div class="desc docblock-short">Sender to the main service.</div></li><li><div class="item-name"><a class="struct" href="struct.Client.html" title="struct iroh_net_report::Client">Client</a></div><div class="desc docblock-short">Client to run net_reports.</div></li><li><div class="item-name"><a class="struct" href="struct.IpMappedAddr.html" title="struct iroh_net_report::IpMappedAddr">IpMapped<wbr>Addr</a></div><div class="desc docblock-short">A mirror for the <code>NodeIdMappedAddr</code>, mapping a fake Ipv6 address with an actual IP address.</div></li><li><div class="item-name"><a class="struct" href="struct.IpMappedAddrError.html" title="struct iroh_net_report::IpMappedAddrError">IpMapped<wbr>Addr<wbr>Error</a></div><div class="desc docblock-short">Can occur when converting a <a href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr"><code>SocketAddr</code></a> to an <a href="struct.IpMappedAddr.html" title="struct iroh_net_report::IpMappedAddr"><code>IpMappedAddr</code></a></div></li><li><div class="item-name"><a class="struct" href="struct.IpMappedAddrs.html" title="struct iroh_net_report::IpMappedAddrs">IpMapped<wbr>Addrs</a></div><div class="desc docblock-short">A Map of <a href="struct.IpMappedAddrs.html" title="struct iroh_net_report::IpMappedAddrs"><code>IpMappedAddrs</code></a> to <a href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr"><code>SocketAddr</code></a>.</div></li><li><div class="item-name"><a class="struct" href="struct.Metrics.html" title="struct iroh_net_report::Metrics">Metrics</a></div><div class="desc docblock-short">Enum of metrics for the module</div></li><li><div class="item-name"><a class="struct" href="struct.Options.html" title="struct iroh_net_report::Options">Options</a></div><div class="desc docblock-short">Options for running probes</div></li><li><div class="item-name"><a class="struct" href="struct.QuicConfig.html" title="struct iroh_net_report::QuicConfig">Quic<wbr>Config</a></div><div class="desc docblock-short">Pieces needed to do QUIC address discovery.</div></li><li><div class="item-name"><a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">Relay<wbr>Latencies</a></div><div class="desc docblock-short">Latencies per relay node.</div></li><li><div class="item-name"><a class="struct" href="struct.Report.html" title="struct iroh_net_report::Report">Report</a></div><div class="desc docblock-short">A net_report report.</div></li></ul><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.MAPPED_ADDR_PORT.html" title="constant iroh_net_report::MAPPED_ADDR_PORT">MAPPED_<wbr>ADDR_<wbr>PORT</a></div><div class="desc docblock-short">The dummy port used for all mapped addresses</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.bind_local_stun_socket.html" title="fn iroh_net_report::bind_local_stun_socket">bind_<wbr>local_<wbr>stun_<wbr>socket</a><wbr><span class="stab portability" title="Available on crate feature `stun-utils` only"><code>stun-utils</code></span></div><div class="desc docblock-short">Attempts to bind a local socket to send STUN packets from.</div></li><li><div class="item-name"><a class="fn" href="fn.os_has_ipv6.html" title="fn iroh_net_report::os_has_ipv6">os_<wbr>has_<wbr>ipv6</a></div><div class="desc docblock-short">Test if IPv6 works at all, or if it’s been hard disabled at the OS level.</div></li></ul></section></div></main></body></html>
@@ -17,7 +17,7 @@ stop running.</p>
allows sending messages to the actor.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_report" class="method"><a class="src rightside" href="../src/iroh_net_report/lib.rs.html#400-416">Source</a><h4 class="code-header">pub async fn <a href="#method.get_report" class="fn">get_report</a>(
&amp;mut self,
relay_map: RelayMap,
relay_map: <a class="struct" href="../iroh_relay/relay_map/struct.RelayMap.html" title="struct iroh_relay::relay_map::RelayMap">RelayMap</a>,
stun_sock_v4: <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/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;UdpSocket&gt;&gt;,
stun_sock_v6: <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/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;UdpSocket&gt;&gt;,
quic_config: <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.QuicConfig.html" title="struct iroh_net_report::QuicConfig">QuicConfig</a>&gt;,
@@ -39,14 +39,14 @@ using QUIC address discovery.</p>
<p>This will attempt to use <em>all</em> probe protocols.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_report_with_opts" class="method"><a class="src rightside" href="../src/iroh_net_report/lib.rs.html#423-433">Source</a><h4 class="code-header">pub async fn <a href="#method.get_report_with_opts" class="fn">get_report_with_opts</a>(
&amp;mut self,
relay_map: RelayMap,
relay_map: <a class="struct" href="../iroh_relay/relay_map/struct.RelayMap.html" title="struct iroh_relay::relay_map::RelayMap">RelayMap</a>,
opts: <a class="struct" href="struct.Options.html" title="struct iroh_net_report::Options">Options</a>,
) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="struct" href="struct.Report.html" title="struct iroh_net_report::Report">Report</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Runs a net_report, returning the report.</p>
<p>It may not be called concurrently with itself, <code>&amp;mut self</code> takes care of that.</p>
<p>Look at <a href="struct.Options.html" title="struct iroh_net_report::Options"><code>Options</code></a> for the different configuration options.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.get_report_channel" class="method"><a class="src rightside" href="../src/iroh_net_report/lib.rs.html#438-452">Source</a><h4 class="code-header">pub async fn <a href="#method.get_report_channel" class="fn">get_report_channel</a>(
&amp;mut self,
relay_map: RelayMap,
relay_map: <a class="struct" href="../iroh_relay/relay_map/struct.RelayMap.html" title="struct iroh_relay::relay_map::RelayMap">RelayMap</a>,
opts: <a class="struct" href="struct.Options.html" title="struct iroh_net_report::Options">Options</a>,
) -&gt; <a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;Receiver&lt;<a class="type" href="https://docs.rs/anyhow/1.0.95/anyhow/type.Result.html" title="type anyhow::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a>&lt;<a class="struct" href="struct.Report.html" title="struct iroh_net_report::Report">Report</a>&gt;&gt;&gt;&gt;</h4></section></summary><div class="docblock"><p>Get report with channel</p>
<p>Look at <a href="struct.Options.html" title="struct iroh_net_report::Options"><code>Options</code></a> for the different configuration options.</p>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
pub mapping_varies_by_dest_ipv6: <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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,
pub hair_pinning: <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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;,
pub portmap_probe: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;ProbeOutput&gt;,
pub preferred_relay: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;,
pub preferred_relay: <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;,
pub relay_latency: <a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">RelayLatencies</a>,
pub relay_v4_latency: <a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">RelayLatencies</a>,
pub relay_v6_latency: <a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">RelayLatencies</a>,
@@ -35,7 +35,7 @@ detecting rather than using it. For now.</p>
</div><span id="structfield.hair_pinning" class="structfield section-header"><a href="#structfield.hair_pinning" class="anchor field">§</a><code>hair_pinning: <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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>&gt;</code></span><div class="docblock"><p>Whether the router supports communicating between two local devices through the NATted
public IP address (on IPv4).</p>
</div><span id="structfield.portmap_probe" class="structfield section-header"><a href="#structfield.portmap_probe" class="anchor field">§</a><code>portmap_probe: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;ProbeOutput&gt;</code></span><div class="docblock"><p>Probe indicating the presence of port mapping protocols on the LAN.</p>
</div><span id="structfield.preferred_relay" class="structfield section-header"><a href="#structfield.preferred_relay" class="anchor field">§</a><code>preferred_relay: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;</code></span><div class="docblock"><p><code>None</code> for unknown</p>
</div><span id="structfield.preferred_relay" class="structfield section-header"><a href="#structfield.preferred_relay" class="anchor field">§</a><code>preferred_relay: <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;</code></span><div class="docblock"><p><code>None</code> for unknown</p>
</div><span id="structfield.relay_latency" class="structfield section-header"><a href="#structfield.relay_latency" class="anchor field">§</a><code>relay_latency: <a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">RelayLatencies</a></code></span><div class="docblock"><p>keyed by relay Url</p>
</div><span id="structfield.relay_v4_latency" class="structfield section-header"><a href="#structfield.relay_v4_latency" class="anchor field">§</a><code>relay_v4_latency: <a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">RelayLatencies</a></code></span><div class="docblock"><p>keyed by relay Url</p>
</div><span id="structfield.relay_v6_latency" class="structfield section-header"><a href="#structfield.relay_v6_latency" class="anchor field">§</a><code>relay_v6_latency: <a class="struct" href="struct.RelayLatencies.html" title="struct iroh_net_report::RelayLatencies">RelayLatencies</a></code></span><div class="docblock"><p>keyed by relay Url</p>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -14,9 +14,9 @@ case there is an error in the server before it is shut down.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.quic_addr" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#480-482">Source</a><h4 class="code-header">pub fn <a href="#method.quic_addr" class="fn">quic_addr</a>(&amp;self) -&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="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>&gt;</h4></section></summary><div class="docblock"><p>The socket address the QUIC server is listening on.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.stun_addr" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#485-487">Source</a><h4 class="code-header">pub fn <a href="#method.stun_addr" class="fn">stun_addr</a>(&amp;self) -&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="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>&gt;</h4></section></summary><div class="docblock"><p>The socket address the STUN server is listening on.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.certificates" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#490-492">Source</a><h4 class="code-header">pub fn <a href="#method.certificates" class="fn">certificates</a>(&amp;self) -&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="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;CertificateDer&lt;'static&gt;&gt;&gt;</h4></section></summary><div class="docblock"><p>The certificates chain if configured with manual TLS certificates.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.https_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#498-504">Source</a><h4 class="code-header">pub fn <a href="#method.https_url" class="fn">https_url</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s https [<code>RelayUrl</code>].</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.https_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#498-504">Source</a><h4 class="code-header">pub fn <a href="#method.https_url" class="fn">https_url</a>(&amp;self) -&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="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s https <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a>.</p>
<p>This uses <a href="struct.Server.html#method.https_addr" title="method iroh_relay::server::Server::https_addr"><code>Self::https_addr</code></a> so it’s mostly useful for local development.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#510-516">Source</a><h4 class="code-header">pub fn <a href="#method.http_url" class="fn">http_url</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s http [<code>RelayUrl</code>].</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#510-516">Source</a><h4 class="code-header">pub fn <a href="#method.http_url" class="fn">http_url</a>(&amp;self) -&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="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s http <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a>.</p>
<p>This uses <a href="struct.Server.html#method.http_addr" title="method iroh_relay::server::Server::http_addr"><code>Self::http_addr</code></a> so it’s mostly useful for local development.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Server" class="impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#248">Source</a><a href="#impl-Debug-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#248">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, __derive_more_f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Server" class="impl"><a href="#impl-Freeze-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-RefUnwindSafe-for-Server" class="impl"><a href="#impl-RefUnwindSafe-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Send-for-Server" class="impl"><a href="#impl-Send-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Sync-for-Server" class="impl"><a href="#impl-Sync-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Unpin-for-Server" class="impl"><a href="#impl-Unpin-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-UnwindSafe-for-Server" class="impl"><a href="#impl-UnwindSafe-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-AsTaggedExplicit%3C'a,+E%3E-for-T" class="impl"><a href="#impl-AsTaggedExplicit%3C'a,+E%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T, E&gt; AsTaggedExplicit&lt;'a, E&gt; for T<div class="where">where
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
searchState.loadedDescShard("iroh_net_report", 0, "Checks the network conditions from the current host.\nSender to the main service.\nClient to run net_reports.\nA mirror for the <code>NodeIdMappedAddr</code>, mapping a fake Ipv6 …\nCan occur when converting a <code>SocketAddr</code> to an <code>IpMappedAddr</code>\nA Map of <code>IpMappedAddrs</code> to <code>SocketAddr</code>\nThe dummy port used for all mapped addresses\nEnum of metrics for the module\nOptions for running probes\nPieces needed to do QUIC address discovery.\nLatencies per relay node.\nA net_report report.\nAdd a <code>SocketAddr</code> to the map and the generated <code>IpMappedAddr</code> …\nReturns a new address to send messages to this actor.\nAttempts to bind a local socket to send STUN packets from.\nCaptivePortal is set when we think there’s a captive …\nA client config.\nCreate an <code>Options</code> that disables all probes\nA QUIC Endpoint\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGenerates a globally unique fake UDP address.\nGet the <code>SocketAddr</code> for the given <code>IpMappedAddr</code>.\nGet the <code>IpMappedAddr</code> for the given <code>SocketAddr</code>.\nRuns a net_report, returning the report.\nGet report with channel\nRuns a net_report, returning the report.\nip:port of global IPv4\n<code>[ip]:port</code> of global IPv6\nWhether the router supports communicating between two …\nEnable or disable https probe\nEnable or disable icmp_v4 probe\nEnable or disable icmp_v6 probe\nAn ICMPv4 round trip completed, <code>None</code> if not checked.\nAn ICMPv6 round trip completed, <code>None</code> if not checked.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nEnable ipv4 QUIC address discovery probes\nAn IPv4 STUN round trip completed.\nan IPv4 packet was able to be sent\nEnable ipv6 QUIC address discovery probes\nAn IPv6 STUN round trip completed.\nAn IPv6 packet was able to be sent\nReturns an iterator over all the relays and their …\nWhether STUN results depend on which STUN server you’re …\nWhether STUN results depend on which STUN server you’re …\nCreate an empty <code>IpMappedAddrs</code>\nCreates a new net_report client.\nTest if IPv6 works at all, or if it’s been hard disabled …\ncould bind a socket to ::1\nProbe indicating the presence of port mapping protocols on …\n<code>None</code> for unknown\nEnable quic probes\nPass a received STUN packet to the net_reporter.\nkeyed by relay Url\nkeyed by relay Url\nkeyed by relay Url\nReturn a <code>SocketAddr</code> from the <code>IpMappedAddr</code>.\nSet the ipv4 stun socket and enable ipv4 stun probes\nSet the ipv6 stun socket and enable ipv6 stun probes\nA UDP STUN round trip completed.")
searchState.loadedDescShard("iroh_net_report", 0, "Checks the network conditions from the current host.\nSender to the main service.\nClient to run net_reports.\nA mirror for the <code>NodeIdMappedAddr</code>, mapping a fake Ipv6 …\nCan occur when converting a <code>SocketAddr</code> to an <code>IpMappedAddr</code>\nA Map of <code>IpMappedAddrs</code> to <code>SocketAddr</code>.\nThe dummy port used for all mapped addresses\nEnum of metrics for the module\nOptions for running probes\nPieces needed to do QUIC address discovery.\nLatencies per relay node.\nA net_report report.\nAdds a <code>SocketAddr</code> to the map and returns the generated …\nReturns a new address to send messages to this actor.\nAttempts to bind a local socket to send STUN packets from.\nCaptivePortal is set when we think there’s a captive …\nA client config.\nCreate an <code>Options</code> that disables all probes\nA QUIC Endpoint\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nReturns the argument unchanged.\nGenerates a globally unique fake UDP address.\nReturns the <code>SocketAddr</code> for the given <code>IpMappedAddr</code>.\nReturns the <code>IpMappedAddr</code> for the given <code>SocketAddr</code>.\nRuns a net_report, returning the report.\nGet report with channel\nRuns a net_report, returning the report.\nip:port of global IPv4\n<code>[ip]:port</code> of global IPv6\nWhether the router supports communicating between two …\nEnable or disable https probe\nEnable or disable icmp_v4 probe\nEnable or disable icmp_v6 probe\nAn ICMPv4 round trip completed, <code>None</code> if not checked.\nAn ICMPv6 round trip completed, <code>None</code> if not checked.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nCalls <code>U::from(self)</code>.\nEnable ipv4 QUIC address discovery probes\nAn IPv4 STUN round trip completed.\nan IPv4 packet was able to be sent\nEnable ipv6 QUIC address discovery probes\nAn IPv6 STUN round trip completed.\nAn IPv6 packet was able to be sent\nReturns an iterator over all the relays and their …\nWhether STUN results depend on which STUN server you’re …\nWhether STUN results depend on which STUN server you’re …\nCreates an empty <code>IpMappedAddrs</code>.\nCreates a new net_report client.\nTest if IPv6 works at all, or if it’s been hard disabled …\ncould bind a socket to ::1\nProbe indicating the presence of port mapping protocols on …\n<code>None</code> for unknown\nEnable quic probes\nPass a received STUN packet to the net_reporter.\nkeyed by relay Url\nkeyed by relay Url\nkeyed by relay Url\nReturn a <code>SocketAddr</code> from the <code>IpMappedAddr</code>.\nSet the ipv4 stun socket and enable ipv4 stun probes\nSet the ipv6 stun socket and enable ipv6 stun probes\nA UDP STUN round trip completed.")
+2 -2
View File
@@ -1,3 +1,3 @@
var srcIndex = new Map(JSON.parse('[["bulk",["",[],["bulk.rs"]]],["iroh",["",[["discovery",[["pkarr",[],["dht.rs"]]],["dns.rs","local_swarm_discovery.rs","pkarr.rs","static_provider.rs"]],["dns",[],["node_info.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","timer.rs","udp_conn.rs"]],["tls",[],["certificate.rs","verifier.rs"]]],["defaults.rs","disco.rs","discovery.rs","dns.rs","endpoint.rs","key.rs","lib.rs","magicsock.rs","metrics.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_net_report",["",[["reportgen",[],["hairpin.rs","probes.rs"]]],["defaults.rs","dns.rs","ip_mapped_addrs.rs","lib.rs","metrics.rs","ping.rs","reportgen.rs"]]],["iroh_relay",["",[["client",[],["conn.rs","streams.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","http.rs","key_cache.rs","lib.rs","ping_tracker.rs","protos.rs","quic.rs","relay_map.rs","server.rs"]]],["iroh_test",["",[],["hexdump.rs","lib.rs","logging.rs"]]]]'));
var srcIndex = new Map(JSON.parse('[["bulk",["",[],["bulk.rs"]]],["iroh",["",[["discovery",[["pkarr",[],["dht.rs"]]],["dns.rs","local_swarm_discovery.rs","pkarr.rs","static_provider.rs"]],["dns",[],["node_info.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"]],["tls",[],["certificate.rs","verifier.rs"]]],["defaults.rs","disco.rs","discovery.rs","dns.rs","endpoint.rs","key.rs","lib.rs","magicsock.rs","metrics.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_net_report",["",[["reportgen",[],["hairpin.rs","probes.rs"]]],["defaults.rs","dns.rs","ip_mapped_addrs.rs","lib.rs","metrics.rs","ping.rs","reportgen.rs"]]],["iroh_relay",["",[["client",[],["conn.rs","streams.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","http.rs","key_cache.rs","lib.rs","ping_tracker.rs","protos.rs","quic.rs","relay_map.rs","server.rs"]]],["iroh_test",["",[],["hexdump.rs","lib.rs","logging.rs"]]]]'));
createSrcSidebar();
//{"start":36,"fragment_lengths":[28,573,109,75,306,164,359,59]}
//{"start":36,"fragment_lengths":[28,562,109,75,306,164,359,59]}
+730 -50
View File
@@ -1894,7 +1894,347 @@
<a href="#1893" id="1893">1893</a>
<a href="#1894" id="1894">1894</a>
<a href="#1895" id="1895">1895</a>
<a href="#1896" id="1896">1896</a></pre></div><pre class="rust"><code><span class="doccomment">//! The [`Endpoint`] allows establishing connections to other iroh nodes.
<a href="#1896" id="1896">1896</a>
<a href="#1897" id="1897">1897</a>
<a href="#1898" id="1898">1898</a>
<a href="#1899" id="1899">1899</a>
<a href="#1900" id="1900">1900</a>
<a href="#1901" id="1901">1901</a>
<a href="#1902" id="1902">1902</a>
<a href="#1903" id="1903">1903</a>
<a href="#1904" id="1904">1904</a>
<a href="#1905" id="1905">1905</a>
<a href="#1906" id="1906">1906</a>
<a href="#1907" id="1907">1907</a>
<a href="#1908" id="1908">1908</a>
<a href="#1909" id="1909">1909</a>
<a href="#1910" id="1910">1910</a>
<a href="#1911" id="1911">1911</a>
<a href="#1912" id="1912">1912</a>
<a href="#1913" id="1913">1913</a>
<a href="#1914" id="1914">1914</a>
<a href="#1915" id="1915">1915</a>
<a href="#1916" id="1916">1916</a>
<a href="#1917" id="1917">1917</a>
<a href="#1918" id="1918">1918</a>
<a href="#1919" id="1919">1919</a>
<a href="#1920" id="1920">1920</a>
<a href="#1921" id="1921">1921</a>
<a href="#1922" id="1922">1922</a>
<a href="#1923" id="1923">1923</a>
<a href="#1924" id="1924">1924</a>
<a href="#1925" id="1925">1925</a>
<a href="#1926" id="1926">1926</a>
<a href="#1927" id="1927">1927</a>
<a href="#1928" id="1928">1928</a>
<a href="#1929" id="1929">1929</a>
<a href="#1930" id="1930">1930</a>
<a href="#1931" id="1931">1931</a>
<a href="#1932" id="1932">1932</a>
<a href="#1933" id="1933">1933</a>
<a href="#1934" id="1934">1934</a>
<a href="#1935" id="1935">1935</a>
<a href="#1936" id="1936">1936</a>
<a href="#1937" id="1937">1937</a>
<a href="#1938" id="1938">1938</a>
<a href="#1939" id="1939">1939</a>
<a href="#1940" id="1940">1940</a>
<a href="#1941" id="1941">1941</a>
<a href="#1942" id="1942">1942</a>
<a href="#1943" id="1943">1943</a>
<a href="#1944" id="1944">1944</a>
<a href="#1945" id="1945">1945</a>
<a href="#1946" id="1946">1946</a>
<a href="#1947" id="1947">1947</a>
<a href="#1948" id="1948">1948</a>
<a href="#1949" id="1949">1949</a>
<a href="#1950" id="1950">1950</a>
<a href="#1951" id="1951">1951</a>
<a href="#1952" id="1952">1952</a>
<a href="#1953" id="1953">1953</a>
<a href="#1954" id="1954">1954</a>
<a href="#1955" id="1955">1955</a>
<a href="#1956" id="1956">1956</a>
<a href="#1957" id="1957">1957</a>
<a href="#1958" id="1958">1958</a>
<a href="#1959" id="1959">1959</a>
<a href="#1960" id="1960">1960</a>
<a href="#1961" id="1961">1961</a>
<a href="#1962" id="1962">1962</a>
<a href="#1963" id="1963">1963</a>
<a href="#1964" id="1964">1964</a>
<a href="#1965" id="1965">1965</a>
<a href="#1966" id="1966">1966</a>
<a href="#1967" id="1967">1967</a>
<a href="#1968" id="1968">1968</a>
<a href="#1969" id="1969">1969</a>
<a href="#1970" id="1970">1970</a>
<a href="#1971" id="1971">1971</a>
<a href="#1972" id="1972">1972</a>
<a href="#1973" id="1973">1973</a>
<a href="#1974" id="1974">1974</a>
<a href="#1975" id="1975">1975</a>
<a href="#1976" id="1976">1976</a>
<a href="#1977" id="1977">1977</a>
<a href="#1978" id="1978">1978</a>
<a href="#1979" id="1979">1979</a>
<a href="#1980" id="1980">1980</a>
<a href="#1981" id="1981">1981</a>
<a href="#1982" id="1982">1982</a>
<a href="#1983" id="1983">1983</a>
<a href="#1984" id="1984">1984</a>
<a href="#1985" id="1985">1985</a>
<a href="#1986" id="1986">1986</a>
<a href="#1987" id="1987">1987</a>
<a href="#1988" id="1988">1988</a>
<a href="#1989" id="1989">1989</a>
<a href="#1990" id="1990">1990</a>
<a href="#1991" id="1991">1991</a>
<a href="#1992" id="1992">1992</a>
<a href="#1993" id="1993">1993</a>
<a href="#1994" id="1994">1994</a>
<a href="#1995" id="1995">1995</a>
<a href="#1996" id="1996">1996</a>
<a href="#1997" id="1997">1997</a>
<a href="#1998" id="1998">1998</a>
<a href="#1999" id="1999">1999</a>
<a href="#2000" id="2000">2000</a>
<a href="#2001" id="2001">2001</a>
<a href="#2002" id="2002">2002</a>
<a href="#2003" id="2003">2003</a>
<a href="#2004" id="2004">2004</a>
<a href="#2005" id="2005">2005</a>
<a href="#2006" id="2006">2006</a>
<a href="#2007" id="2007">2007</a>
<a href="#2008" id="2008">2008</a>
<a href="#2009" id="2009">2009</a>
<a href="#2010" id="2010">2010</a>
<a href="#2011" id="2011">2011</a>
<a href="#2012" id="2012">2012</a>
<a href="#2013" id="2013">2013</a>
<a href="#2014" id="2014">2014</a>
<a href="#2015" id="2015">2015</a>
<a href="#2016" id="2016">2016</a>
<a href="#2017" id="2017">2017</a>
<a href="#2018" id="2018">2018</a>
<a href="#2019" id="2019">2019</a>
<a href="#2020" id="2020">2020</a>
<a href="#2021" id="2021">2021</a>
<a href="#2022" id="2022">2022</a>
<a href="#2023" id="2023">2023</a>
<a href="#2024" id="2024">2024</a>
<a href="#2025" id="2025">2025</a>
<a href="#2026" id="2026">2026</a>
<a href="#2027" id="2027">2027</a>
<a href="#2028" id="2028">2028</a>
<a href="#2029" id="2029">2029</a>
<a href="#2030" id="2030">2030</a>
<a href="#2031" id="2031">2031</a>
<a href="#2032" id="2032">2032</a>
<a href="#2033" id="2033">2033</a>
<a href="#2034" id="2034">2034</a>
<a href="#2035" id="2035">2035</a>
<a href="#2036" id="2036">2036</a>
<a href="#2037" id="2037">2037</a>
<a href="#2038" id="2038">2038</a>
<a href="#2039" id="2039">2039</a>
<a href="#2040" id="2040">2040</a>
<a href="#2041" id="2041">2041</a>
<a href="#2042" id="2042">2042</a>
<a href="#2043" id="2043">2043</a>
<a href="#2044" id="2044">2044</a>
<a href="#2045" id="2045">2045</a>
<a href="#2046" id="2046">2046</a>
<a href="#2047" id="2047">2047</a>
<a href="#2048" id="2048">2048</a>
<a href="#2049" id="2049">2049</a>
<a href="#2050" id="2050">2050</a>
<a href="#2051" id="2051">2051</a>
<a href="#2052" id="2052">2052</a>
<a href="#2053" id="2053">2053</a>
<a href="#2054" id="2054">2054</a>
<a href="#2055" id="2055">2055</a>
<a href="#2056" id="2056">2056</a>
<a href="#2057" id="2057">2057</a>
<a href="#2058" id="2058">2058</a>
<a href="#2059" id="2059">2059</a>
<a href="#2060" id="2060">2060</a>
<a href="#2061" id="2061">2061</a>
<a href="#2062" id="2062">2062</a>
<a href="#2063" id="2063">2063</a>
<a href="#2064" id="2064">2064</a>
<a href="#2065" id="2065">2065</a>
<a href="#2066" id="2066">2066</a>
<a href="#2067" id="2067">2067</a>
<a href="#2068" id="2068">2068</a>
<a href="#2069" id="2069">2069</a>
<a href="#2070" id="2070">2070</a>
<a href="#2071" id="2071">2071</a>
<a href="#2072" id="2072">2072</a>
<a href="#2073" id="2073">2073</a>
<a href="#2074" id="2074">2074</a>
<a href="#2075" id="2075">2075</a>
<a href="#2076" id="2076">2076</a>
<a href="#2077" id="2077">2077</a>
<a href="#2078" id="2078">2078</a>
<a href="#2079" id="2079">2079</a>
<a href="#2080" id="2080">2080</a>
<a href="#2081" id="2081">2081</a>
<a href="#2082" id="2082">2082</a>
<a href="#2083" id="2083">2083</a>
<a href="#2084" id="2084">2084</a>
<a href="#2085" id="2085">2085</a>
<a href="#2086" id="2086">2086</a>
<a href="#2087" id="2087">2087</a>
<a href="#2088" id="2088">2088</a>
<a href="#2089" id="2089">2089</a>
<a href="#2090" id="2090">2090</a>
<a href="#2091" id="2091">2091</a>
<a href="#2092" id="2092">2092</a>
<a href="#2093" id="2093">2093</a>
<a href="#2094" id="2094">2094</a>
<a href="#2095" id="2095">2095</a>
<a href="#2096" id="2096">2096</a>
<a href="#2097" id="2097">2097</a>
<a href="#2098" id="2098">2098</a>
<a href="#2099" id="2099">2099</a>
<a href="#2100" id="2100">2100</a>
<a href="#2101" id="2101">2101</a>
<a href="#2102" id="2102">2102</a>
<a href="#2103" id="2103">2103</a>
<a href="#2104" id="2104">2104</a>
<a href="#2105" id="2105">2105</a>
<a href="#2106" id="2106">2106</a>
<a href="#2107" id="2107">2107</a>
<a href="#2108" id="2108">2108</a>
<a href="#2109" id="2109">2109</a>
<a href="#2110" id="2110">2110</a>
<a href="#2111" id="2111">2111</a>
<a href="#2112" id="2112">2112</a>
<a href="#2113" id="2113">2113</a>
<a href="#2114" id="2114">2114</a>
<a href="#2115" id="2115">2115</a>
<a href="#2116" id="2116">2116</a>
<a href="#2117" id="2117">2117</a>
<a href="#2118" id="2118">2118</a>
<a href="#2119" id="2119">2119</a>
<a href="#2120" id="2120">2120</a>
<a href="#2121" id="2121">2121</a>
<a href="#2122" id="2122">2122</a>
<a href="#2123" id="2123">2123</a>
<a href="#2124" id="2124">2124</a>
<a href="#2125" id="2125">2125</a>
<a href="#2126" id="2126">2126</a>
<a href="#2127" id="2127">2127</a>
<a href="#2128" id="2128">2128</a>
<a href="#2129" id="2129">2129</a>
<a href="#2130" id="2130">2130</a>
<a href="#2131" id="2131">2131</a>
<a href="#2132" id="2132">2132</a>
<a href="#2133" id="2133">2133</a>
<a href="#2134" id="2134">2134</a>
<a href="#2135" id="2135">2135</a>
<a href="#2136" id="2136">2136</a>
<a href="#2137" id="2137">2137</a>
<a href="#2138" id="2138">2138</a>
<a href="#2139" id="2139">2139</a>
<a href="#2140" id="2140">2140</a>
<a href="#2141" id="2141">2141</a>
<a href="#2142" id="2142">2142</a>
<a href="#2143" id="2143">2143</a>
<a href="#2144" id="2144">2144</a>
<a href="#2145" id="2145">2145</a>
<a href="#2146" id="2146">2146</a>
<a href="#2147" id="2147">2147</a>
<a href="#2148" id="2148">2148</a>
<a href="#2149" id="2149">2149</a>
<a href="#2150" id="2150">2150</a>
<a href="#2151" id="2151">2151</a>
<a href="#2152" id="2152">2152</a>
<a href="#2153" id="2153">2153</a>
<a href="#2154" id="2154">2154</a>
<a href="#2155" id="2155">2155</a>
<a href="#2156" id="2156">2156</a>
<a href="#2157" id="2157">2157</a>
<a href="#2158" id="2158">2158</a>
<a href="#2159" id="2159">2159</a>
<a href="#2160" id="2160">2160</a>
<a href="#2161" id="2161">2161</a>
<a href="#2162" id="2162">2162</a>
<a href="#2163" id="2163">2163</a>
<a href="#2164" id="2164">2164</a>
<a href="#2165" id="2165">2165</a>
<a href="#2166" id="2166">2166</a>
<a href="#2167" id="2167">2167</a>
<a href="#2168" id="2168">2168</a>
<a href="#2169" id="2169">2169</a>
<a href="#2170" id="2170">2170</a>
<a href="#2171" id="2171">2171</a>
<a href="#2172" id="2172">2172</a>
<a href="#2173" id="2173">2173</a>
<a href="#2174" id="2174">2174</a>
<a href="#2175" id="2175">2175</a>
<a href="#2176" id="2176">2176</a>
<a href="#2177" id="2177">2177</a>
<a href="#2178" id="2178">2178</a>
<a href="#2179" id="2179">2179</a>
<a href="#2180" id="2180">2180</a>
<a href="#2181" id="2181">2181</a>
<a href="#2182" id="2182">2182</a>
<a href="#2183" id="2183">2183</a>
<a href="#2184" id="2184">2184</a>
<a href="#2185" id="2185">2185</a>
<a href="#2186" id="2186">2186</a>
<a href="#2187" id="2187">2187</a>
<a href="#2188" id="2188">2188</a>
<a href="#2189" id="2189">2189</a>
<a href="#2190" id="2190">2190</a>
<a href="#2191" id="2191">2191</a>
<a href="#2192" id="2192">2192</a>
<a href="#2193" id="2193">2193</a>
<a href="#2194" id="2194">2194</a>
<a href="#2195" id="2195">2195</a>
<a href="#2196" id="2196">2196</a>
<a href="#2197" id="2197">2197</a>
<a href="#2198" id="2198">2198</a>
<a href="#2199" id="2199">2199</a>
<a href="#2200" id="2200">2200</a>
<a href="#2201" id="2201">2201</a>
<a href="#2202" id="2202">2202</a>
<a href="#2203" id="2203">2203</a>
<a href="#2204" id="2204">2204</a>
<a href="#2205" id="2205">2205</a>
<a href="#2206" id="2206">2206</a>
<a href="#2207" id="2207">2207</a>
<a href="#2208" id="2208">2208</a>
<a href="#2209" id="2209">2209</a>
<a href="#2210" id="2210">2210</a>
<a href="#2211" id="2211">2211</a>
<a href="#2212" id="2212">2212</a>
<a href="#2213" id="2213">2213</a>
<a href="#2214" id="2214">2214</a>
<a href="#2215" id="2215">2215</a>
<a href="#2216" id="2216">2216</a>
<a href="#2217" id="2217">2217</a>
<a href="#2218" id="2218">2218</a>
<a href="#2219" id="2219">2219</a>
<a href="#2220" id="2220">2220</a>
<a href="#2221" id="2221">2221</a>
<a href="#2222" id="2222">2222</a>
<a href="#2223" id="2223">2223</a>
<a href="#2224" id="2224">2224</a>
<a href="#2225" id="2225">2225</a>
<a href="#2226" id="2226">2226</a>
<a href="#2227" id="2227">2227</a>
<a href="#2228" id="2228">2228</a>
<a href="#2229" id="2229">2229</a>
<a href="#2230" id="2230">2230</a>
<a href="#2231" id="2231">2231</a>
<a href="#2232" id="2232">2232</a>
<a href="#2233" id="2233">2233</a>
<a href="#2234" id="2234">2234</a>
<a href="#2235" id="2235">2235</a>
<a href="#2236" id="2236">2236</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
@@ -1919,7 +2259,7 @@
};
<span class="kw">use </span>anyhow::{bail, Context, <span class="prelude-ty">Result</span>};
<span class="kw">use </span>iroh_base::{NodeAddr, NodeId, PublicKey, RelayUrl, SecretKey};
<span class="kw">use </span>iroh_base::{NodeAddr, NodeId, RelayUrl, SecretKey};
<span class="kw">use </span>iroh_relay::RelayMap;
<span class="kw">use </span>pin_project::pin_project;
<span class="kw">use </span>tracing::{debug, instrument, trace, warn};
@@ -1939,7 +2279,7 @@
<span class="comment">// Missing still: SendDatagram and ConnectionClose::frame_type's Type.
</span><span class="kw">pub use </span>quinn::{
AcceptBi, AcceptUni, AckFrequencyConfig, ApplicationClose, Chunk, ClosedStream, Connection,
AcceptBi, AcceptUni, AckFrequencyConfig, ApplicationClose, Chunk, ClosedStream,
ConnectionClose, ConnectionError, ConnectionStats, MtuDiscoveryConfig, OpenBi, OpenUni,
ReadDatagram, ReadError, ReadExactError, ReadToEndError, RecvStream, ResetError, RetryError,
SendDatagramError, SendStream, ServerConfig, StoppedError, StreamId, TransportConfig, VarInt,
@@ -1991,7 +2331,7 @@
secret_key: <span class="prelude-ty">Option</span>&lt;SecretKey&gt;,
relay_mode: RelayMode,
alpn_protocols: Vec&lt;Vec&lt;u8&gt;&gt;,
transport_config: <span class="prelude-ty">Option</span>&lt;quinn::TransportConfig&gt;,
transport_config: quinn::TransportConfig,
keylog: bool,
<span class="attr">#[debug(skip)]
</span>discovery: Vec&lt;DiscoveryBuilder&gt;,
@@ -2009,11 +2349,13 @@
<span class="kw">impl </span>Default <span class="kw">for </span>Builder {
<span class="kw">fn </span>default() -&gt; <span class="self">Self </span>{
<span class="kw">let </span><span class="kw-2">mut </span>transport_config = quinn::TransportConfig::default();
transport_config.keep_alive_interval(<span class="prelude-val">Some</span>(Duration::from_secs(<span class="number">1</span>)));
<span class="self">Self </span>{
secret_key: Default::default(),
relay_mode: default_relay_mode(),
alpn_protocols: Default::default(),
transport_config: Default::default(),
transport_config,
keylog: Default::default(),
discovery: Default::default(),
proxy_url: <span class="prelude-val">None</span>,
@@ -2042,7 +2384,7 @@
</span>.secret_key
.unwrap_or_else(|| SecretKey::generate(rand::rngs::OsRng));
<span class="kw">let </span>static_config = StaticConfig {
transport_config: Arc::new(<span class="self">self</span>.transport_config.unwrap_or_default()),
transport_config: Arc::new(<span class="self">self</span>.transport_config),
keylog: <span class="self">self</span>.keylog,
secret_key: secret_key.clone(),
};
@@ -2109,6 +2451,8 @@
/// also its [`NodeId`]
///
/// If not set, a new secret key will be generated.
///
/// [`PublicKey`]: iroh_base::PublicKey
</span><span class="kw">pub fn </span>secret_key(<span class="kw-2">mut </span><span class="self">self</span>, secret_key: SecretKey) -&gt; <span class="self">Self </span>{
<span class="self">self</span>.secret_key = <span class="prelude-val">Some</span>(secret_key);
<span class="self">self
@@ -2277,8 +2621,11 @@
/// internet applications. Applications protocols which forbid remotely-initiated
/// streams should set `max_concurrent_bidi_streams` and `max_concurrent_uni_streams` to
/// zero.
///
/// Please be aware that changing some settings may have adverse effects on establishing
/// and maintaining direct connections.
</span><span class="kw">pub fn </span>transport_config(<span class="kw-2">mut </span><span class="self">self</span>, transport_config: quinn::TransportConfig) -&gt; <span class="self">Self </span>{
<span class="self">self</span>.transport_config = <span class="prelude-val">Some</span>(transport_config);
<span class="self">self</span>.transport_config = transport_config;
<span class="self">self
</span>}
@@ -2475,8 +2822,25 @@
/// The `alpn`, or application-level protocol identifier, is also required. The remote
/// endpoint must support this `alpn`, otherwise the connection attempt will fail with
/// an error.
</span><span class="attr">#[instrument(skip_all, fields(me = %<span class="self">self</span>.node_id().fmt_short(), alpn = <span class="question-mark">?</span>String::from_utf8_lossy(alpn)))]
</span><span class="kw">pub async fn </span>connect(<span class="kw-2">&amp;</span><span class="self">self</span>, node_addr: <span class="kw">impl </span>Into&lt;NodeAddr&gt;, alpn: <span class="kw-2">&amp;</span>[u8]) -&gt; <span class="prelude-ty">Result</span>&lt;Connection&gt; {
<span class="self">self</span>.connect_with(node_addr, alpn, <span class="self">self</span>.static_config.transport_config.clone())
.<span class="kw">await
</span>}
<span class="doccomment">/// Connects to a remote [`Endpoint`] using a custom [`TransportConfig`].
///
/// Like [`Endpoint::connect`], but allows providing a custom for the connection. See
/// the docs of [`Endpoint::connect`] for details.
///
/// Please be aware that changing some settings may have adverse effects on establishing
/// and maintaining direct connections. Carefully test settings you use and consider
/// this currently as still rather experimental.
</span><span class="kw">pub async fn </span>connect_with(
<span class="kw-2">&amp;</span><span class="self">self</span>,
node_addr: <span class="kw">impl </span>Into&lt;NodeAddr&gt;,
alpn: <span class="kw-2">&amp;</span>[u8],
transport_config: Arc&lt;TransportConfig&gt;,
) -&gt; <span class="prelude-ty">Result</span>&lt;Connection&gt; {
<span class="kw">let </span>node_addr: NodeAddr = node_addr.into();
tracing::Span::current().record(<span class="string">"remote"</span>, node_addr.node_id.fmt_short());
<span class="comment">// Connecting to ourselves is not supported.
@@ -2514,18 +2878,25 @@
<span class="comment">// Start connecting via quinn. This will time out after 10 seconds if no reachable
// address is available.
</span><span class="self">self</span>.connect_quinn(node_id, alpn, addr).<span class="kw">await
</span><span class="self">self</span>.connect_quinn(node_id, alpn, addr, transport_config)
.<span class="kw">await
</span>}
<span class="attr">#[instrument(
name = <span class="string">"connect"</span>,
skip_all,
fields(remote_node = node_id.fmt_short(), alpn = %String::from_utf8_lossy(alpn))
fields(
me = %<span class="self">self</span>.node_id().fmt_short(),
remote_node = node_id.fmt_short(),
alpn = %String::from_utf8_lossy(alpn),
)
)]
</span><span class="kw">async fn </span>connect_quinn(
<span class="kw-2">&amp;</span><span class="self">self</span>,
node_id: NodeId,
alpn: <span class="kw-2">&amp;</span>[u8],
addr: NodeIdMappedAddr,
transport_config: Arc&lt;TransportConfig&gt;,
) -&gt; <span class="prelude-ty">Result</span>&lt;Connection&gt; {
<span class="macro">debug!</span>(<span class="string">"Attempting connection..."</span>);
<span class="kw">let </span>client_config = {
@@ -2537,9 +2908,7 @@
<span class="self">self</span>.static_config.keylog,
)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>client_config = quinn::ClientConfig::new(Arc::new(quic_client_config));
<span class="kw">let </span><span class="kw-2">mut </span>transport_config = quinn::TransportConfig::default();
transport_config.keep_alive_interval(<span class="prelude-val">Some</span>(Duration::from_secs(<span class="number">1</span>)));
client_config.transport_config(Arc::new(transport_config));
client_config.transport_config(transport_config);
client_config
};
@@ -2563,7 +2932,7 @@
</span><span class="macro">warn!</span>(<span class="string">"rtt-actor not reachable: {err:#}"</span>);
}
<span class="macro">debug!</span>(<span class="string">"Connection established"</span>);
<span class="prelude-val">Ok</span>(connection)
<span class="prelude-val">Ok</span>(Connection { inner: connection })
}
<span class="doccomment">/// Accepts an incoming connection on the endpoint.
@@ -2600,8 +2969,8 @@
///
/// # Errors
///
/// Will return an error if we attempt to add our own [`PublicKey`] to the node map or if the
/// direct addresses are a subset of ours.
/// Will return an error if we attempt to add our own [`NodeId`] to the node map or
/// if the direct addresses are a subset of ours.
///
/// [`StaticProvider`]: crate::discovery::static_provider::StaticProvider
</span><span class="kw">pub fn </span>add_node_addr(<span class="kw-2">&amp;</span><span class="self">self</span>, node_addr: NodeAddr) -&gt; <span class="prelude-ty">Result</span>&lt;()&gt; {
@@ -2623,8 +2992,8 @@
///
/// # Errors
///
/// Will return an error if we attempt to add our own [`PublicKey`] to the node map or if the
/// direct addresses are a subset of ours.
/// Will return an error if we attempt to add our own [`NodeId`] to the node map or
/// if the direct addresses are a subset of ours.
///
/// [`StaticProvider`]: crate::discovery::static_provider::StaticProvider
</span><span class="kw">pub fn </span>add_node_addr_with_source(
@@ -3083,14 +3452,15 @@
}
<span class="kw">impl </span>Future <span class="kw">for </span>IncomingFuture {
<span class="kw">type </span>Output = <span class="prelude-ty">Result</span>&lt;quinn::Connection, ConnectionError&gt;;
<span class="kw">type </span>Output = <span class="prelude-ty">Result</span>&lt;Connection, ConnectionError&gt;;
<span class="kw">fn </span>poll(<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>std::task::Context&lt;<span class="lifetime">'_</span>&gt;) -&gt; Poll&lt;<span class="self">Self</span>::Output&gt; {
<span class="kw">let </span>this = <span class="self">self</span>.project();
<span class="kw">match </span>this.inner.poll(cx) {
Poll::Pending =&gt; Poll::Pending,
Poll::Ready(<span class="prelude-val">Err</span>(err)) =&gt; Poll::Ready(<span class="prelude-val">Err</span>(err)),
Poll::Ready(<span class="prelude-val">Ok</span>(conn)) =&gt; {
Poll::Ready(<span class="prelude-val">Ok</span>(inner)) =&gt; {
<span class="kw">let </span>conn = Connection { inner };
try_send_rtt_msg(<span class="kw-2">&amp;</span>conn, this.ep);
Poll::Ready(<span class="prelude-val">Ok</span>(conn))
}
@@ -3111,7 +3481,8 @@
<span class="doccomment">/// Convert into a 0-RTT or 0.5-RTT connection at the cost of weakened security.
</span><span class="kw">pub fn </span>into_0rtt(<span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;(Connection, ZeroRttAccepted), <span class="self">Self</span>&gt; {
<span class="kw">match </span><span class="self">self</span>.inner.into_0rtt() {
<span class="prelude-val">Ok</span>((conn, zrtt_accepted)) =&gt; {
<span class="prelude-val">Ok</span>((inner, zrtt_accepted)) =&gt; {
<span class="kw">let </span>conn = Connection { inner };
try_send_rtt_msg(<span class="kw-2">&amp;</span>conn, <span class="kw-2">&amp;</span><span class="self">self</span>.ep);
<span class="prelude-val">Ok</span>((conn, zrtt_accepted))
}
@@ -3157,7 +3528,8 @@
<span class="kw">match </span>this.inner.poll(cx) {
Poll::Pending =&gt; Poll::Pending,
Poll::Ready(<span class="prelude-val">Err</span>(err)) =&gt; Poll::Ready(<span class="prelude-val">Err</span>(err)),
Poll::Ready(<span class="prelude-val">Ok</span>(conn)) =&gt; {
Poll::Ready(<span class="prelude-val">Ok</span>(inner)) =&gt; {
<span class="kw">let </span>conn = Connection { inner };
try_send_rtt_msg(<span class="kw-2">&amp;</span>conn, this.ep);
Poll::Ready(<span class="prelude-val">Ok</span>(conn))
}
@@ -3165,25 +3537,333 @@
}
}
<span class="doccomment">/// Extract the [`PublicKey`] from the peer's TLS certificate.
</span><span class="comment">// TODO: make this a method now
</span><span class="kw">pub fn </span>get_remote_node_id(connection: <span class="kw-2">&amp;</span>Connection) -&gt; <span class="prelude-ty">Result</span>&lt;PublicKey&gt; {
<span class="kw">let </span>data = connection.peer_identity();
<span class="kw">match </span>data {
<span class="prelude-val">None </span>=&gt; <span class="macro">bail!</span>(<span class="string">"no peer certificate found"</span>),
<span class="prelude-val">Some</span>(data) =&gt; <span class="kw">match </span>data.downcast::&lt;Vec&lt;rustls::pki_types::CertificateDer&gt;&gt;() {
<span class="prelude-val">Ok</span>(certs) =&gt; {
<span class="kw">if </span>certs.len() != <span class="number">1 </span>{
<span class="macro">bail!</span>(
<span class="string">"expected a single peer certificate, but {} found"</span>,
certs.len()
);
<span class="doccomment">/// A QUIC connection.
///
/// If all references to a connection (including every clone of the Connection handle,
/// streams of incoming streams, and the various stream types) have been dropped, then the
/// connection will be automatically closed with an error_code of 0 and an empty reason. You
/// can also close the connection explicitly by calling [`Connection::close`].
///
/// Closing the connection immediately abandons efforts to deliver data to the peer. Upon
/// receiving CONNECTION_CLOSE the peer may drop any stream data not yet delivered to the
/// application. [`Connection::close`] describes in more detail how to gracefully close a
/// connection without losing application data.
///
/// May be cloned to obtain another handle to the same connection.
</span><span class="comment">// This has repr(transparent) as it opens the door to potentially allow casting it to a
// quinn::Connection in the future. Right now however that'd be iroh_quinn::Connection.
</span><span class="attr">#[derive(Debug, Clone)]
#[repr(transparent)]
</span><span class="kw">pub struct </span>Connection {
inner: quinn::Connection,
}
<span class="kw">impl </span>Connection {
<span class="doccomment">/// Initiates a new outgoing unidirectional stream.
///
/// Streams are cheap and instantaneous to open unless blocked by flow control. As a
/// consequence, the peer won’t be notified that a stream has been opened until the
/// stream is actually used.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>open_uni(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; OpenUni&lt;<span class="lifetime">'_</span>&gt; {
<span class="self">self</span>.inner.open_uni()
}
<span class="doccomment">/// Initiates a new outgoing bidirectional stream.
///
/// Streams are cheap and instantaneous to open unless blocked by flow control. As a
/// consequence, the peer won't be notified that a stream has been opened until the
/// stream is actually used. Calling [`open_bi`] then waiting on the [`RecvStream`]
/// without writing anything to [`SendStream`] will never succeed.
///
/// [`open_bi`]: Connection::open_bi
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>open_bi(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; OpenBi&lt;<span class="lifetime">'_</span>&gt; {
<span class="self">self</span>.inner.open_bi()
}
<span class="doccomment">/// Accepts the next incoming uni-directional stream.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>accept_uni(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; AcceptUni&lt;<span class="lifetime">'_</span>&gt; {
<span class="self">self</span>.inner.accept_uni()
}
<span class="doccomment">/// Accept the next incoming bidirectional stream.
///
/// **Important Note**: The peer that calls [`open_bi`] must write to its [`SendStream`]
/// before the peer `Connection` is able to accept the stream using
/// `accept_bi()`. Calling [`open_bi`] then waiting on the [`RecvStream`] without
/// writing anything to the connected [`SendStream`] will never succeed.
///
/// [`open_bi`]: Connection::open_bi
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>accept_bi(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; AcceptBi&lt;<span class="lifetime">'_</span>&gt; {
<span class="self">self</span>.inner.accept_bi()
}
<span class="doccomment">/// Receives an application datagram.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>read_datagram(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; ReadDatagram&lt;<span class="lifetime">'_</span>&gt; {
<span class="self">self</span>.inner.read_datagram()
}
<span class="doccomment">/// Wait for the connection to be closed for any reason.
///
/// Despite the return type's name, closed connections are often not an error condition
/// at the application layer. Cases that might be routine include
/// [`ConnectionError::LocallyClosed`] and [`ConnectionError::ApplicationClosed`].
</span><span class="attr">#[inline]
</span><span class="kw">pub async fn </span>closed(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; ConnectionError {
<span class="self">self</span>.inner.closed().<span class="kw">await
</span>}
<span class="doccomment">/// If the connection is closed, the reason why.
///
/// Returns `None` if the connection is still open.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>close_reason(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;ConnectionError&gt; {
<span class="self">self</span>.inner.close_reason()
}
<span class="doccomment">/// Closes the connection immediately.
///
/// Pending operations will fail immediately with [`ConnectionError::LocallyClosed`]. No
/// more data is sent to the peer and the peer may drop buffered data upon receiving the
/// CONNECTION_CLOSE frame.
///
/// `error_code` and `reason` are not interpreted, and are provided directly to the
/// peer.
///
/// `reason` will be truncated to fit in a single packet with overhead; to improve odds
/// that it is preserved in full, it should be kept under 1KiB.
///
/// # Gracefully closing a connection
///
/// Only the peer last receiving application data can be certain that all data is
/// delivered. The only reliable action it can then take is to close the connection,
/// potentially with a custom error code. The delivery of the final CONNECTION_CLOSE
/// frame is very likely if both endpoints stay online long enough, calling
/// [`Endpoint::close`] will wait to provide sufficient time. Otherwise, the remote peer
/// will time out the connection, provided that the idle timeout is not disabled.
///
/// The sending side can not guarantee all stream data is delivered to the remote
/// application. It only knows the data is delivered to the QUIC stack of the remote
/// endpoint. Once the local side sends a CONNECTION_CLOSE frame in response to calling
/// [`close`] the remote endpoint may drop any data it received but is as yet
/// undelivered to the application, including data that was acknowledged as received to
/// the local endpoint.
///
/// [`close`]: Connection::close
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>close(<span class="kw-2">&amp;</span><span class="self">self</span>, error_code: VarInt, reason: <span class="kw-2">&amp;</span>[u8]) {
<span class="self">self</span>.inner.close(error_code, reason)
}
<span class="doccomment">/// Transmits `data` as an unreliable, unordered application datagram.
///
/// Application datagrams are a low-level primitive. They may be lost or delivered out
/// of order, and `data` must both fit inside a single QUIC packet and be smaller than
/// the maximum dictated by the peer.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>send_datagram(<span class="kw-2">&amp;</span><span class="self">self</span>, data: bytes::Bytes) -&gt; <span class="prelude-ty">Result</span>&lt;(), SendDatagramError&gt; {
<span class="self">self</span>.inner.send_datagram(data)
}
<span class="comment">// TODO: It seems `SendDatagram` is not yet exposed by quinn. This has been fixed
// upstream and will be in the next release.
// /// Transmits `data` as an unreliable, unordered application datagram
// ///
// /// Unlike [`send_datagram()`], this method will wait for buffer space during congestion
// /// conditions, which effectively prioritizes old datagrams over new datagrams.
// ///
// /// See [`send_datagram()`] for details.
// ///
// /// [`send_datagram()`]: Connection::send_datagram
// #[inline]
// pub fn send_datagram_wait(&amp;self, data: bytes::Bytes) -&gt; SendDatagram&lt;'_&gt; {
// self.inner.send_datagram_wait(data)
// }
</span><span class="doccomment">/// Computes the maximum size of datagrams that may be passed to [`send_datagram`].
///
/// Returns `None` if datagrams are unsupported by the peer or disabled locally.
///
/// This may change over the lifetime of a connection according to variation in the path
/// MTU estimate. The peer can also enforce an arbitrarily small fixed limit, but if the
/// peer's limit is large this is guaranteed to be a little over a kilobyte at minimum.
///
/// Not necessarily the maximum size of received datagrams.
///
/// [`send_datagram`]: Self::send_datagram
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>max_datagram_size(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;usize&gt; {
<span class="self">self</span>.inner.max_datagram_size()
}
<span class="doccomment">/// Bytes available in the outgoing datagram buffer.
///
/// When greater than zero, calling [`send_datagram`] with a
/// datagram of at most this size is guaranteed not to cause older datagrams to be
/// dropped.
///
/// [`send_datagram`]: Self::send_datagram
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>datagram_send_buffer_space(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; usize {
<span class="self">self</span>.inner.datagram_send_buffer_space()
}
<span class="doccomment">/// The peer's UDP address.
///
/// If [`ServerConfig::migration`] is `true`, clients may change addresses at will,
/// e.g. when switching to a cellular internet connection.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>remote_address(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; SocketAddr {
<span class="self">self</span>.inner.remote_address()
}
<span class="doccomment">/// The local IP address which was used when the peer established the connection.
///
/// This can be different from the address the endpoint is bound to, in case the
/// endpoint is bound to a wildcard address like `0.0.0.0` or `::`.
///
/// This will return `None` for clients, or when the platform does not expose this
/// information. See [`quinn::udp::RecvMeta::dst_ip`] for a list of supported
/// platforms.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>local_ip(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;IpAddr&gt; {
<span class="self">self</span>.inner.local_ip()
}
<span class="doccomment">/// Current best estimate of this connection's latency (round-trip-time).
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>rtt(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Duration {
<span class="self">self</span>.inner.rtt()
}
<span class="doccomment">/// Returns connection statistics.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>stats(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; ConnectionStats {
<span class="self">self</span>.inner.stats()
}
<span class="doccomment">/// Current state of the congestion control algorithm, for debugging purposes.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>congestion_state(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Box&lt;<span class="kw">dyn </span>quinn_proto::congestion::Controller&gt; {
<span class="self">self</span>.inner.congestion_state()
}
<span class="doccomment">/// Parameters negotiated during the handshake.
///
/// Guaranteed to return `Some` on fully established connections or after
/// [`Connecting::handshake_data()`] succeeds. See that method's documentations for
/// details on the returned value.
///
/// [`Connection::handshake_data()`]: crate::Connecting::handshake_data
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>handshake_data(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;Box&lt;<span class="kw">dyn </span>Any&gt;&gt; {
<span class="self">self</span>.inner.handshake_data()
}
<span class="doccomment">/// Extracts the ALPN protocol from the peer's handshake data.
</span><span class="kw">pub fn </span>alpn(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;Vec&lt;u8&gt;&gt; {
<span class="kw">let </span>data = <span class="self">self</span>.handshake_data()<span class="question-mark">?</span>;
<span class="kw">match </span>data.downcast::&lt;quinn::crypto::rustls::HandshakeData&gt;() {
<span class="prelude-val">Ok</span>(data) =&gt; data.protocol,
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="prelude-val">None</span>,
}
}
<span class="doccomment">/// Cryptographic identity of the peer.
///
/// The dynamic type returned is determined by the configured [`Session`]. For the
/// default `rustls` session, the return value can be [`downcast`] to a
/// &lt;code&gt;Vec&lt;[rustls::pki_types::CertificateDer]&gt;&lt;/code&gt;
///
/// [`Session`]: quinn_proto::crypto::Session
/// [`downcast`]: Box::downcast
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>peer_identity(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;Box&lt;<span class="kw">dyn </span>Any&gt;&gt; {
<span class="self">self</span>.inner.peer_identity()
}
<span class="doccomment">/// Returns the [`NodeId`] from the peer's TLS certificate.
///
/// The [`PublicKey`] of a node is also known as a [`NodeId`]. This [`PublicKey`] is
/// included in the TLS certificate presented during the handshake when connecting.
/// This function allows you to get the [`NodeId`] of the remote node of this
/// connection.
///
/// [`PublicKey`]: iroh_base::PublicKey
</span><span class="comment">// TODO: Would be nice if this could be infallible.
</span><span class="kw">pub fn </span>remote_node_id(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;NodeId&gt; {
<span class="kw">let </span>data = <span class="self">self</span>.peer_identity();
<span class="kw">match </span>data {
<span class="prelude-val">None </span>=&gt; <span class="macro">bail!</span>(<span class="string">"no peer certificate found"</span>),
<span class="prelude-val">Some</span>(data) =&gt; <span class="kw">match </span>data.downcast::&lt;Vec&lt;rustls::pki_types::CertificateDer&gt;&gt;() {
<span class="prelude-val">Ok</span>(certs) =&gt; {
<span class="kw">if </span>certs.len() != <span class="number">1 </span>{
<span class="macro">bail!</span>(
<span class="string">"expected a single peer certificate, but {} found"</span>,
certs.len()
);
}
<span class="kw">let </span>cert = tls::certificate::parse(<span class="kw-2">&amp;</span>certs[<span class="number">0</span>])<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(cert.peer_id())
}
<span class="kw">let </span>cert = tls::certificate::parse(<span class="kw-2">&amp;</span>certs[<span class="number">0</span>])<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(cert.peer_id())
}
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="macro">bail!</span>(<span class="string">"invalid peer certificate"</span>),
},
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="macro">bail!</span>(<span class="string">"invalid peer certificate"</span>),
},
}
}
<span class="doccomment">/// A stable identifier for this connection.
///
/// Peer addresses and connection IDs can change, but this value will remain fixed for
/// the lifetime of the connection.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>stable_id(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; usize {
<span class="self">self</span>.inner.stable_id()
}
<span class="doccomment">/// Derives keying material from this connection's TLS session secrets.
///
/// When both peers call this method with the same `label` and `context`
/// arguments and `output` buffers of equal length, they will get the
/// same sequence of bytes in `output`. These bytes are cryptographically
/// strong and pseudorandom, and are suitable for use as keying material.
///
/// See [RFC5705](https://tools.ietf.org/html/rfc5705) for more information.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>export_keying_material(
<span class="kw-2">&amp;</span><span class="self">self</span>,
output: <span class="kw-2">&amp;mut </span>[u8],
label: <span class="kw-2">&amp;</span>[u8],
context: <span class="kw-2">&amp;</span>[u8],
) -&gt; <span class="prelude-ty">Result</span>&lt;(), quinn_proto::crypto::ExportKeyingMaterialError&gt; {
<span class="self">self</span>.inner.export_keying_material(output, label, context)
}
<span class="doccomment">/// Modifies the number of unidirectional streams that may be concurrently opened.
///
/// No streams may be opened by the peer unless fewer than `count` are already
/// open. Large `count`s increase both minimum and worst-case memory consumption.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>set_max_concurrent_uni_streams(<span class="kw-2">&amp;</span><span class="self">self</span>, count: VarInt) {
<span class="self">self</span>.inner.set_max_concurrent_uni_streams(count)
}
<span class="doccomment">/// See [`quinn_proto::TransportConfig::receive_window`].
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>set_receive_window(<span class="kw-2">&amp;</span><span class="self">self</span>, receive_window: VarInt) {
<span class="self">self</span>.inner.set_receive_window(receive_window)
}
<span class="doccomment">/// Modifies the number of bidirectional streams that may be concurrently opened.
///
/// No streams may be opened by the peer unless fewer than `count` are already
/// open. Large `count`s increase both minimum and worst-case memory consumption.
</span><span class="attr">#[inline]
</span><span class="kw">pub fn </span>set_max_concurrent_bi_streams(<span class="kw-2">&amp;</span><span class="self">self</span>, count: VarInt) {
<span class="self">self</span>.inner.set_max_concurrent_bi_streams(count)
}
}
@@ -3193,18 +3873,18 @@
/// function.
</span><span class="kw">fn </span>try_send_rtt_msg(conn: <span class="kw-2">&amp;</span>Connection, magic_ep: <span class="kw-2">&amp;</span>Endpoint) {
<span class="comment">// If we can't notify the rtt-actor that's not great but not critical.
</span><span class="kw">let </span><span class="prelude-val">Ok</span>(peer_id) = get_remote_node_id(conn) <span class="kw">else </span>{
</span><span class="kw">let </span><span class="prelude-val">Ok</span>(node_id) = conn.remote_node_id() <span class="kw">else </span>{
<span class="macro">warn!</span>(<span class="question-mark">?</span>conn, <span class="string">"failed to get remote node id"</span>);
<span class="kw">return</span>;
};
<span class="kw">let </span><span class="prelude-val">Ok</span>(conn_type_changes) = magic_ep.conn_type(peer_id) <span class="kw">else </span>{
<span class="kw">let </span><span class="prelude-val">Ok</span>(conn_type_changes) = magic_ep.conn_type(node_id) <span class="kw">else </span>{
<span class="macro">warn!</span>(<span class="question-mark">?</span>conn, <span class="string">"failed to create conn_type stream"</span>);
<span class="kw">return</span>;
};
<span class="kw">let </span>rtt_msg = RttMessage::NewConnection {
connection: conn.weak_handle(),
connection: conn.inner.weak_handle(),
conn_type_changes: conn_type_changes.stream(),
node_id: peer_id,
node_id,
};
<span class="kw">if let </span><span class="prelude-val">Err</span>(err) = magic_ep.rtt_actor.msg_tx.try_send(rtt_msg) {
<span class="macro">warn!</span>(<span class="question-mark">?</span>conn, <span class="string">"rtt-actor not reachable: {err:#}"</span>);
@@ -3522,8 +4202,8 @@
<span class="macro">info!</span>(<span class="string">"[server] round {i}"</span>);
<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>peer_id = get_remote_node_id(<span class="kw-2">&amp;</span>conn).unwrap();
<span class="macro">info!</span>(%i, peer = %peer_id.fmt_short(), <span class="string">"accepted connection"</span>);
<span class="kw">let </span>node_id = conn.remote_node_id().unwrap();
<span class="macro">info!</span>(%i, peer = %node_id.fmt_short(), <span class="string">"accepted connection"</span>);
<span class="kw">let </span>(<span class="kw-2">mut </span>send, <span class="kw-2">mut </span>recv) = conn.accept_bi().<span class="kw">await</span>.unwrap();
<span class="kw">let </span><span class="kw-2">mut </span>buf = <span class="macro">vec!</span>[<span class="number">0u8</span>; chunk_size];
<span class="kw">for </span>_i <span class="kw">in </span><span class="number">0</span>..n_chunks_per_client {
@@ -3533,7 +4213,7 @@
send.finish().unwrap();
send.stopped().<span class="kw">await</span>.unwrap();
recv.read_to_end(<span class="number">0</span>).<span class="kw">await</span>.unwrap();
<span class="macro">info!</span>(%i, peer = %peer_id.fmt_short(), <span class="string">"finished"</span>);
<span class="macro">info!</span>(%i, peer = %node_id.fmt_short(), <span class="string">"finished"</span>);
<span class="macro">info!</span>(<span class="string">"[server] round {i} done in {:?}"</span>, round_start.elapsed());
}
}
@@ -3638,7 +4318,7 @@
<span class="kw">let </span><span class="kw-2">mut </span>iconn = incoming.accept().unwrap();
<span class="kw">let </span>alpn = iconn.alpn().<span class="kw">await</span>.unwrap();
<span class="kw">let </span>conn = iconn.<span class="kw">await</span>.unwrap();
<span class="kw">let </span>node_id = get_remote_node_id(<span class="kw-2">&amp;</span>conn).unwrap();
<span class="kw">let </span>node_id = conn.remote_node_id().unwrap();
<span class="macro">assert_eq!</span>(node_id, src);
<span class="macro">assert_eq!</span>(alpn, TEST_ALPN);
<span class="kw">let </span>(<span class="kw-2">mut </span>send, <span class="kw-2">mut </span>recv) = conn.accept_bi().<span class="kw">await</span>.unwrap();
@@ -3712,7 +4392,7 @@
.<span class="kw">await
</span>.unwrap();
<span class="kw">async fn </span>handle_direct_conn(ep: <span class="kw-2">&amp;</span>Endpoint, node_id: PublicKey) -&gt; <span class="prelude-ty">Result</span>&lt;()&gt; {
<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">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();
@@ -3728,7 +4408,7 @@
<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 = get_remote_node_id(<span class="kw-2">&amp;</span>conn).unwrap();
<span class="kw">let </span>node_id = conn.remote_node_id().unwrap();
<span class="macro">tracing::info!</span>(node_id=%node_id.fmt_short(), <span class="string">"accepted connection"</span>);
node_id
}
+17 -5
View File
@@ -4391,7 +4391,13 @@
<a href="#4390" id="4390">4390</a>
<a href="#4391" id="4391">4391</a>
<a href="#4392" id="4392">4392</a>
<a href="#4393" id="4393">4393</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="#4393" id="4393">4393</a>
<a href="#4394" id="4394">4394</a>
<a href="#4395" id="4395">4395</a>
<a href="#4396" id="4396">4396</a>
<a href="#4397" id="4397">4397</a>
<a href="#4398" id="4398">4398</a>
<a href="#4399" id="4399">4399</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
//!
@@ -4469,12 +4475,10 @@
<span class="kw">mod </span>metrics;
<span class="kw">mod </span>node_map;
<span class="kw">mod </span>relay_actor;
<span class="kw">mod </span>timer;
<span class="kw">mod </span>udp_conn;
<span class="kw">pub use </span>node_map::Source;
<span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">use </span><span class="self">self</span>::timer::Timer;
<span class="kw">pub use </span><span class="self">self</span>::{
metrics::Metrics,
node_map::{ConnectionType, ControlMsg, DirectAddrInfo, RemoteInfo},
@@ -6175,8 +6179,9 @@
/// indefinitely after this call.
</span><span class="attr">#[instrument(skip_all, fields(me = %<span class="self">self</span>.msock.me))]
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">async fn </span>close(<span class="kw-2">&amp;</span><span class="self">self</span>) {
<span class="macro">tracing::debug!</span>(<span class="string">"Closing connections"</span>);
<span class="self">self</span>.endpoint.close(<span class="number">0u16</span>.into(), <span class="string">b""</span>);
<span class="macro">tracing::warn!</span>(<span class="string">"msock - closing connections"</span>);
<span class="comment">// Initiate closing all connections, and refuse future connections.
</span><span class="self">self</span>.endpoint.close(<span class="number">0u16</span>.into(), <span class="string">b""</span>);
<span class="self">self</span>.endpoint.wait_idle().<span class="kw">await</span>;
<span class="kw">if </span><span class="self">self</span>.msock.is_closed() {
@@ -6210,6 +6215,7 @@
</span><span class="macro">debug!</span>(<span class="string">"aborting remaining {}/3 tasks"</span>, tasks.len());
tasks.shutdown().<span class="kw">await</span>;
}
<span class="macro">warn!</span>(<span class="string">"msock - finished closing"</span>);
}
}
@@ -6966,6 +6972,12 @@
/// this will be refactored to not allow this easy mistake to be made.
</span><span class="attr">#[instrument(level = <span class="string">"debug"</span>, skip_all)]
</span><span class="kw">async fn </span>update_net_info(<span class="kw-2">&amp;mut </span><span class="self">self</span>, why: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str) {
<span class="comment">// Don't start a net report probe if we know
// we are shutting down
</span><span class="kw">if </span><span class="self">self</span>.msock.is_closing() || <span class="self">self</span>.msock.is_closed() {
<span class="macro">debug!</span>(<span class="string">"skipping net_report, socket is shutting down"</span>);
<span class="kw">return</span>;
}
<span class="kw">if </span><span class="self">self</span>.msock.relay_map.is_empty() {
<span class="macro">debug!</span>(<span class="string">"skipping net_report, empty RelayMap"</span>);
<span class="self">self</span>.msg_sender
@@ -1751,6 +1751,7 @@
<span class="kw">use </span>netwatch::ip::is_unicast_link_local;
<span class="kw">use </span>serde::{Deserialize, Serialize};
<span class="kw">use </span>tokio::sync::mpsc;
<span class="kw">use </span>tokio_util::task::AbortOnDropHandle;
<span class="kw">use </span>tracing::{debug, event, info, instrument, trace, warn, Level};
<span class="kw">use super</span>::{
@@ -1763,7 +1764,7 @@
</span><span class="kw">use </span><span class="kw">crate</span>::endpoint::PathSelection;
<span class="kw">use crate</span>::{
disco::{<span class="self">self</span>, SendAddr},
magicsock::{ActorMessage, MagicsockMetrics, NodeIdMappedAddr, Timer, HEARTBEAT_INTERVAL},
magicsock::{ActorMessage, MagicsockMetrics, NodeIdMappedAddr, HEARTBEAT_INTERVAL},
watchable::{Watchable, Watcher},
};
@@ -2265,19 +2266,20 @@
}
<span class="kw">let </span>id = <span class="self">self</span>.id;
<span class="kw">let </span>timer = Timer::after(PING_TIMEOUT_DURATION, <span class="kw">async move </span>{
<span class="kw">let </span>_expiry_task = AbortOnDropHandle::new(tokio::spawn(<span class="kw">async move </span>{
tokio::time::sleep(PING_TIMEOUT_DURATION).<span class="kw">await</span>;
sender
.send(ActorMessage::EndpointPingExpired(id, tx_id))
.<span class="kw">await
</span>.ok();
});
}));
<span class="self">self</span>.sent_pings.insert(
tx_id,
SentPing {
to,
at: now,
purpose,
timer,
_expiry_task,
},
);
}
@@ -2626,8 +2628,6 @@
<span class="prelude-val">None
</span>}
<span class="prelude-val">Some</span>(sp) =&gt; {
sp.timer.abort();
<span class="kw">let </span><span class="kw-2">mut </span>node_map_insert = <span class="prelude-val">None</span>;
<span class="kw">let </span>now = Instant::now();
@@ -2969,7 +2969,7 @@
<span class="kw">pub</span>(<span class="kw">super</span>) at: Instant,
<span class="attr">#[allow(dead_code)]
</span><span class="kw">pub</span>(<span class="kw">super</span>) purpose: DiscoPingPurpose,
<span class="kw">pub</span>(<span class="kw">super</span>) timer: Timer,
<span class="kw">pub</span>(<span class="kw">super</span>) _expiry_task: AbortOnDropHandle&lt;()&gt;,
}
<span class="doccomment">/// The reason why a discovery ping message was sent.
@@ -1,203 +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="Source of the Rust file `iroh/src/magicsock/timer.rs`."><title>timer.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/magicsock/</div>timer.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>
<a href="#4" id="4">4</a>
<a href="#5" id="5">5</a>
<a href="#6" id="6">6</a>
<a href="#7" id="7">7</a>
<a href="#8" id="8">8</a>
<a href="#9" id="9">9</a>
<a href="#10" id="10">10</a>
<a href="#11" id="11">11</a>
<a href="#12" id="12">12</a>
<a href="#13" id="13">13</a>
<a href="#14" id="14">14</a>
<a href="#15" id="15">15</a>
<a href="#16" id="16">16</a>
<a href="#17" id="17">17</a>
<a href="#18" id="18">18</a>
<a href="#19" id="19">19</a>
<a href="#20" id="20">20</a>
<a href="#21" id="21">21</a>
<a href="#22" id="22">22</a>
<a href="#23" id="23">23</a>
<a href="#24" id="24">24</a>
<a href="#25" id="25">25</a>
<a href="#26" id="26">26</a>
<a href="#27" id="27">27</a>
<a href="#28" id="28">28</a>
<a href="#29" id="29">29</a>
<a href="#30" id="30">30</a>
<a href="#31" id="31">31</a>
<a href="#32" id="32">32</a>
<a href="#33" id="33">33</a>
<a href="#34" id="34">34</a>
<a href="#35" id="35">35</a>
<a href="#36" id="36">36</a>
<a href="#37" id="37">37</a>
<a href="#38" id="38">38</a>
<a href="#39" id="39">39</a>
<a href="#40" id="40">40</a>
<a href="#41" id="41">41</a>
<a href="#42" id="42">42</a>
<a href="#43" id="43">43</a>
<a href="#44" id="44">44</a>
<a href="#45" id="45">45</a>
<a href="#46" id="46">46</a>
<a href="#47" id="47">47</a>
<a href="#48" id="48">48</a>
<a href="#49" id="49">49</a>
<a href="#50" id="50">50</a>
<a href="#51" id="51">51</a>
<a href="#52" id="52">52</a>
<a href="#53" id="53">53</a>
<a href="#54" id="54">54</a>
<a href="#55" id="55">55</a>
<a href="#56" id="56">56</a>
<a href="#57" id="57">57</a>
<a href="#58" id="58">58</a>
<a href="#59" id="59">59</a>
<a href="#60" id="60">60</a>
<a href="#61" id="61">61</a>
<a href="#62" id="62">62</a>
<a href="#63" id="63">63</a>
<a href="#64" id="64">64</a>
<a href="#65" id="65">65</a>
<a href="#66" id="66">66</a>
<a href="#67" id="67">67</a>
<a href="#68" id="68">68</a>
<a href="#69" id="69">69</a>
<a href="#70" id="70">70</a>
<a href="#71" id="71">71</a>
<a href="#72" id="72">72</a>
<a href="#73" id="73">73</a>
<a href="#74" id="74">74</a>
<a href="#75" id="75">75</a>
<a href="#76" id="76">76</a>
<a href="#77" id="77">77</a>
<a href="#78" id="78">78</a>
<a href="#79" id="79">79</a>
<a href="#80" id="80">80</a>
<a href="#81" id="81">81</a>
<a href="#82" id="82">82</a>
<a href="#83" id="83">83</a>
<a href="#84" id="84">84</a>
<a href="#85" id="85">85</a>
<a href="#86" id="86">86</a>
<a href="#87" id="87">87</a>
<a href="#88" id="88">88</a>
<a href="#89" id="89">89</a>
<a href="#90" id="90">90</a>
<a href="#91" id="91">91</a>
<a href="#92" id="92">92</a>
<a href="#93" id="93">93</a>
<a href="#94" id="94">94</a>
<a href="#95" id="95">95</a>
<a href="#96" id="96">96</a>
<a href="#97" id="97">97</a>
<a href="#98" id="98">98</a>
<a href="#99" id="99">99</a>
<a href="#100" id="100">100</a>
<a href="#101" id="101">101</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{future::Future, time::Duration};
<span class="kw">use </span>tokio::{task::JoinHandle, time};
<span class="doccomment">/// A timer that works similar to golangs `Timer`.
</span><span class="attr">#[derive(Debug)]
</span><span class="kw">pub struct </span>Timer {
t: JoinHandle&lt;()&gt;,
}
<span class="kw">impl </span>Timer {
<span class="doccomment">/// Will trigger the execution of `f` after time `d` once.
</span><span class="kw">pub fn </span>after&lt;F&gt;(d: Duration, f: F) -&gt; <span class="self">Self
</span><span class="kw">where
</span>F: Future&lt;Output = ()&gt; + Send + Sync + <span class="lifetime">'static</span>,
{
<span class="kw">let </span>t = tokio::task::spawn(<span class="kw">async move </span>{
time::sleep(d).<span class="kw">await</span>;
f.<span class="kw">await
</span>});
Timer { t }
}
<span class="doccomment">/// Abort the timer.
</span><span class="kw">pub fn </span>abort(<span class="self">self</span>) {
<span class="self">self</span>.t.abort();
}
}
<span class="kw">impl </span>Future <span class="kw">for </span>Timer {
<span class="kw">type </span>Output = ();
<span class="kw">fn </span>poll(
<span class="kw-2">mut </span><span class="self">self</span>: std::pin::Pin&lt;<span class="kw-2">&amp;mut </span><span class="self">Self</span>&gt;,
cx: <span class="kw-2">&amp;mut </span>std::task::Context&lt;<span class="lifetime">'_</span>&gt;,
) -&gt; std::task::Poll&lt;<span class="self">Self</span>::Output&gt; {
std::pin::Pin::new(<span class="kw-2">&amp;mut </span><span class="self">self</span>.t).poll(cx).map(|<span class="kw">_</span>| ())
}
}
<span class="attr">#[cfg(test)]
</span><span class="kw">mod </span>tests {
<span class="kw">use </span>std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
<span class="kw">use super</span>::<span class="kw-2">*</span>;
<span class="attr">#[tokio::test(flavor = <span class="string">"current_thread"</span>, start_paused = <span class="bool-val">true</span>)]
</span><span class="kw">async fn </span>test_timer_success() {
<span class="kw">let </span>val = Arc::new(AtomicBool::new(<span class="bool-val">false</span>));
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
<span class="kw">let </span>moved_val = val.clone();
<span class="kw">let </span>timer = Timer::after(Duration::from_millis(<span class="number">10</span>), <span class="kw">async move </span>{
moved_val.store(<span class="bool-val">true</span>, Ordering::Relaxed);
});
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
timer.<span class="kw">await</span>;
<span class="macro">assert!</span>(val.load(Ordering::Relaxed));
}
<span class="attr">#[tokio::test(flavor = <span class="string">"current_thread"</span>, start_paused = <span class="bool-val">true</span>)]
</span><span class="kw">async fn </span>test_timer_abort() {
<span class="kw">let </span>val = Arc::new(AtomicBool::new(<span class="bool-val">false</span>));
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
<span class="kw">let </span>moved_val = val.clone();
<span class="kw">let </span>timer = Timer::after(Duration::from_millis(<span class="number">10</span>), <span class="kw">async move </span>{
moved_val.store(<span class="bool-val">true</span>, Ordering::Relaxed);
});
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
timer.abort();
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
}
<span class="attr">#[tokio::test(flavor = <span class="string">"current_thread"</span>, start_paused = <span class="bool-val">true</span>)]
</span><span class="kw">async fn </span>test_timer_abort_late() {
<span class="kw">let </span>val = Arc::new(AtomicBool::new(<span class="bool-val">false</span>));
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
<span class="kw">let </span>moved_val = val.clone();
<span class="kw">let </span>timer = Timer::after(Duration::from_millis(<span class="number">50</span>), <span class="kw">async move </span>{
moved_val.store(<span class="bool-val">true</span>, Ordering::Relaxed);
});
<span class="macro">assert!</span>(!val.load(Ordering::Relaxed));
time::sleep(Duration::from_millis(<span class="number">75</span>)).<span class="kw">await</span>;
timer.abort();
<span class="macro">assert!</span>(val.load(Ordering::Relaxed));
}
}
</code></pre></div></section></main></body></html>
@@ -132,7 +132,8 @@
<a href="#131" id="131">131</a>
<a href="#132" id="132">132</a>
<a href="#133" id="133">133</a>
<a href="#134" id="134">134</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{
<a href="#134" id="134">134</a>
<a href="#135" id="135">135</a></pre></div><pre class="rust"><code><span class="kw">use </span>std::{
collections::BTreeMap,
net::{IpAddr, Ipv6Addr, SocketAddr},
sync::{
@@ -160,7 +161,7 @@
</span><span class="attr">#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd)]
</span><span class="kw">pub struct </span>IpMappedAddr(Ipv6Addr);
<span class="doccomment">/// Counter to always generate unique addresses for `NodeIdMappedAddr`.
<span class="doccomment">/// Counter to always generate unique addresses for [`IpMappedAddr`].
</span><span class="kw">static </span>IP_ADDR_COUNTER: AtomicU64 = AtomicU64::new(<span class="number">1</span>);
<span class="kw">impl </span>IpMappedAddr {
@@ -173,7 +174,8 @@
<span class="doccomment">/// Generates a globally unique fake UDP address.
///
/// This generates and IPv6 Unique Local Address according to RFC 4193.
/// This generates a new IPv6 address in the Unique Local Address range (RFC 4193)
/// which is recognised by iroh as an IP mapped address.
</span><span class="kw">pub fn </span>generate() -&gt; <span class="self">Self </span>{
<span class="kw">let </span><span class="kw-2">mut </span>addr = [<span class="number">0u8</span>; <span class="number">16</span>];
addr[<span class="number">0</span>] = <span class="self">Self</span>::ADDR_PREFIXL;
@@ -216,7 +218,7 @@
}
<span class="attr">#[derive(Debug, Clone)]
</span><span class="doccomment">/// A Map of [`IpMappedAddrs`] to [`SocketAddr`]
</span><span class="doccomment">/// A Map of [`IpMappedAddrs`] to [`SocketAddr`].
</span><span class="comment">// TODO(ramfox): before this is ready to be used beyond QAD, we should add
// mechanisms for keeping track of "aliveness" and pruning address, as we do
// with the `NodeMap`
@@ -229,14 +231,14 @@
}
<span class="kw">impl </span>IpMappedAddrs {
<span class="doccomment">/// Create an empty [`IpMappedAddrs`]
<span class="doccomment">/// Creates an empty [`IpMappedAddrs`].
</span><span class="kw">pub fn </span>new() -&gt; <span class="self">Self </span>{
<span class="self">Self</span>(Arc::new(std::sync::Mutex::new(Inner::default())))
}
<span class="doccomment">/// Add a [`SocketAddr`] to the map and the generated [`IpMappedAddr`] it is now associated with back.
<span class="doccomment">/// Adds a [`SocketAddr`] to the map and returns the generated [`IpMappedAddr`].
///
/// If this [`SocketAddr`] already exists in the map, it returns its associated [`IpMappedAddr`].
/// If this [`SocketAddr`] already exists in the map, it returns its associated [`IpMappedAddr`]. Otherwise a new [`IpMappedAddr`] is generated for it and returned.
</span><span class="kw">pub fn </span>add(<span class="kw-2">&amp;</span><span class="self">self</span>, ip_addr: SocketAddr) -&gt; IpMappedAddr {
<span class="kw">let </span><span class="kw-2">mut </span>inner = <span class="self">self</span>.<span class="number">0</span>.lock().expect(<span class="string">"poisoned"</span>);
<span class="kw">if let </span><span class="prelude-val">Some</span>(mapped_addr) = inner.by_socket_addr.get(<span class="kw-2">&amp;</span>ip_addr) {
@@ -248,13 +250,13 @@
ip_mapped_addr
}
<span class="doccomment">/// Get the [`IpMappedAddr`] for the given [`SocketAddr`].
<span class="doccomment">/// Returns the [`IpMappedAddr`] for the given [`SocketAddr`].
</span><span class="kw">pub fn </span>get_mapped_addr(<span class="kw-2">&amp;</span><span class="self">self</span>, ip_addr: <span class="kw-2">&amp;</span>SocketAddr) -&gt; <span class="prelude-ty">Option</span>&lt;IpMappedAddr&gt; {
<span class="kw">let </span>inner = <span class="self">self</span>.<span class="number">0</span>.lock().expect(<span class="string">"poisoned"</span>);
inner.by_socket_addr.get(ip_addr).copied()
}
<span class="doccomment">/// Get the [`SocketAddr`] for the given [`IpMappedAddr`].
<span class="doccomment">/// Returns the [`SocketAddr`] for the given [`IpMappedAddr`].
</span><span class="kw">pub fn </span>get_ip_addr(<span class="kw-2">&amp;</span><span class="self">self</span>, mapped_addr: <span class="kw-2">&amp;</span>IpMappedAddr) -&gt; <span class="prelude-ty">Option</span>&lt;SocketAddr&gt; {
<span class="kw">let </span>inner = <span class="self">self</span>.<span class="number">0</span>.lock().expect(<span class="string">"poisoned"</span>);
inner.by_mapped_addr.get(mapped_addr).copied()
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