deploy: fa84effda7ec8ae852c9ad1ea25eedaed7e64032

This commit is contained in:
matheus23
2025-04-30 08:59:13 +00:00
parent 44b119ba3b
commit 7fdc98ad69
70 changed files with 1221 additions and 502 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,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.34.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer"></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#2007">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.34.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer"></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#2101">Source</a> </span></div><pre class="rust item-decl"><code>pub const ENV_FORCE_STAGING_RELAYS: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> = &quot;IROH_FORCE_STAGING_RELAYS&quot;;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Environment variable to force the use of staging relays.</p>
</div></details></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,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.34.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer"></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#2018-2024">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.34.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer"></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#2112-2118">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.34.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer"></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#2010-2012">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.34.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer"></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#2104-2106">Source</a> </span></div><pre class="rust item-decl"><code>pub fn force_staging_infra() -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns <code>true</code> if the use of staging relays is forced.</p>
</div></details></section></div></main></body></html>
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
window.SIDEBAR_ITEMS = {"constant":["ENV_FORCE_STAGING_RELAYS"],"enum":["ConnectionError","ConnectionType","ControlMsg","DirectAddrType","PathSelection","ReadError","ReadExactError","ReadToEndError","RelayMode","ResetError","SendDatagramError","Source","StoppedError","WriteError"],"fn":["default_relay_mode","force_staging_infra"],"struct":["Accept","AcceptBi","AcceptUni","AckFrequencyConfig","ApplicationClose","Builder","Chunk","ClosedStream","ConnectOptions","Connecting","Connection","ConnectionClose","ConnectionStats","CryptoError","DirectAddr","DirectAddrInfo","Endpoint","ExportKeyingMaterialError","FrameStats","Incoming","IncomingFuture","MtuDiscoveryConfig","OpenBi","OpenUni","PathStats","ReadDatagram","RecvStream","RemoteInfo","RetryError","SendStream","ServerConfig","StreamId","TransportConfig","TransportError","TransportErrorCode","UdpStats","UnsupportedVersion","VarInt","WeakConnectionHandle","Written","ZeroRttAccepted"],"trait":["AeadKey","Controller","ControllerFactory","CryptoServerConfig","HandshakeTokenKey"]};
window.SIDEBAR_ITEMS = {"constant":["ENV_FORCE_STAGING_RELAYS"],"enum":["AddNodeAddrError","AlpnError","BindError","ConnectError","ConnectWithOptsError","ConnectionError","ConnectionType","ControlMsg","DirectAddrType","GetMappingAddressError","PathSelection","ReadError","ReadExactError","ReadToEndError","RelayMode","ResetError","SendDatagramError","Source","StoppedError","WriteError"],"fn":["default_relay_mode","force_staging_infra"],"struct":["Accept","AcceptBi","AcceptUni","AckFrequencyConfig","ApplicationClose","Builder","Chunk","ClosedStream","ConnectOptions","Connecting","Connection","ConnectionClose","ConnectionStats","CryptoError","DirectAddr","DirectAddrInfo","Endpoint","ExportKeyingMaterialError","FrameStats","Incoming","IncomingFuture","MtuDiscoveryConfig","OpenBi","OpenUni","PathStats","ReadDatagram","RecvStream","RemoteInfo","RemoteNodeIdError","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
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../iroh/endpoint/enum.AddNodeAddrError.html">
<title>Redirection</title>
</head>
<body>
<p>Redirecting to <a href="../../iroh/endpoint/enum.AddNodeAddrError.html">../../iroh/endpoint/enum.AddNodeAddrError.html</a>...</p>
<script>location.replace("../../iroh/endpoint/enum.AddNodeAddrError.html" + location.search + location.hash);</script>
</body>
</html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extension methods for `NodeId` to encode to and decode from `z32`, which is the encoding used in `pkarr` domain names."><title>NodeIdExt in iroh::node_info - 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 trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.34.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Node<wbr>IdExt</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_z32" title="from_z32">from_z32</a></li><li><a href="#tymethod.to_z32" title="to_z32">to_z32</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>node_<wbr>info</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">node_info</a></span><h1>Trait <span class="trait">NodeIdExt</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/node_info.rs.html#93">Source</a> </span></div><pre class="rust item-decl"><code>pub trait NodeIdExt {
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extension methods for `NodeId` to encode to and decode from `z32`, which is the encoding used in `pkarr` domain names."><title>NodeIdExt in iroh::node_info - 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 trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.34.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Node<wbr>IdExt</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_z32" title="from_z32">from_z32</a></li><li><a href="#tymethod.to_z32" title="to_z32">to_z32</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>node_<wbr>info</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">node_info</a></span><h1>Trait <span class="trait">NodeIdExt</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/node_info.rs.html#97">Source</a> </span></div><pre class="rust item-decl"><code>pub trait NodeIdExt {
// Required methods
fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="struct" href="../struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>, <a class="enum" href="enum.Error.html" title="enum iroh::node_info::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extension methods for <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> to encode to and decode from [<code>z32</code>],
which is the encoding used in [<code>pkarr</code>] domain names.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.to_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#97">Source</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Encodes a <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#102">Source</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="struct" href="../struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>, <a class="enum" href="enum.Error.html" title="enum iroh::node_info::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Parses a <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#105">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.NodeIdExt.html" title="trait iroh::node_info::NodeIdExt">NodeIdExt</a> for <a class="struct" href="../struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></div><script src="../../trait.impl/iroh_relay/node_info/trait.NodeIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.to_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#101">Source</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Encodes a <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#106">Source</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="struct" href="../struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>, <a class="enum" href="enum.Error.html" title="enum iroh::node_info::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Parses a <a href="../type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#109">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.NodeIdExt.html" title="trait iroh::node_info::NodeIdExt">NodeIdExt</a> for <a class="struct" href="../struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></div><script src="../../trait.impl/iroh_relay/node_info/trait.NodeIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -22,7 +22,7 @@ representation of the key.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err" class="associatedtype trait-impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#208">Source</a><a href="#associatedtype.Err" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="enum" href="enum.KeyParsingError.html" title="enum iroh::KeyParsingError">KeyParsingError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#210">Source</a><a href="#method.from_str" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>, &lt;<a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html#associatedtype.Err" title="type core::str::traits::FromStr::Err">Err</a>&gt;</h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-PublicKey" class="impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#58">Source</a><a href="#impl-Hash-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#59">Source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a>&lt;H&gt;(&amp;self, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut H</a>)<div class="where">where
H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,</div></h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#235-237">Source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a>&lt;H&gt;(data: &amp;[Self], state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut H</a>)<div class="where">where
H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../src/iroh_relay/node_info.rs.html#105">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="node_info/trait.NodeIdExt.html" title="trait iroh::node_info::NodeIdExt">NodeIdExt</a> for <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../src/iroh_relay/node_info.rs.html#106">Source</a><a href="#method.to_z32" class="anchor">§</a><h4 class="code-header">fn <a href="node_info/trait.NodeIdExt.html#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Encodes a <a href="type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_z32" class="method trait-impl"><a class="src rightside" href="../src/iroh_relay/node_info.rs.html#110">Source</a><a href="#method.from_z32" class="anchor">§</a><h4 class="code-header">fn <a href="node_info/trait.NodeIdExt.html#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>, <a class="enum" href="node_info/enum.Error.html" title="enum iroh::node_info::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Parses a <a href="type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-PublicKey" class="impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#38">Source</a><a href="#impl-Ord-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#39">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#980-982">Source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../src/iroh_relay/node_info.rs.html#109">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="node_info/trait.NodeIdExt.html" title="trait iroh::node_info::NodeIdExt">NodeIdExt</a> for <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../src/iroh_relay/node_info.rs.html#110">Source</a><a href="#method.to_z32" class="anchor">§</a><h4 class="code-header">fn <a href="node_info/trait.NodeIdExt.html#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Encodes a <a href="type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_z32" class="method trait-impl"><a class="src rightside" href="../src/iroh_relay/node_info.rs.html#114">Source</a><a href="#method.from_z32" class="anchor">§</a><h4 class="code-header">fn <a href="node_info/trait.NodeIdExt.html#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>, <a class="enum" href="node_info/enum.Error.html" title="enum iroh::node_info::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Parses a <a href="type.NodeId.html" title="type iroh::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-PublicKey" class="impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#38">Source</a><a href="#impl-Ord-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#39">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#980-982">Source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1001-1003">Source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1027-1029">Source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -&gt; Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq-for-PublicKey" class="impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#22">Source</a><a href="#impl-PartialEq-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a> for <a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../src/iroh_base/key.rs.html#22">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.PublicKey.html" title="struct iroh::PublicKey">PublicKey</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#261">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Support for handling DNS resource records for dialing by `NodeId`."><title>iroh_relay::node_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-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_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.34.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module node_<wbr>info</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a></span><h1>Module <span>node_info</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/node_info.rs.html#1-811">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support for handling DNS resource records for dialing by <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a>.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Support for handling DNS resource records for dialing by `NodeId`."><title>iroh_relay::node_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-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_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.34.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module node_<wbr>info</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>relay</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a></span><h1>Module <span>node_info</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/node_info.rs.html#1-823">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support for handling DNS resource records for dialing by <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a>.</p>
<p>Dialing by <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> is supported by iroh nodes publishing <a href="https://app.pkarr.org">Pkarr</a> records to DNS
servers or the Mainline DHT. This module supports creating and parsing these records.</p>
<p>DNS records are published under the following names:</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
@@ -1,9 +1,9 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extension methods for `NodeId` to encode to and decode from `z32`, which is the encoding used in `pkarr` domain names."><title>NodeIdExt in iroh_relay::node_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-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_relay" 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 trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.34.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Node<wbr>IdExt</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_z32" title="from_z32">from_z32</a></li><li><a href="#tymethod.to_z32" title="to_z32">to_z32</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-NodeIdExt-for-PublicKey" title="NodeId">NodeId</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>relay::<wbr>node_<wbr>info</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a>::<wbr><a href="index.html">node_info</a></span><h1>Trait <span class="trait">NodeIdExt</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/node_info.rs.html#93-103">Source</a> </span></div><pre class="rust item-decl"><code>pub trait NodeIdExt {
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extension methods for `NodeId` to encode to and decode from `z32`, which is the encoding used in `pkarr` domain names."><title>NodeIdExt in iroh_relay::node_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-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_relay" 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 trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.34.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Node<wbr>IdExt</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.from_z32" title="from_z32">from_z32</a></li><li><a href="#tymethod.to_z32" title="to_z32">to_z32</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-NodeIdExt-for-PublicKey" title="NodeId">NodeId</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>relay::<wbr>node_<wbr>info</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a>::<wbr><a href="index.html">node_info</a></span><h1>Trait <span class="trait">NodeIdExt</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_relay/node_info.rs.html#97-107">Source</a> </span></div><pre class="rust item-decl"><code>pub trait NodeIdExt {
// Required methods
fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.Error.html" title="enum iroh_relay::node_info::Error">Error</a>&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extension methods for <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> to encode to and decode from [<code>z32</code>],
which is the encoding used in [<code>pkarr</code>] domain names.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.to_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#97">Source</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Encodes a <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#102">Source</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.Error.html" title="enum iroh_relay::node_info::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Parses a <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#105-118">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.NodeIdExt.html" title="trait iroh_relay::node_info::NodeIdExt">NodeIdExt</a> for <a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a></h3></section></summary><div class="impl-items"><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#106-108">Source</a><a href="#method.to_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><section id="method.from_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#110-117">Source</a><a href="#method.from_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.Error.html" title="enum iroh_relay::node_info::Error">Error</a>&gt;</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/iroh_relay/node_info/trait.NodeIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.to_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#101">Source</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Encodes a <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> in [<code>z-base-32</code>] encoding.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.from_z32" class="method"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#106">Source</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.Error.html" title="enum iroh_relay::node_info::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Parses a <a href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId"><code>NodeId</code></a> from [<code>z-base-32</code>] encoding.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-NodeIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#109-122">Source</a><a href="#impl-NodeIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.NodeIdExt.html" title="trait iroh_relay::node_info::NodeIdExt">NodeIdExt</a> for <a class="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a></h3></section></summary><div class="impl-items"><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#110-112">Source</a><a href="#method.to_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.to_z32" class="fn">to_z32</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><section id="method.from_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/node_info.rs.html#114-121">Source</a><a href="#method.from_z32" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</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="type" href="../../iroh_base/key/type.NodeId.html" title="type iroh_base::key::NodeId">NodeId</a>, <a class="enum" href="enum.Error.html" title="enum iroh_relay::node_info::Error">Error</a>&gt;</h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/iroh_relay/node_info/trait.NodeIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+248 -60
View File
@@ -2795,7 +2795,101 @@
<a href="#2794" id="2794">2794</a>
<a href="#2795" id="2795">2795</a>
<a href="#2796" id="2796">2796</a>
<a href="#2797" id="2797">2797</a></pre></div><pre class="rust"><code><span class="doccomment">//! The [`Endpoint`] allows establishing connections to other iroh nodes.
<a href="#2797" id="2797">2797</a>
<a href="#2798" id="2798">2798</a>
<a href="#2799" id="2799">2799</a>
<a href="#2800" id="2800">2800</a>
<a href="#2801" id="2801">2801</a>
<a href="#2802" id="2802">2802</a>
<a href="#2803" id="2803">2803</a>
<a href="#2804" id="2804">2804</a>
<a href="#2805" id="2805">2805</a>
<a href="#2806" id="2806">2806</a>
<a href="#2807" id="2807">2807</a>
<a href="#2808" id="2808">2808</a>
<a href="#2809" id="2809">2809</a>
<a href="#2810" id="2810">2810</a>
<a href="#2811" id="2811">2811</a>
<a href="#2812" id="2812">2812</a>
<a href="#2813" id="2813">2813</a>
<a href="#2814" id="2814">2814</a>
<a href="#2815" id="2815">2815</a>
<a href="#2816" id="2816">2816</a>
<a href="#2817" id="2817">2817</a>
<a href="#2818" id="2818">2818</a>
<a href="#2819" id="2819">2819</a>
<a href="#2820" id="2820">2820</a>
<a href="#2821" id="2821">2821</a>
<a href="#2822" id="2822">2822</a>
<a href="#2823" id="2823">2823</a>
<a href="#2824" id="2824">2824</a>
<a href="#2825" id="2825">2825</a>
<a href="#2826" id="2826">2826</a>
<a href="#2827" id="2827">2827</a>
<a href="#2828" id="2828">2828</a>
<a href="#2829" id="2829">2829</a>
<a href="#2830" id="2830">2830</a>
<a href="#2831" id="2831">2831</a>
<a href="#2832" id="2832">2832</a>
<a href="#2833" id="2833">2833</a>
<a href="#2834" id="2834">2834</a>
<a href="#2835" id="2835">2835</a>
<a href="#2836" id="2836">2836</a>
<a href="#2837" id="2837">2837</a>
<a href="#2838" id="2838">2838</a>
<a href="#2839" id="2839">2839</a>
<a href="#2840" id="2840">2840</a>
<a href="#2841" id="2841">2841</a>
<a href="#2842" id="2842">2842</a>
<a href="#2843" id="2843">2843</a>
<a href="#2844" id="2844">2844</a>
<a href="#2845" id="2845">2845</a>
<a href="#2846" id="2846">2846</a>
<a href="#2847" id="2847">2847</a>
<a href="#2848" id="2848">2848</a>
<a href="#2849" id="2849">2849</a>
<a href="#2850" id="2850">2850</a>
<a href="#2851" id="2851">2851</a>
<a href="#2852" id="2852">2852</a>
<a href="#2853" id="2853">2853</a>
<a href="#2854" id="2854">2854</a>
<a href="#2855" id="2855">2855</a>
<a href="#2856" id="2856">2856</a>
<a href="#2857" id="2857">2857</a>
<a href="#2858" id="2858">2858</a>
<a href="#2859" id="2859">2859</a>
<a href="#2860" id="2860">2860</a>
<a href="#2861" id="2861">2861</a>
<a href="#2862" id="2862">2862</a>
<a href="#2863" id="2863">2863</a>
<a href="#2864" id="2864">2864</a>
<a href="#2865" id="2865">2865</a>
<a href="#2866" id="2866">2866</a>
<a href="#2867" id="2867">2867</a>
<a href="#2868" id="2868">2868</a>
<a href="#2869" id="2869">2869</a>
<a href="#2870" id="2870">2870</a>
<a href="#2871" id="2871">2871</a>
<a href="#2872" id="2872">2872</a>
<a href="#2873" id="2873">2873</a>
<a href="#2874" id="2874">2874</a>
<a href="#2875" id="2875">2875</a>
<a href="#2876" id="2876">2876</a>
<a href="#2877" id="2877">2877</a>
<a href="#2878" id="2878">2878</a>
<a href="#2879" id="2879">2879</a>
<a href="#2880" id="2880">2880</a>
<a href="#2881" id="2881">2881</a>
<a href="#2882" id="2882">2882</a>
<a href="#2883" id="2883">2883</a>
<a href="#2884" id="2884">2884</a>
<a href="#2885" id="2885">2885</a>
<a href="#2886" id="2886">2886</a>
<a href="#2887" id="2887">2887</a>
<a href="#2888" id="2888">2888</a>
<a href="#2889" id="2889">2889</a>
<a href="#2890" id="2890">2890</a>
<a href="#2891" id="2891">2891</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
@@ -2818,13 +2912,14 @@
task::Poll,
};
<span class="kw">use </span>anyhow::{bail, Context};
<span class="kw">use </span>data_encoding::BASE32_DNSSEC;
<span class="kw">use </span>ed25519_dalek::{pkcs8::DecodePublicKey, VerifyingKey};
<span class="kw">use </span>iroh_base::{NodeAddr, NodeId, RelayUrl, SecretKey};
<span class="kw">use </span>iroh_relay::RelayMap;
<span class="kw">use </span>n0_future::{time::Duration, Stream};
<span class="kw">use </span>nested_enum_utils::common_fields;
<span class="kw">use </span>pin_project::pin_project;
<span class="kw">use </span>snafu::{ensure, ResultExt, Snafu};
<span class="kw">use </span>tracing::{debug, instrument, trace, warn};
<span class="kw">use </span>url::Url;
@@ -2837,7 +2932,7 @@
pkarr::PkarrPublisher, ConcurrentDiscovery, Discovery, DiscoveryItem, DiscoverySubscribers,
DiscoveryTask, Lagged, UserData,
},
magicsock::{<span class="self">self</span>, Handle, NodeIdMappedAddr},
magicsock::{<span class="self">self</span>, Handle, NodeIdMappedAddr, OwnAddressSnafu},
tls,
watchable::{Disconnected, Watcher},
RelayProtocol,
@@ -2864,7 +2959,8 @@
<span class="kw">use </span><span class="self">self</span>::rtt_actor::RttMessage;
<span class="kw">pub use </span><span class="kw">super</span>::magicsock::{
ConnectionType, ControlMsg, DirectAddr, DirectAddrInfo, DirectAddrType, RemoteInfo, Source,
AddNodeAddrError, ConnectionType, ControlMsg, DirectAddr, DirectAddrInfo, DirectAddrType,
RemoteInfo, Source,
};
<span class="doccomment">/// The delay to fall back to discovery when direct addresses fail.
@@ -2964,7 +3060,7 @@
// # The final constructor that everyone needs.
</span><span class="doccomment">/// Binds the magic endpoint.
</span><span class="kw">pub async fn </span>bind(<span class="self">self</span>) -&gt; anyhow::Result&lt;Endpoint&gt; {
</span><span class="kw">pub async fn </span>bind(<span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;Endpoint, BindError&gt; {
<span class="kw">let </span>relay_map = <span class="self">self</span>.relay_mode.relay_map();
<span class="kw">let </span>secret_key = <span class="self">self
</span>.secret_key
@@ -3396,6 +3492,73 @@
</span>session_store: Arc&lt;<span class="kw">dyn </span>rustls::client::ClientSessionStore&gt;,
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">pub enum </span>ConnectWithOptsError {
<span class="attr">#[snafu(transparent)]
</span>AddNodeAddr { source: AddNodeAddrError },
<span class="attr">#[snafu(display(<span class="string">"Connecting to ourself is not supported"</span>))]
</span>SelfConnect {},
<span class="attr">#[snafu(display(<span class="string">"No addressing information available"</span>))]
</span>NoAddress { source: GetMappingAddressError },
<span class="attr">#[snafu(display(<span class="string">"Invalid TLS configuration"</span>))]
</span>TlsCreate { source: tls::CreateConfigError },
<span class="attr">#[snafu(display(<span class="string">"Unable to connect to remote"</span>))]
</span>Quinn { source: quinn::ConnectError },
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">pub enum </span>ConnectError {
<span class="attr">#[snafu(transparent)]
</span>Connect { source: ConnectWithOptsError },
<span class="attr">#[snafu(transparent)]
</span>Connection { source: ConnectionError },
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">pub enum </span>BindError {
<span class="attr">#[snafu(transparent)]
</span>TlsCreate { source: tls::CreateConfigError },
<span class="attr">#[snafu(transparent)]
</span>MagicSpawn {
source: magicsock::CreateHandleError,
},
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
#[snafu(module)]
</span><span class="kw">pub enum </span>GetMappingAddressError {
<span class="attr">#[snafu(display(<span class="string">"Discovery service required due to missing addressing information"</span>))]
</span>DiscoveryStart { source: anyhow::Error },
<span class="attr">#[snafu(display(<span class="string">"Discovery service failed"</span>))]
</span>Discover { source: anyhow::Error },
<span class="attr">#[snafu(display(<span class="string">"No addressing information found"</span>))]
</span>NoAddress {},
}
<span class="kw">impl </span>Endpoint {
<span class="comment">// The ordering of public methods is reflected directly in the documentation. This is
// roughly ordered by what is most commonly needed by users, but grouped in similar
@@ -3416,7 +3579,7 @@
</span><span class="kw">async fn </span>bind(
static_config: StaticConfig,
msock_opts: magicsock::Options,
) -&gt; anyhow::Result&lt;<span class="self">Self</span>&gt; {
) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, BindError&gt; {
<span class="kw">let </span>msock = magicsock::MagicSock::spawn(msock_opts).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">trace!</span>(<span class="string">"created magicsock"</span>);
<span class="macro">debug!</span>(version = <span class="macro">env!</span>(<span class="string">"CARGO_PKG_VERSION"</span>), <span class="string">"iroh Endpoint created"</span>);
@@ -3436,7 +3599,7 @@
///
/// This will only affect new incoming connections.
/// Note that this *overrides* the current list of ALPNs.
</span><span class="kw">pub fn </span>set_alpns(<span class="kw-2">&amp;</span><span class="self">self</span>, alpns: Vec&lt;Vec&lt;u8&gt;&gt;) -&gt; anyhow::Result&lt;()&gt; {
</span><span class="kw">pub fn </span>set_alpns(<span class="kw-2">&amp;</span><span class="self">self</span>, alpns: Vec&lt;Vec&lt;u8&gt;&gt;) -&gt; <span class="prelude-ty">Result</span>&lt;(), tls::CreateConfigError&gt; {
<span class="kw">let </span>server_config = <span class="self">self</span>.static_config.create_server_config(alpns)<span class="question-mark">?</span>;
<span class="self">self</span>.msock.endpoint().set_server_config(<span class="prelude-val">Some</span>(server_config));
<span class="prelude-val">Ok</span>(())
@@ -3470,15 +3633,14 @@
<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; anyhow::Result&lt;Connection&gt; {
) -&gt; <span class="prelude-ty">Result</span>&lt;Connection, ConnectError&gt; {
<span class="kw">let </span>node_addr = node_addr.into();
<span class="kw">let </span>remote = node_addr.node_id;
<span class="kw">let </span>connecting = <span class="self">self
</span>.connect_with_opts(node_addr, alpn, Default::default())
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>conn = connecting
.<span class="kw">await
</span>.context(<span class="string">"failed connecting to remote endpoint"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>conn = connecting.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">debug!</span>(
me = %<span class="self">self</span>.node_id().fmt_short(),
remote = %remote.fmt_short(),
@@ -3512,17 +3674,12 @@
node_addr: <span class="kw">impl </span>Into&lt;NodeAddr&gt;,
alpn: <span class="kw-2">&amp;</span>[u8],
options: ConnectOptions,
) -&gt; anyhow::Result&lt;Connecting&gt; {
) -&gt; <span class="prelude-ty">Result</span>&lt;Connecting, ConnectWithOptsError&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.
</span><span class="kw">if </span>node_addr.node_id == <span class="self">self</span>.node_id() {
<span class="macro">bail!</span>(
<span class="string">"Connecting to ourself is not supported ({} is the node id of this node)"</span>,
node_addr.node_id.fmt_short()
);
}
</span><span class="macro">ensure!</span>(node_addr.node_id != <span class="self">self</span>.node_id(), SelfConnectSnafu);
<span class="kw">if </span>!node_addr.is_empty() {
<span class="self">self</span>.add_node_addr(node_addr.clone())<span class="question-mark">?</span>;
@@ -3538,12 +3695,7 @@
</span><span class="kw">let </span>(mapped_addr, _discovery_drop_guard) = <span class="self">self
</span>.get_mapping_addr_and_maybe_start_discovery(node_addr)
.<span class="kw">await
</span>.with_context(|| {
<span class="macro">format!</span>(
<span class="string">"No addressing information for NodeId({}), unable to connect"</span>,
node_id.fmt_short()
)
})<span class="question-mark">?</span>;
</span>.context(NoAddressSnafu)<span class="question-mark">?</span>;
<span class="kw">let </span>transport_config = options
.transport_config
@@ -3560,13 +3712,17 @@
</span>);
<span class="kw">let </span>client_config = {
<span class="kw">let </span>alpn_protocols = <span class="macro">vec!</span>[alpn.to_vec()];
<span class="kw">let </span>quic_client_config = <span class="self">self</span>.static_config.tls_auth.make_client_config(
<span class="kw-2">&amp;</span><span class="self">self</span>.static_config.secret_key,
node_id,
alpn_protocols,
<span class="prelude-val">Some</span>(<span class="self">self</span>.session_store.clone()),
<span class="self">self</span>.static_config.keylog,
)<span class="question-mark">?</span>;
<span class="kw">let </span>quic_client_config = <span class="self">self
</span>.static_config
.tls_auth
.make_client_config(
<span class="kw-2">&amp;</span><span class="self">self</span>.static_config.secret_key,
node_id,
alpn_protocols,
<span class="prelude-val">Some</span>(<span class="self">self</span>.session_store.clone()),
<span class="self">self</span>.static_config.keylog,
)
.context(TlsCreateSnafu)<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));
client_config.transport_config(transport_config);
client_config
@@ -3582,11 +3738,15 @@
// We also add "iroh" as a subdomain, although those 5 bytes might not be necessary.
// We *could* decide to remove that indicator in the future likely without breakage.
</span><span class="kw">let </span>server_name = <span class="kw-2">&amp;</span><span class="macro">format!</span>(<span class="string">"{}.iroh.invalid"</span>, BASE32_DNSSEC.encode(node_id.as_bytes()));
<span class="kw">let </span>connect = <span class="self">self</span>.msock.endpoint().connect_with(
client_config,
mapped_addr.private_socket_addr(),
server_name,
)<span class="question-mark">?</span>;
<span class="kw">let </span>connect = <span class="self">self
</span>.msock
.endpoint()
.connect_with(
client_config,
mapped_addr.private_socket_addr(),
server_name,
)
.context(QuinnSnafu)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(Connecting {
inner: connect,
@@ -3634,7 +3794,7 @@
/// 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; anyhow::Result&lt;()&gt; {
</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;(), AddNodeAddrError&gt; {
<span class="self">self</span>.add_node_addr_inner(node_addr, magicsock::Source::App)
}
@@ -3661,7 +3821,7 @@
<span class="kw-2">&amp;</span><span class="self">self</span>,
node_addr: NodeAddr,
source: <span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
) -&gt; anyhow::Result&lt;()&gt; {
) -&gt; <span class="prelude-ty">Result</span>&lt;(), AddNodeAddrError&gt; {
<span class="self">self</span>.add_node_addr_inner(
node_addr,
magicsock::Source::NamedApp {
@@ -3674,14 +3834,9 @@
<span class="kw-2">&amp;</span><span class="self">self</span>,
node_addr: NodeAddr,
source: magicsock::Source,
) -&gt; anyhow::Result&lt;()&gt; {
) -&gt; <span class="prelude-ty">Result</span>&lt;(), AddNodeAddrError&gt; {
<span class="comment">// Connecting to ourselves is not supported.
</span><span class="kw">if </span>node_addr.node_id == <span class="self">self</span>.node_id() {
<span class="macro">bail!</span>(
<span class="string">"Adding our own address is not supported ({} is the node id of this node)"</span>,
node_addr.node_id.fmt_short()
);
}
</span><span class="macro">snafu::ensure!</span>(node_addr.node_id != <span class="self">self</span>.node_id(), OwnAddressSnafu);
<span class="self">self</span>.msock.add_node_addr(node_addr, source)
}
@@ -4009,7 +4164,7 @@
</span><span class="kw">async fn </span>get_mapping_addr_and_maybe_start_discovery(
<span class="kw-2">&amp;</span><span class="self">self</span>,
node_addr: NodeAddr,
) -&gt; anyhow::Result&lt;(NodeIdMappedAddr, <span class="prelude-ty">Option</span>&lt;DiscoveryTask&gt;)&gt; {
) -&gt; <span class="prelude-ty">Result</span>&lt;(NodeIdMappedAddr, <span class="prelude-ty">Option</span>&lt;DiscoveryTask&gt;), GetMappingAddressError&gt; {
<span class="kw">let </span>node_id = node_addr.node_id;
<span class="comment">// Only return a mapped addr if we have some way of dialing this node, in other
@@ -4040,16 +4195,16 @@
// So, we start a discovery task and wait for the first result to arrive, and
// only then continue, because otherwise we wouldn't have any
// path to the remote endpoint.
</span><span class="kw">let </span><span class="kw-2">mut </span>discovery = DiscoveryTask::start(<span class="self">self</span>.clone(), node_id)
.context(<span class="string">"Discovery service required due to missing addressing information"</span>)<span class="question-mark">?</span>;
</span><span class="kw">let </span>res = DiscoveryTask::start(<span class="self">self</span>.clone(), node_id);
<span class="kw">let </span><span class="kw-2">mut </span>discovery = res.context(get_mapping_address_error::DiscoveryStartSnafu)<span class="question-mark">?</span>;
discovery
.first_arrived()
.<span class="kw">await
</span>.context(<span class="string">"Discovery service failed"</span>)<span class="question-mark">?</span>;
</span>.context(get_mapping_address_error::DiscoverSnafu)<span class="question-mark">?</span>;
<span class="kw">if let </span><span class="prelude-val">Some</span>(addr) = <span class="self">self</span>.msock.get_mapping_addr(node_id) {
<span class="prelude-val">Ok</span>((addr, <span class="prelude-val">Some</span>(discovery)))
} <span class="kw">else </span>{
<span class="macro">bail!</span>(<span class="string">"Discovery did not find addressing information"</span>);
<span class="prelude-val">Err</span>(get_mapping_address_error::NoAddressSnafu.build())
}
}
}
@@ -4257,6 +4412,22 @@
</span>_discovery_drop_guard: <span class="prelude-ty">Option</span>&lt;DiscoveryTask&gt;,
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">pub enum </span>AlpnError {
<span class="attr">#[snafu(transparent)]
</span>ConnectionError { source: ConnectionError },
<span class="attr">#[snafu(display(<span class="string">"No ALPN available"</span>))]
</span>Unavailable {},
<span class="attr">#[snafu(display(<span class="string">"Unknown handshake type"</span>))]
</span>UnknownHandshake {},
}
<span class="kw">impl </span>Connecting {
<span class="doccomment">/// Converts this [`Connecting`] into a 0-RTT or 0.5-RTT connection at the cost of weakened
/// security.
@@ -4338,14 +4509,14 @@
</span>}
<span class="doccomment">/// Extracts the ALPN protocol from the peer's handshake data.
</span><span class="kw">pub async fn </span>alpn(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; anyhow::Result&lt;Vec&lt;u8&gt;&gt; {
</span><span class="kw">pub async fn </span>alpn(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;Vec&lt;u8&gt;, AlpnError&gt; {
<span class="kw">let </span>data = <span class="self">self</span>.handshake_data().<span class="kw">await</span><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; <span class="kw">match </span>data.protocol {
<span class="prelude-val">Some</span>(protocol) =&gt; <span class="prelude-val">Ok</span>(protocol),
<span class="prelude-val">None </span>=&gt; <span class="macro">bail!</span>(<span class="string">"no ALPN protocol available"</span>),
<span class="prelude-val">None </span>=&gt; <span class="prelude-val">Err</span>(UnavailableSnafu.build()),
},
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="macro">bail!</span>(<span class="string">"unknown handshake type"</span>),
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(UnknownHandshakeSnafu.build()),
}
}
}
@@ -4414,6 +4585,13 @@
tls_auth: tls::Authentication,
}
<span class="attr">#[allow(missing_docs)]
#[derive(Debug, Snafu)]
#[snafu(display(<span class="string">"Protocol error: no remote id available"</span>))]
</span><span class="kw">pub struct </span>RemoteNodeIdError {
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
}
<span class="kw">impl </span>Connection {
<span class="doccomment">/// Initiates a new outgoing unidirectional stream.
///
@@ -4629,31 +4807,41 @@
///
/// [`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; anyhow::Result&lt;NodeId&gt; {
</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, RemoteNodeIdError&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">None </span>=&gt; {
<span class="macro">warn!</span>(<span class="string">"no peer certificate found"</span>);
<span class="prelude-val">Err</span>(RemoteNodeIdSnafu.build())
}
<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="macro">warn!</span>(
<span class="string">"expected a single peer certificate, but {} found"</span>,
certs.len()
);
<span class="kw">return </span><span class="prelude-val">Err</span>(RemoteNodeIdSnafu.build());
}
<span class="kw">match </span><span class="self">self</span>.tls_auth {
tls::Authentication::X509 =&gt; {
<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="kw">let </span>cert = tls::certificate::parse(<span class="kw-2">&amp;</span>certs[<span class="number">0</span>])
.map_err(|<span class="kw">_</span>| RemoteNodeIdSnafu.build())<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(cert.peer_id())
}
tls::Authentication::RawPublicKey =&gt; {
<span class="kw">let </span>peer_id = VerifyingKey::from_public_key_der(<span class="kw-2">&amp;</span>certs[<span class="number">0</span>])<span class="question-mark">?</span>.into();
<span class="kw">let </span>peer_id = VerifyingKey::from_public_key_der(<span class="kw-2">&amp;</span>certs[<span class="number">0</span>])
.map_err(|<span class="kw">_</span>| RemoteNodeIdSnafu.build())<span class="question-mark">?
</span>.into();
<span class="prelude-val">Ok</span>(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>(err) =&gt; {
<span class="macro">warn!</span>(<span class="string">"invalid peer certificate: {:?}"</span>, err);
<span class="prelude-val">Err</span>(RemoteNodeIdSnafu.build())
}
},
}
}
@@ -4832,9 +5020,9 @@
// https://github.com/n0-computer/iroh/issues/1183
</span><span class="attr">#[cfg(test)]
</span><span class="kw">mod </span>tests {
<span class="kw">use </span>std::time::Instant;
<span class="kw">use </span>anyhow::bail;
<span class="kw">use </span>iroh_relay::http::Protocol;
<span class="kw">use </span>n0_future::StreamExt;
<span class="kw">use </span>rand::SeedableRng;
+186 -80
View File
@@ -4438,7 +4438,60 @@
<a href="#4437" id="4437">4437</a>
<a href="#4438" id="4438">4438</a>
<a href="#4439" id="4439">4439</a>
<a href="#4440" id="4440">4440</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="#4440" id="4440">4440</a>
<a href="#4441" id="4441">4441</a>
<a href="#4442" id="4442">4442</a>
<a href="#4443" id="4443">4443</a>
<a href="#4444" id="4444">4444</a>
<a href="#4445" id="4445">4445</a>
<a href="#4446" id="4446">4446</a>
<a href="#4447" id="4447">4447</a>
<a href="#4448" id="4448">4448</a>
<a href="#4449" id="4449">4449</a>
<a href="#4450" id="4450">4450</a>
<a href="#4451" id="4451">4451</a>
<a href="#4452" id="4452">4452</a>
<a href="#4453" id="4453">4453</a>
<a href="#4454" id="4454">4454</a>
<a href="#4455" id="4455">4455</a>
<a href="#4456" id="4456">4456</a>
<a href="#4457" id="4457">4457</a>
<a href="#4458" id="4458">4458</a>
<a href="#4459" id="4459">4459</a>
<a href="#4460" id="4460">4460</a>
<a href="#4461" id="4461">4461</a>
<a href="#4462" id="4462">4462</a>
<a href="#4463" id="4463">4463</a>
<a href="#4464" id="4464">4464</a>
<a href="#4465" id="4465">4465</a>
<a href="#4466" id="4466">4466</a>
<a href="#4467" id="4467">4467</a>
<a href="#4468" id="4468">4468</a>
<a href="#4469" id="4469">4469</a>
<a href="#4470" id="4470">4470</a>
<a href="#4471" id="4471">4471</a>
<a href="#4472" id="4472">4472</a>
<a href="#4473" id="4473">4473</a>
<a href="#4474" id="4474">4474</a>
<a href="#4475" id="4475">4475</a>
<a href="#4476" id="4476">4476</a>
<a href="#4477" id="4477">4477</a>
<a href="#4478" id="4478">4478</a>
<a href="#4479" id="4479">4479</a>
<a href="#4480" id="4480">4480</a>
<a href="#4481" id="4481">4481</a>
<a href="#4482" id="4482">4482</a>
<a href="#4483" id="4483">4483</a>
<a href="#4484" id="4484">4484</a>
<a href="#4485" id="4485">4485</a>
<a href="#4486" id="4486">4486</a>
<a href="#4487" id="4487">4487</a>
<a href="#4488" id="4488">4488</a>
<a href="#4489" id="4489">4489</a>
<a href="#4490" id="4490">4490</a>
<a href="#4491" id="4491">4491</a>
<a href="#4492" id="4492">4492</a>
<a href="#4493" id="4493">4493</a></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
//!
@@ -4468,7 +4521,6 @@
task::{Context, Poll, Waker},
};
<span class="kw">use </span>anyhow::{anyhow, Context <span class="kw">as _</span>};
<span class="kw">use </span>atomic_waker::AtomicWaker;
<span class="kw">use </span>bytes::Bytes;
<span class="kw">use </span>concurrent_queue::ConcurrentQueue;
@@ -4483,14 +4535,17 @@
FutureExt, StreamExt,
};
<span class="kw">use </span>nested_enum_utils::common_fields;
<span class="kw">use </span>netwatch::{interfaces, netmon};
<span class="kw">use </span>netwatch::{
interfaces,
netmon::{<span class="self">self</span>, CallbackToken},
};
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">use </span>netwatch::{ip::LocalAddresses, UdpSocket};
<span class="kw">use </span>quinn::{AsyncUdpSocket, ServerConfig};
<span class="kw">use </span>rand::{seq::SliceRandom, Rng, SeedableRng};
<span class="kw">use </span>relay_actor::RelaySendItem;
<span class="kw">use </span>smallvec::{smallvec, SmallVec};
<span class="kw">use </span>snafu::{IntoError, Snafu};
<span class="kw">use </span>snafu::{IntoError, ResultExt, Snafu};
<span class="kw">use </span>tokio::sync::{<span class="self">self</span>, mpsc, Mutex};
<span class="kw">use </span>tokio_util::sync::CancellationToken;
<span class="kw">use </span>tracing::{
@@ -4715,9 +4770,26 @@
</span>local_addrs: std::sync::RwLock&lt;(SocketAddr, <span class="prelude-ty">Option</span>&lt;SocketAddr&gt;)&gt;,
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
#[snafu(visibility(<span class="kw">pub</span>(<span class="kw">crate</span>)))]
</span><span class="kw">pub enum </span>AddNodeAddrError {
<span class="attr">#[snafu(display(<span class="string">"Empty addressing info"</span>))]
</span>Empty,
<span class="attr">#[snafu(display(<span class="string">"Empty addressing info, {pruned} direct address have been pruned"</span>))]
</span>EmptyPruned { pruned: usize },
<span class="attr">#[snafu(display(<span class="string">"Adding our own address is not supported"</span>))]
</span>OwnAddress,
}
<span class="kw">impl </span>MagicSock {
<span class="doccomment">/// Creates a magic [`MagicSock`] listening on [`Options::addr_v4`] and [`Options::addr_v6`].
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">async fn </span>spawn(opts: Options) -&gt; anyhow::Result&lt;Handle&gt; {
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">async fn </span>spawn(opts: Options) -&gt; <span class="prelude-ty">Result</span>&lt;Handle, CreateHandleError&gt; {
Handle::new(opts).<span class="kw">await
</span>}
@@ -4824,8 +4896,8 @@
<span class="kw-2">&amp;</span><span class="self">self</span>,
<span class="kw-2">mut </span>addr: NodeAddr,
source: node_map::Source,
) -&gt; anyhow::Result&lt;()&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>pruned = <span class="number">0</span>;
) -&gt; <span class="prelude-ty">Result</span>&lt;(), AddNodeAddrError&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>pruned: usize = <span class="number">0</span>;
<span class="kw">for </span>my_addr <span class="kw">in </span><span class="self">self</span>.direct_addrs.sockaddrs() {
<span class="kw">if </span>addr.direct_addresses.remove(<span class="kw-2">&amp;</span>my_addr) {
<span class="macro">warn!</span>( node_id=addr.node_id.fmt_short(), %my_addr, %source, <span class="string">"not adding our addr for node"</span>);
@@ -4836,11 +4908,9 @@
<span class="self">self</span>.node_map.add_node_addr(addr, source);
<span class="prelude-val">Ok</span>(())
} <span class="kw">else if </span>pruned != <span class="number">0 </span>{
<span class="prelude-val">Err</span>(<span class="macro">anyhow::anyhow!</span>(
<span class="string">"empty addressing info, {pruned} direct addresses have been pruned"
</span>))
<span class="prelude-val">Err</span>(EmptyPrunedSnafu { pruned }.build())
} <span class="kw">else </span>{
<span class="prelude-val">Err</span>(<span class="macro">anyhow::anyhow!</span>(<span class="string">"empty addressing info"</span>))
<span class="prelude-val">Err</span>(EmptySnafu.build())
}
}
@@ -6103,9 +6173,31 @@
}
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">pub enum </span>CreateHandleError {
<span class="attr">#[snafu(display(<span class="string">"Failed to create bind sockets"</span>))]
</span>BindSockets { source: io::Error },
<span class="attr">#[snafu(display(<span class="string">"Failed to create internal quinn endpoint"</span>))]
</span>CreateQuinnEndpoint { source: io::Error },
<span class="attr">#[snafu(display(<span class="string">"Failed to create socket state"</span>))]
</span>CreateSocketState { source: io::Error },
<span class="attr">#[snafu(display(<span class="string">"Failed to create net report client"</span>))]
</span>CreateNetReportClient { source: anyhow::Error },
<span class="attr">#[snafu(display(<span class="string">"Failed to create netmon monitor"</span>))]
</span>CreateNetmonMonitor { source: netmon::Error },
<span class="attr">#[snafu(display(<span class="string">"Failed to subscribe netmon monitor"</span>))]
</span>SubscribeNetmonMonitor { source: netmon::Error },
}
<span class="kw">impl </span>Handle {
<span class="doccomment">/// Creates a magic [`MagicSock`] listening on [`Options::addr_v4`] and [`Options::addr_v6`].
</span><span class="kw">async fn </span>new(opts: Options) -&gt; anyhow::Result&lt;<span class="self">Self</span>&gt; {
</span><span class="kw">async fn </span>new(opts: Options) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, CreateHandleError&gt; {
<span class="kw">let </span>me = opts.secret_key.public().fmt_short();
<span class="self">Self</span>::with_name(me, opts)
@@ -6113,7 +6205,7 @@
.<span class="kw">await
</span>}
<span class="kw">async fn </span>with_name(me: String, opts: Options) -&gt; anyhow::Result&lt;<span class="self">Self</span>&gt; {
<span class="kw">async fn </span>with_name(me: String, opts: Options) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, CreateHandleError&gt; {
<span class="kw">let </span>Options {
addr_v4,
addr_v6,
@@ -6134,10 +6226,12 @@
} = opts;
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">let </span>actor_sockets = ActorSocketState::bind(addr_v4, addr_v6)<span class="question-mark">?</span>;
</span><span class="kw">let </span>actor_sockets = ActorSocketState::bind(addr_v4, addr_v6).context(BindSocketsSnafu)<span class="question-mark">?</span>;
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">let </span>sockets = actor_sockets.msock_socket_state()<span class="question-mark">?</span>;
</span><span class="kw">let </span>sockets = actor_sockets
.msock_socket_state()
.context(CreateSocketStateSnafu)<span class="question-mark">?</span>;
<span class="kw">let </span>ip_mapped_addrs = IpMappedAddresses::default();
@@ -6148,7 +6242,8 @@
</span>dns_resolver.clone(),
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="prelude-val">Some</span>(ip_mapped_addrs.clone()),
)<span class="question-mark">?</span>;
)
.context(CreateNetReportClientSnafu)<span class="question-mark">?</span>;
<span class="kw">let </span>(actor_sender, actor_receiver) = mpsc::channel(<span class="number">256</span>);
<span class="kw">let </span>(relay_actor_sender, relay_actor_receiver) = mpsc::channel(<span class="number">256</span>);
@@ -6214,7 +6309,8 @@
</span>Arc::new(quinn::TokioRuntime),
<span class="attr">#[cfg(wasm_browser)]
</span>Arc::new(<span class="kw">crate</span>::web_runtime::WebRuntime),
)<span class="question-mark">?</span>;
)
.context(CreateQuinnEndpointSnafu)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>actor_tasks = JoinSet::default();
@@ -6241,7 +6337,9 @@
}
});
<span class="kw">let </span>network_monitor = netmon::Monitor::new().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>network_monitor = netmon::Monitor::new()
.<span class="kw">await
</span>.context(CreateNetmonMonitorSnafu)<span class="question-mark">?</span>;
<span class="kw">let </span>qad_endpoint = endpoint.clone();
<span class="comment">// create a client config for the endpoint to use for QUIC address discovery
@@ -6270,6 +6368,19 @@
<span class="attr">#[cfg(wasm_browser)]
</span><span class="kw">let </span>net_report_config = net_report::Options::default();
<span class="comment">// Setup network monitoring
</span><span class="kw">let </span>(link_change_s, link_change_r) = mpsc::channel(<span class="number">8</span>);
<span class="kw">let </span>netmon_token = network_monitor
.subscribe(<span class="kw">move </span>|is_major| {
<span class="kw">let </span>link_change_s = link_change_s.clone();
<span class="kw">async move </span>{
link_change_s.send(is_major).<span class="kw">await</span>.ok();
}
.boxed()
})
.<span class="kw">await
</span>.context(SubscribeNetmonMonitorSnafu)<span class="question-mark">?</span>;
actor_tasks.spawn({
<span class="kw">let </span>msock = msock.clone();
<span class="kw">async move </span>{
@@ -6289,9 +6400,7 @@
net_report_config,
};
<span class="kw">if let </span><span class="prelude-val">Err</span>(err) = actor.run().<span class="kw">await </span>{
<span class="macro">warn!</span>(<span class="string">"relay handler errored: {:?}"</span>, err);
}
actor.run(link_change_r, netmon_token).<span class="kw">await</span>;
}
.instrument(<span class="macro">info_span!</span>(<span class="string">"actor"</span>))
});
@@ -6524,6 +6633,12 @@
waker: AtomicWaker,
}
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">enum </span>RelayRecvDatagramError {
<span class="attr">#[snafu(display(<span class="string">"Queue is closed"</span>))]
</span>Closed,
}
<span class="kw">impl </span>RelayDatagramRecvQueue {
<span class="doccomment">/// Creates a new, empty queue with a fixed size bound of 512 items.
</span><span class="kw">fn </span>new() -&gt; <span class="self">Self </span>{
@@ -6558,7 +6673,10 @@
/// The reason this method is made available as `&amp;self` is because
/// the interface for quinn's [`AsyncUdpSocket::poll_recv`] requires us
/// to be able to poll from `&amp;self`.
</span><span class="kw">fn </span>poll_recv(<span class="kw-2">&amp;</span><span class="self">self</span>, cx: <span class="kw-2">&amp;mut </span>Context) -&gt; Poll&lt;anyhow::Result&lt;RelayRecvDatagram&gt;&gt; {
</span><span class="kw">fn </span>poll_recv(
<span class="kw-2">&amp;</span><span class="self">self</span>,
cx: <span class="kw-2">&amp;mut </span>Context,
) -&gt; Poll&lt;<span class="prelude-ty">Result</span>&lt;RelayRecvDatagram, RelayRecvDatagramError&gt;&gt; {
<span class="kw">match </span><span class="self">self</span>.queue.pop() {
<span class="prelude-val">Ok</span>(value) =&gt; Poll::Ready(<span class="prelude-val">Ok</span>(value)),
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Empty) =&gt; {
@@ -6572,11 +6690,11 @@
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Empty) =&gt; Poll::Pending,
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Closed) =&gt; {
<span class="self">self</span>.waker.take();
Poll::Ready(<span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Queue closed"</span>)))
Poll::Ready(<span class="prelude-val">Err</span>(ClosedSnafu.build()))
}
}
}
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Closed) =&gt; Poll::Ready(<span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Queue closed"</span>))),
<span class="prelude-val">Err</span>(concurrent_queue::PopError::Closed) =&gt; Poll::Ready(<span class="prelude-val">Err</span>(ClosedSnafu.build())),
}
}
}
@@ -6733,7 +6851,7 @@
Shutdown,
EndpointPingExpired(usize, stun_rs::TransactionId),
NetReport(
anyhow::Result&lt;<span class="prelude-ty">Option</span>&lt;Arc&lt;net_report::Report&gt;&gt;&gt;,
<span class="prelude-ty">Result</span>&lt;<span class="prelude-ty">Option</span>&lt;Arc&lt;net_report::Report&gt;&gt;, NetReportError&gt;,
<span class="kw-2">&amp;</span><span class="lifetime">'static </span>str,
),
NetworkChange,
@@ -6785,7 +6903,7 @@
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">impl </span>ActorSocketState {
<span class="kw">fn </span>bind(addr_v4: <span class="prelude-ty">Option</span>&lt;SocketAddrV4&gt;, addr_v6: <span class="prelude-ty">Option</span>&lt;SocketAddrV6&gt;) -&gt; anyhow::Result&lt;<span class="self">Self</span>&gt; {
<span class="kw">fn </span>bind(addr_v4: <span class="prelude-ty">Option</span>&lt;SocketAddrV4&gt;, addr_v6: <span class="prelude-ty">Option</span>&lt;SocketAddrV6&gt;) -&gt; io::Result&lt;<span class="self">Self</span>&gt; {
<span class="kw">let </span>port_mapper = portmapper::Client::default();
<span class="kw">let </span>(v4, v6) = <span class="self">Self</span>::bind_sockets(addr_v4, addr_v6)<span class="question-mark">?</span>;
@@ -6816,9 +6934,9 @@
<span class="kw">fn </span>bind_sockets(
addr_v4: <span class="prelude-ty">Option</span>&lt;SocketAddrV4&gt;,
addr_v6: <span class="prelude-ty">Option</span>&lt;SocketAddrV6&gt;,
) -&gt; anyhow::Result&lt;(Arc&lt;UdpSocket&gt;, <span class="prelude-ty">Option</span>&lt;Arc&lt;UdpSocket&gt;&gt;)&gt; {
) -&gt; io::Result&lt;(Arc&lt;UdpSocket&gt;, <span class="prelude-ty">Option</span>&lt;Arc&lt;UdpSocket&gt;&gt;)&gt; {
<span class="kw">let </span>addr_v4 = addr_v4.unwrap_or_else(|| SocketAddrV4::new(Ipv4Addr::UNSPECIFIED, <span class="number">0</span>));
<span class="kw">let </span>v4 = Arc::new(bind_with_fallback(SocketAddr::V4(addr_v4)).context(<span class="string">"bind IPv4 failed"</span>)<span class="question-mark">?</span>);
<span class="kw">let </span>v4 = Arc::new(bind_with_fallback(SocketAddr::V4(addr_v4))<span class="question-mark">?</span>);
<span class="kw">let </span>ip4_port = v4.local_addr()<span class="question-mark">?</span>.port();
<span class="kw">let </span>ip6_port = ip4_port.checked_add(<span class="number">1</span>).unwrap_or(ip4_port - <span class="number">1</span>);
@@ -6835,7 +6953,7 @@
<span class="prelude-val">Ok</span>((v4, v6))
}
<span class="kw">fn </span>msock_socket_state(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; anyhow::Result&lt;SocketState&gt; {
<span class="kw">fn </span>msock_socket_state(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; io::Result&lt;SocketState&gt; {
<span class="kw">let </span>ipv4_addr = <span class="self">self</span>.v4.local_addr()<span class="question-mark">?</span>;
<span class="kw">let </span>ipv6_addr = <span class="self">self</span>.v6.as_ref().and_then(|c| c.local_addr().ok());
@@ -6850,21 +6968,18 @@
}
}
<span class="kw">impl </span>Actor {
<span class="kw">async fn </span>run(<span class="kw-2">mut </span><span class="self">self</span>) -&gt; anyhow::Result&lt;()&gt; {
<span class="comment">// Setup network monitoring
</span><span class="kw">let </span>(link_change_s, <span class="kw-2">mut </span>link_change_r) = mpsc::channel(<span class="number">8</span>);
<span class="kw">let </span>_token = <span class="self">self
</span>.network_monitor
.subscribe(<span class="kw">move </span>|is_major| {
<span class="kw">let </span>link_change_s = link_change_s.clone();
<span class="kw">async move </span>{
link_change_s.send(is_major).<span class="kw">await</span>.ok();
}
.boxed()
})
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">enum </span>NetReportError {
<span class="attr">#[snafu(display(<span class="string">"Net report not received"</span>))]
</span>NotReceived,
<span class="attr">#[snafu(display(<span class="string">"Net report timed out"</span>))]
</span>Timeout,
<span class="attr">#[snafu(display(<span class="string">"Net report encountered an error"</span>))]
</span>NetReport { source: anyhow::Error },
}
<span class="kw">impl </span>Actor {
<span class="kw">async fn </span>run(<span class="kw-2">mut </span><span class="self">self</span>, <span class="kw-2">mut </span>link_change_r: mpsc::Receiver&lt;bool&gt;, _token: CallbackToken) {
<span class="comment">// Let the the heartbeat only start a couple seconds later
</span><span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">let </span><span class="kw-2">mut </span>direct_addr_heartbeat_timer = time::interval_at(
@@ -6912,7 +7027,7 @@
<span class="macro">trace!</span>(<span class="question-mark">?</span>msg, <span class="string">"tick: msg"</span>);
<span class="macro">inc!</span>(Metrics, actor_tick_msg);
<span class="kw">if </span><span class="self">self</span>.handle_actor_message(msg).<span class="kw">await </span>{
<span class="kw">return </span><span class="prelude-val">Ok</span>(());
<span class="kw">return</span>;
}
}
tick = <span class="self">self</span>.periodic_re_stun_timer.tick() =&gt; {
@@ -7304,11 +7419,11 @@
<span class="kw">let </span>msg_sender = <span class="self">self</span>.msg_sender.clone();
task::spawn(<span class="kw">async move </span>{
<span class="kw">let </span>report = time::timeout(NET_REPORT_TIMEOUT, rx).<span class="kw">await</span>;
<span class="kw">let </span>report: anyhow::Result&lt;<span class="kw">_</span>&gt; = <span class="kw">match </span>report {
<span class="kw">let </span>report = <span class="kw">match </span>report {
<span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(report))) =&gt; <span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>(report)),
<span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(err))) =&gt; <span class="prelude-val">Err</span>(err),
<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(<span class="kw">_</span>)) =&gt; <span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"net_report report not received"</span>)),
<span class="prelude-val">Err</span>(err) =&gt; <span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"net_report report timeout: {:?}"</span>, err)),
<span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(err))) =&gt; <span class="prelude-val">Err</span>(NetReportSnafu.into_error(err)),
<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(<span class="kw">_</span>)) =&gt; <span class="prelude-val">Err</span>(NotReceivedSnafu.build()),
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(TimeoutSnafu.build()),
};
msg_sender
.send(ActorMessage::NetReport(report, why))
@@ -7491,13 +7606,13 @@
}
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">fn </span>bind_with_fallback(<span class="kw-2">mut </span>addr: SocketAddr) -&gt; anyhow::Result&lt;UdpSocket&gt; {
</span><span class="kw">fn </span>bind_with_fallback(<span class="kw-2">mut </span>addr: SocketAddr) -&gt; io::Result&lt;UdpSocket&gt; {
<span class="macro">debug!</span>(%addr, <span class="string">"binding"</span>);
<span class="comment">// First try binding a preferred port, if specified
</span><span class="kw">match </span>UdpSocket::bind_full(addr) {
<span class="prelude-val">Ok</span>(socket) =&gt; {
<span class="kw">let </span>local_addr = socket.local_addr().context(<span class="string">"UDP socket not bound"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>local_addr = socket.local_addr()<span class="question-mark">?</span>;
<span class="macro">debug!</span>(%addr, %local_addr, <span class="string">"successfully bound"</span>);
<span class="kw">return </span><span class="prelude-val">Ok</span>(socket);
}
@@ -7505,14 +7620,14 @@
<span class="macro">debug!</span>(%addr, <span class="string">"failed to bind: {err:#}"</span>);
<span class="comment">// If that was already the fallback port, then error out
</span><span class="kw">if </span>addr.port() == <span class="number">0 </span>{
<span class="kw">return </span><span class="prelude-val">Err</span>(err.into());
<span class="kw">return </span><span class="prelude-val">Err</span>(err);
}
}
}
<span class="comment">// Otherwise, try binding with port 0
</span>addr.set_port(<span class="number">0</span>);
UdpSocket::bind_full(addr).context(<span class="string">"failed to bind on fallback port"</span>)
UdpSocket::bind_full(addr)
}
<span class="doccomment">/// The discovered direct addresses of this [`MagicSock`].
@@ -7676,7 +7791,7 @@
<span class="kw">impl </span>TryFrom&lt;Ipv6Addr&gt; <span class="kw">for </span>NodeIdMappedAddr {
<span class="kw">type </span>Error = NodeIdMappedAddrError;
<span class="kw">fn </span>try_from(value: Ipv6Addr) -&gt; std::result::Result&lt;<span class="self">Self</span>, <span class="self">Self</span>::Error&gt; {
<span class="kw">fn </span>try_from(value: Ipv6Addr) -&gt; <span class="prelude-ty">Result</span>&lt;<span class="self">Self</span>, <span class="self">Self</span>::Error&gt; {
<span class="kw">let </span>octets = value.octets();
<span class="kw">if </span>octets[<span class="number">0</span>] == <span class="self">Self</span>::ADDR_PREFIXL
&amp;&amp; octets[<span class="number">1</span>..<span class="number">6</span>] == <span class="self">Self</span>::ADDR_GLOBAL_ID
@@ -7842,7 +7957,7 @@
<span class="attr">#[cfg(test)]
</span><span class="kw">mod </span>tests {
<span class="kw">use </span>anyhow::Context;
<span class="kw">use </span>anyhow::anyhow;
<span class="kw">use </span>rand::RngCore;
<span class="kw">use </span>tokio_util::task::AbortOnDropHandle;
<span class="kw">use </span>tracing_test::traced_test;
@@ -8016,8 +8131,7 @@
time::sleep(Duration::from_millis(<span class="number">200</span>)).<span class="kw">await</span>;
}
})
.<span class="kw">await
</span>.context(<span class="string">"failed to connect nodes"</span>)<span class="question-mark">?</span>;
.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"all nodes meshed"</span>);
<span class="prelude-val">Ok</span>(tasks)
}
@@ -8028,28 +8142,21 @@
<span class="kw">let </span>conn = ep.endpoint.accept().<span class="kw">await</span>.expect(<span class="string">"no conn"</span>);
<span class="macro">info!</span>(<span class="string">"connecting"</span>);
<span class="kw">let </span>conn = conn.<span class="kw">await</span>.context(<span class="string">"[receiver] connecting"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>conn = conn.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"accepting bi"</span>);
<span class="kw">let </span>(<span class="kw-2">mut </span>send_bi, <span class="kw-2">mut </span>recv_bi) =
conn.accept_bi().<span class="kw">await</span>.context(<span class="string">"[receiver] accepting bi"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>(<span class="kw-2">mut </span>send_bi, <span class="kw-2">mut </span>recv_bi) = conn.accept_bi().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"reading"</span>);
<span class="kw">let </span>val = recv_bi
.read_to_end(usize::MAX)
.<span class="kw">await
</span>.context(<span class="string">"[receiver] reading to end"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>val = recv_bi.read_to_end(usize::MAX).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"replying"</span>);
<span class="kw">for </span>chunk <span class="kw">in </span>val.chunks(<span class="number">12</span>) {
send_bi
.write_all(chunk)
.<span class="kw">await
</span>.context(<span class="string">"[receiver] sending chunk"</span>)<span class="question-mark">?</span>;
send_bi.write_all(chunk).<span class="kw">await</span><span class="question-mark">?</span>;
}
<span class="macro">info!</span>(<span class="string">"finishing"</span>);
send_bi.finish().context(<span class="string">"[receiver] finishing"</span>)<span class="question-mark">?</span>;
send_bi.stopped().<span class="kw">await</span>.context(<span class="string">"[receiver] stopped"</span>)<span class="question-mark">?</span>;
send_bi.finish()<span class="question-mark">?</span>;
send_bi.stopped().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>stats = conn.stats();
<span class="macro">info!</span>(<span class="string">"stats: {:#?}"</span>, stats);
@@ -8078,24 +8185,20 @@
) -&gt; anyhow::Result&lt;()&gt; {
<span class="macro">info!</span>(<span class="string">"connecting to {}"</span>, dest_id.fmt_short());
<span class="kw">let </span>dest = NodeAddr::new(dest_id);
<span class="kw">let </span>conn = ep
.endpoint
.connect(dest, ALPN)
.<span class="kw">await
</span>.context(<span class="string">"[sender] connect"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>conn = ep.endpoint.connect(dest, ALPN).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"opening bi"</span>);
<span class="kw">let </span>(<span class="kw-2">mut </span>send_bi, <span class="kw-2">mut </span>recv_bi) = conn.open_bi().<span class="kw">await</span>.context(<span class="string">"[sender] open bi"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>(<span class="kw-2">mut </span>send_bi, <span class="kw-2">mut </span>recv_bi) = conn.open_bi().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"writing message"</span>);
send_bi.write_all(msg).<span class="kw">await</span>.context(<span class="string">"[sender] write all"</span>)<span class="question-mark">?</span>;
send_bi.write_all(msg).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"finishing"</span>);
send_bi.finish().context(<span class="string">"[sender] finish"</span>)<span class="question-mark">?</span>;
send_bi.stopped().<span class="kw">await</span>.context(<span class="string">"[sender] stopped"</span>)<span class="question-mark">?</span>;
send_bi.finish()<span class="question-mark">?</span>;
send_bi.stopped().<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="string">"reading_to_end"</span>);
<span class="kw">let </span>val = recv_bi.read_to_end(usize::MAX).<span class="kw">await</span>.context(<span class="string">"[sender]"</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>val = recv_bi.read_to_end(usize::MAX).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(
val,
msg,
@@ -8837,7 +8940,10 @@
.magic_sock()
.add_node_addr(empty_addr, node_map::Source::App)
.unwrap_err();
<span class="macro">assert!</span>(err.to_string().contains(<span class="string">"empty addressing info"</span>));
<span class="macro">assert!</span>(err
.to_string()
.to_lowercase()
.contains(<span class="string">"empty addressing info"</span>));
<span class="comment">// relay url only
</span><span class="kw">let </span>addr = NodeAddr {
@@ -1629,7 +1629,41 @@
<a href="#1628" id="1628">1628</a>
<a href="#1629" id="1629">1629</a>
<a href="#1630" id="1630">1630</a>
<a href="#1631" id="1631">1631</a></pre></div><pre class="rust"><code><span class="doccomment">//! The relay actor.
<a href="#1631" id="1631">1631</a>
<a href="#1632" id="1632">1632</a>
<a href="#1633" id="1633">1633</a>
<a href="#1634" id="1634">1634</a>
<a href="#1635" id="1635">1635</a>
<a href="#1636" id="1636">1636</a>
<a href="#1637" id="1637">1637</a>
<a href="#1638" id="1638">1638</a>
<a href="#1639" id="1639">1639</a>
<a href="#1640" id="1640">1640</a>
<a href="#1641" id="1641">1641</a>
<a href="#1642" id="1642">1642</a>
<a href="#1643" id="1643">1643</a>
<a href="#1644" id="1644">1644</a>
<a href="#1645" id="1645">1645</a>
<a href="#1646" id="1646">1646</a>
<a href="#1647" id="1647">1647</a>
<a href="#1648" id="1648">1648</a>
<a href="#1649" id="1649">1649</a>
<a href="#1650" id="1650">1650</a>
<a href="#1651" id="1651">1651</a>
<a href="#1652" id="1652">1652</a>
<a href="#1653" id="1653">1653</a>
<a href="#1654" id="1654">1654</a>
<a href="#1655" id="1655">1655</a>
<a href="#1656" id="1656">1656</a>
<a href="#1657" id="1657">1657</a>
<a href="#1658" id="1658">1658</a>
<a href="#1659" id="1659">1659</a>
<a href="#1660" id="1660">1660</a>
<a href="#1661" id="1661">1661</a>
<a href="#1662" id="1662">1662</a>
<a href="#1663" id="1663">1663</a>
<a href="#1664" id="1664">1664</a>
<a href="#1665" id="1665">1665</a></pre></div><pre class="rust"><code><span class="doccomment">//! The relay actor.
//!
//! The [`RelayActor`] handles all the relay connections. It is helped by the
//! [`ActiveRelayActor`] which handles a single relay connection.
@@ -1668,14 +1702,13 @@
},
};
<span class="kw">use </span>anyhow::anyhow;
<span class="kw">use </span>backon::{Backoff, BackoffBuilder, ExponentialBuilder};
<span class="kw">use </span>bytes::{Bytes, BytesMut};
<span class="kw">use </span>iroh_base::{NodeId, PublicKey, RelayUrl, SecretKey};
<span class="kw">use </span>iroh_metrics::{inc, inc_by};
<span class="kw">use </span>iroh_relay::{
<span class="self">self </span><span class="kw">as </span>relay,
client::{Client, ReceivedMessage, SendMessage},
client::{Client, ConnectError, ReceivedMessage, RecvError, SendError, SendMessage},
PingTracker, MAX_PACKET_SIZE,
};
<span class="kw">use </span>n0_future::{
@@ -1857,11 +1890,49 @@
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">enum </span>RelayConnectionError {
<span class="attr">#[snafu(display(<span class="string">"Failed to connect to relay server"</span>))]
</span>Connecting { source: anyhow::Error },
</span>Dial { source: DialError },
<span class="attr">#[snafu(display(<span class="string">"Failed to handshake with relay server"</span>))]
</span>Handshake { source: anyhow::Error },
</span>Handshake { source: RunError },
<span class="attr">#[snafu(display(<span class="string">"Lost connection to relay server"</span>))]
</span>Established { source: anyhow::Error },
</span>Established { source: RunError },
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">enum </span>RunError {
<span class="attr">#[snafu(display(<span class="string">"Send timeout"</span>))]
</span>SendTimeout {},
<span class="attr">#[snafu(display(<span class="string">"Ping timeout"</span>))]
</span>PingTimeout {},
<span class="attr">#[snafu(display(<span class="string">"Local IP no longer valid"</span>))]
</span>LocalIpInvalid {},
<span class="attr">#[snafu(display(<span class="string">"No local address"</span>))]
</span>LocalAddrMissing {},
<span class="attr">#[snafu(display(<span class="string">"Stream closed by server."</span>))]
</span>StreamClosedServer {},
<span class="attr">#[snafu(display(<span class="string">"Client stream read failed"</span>))]
</span>ClientStreamRead { source: RecvError },
<span class="attr">#[snafu(transparent)]
</span>Send { source: SendError },
}
<span class="attr">#[allow(missing_docs)]
#[common_fields({
backtrace: <span class="prelude-ty">Option</span>&lt;snafu::Backtrace&gt;,
<span class="attr">#[snafu(implicit)]
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">enum </span>DialError {
<span class="attr">#[snafu(display(<span class="string">"timeout trying to establish a connection"</span>))]
</span>Timeout {},
<span class="attr">#[snafu(display(<span class="string">"unable to connect"</span>))]
</span>Connect { source: ConnectError },
}
<span class="kw">impl </span>ActiveRelayActor {
@@ -1923,9 +1994,7 @@
<span class="doccomment">/// The main actor run loop.
///
/// Primarily switches between the dialing and connected states.
</span><span class="kw">async fn </span>run(<span class="kw-2">mut </span><span class="self">self</span>) -&gt; anyhow::Result&lt;()&gt; {
<span class="kw">use </span>anyhow::Context;
</span><span class="kw">async fn </span>run(<span class="kw-2">mut </span><span class="self">self</span>) {
<span class="macro">inc!</span>(MagicsockMetrics, num_relay_conns_added);
<span class="kw">let </span><span class="kw-2">mut </span>backoff = <span class="self">Self</span>::build_backoff();
@@ -1933,12 +2002,14 @@
<span class="kw">while let </span><span class="prelude-val">Err</span>(err) = <span class="self">self</span>.run_once().<span class="kw">await </span>{
<span class="macro">warn!</span>(<span class="string">"{err}"</span>);
<span class="kw">match </span>err {
RelayConnectionError::Connecting { .. }
| RelayConnectionError::Handshake { .. } =&gt; {
RelayConnectionError::Dial { .. } | RelayConnectionError::Handshake { .. } =&gt; {
<span class="comment">// If dialing failed, or if the relay connection failed before we received a pong,
// we wait an exponentially increasing time until we attempt to reconnect again.
</span><span class="kw">let </span>delay = backoff.next().context(<span class="string">"Retries exceeded"</span>)<span class="question-mark">?</span>;
<span class="macro">debug!</span>(<span class="string">"Retry in {delay:?}"</span>);
</span><span class="kw">let </span><span class="prelude-val">Some</span>(delay) = backoff.next() <span class="kw">else </span>{
<span class="macro">warn!</span>(<span class="string">"retries exceeded"</span>);
<span class="kw">break</span>;
};
<span class="macro">debug!</span>(<span class="string">"retry in {delay:?}"</span>);
time::sleep(delay).<span class="kw">await</span>;
}
RelayConnectionError::Established { .. } =&gt; {
@@ -1950,7 +2021,6 @@
}
<span class="macro">debug!</span>(<span class="string">"exiting"</span>);
<span class="macro">inc!</span>(MagicsockMetrics, num_relay_conns_removed);
<span class="prelude-val">Ok</span>(())
}
<span class="kw">fn </span>build_backoff() -&gt; <span class="kw">impl </span>Backoff {
@@ -1969,7 +2039,7 @@
/// be retried with a backoff.
</span><span class="kw">async fn </span>run_once(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;(), RelayConnectionError&gt; {
<span class="kw">let </span>client = <span class="kw">match </span><span class="self">self</span>.run_dialing().instrument(<span class="macro">info_span!</span>(<span class="string">"dialing"</span>)).<span class="kw">await </span>{
<span class="prelude-val">Some</span>(client_res) =&gt; client_res.context(ConnectingSnafu)<span class="question-mark">?</span>,
<span class="prelude-val">Some</span>(client_res) =&gt; client_res.context(DialSnafu)<span class="question-mark">?</span>,
<span class="prelude-val">None </span>=&gt; <span class="kw">return </span><span class="prelude-val">Ok</span>(()),
};
<span class="self">self</span>.run_connected(client)
@@ -1999,7 +2069,7 @@
///
/// Returns `None` if the actor needs to shut down. Returns `Some(Ok(client))` when the
/// connection is established, and `Some(Err(err))` if dialing the relay failed.
</span><span class="kw">async fn </span>run_dialing(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;anyhow::Result&lt;iroh_relay::client::Client&gt;&gt; {
</span><span class="kw">async fn </span>run_dialing(<span class="kw-2">&amp;mut </span><span class="self">self</span>) -&gt; <span class="prelude-ty">Option</span>&lt;<span class="prelude-ty">Result</span>&lt;iroh_relay::client::Client, DialError&gt;&gt; {
<span class="macro">debug!</span>(<span class="string">"Actor loop: connecting to relay."</span>);
<span class="comment">// We regularly flush the relay_datagrams_send queue so it is not full of stale
@@ -2086,13 +2156,13 @@
/// connections. It currently does not ever return `Err` as the retries continue
/// forever.
</span><span class="comment">// This is using `impl Future` to return a future without a reference to self.
</span><span class="kw">fn </span>dial_relay(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="kw">impl </span>Future&lt;Output = anyhow::Result&lt;Client&gt;&gt; {
</span><span class="kw">fn </span>dial_relay(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="kw">impl </span>Future&lt;Output = <span class="prelude-ty">Result</span>&lt;Client, DialError&gt;&gt; {
<span class="kw">let </span>client_builder = <span class="self">self</span>.relay_client_builder.clone();
<span class="kw">async move </span>{
<span class="kw">match </span>time::timeout(CONNECT_TIMEOUT, client_builder.connect()).<span class="kw">await </span>{
<span class="prelude-val">Ok</span>(<span class="prelude-val">Ok</span>(client)) =&gt; <span class="prelude-val">Ok</span>(client),
<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(err)) =&gt; <span class="prelude-val">Err</span>(anyhow::Error::from(err)),
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Connecting timed out after {CONNECT_TIMEOUT:?}"</span>)),
<span class="prelude-val">Ok</span>(<span class="prelude-val">Err</span>(err)) =&gt; <span class="prelude-val">Err</span>(ConnectSnafu.into_error(err)),
<span class="prelude-val">Err</span>(<span class="kw">_</span>) =&gt; <span class="prelude-val">Err</span>(TimeoutSnafu.build()),
}
}
}
@@ -2158,7 +2228,7 @@
}
}
<span class="kw">_ </span>= state.ping_tracker.timeout() =&gt; {
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Ping timeout"</span>));
<span class="kw">break </span><span class="prelude-val">Err</span>(PingTimeoutSnafu.build());
}
<span class="kw">_ </span>= ping_interval.tick() =&gt; {
<span class="kw">let </span>data = state.ping_tracker.new_ping();
@@ -2181,8 +2251,8 @@
<span class="kw">let </span>fut = client_sink.send(SendMessage::Ping(data));
<span class="self">self</span>.run_sending(fut, <span class="kw-2">&amp;mut </span>state, <span class="kw-2">&amp;mut </span>client_stream).<span class="kw">await</span><span class="question-mark">?</span>;
}
<span class="prelude-val">Some</span>(<span class="kw">_</span>) =&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Local IP no longer valid"</span>)),
<span class="prelude-val">None </span>=&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"No local addr, reconnecting"</span>)),
<span class="prelude-val">Some</span>(<span class="kw">_</span>) =&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(LocalIpInvalidSnafu.build()),
<span class="prelude-val">None </span>=&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(LocalAddrMissingSnafu.build()),
}
}
<span class="attr">#[cfg(test)]
@@ -2231,7 +2301,7 @@
}
msg = client_stream.next() =&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(msg) = msg <span class="kw">else </span>{
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Stream closed by server."</span>));
<span class="kw">break </span><span class="prelude-val">Err</span>(StreamClosedServerSnafu.build());
};
<span class="kw">match </span>msg {
<span class="prelude-val">Ok</span>(msg) =&gt; {
@@ -2239,7 +2309,7 @@
<span class="comment">// reset the ping timer, we have just received a message
</span>ping_interval.reset();
},
<span class="prelude-val">Err</span>(err) =&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Client stream read error: {err:#}"</span>)),
<span class="prelude-val">Err</span>(err) =&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(ClientStreamReadSnafu.into_error(err)),
}
}
<span class="kw">_ </span>= <span class="kw-2">&amp;mut </span><span class="self">self</span>.inactive_timeout, <span class="kw">if </span>!<span class="self">self</span>.is_home_relay =&gt; {
@@ -2325,7 +2395,7 @@
/// the actor should shut down, consult the [`ActiveRelayActor::stop_token`] and
/// [`ActiveRelayActor::inactive_timeout`] for this, or the send was successful.
</span><span class="attr">#[instrument(name = <span class="string">"tx"</span>, skip_all)]
</span><span class="kw">async fn </span>run_sending&lt;T, E: Into&lt;anyhow::Error&gt;&gt;(
</span><span class="kw">async fn </span>run_sending&lt;T, E: Into&lt;RunError&gt;&gt;(
<span class="kw-2">&amp;mut </span><span class="self">self</span>,
sending_fut: <span class="kw">impl </span>Future&lt;Output = <span class="prelude-ty">Result</span>&lt;T, E&gt;&gt;,
state: <span class="kw-2">&amp;mut </span>ConnectedRelayState,
@@ -2343,7 +2413,7 @@
<span class="kw">break </span><span class="prelude-val">Ok</span>(());
}
<span class="kw">_ </span>= <span class="kw-2">&amp;mut </span>timeout =&gt; {
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Send timeout"</span>));
<span class="kw">break </span><span class="prelude-val">Err</span>(SendTimeoutSnafu.build());
}
msg = <span class="self">self</span>.prio_inbox.recv() =&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(msg) = msg <span class="kw">else </span>{
@@ -2364,16 +2434,16 @@
}
}
<span class="kw">_ </span>= state.ping_tracker.timeout() =&gt; {
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Ping timeout"</span>));
<span class="kw">break </span><span class="prelude-val">Err</span>(PingTimeoutSnafu.build());
}
<span class="comment">// No need to read the inbox or datagrams to send.
</span>msg = client_stream.next() =&gt; {
<span class="kw">let </span><span class="prelude-val">Some</span>(msg) = msg <span class="kw">else </span>{
<span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Stream closed by server."</span>));
<span class="kw">break </span><span class="prelude-val">Err</span>(StreamClosedServerSnafu.build());
};
<span class="kw">match </span>msg {
<span class="prelude-val">Ok</span>(msg) =&gt; <span class="self">self</span>.handle_relay_msg(msg, state),
<span class="prelude-val">Err</span>(err) =&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(<span class="macro">anyhow!</span>(<span class="string">"Client stream read error: {err:#}"</span>)),
<span class="prelude-val">Err</span>(err) =&gt; <span class="kw">break </span><span class="prelude-val">Err</span>(ClientStreamReadSnafu.into_error(err)),
}
}
<span class="kw">_ </span>= <span class="kw-2">&amp;mut </span><span class="self">self</span>.inactive_timeout, <span class="kw">if </span>!<span class="self">self</span>.is_home_relay =&gt; {
@@ -2412,7 +2482,7 @@
}
<span class="kw">impl </span>ConnectedRelayState {
<span class="kw">fn </span>map_err(<span class="kw-2">&amp;</span><span class="self">self</span>, error: anyhow::Error) -&gt; RelayConnectionError {
<span class="kw">fn </span>map_err(<span class="kw-2">&amp;</span><span class="self">self</span>, error: RunError) -&gt; RelayConnectionError {
<span class="kw">if </span><span class="self">self</span>.established {
EstablishedSnafu.into_error(error)
} <span class="kw">else </span>{
@@ -2692,10 +2762,7 @@
<span class="kw">let </span>actor = ActiveRelayActor::new(opts);
<span class="self">self</span>.active_relay_tasks.spawn(
<span class="kw">async move </span>{
<span class="comment">// TODO: Make the actor itself infallible.
</span><span class="kw">if let </span><span class="prelude-val">Err</span>(err) = actor.run().<span class="kw">await </span>{
<span class="macro">warn!</span>(<span class="string">"actor error: {err:#}"</span>);
}
actor.run().<span class="kw">await</span>;
}
.instrument(span),
);
@@ -2961,7 +3028,7 @@
relay_datagrams_send: mpsc::Receiver&lt;RelaySendItem&gt;,
relay_datagrams_recv: Arc&lt;RelayDatagramRecvQueue&gt;,
span: tracing::Span,
) -&gt; AbortOnDropHandle&lt;anyhow::Result&lt;()&gt;&gt; {
) -&gt; AbortOnDropHandle&lt;()&gt; {
<span class="kw">let </span>opts = ActiveRelayActorOptions {
url,
prio_inbox_: prio_inbox_rx,
@@ -3048,7 +3115,7 @@
item: RelaySendItem,
tx: <span class="kw-2">&amp;</span>mpsc::Sender&lt;RelaySendItem&gt;,
rx: <span class="kw-2">&amp;</span>Arc&lt;RelayDatagramRecvQueue&gt;,
) -&gt; anyhow::Result&lt;()&gt; {
) -&gt; TestResult&lt;()&gt; {
<span class="macro">assert!</span>(item.datagrams.len() == <span class="number">1</span>);
tokio::time::timeout(Duration::from_secs(<span class="number">10</span>), <span class="kw">async move </span>{
<span class="kw">loop </span>{
@@ -3115,6 +3182,7 @@
<span class="comment">// Now ask to check the connection, triggering a ping but no reconnect.
</span><span class="kw">let </span>(tx, rx) = oneshot::channel();
inbox_tx.send(ActiveRelayMessage::GetLocalAddr(tx)).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let </span>local_addr = rx.<span class="kw">await</span><span class="question-mark">?</span>.context(<span class="string">"no local addr"</span>)<span class="question-mark">?</span>;
<span class="macro">info!</span>(<span class="question-mark">?</span>local_addr, <span class="string">"check connection with addr"</span>);
inbox_tx
@@ -3157,7 +3225,7 @@
<span class="comment">// Shut down the actor.
</span>cancel_token.cancel();
task.<span class="kw">await</span><span class="question-mark">??</span>;
task.<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())
}
+3 -3
View File
@@ -554,7 +554,7 @@
<span class="kw">use </span>tracing::{error, info_span, trace, warn, Instrument};
<span class="kw">use crate</span>::{
endpoint::{Connecting, Connection},
endpoint::{BindError, Connecting, Connection},
Endpoint,
};
@@ -758,7 +758,7 @@
}
<span class="doccomment">/// Spawns an accept loop and returns a handle to it encapsulated as the [`Router`].
</span><span class="kw">pub async fn </span>spawn(<span class="self">self</span>) -&gt; anyhow::Result&lt;Router&gt; {
</span><span class="kw">pub async fn </span>spawn(<span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;Router, BindError&gt; {
<span class="comment">// Update the endpoint with our alpns.
</span><span class="kw">let </span>alpns = <span class="self">self
</span>.protocols
@@ -769,7 +769,7 @@
<span class="kw">let </span>protocols = Arc::new(<span class="self">self</span>.protocols);
<span class="kw">if let </span><span class="prelude-val">Err</span>(err) = <span class="self">self</span>.endpoint.set_alpns(alpns) {
shutdown(<span class="kw-2">&amp;</span><span class="self">self</span>.endpoint, protocols.clone()).<span class="kw">await</span>;
<span class="kw">return </span><span class="prelude-val">Err</span>(err);
<span class="kw">return </span><span class="prelude-val">Err</span>(err.into());
}
<span class="kw">let </span><span class="kw-2">mut </span>join_set = JoinSet::new();
+1 -1
View File
@@ -245,7 +245,7 @@
</span>span_trace: n0_snafu::SpanTrace,
})]
<span class="attr">#[derive(Debug, Snafu)]
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">enum </span>CreateConfigError {
</span><span class="kw">pub enum </span>CreateConfigError {
<span class="doccomment">/// Error generating the certificate.
</span><span class="attr">#[snafu(display(<span class="string">"Error generating the certificate"</span>), context(<span class="bool-val">false</span>))]
</span>CertError { source: certificate::GenError },
@@ -517,7 +517,7 @@
<span class="doccomment">/// An error that occurs during certificate generation.
</span><span class="attr">#[derive(Debug, Snafu)]
#[snafu(transparent)]
</span><span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct </span>GenError {
</span><span class="kw">pub struct </span>GenError {
source: rcgen::Error,
}
+27 -3
View File
@@ -809,7 +809,19 @@
<a href="#808" id="808">808</a>
<a href="#809" id="809">809</a>
<a href="#810" id="810">810</a>
<a href="#811" id="811">811</a></pre></div><pre class="rust"><code><span class="doccomment">//! Support for handling DNS resource records for dialing by [`NodeId`].
<a href="#811" id="811">811</a>
<a href="#812" id="812">812</a>
<a href="#813" id="813">813</a>
<a href="#814" id="814">814</a>
<a href="#815" id="815">815</a>
<a href="#816" id="816">816</a>
<a href="#817" id="817">817</a>
<a href="#818" id="818">818</a>
<a href="#819" id="819">819</a>
<a href="#820" id="820">820</a>
<a href="#821" id="821">821</a>
<a href="#822" id="822">822</a>
<a href="#823" id="823">823</a></pre></div><pre class="rust"><code><span class="doccomment">//! Support for handling DNS resource records for dialing by [`NodeId`].
//!
//! Dialing by [`NodeId`] is supported by iroh nodes publishing [Pkarr] records to DNS
//! servers or the Mainline DHT. This module supports creating and parsing these records.
@@ -891,8 +903,12 @@
<span class="attr">#[cfg(not(wasm_browser))]
#[snafu(display(<span class="string">"failed to resolve TXT record"</span>))]
</span>LookupFailed { source: DnsError },
<span class="attr">#[snafu(transparent)]
<span class="attr">#[cfg(not(wasm_browser))]
#[snafu(transparent)]
</span>Pkarr { source: pkarr::Error },
<span class="attr">#[cfg(wasm_browser)]
#[snafu(display(<span class="string">"failed pkarr operation: {message}"</span>))]
</span>Pkarr { message: String },
<span class="attr">#[snafu(display(<span class="string">"invalid TXT entry"</span>))]
</span>InvalidTxtEntry { source: pkarr::dns::SimpleDnsError },
<span class="attr">#[snafu(display(<span class="string">"no calls succeeded: [{}]"</span>, errors.iter().map(|e| e.to_string()).collect::&lt;Vec&lt;<span class="kw">_</span>&gt;&gt;().join(<span class="string">""</span>)))]
@@ -1452,7 +1468,15 @@
) -&gt; <span class="prelude-ty">Result</span>&lt;pkarr::SignedPacket, Error&gt; {
<span class="kw">let </span>packet = <span class="self">self</span>.to_pkarr_dns_packet(ttl)<span class="question-mark">?</span>;
<span class="kw">let </span>keypair = pkarr::Keypair::from_secret_key(<span class="kw-2">&amp;</span>secret_key.to_bytes());
<span class="kw">let </span>signed_packet = pkarr::SignedPacket::from_packet(<span class="kw-2">&amp;</span>keypair, <span class="kw-2">&amp;</span>packet)<span class="question-mark">?</span>;
<span class="attr">#[cfg(not(wasm_browser))]
</span><span class="kw">let </span>signed_packet = pkarr::SignedPacket::from_packet(<span class="kw-2">&amp;</span>keypair, <span class="kw-2">&amp;</span>packet)<span class="question-mark">?</span>;
<span class="attr">#[cfg(wasm_browser)]
</span><span class="kw">let </span>signed_packet = pkarr::SignedPacket::from_packet(<span class="kw-2">&amp;</span>keypair, <span class="kw-2">&amp;</span>packet).map_err(|e| {
PkarrSnafu {
message: e.to_string(),
}
.build()
})<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(signed_packet)
}
+2 -2
View File
@@ -891,9 +891,9 @@
<span class="macro">println!</span>(<span class="string">"Closed in {time:?}"</span>);
<span class="macro">assert!</span>(Duration::from_millis(<span class="number">900</span>) &lt; time);
<span class="macro">assert!</span>(time &lt; Duration::from_millis(<span class="number">1100</span>));
<span class="macro">assert!</span>(time &lt; Duration::from_millis(<span class="number">1500</span>)); <span class="comment">// give it some lee-way. Apparently github actions ubuntu runners can be slow?
<span class="prelude-val">Ok</span>(())
</span><span class="prelude-val">Ok</span>(())
}
<span class="doccomment">/// Makes sure that, even though the RTT was set to some fairly low value,
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
@@ -1,9 +1,9 @@
(function() {
var implementors = Object.fromEntries([["iroh",[["impl ErrorCompat for <a class=\"struct\" href=\"iroh/discovery/struct.Lagged.html\" title=\"struct iroh::discovery::Lagged\">Lagged</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh/watchable/struct.Disconnected.html\" title=\"struct iroh::watchable::Disconnected\">Disconnected</a>"]]],["iroh_base",[["impl ErrorCompat for <a class=\"enum\" href=\"iroh_base/enum.KeyParsingError.html\" title=\"enum iroh_base::KeyParsingError\">KeyParsingError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_base/ticket/enum.Error.html\" title=\"enum iroh_base::ticket::Error\">Error</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh_base/struct.RelayUrlParseError.html\" title=\"struct iroh_base::RelayUrlParseError\">RelayUrlParseError</a>"]]],["iroh_relay",[["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.ConnectError.html\" title=\"enum iroh_relay::client::ConnectError\">ConnectError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.DialError.html\" title=\"enum iroh_relay::client::DialError\">DialError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.RecvError.html\" title=\"enum iroh_relay::client::RecvError\">RecvError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.SendError.html\" title=\"enum iroh_relay::client::SendError\">SendError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/dns/enum.Error.html\" title=\"enum iroh_relay::dns::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/node_info/enum.Error.html\" title=\"enum iroh_relay::node_info::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/protos/relay/enum.Error.html\" title=\"enum iroh_relay::protos::relay::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/protos/stun/enum.Error.html\" title=\"enum iroh_relay::protos::stun::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/quic/enum.Error.html\" title=\"enum iroh_relay::quic::Error\">Error</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh_relay/node_info/struct.MaxLengthExceededError.html\" title=\"struct iroh_relay::node_info::MaxLengthExceededError\">MaxLengthExceededError</a>"]]]]);
var implementors = Object.fromEntries([["iroh",[["impl ErrorCompat for <a class=\"enum\" href=\"iroh/endpoint/enum.AddNodeAddrError.html\" title=\"enum iroh::endpoint::AddNodeAddrError\">AddNodeAddrError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh/endpoint/enum.AlpnError.html\" title=\"enum iroh::endpoint::AlpnError\">AlpnError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh/endpoint/enum.BindError.html\" title=\"enum iroh::endpoint::BindError\">BindError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh/endpoint/enum.ConnectError.html\" title=\"enum iroh::endpoint::ConnectError\">ConnectError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh/endpoint/enum.ConnectWithOptsError.html\" title=\"enum iroh::endpoint::ConnectWithOptsError\">ConnectWithOptsError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh/endpoint/enum.GetMappingAddressError.html\" title=\"enum iroh::endpoint::GetMappingAddressError\">GetMappingAddressError</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh/discovery/struct.Lagged.html\" title=\"struct iroh::discovery::Lagged\">Lagged</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh/endpoint/struct.RemoteNodeIdError.html\" title=\"struct iroh::endpoint::RemoteNodeIdError\">RemoteNodeIdError</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh/watchable/struct.Disconnected.html\" title=\"struct iroh::watchable::Disconnected\">Disconnected</a>"]]],["iroh_base",[["impl ErrorCompat for <a class=\"enum\" href=\"iroh_base/enum.KeyParsingError.html\" title=\"enum iroh_base::KeyParsingError\">KeyParsingError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_base/ticket/enum.Error.html\" title=\"enum iroh_base::ticket::Error\">Error</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh_base/struct.RelayUrlParseError.html\" title=\"struct iroh_base::RelayUrlParseError\">RelayUrlParseError</a>"]]],["iroh_relay",[["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.ConnectError.html\" title=\"enum iroh_relay::client::ConnectError\">ConnectError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.DialError.html\" title=\"enum iroh_relay::client::DialError\">DialError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.RecvError.html\" title=\"enum iroh_relay::client::RecvError\">RecvError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/client/enum.SendError.html\" title=\"enum iroh_relay::client::SendError\">SendError</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/dns/enum.Error.html\" title=\"enum iroh_relay::dns::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/node_info/enum.Error.html\" title=\"enum iroh_relay::node_info::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/protos/relay/enum.Error.html\" title=\"enum iroh_relay::protos::relay::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/protos/stun/enum.Error.html\" title=\"enum iroh_relay::protos::stun::Error\">Error</a>"],["impl ErrorCompat for <a class=\"enum\" href=\"iroh_relay/quic/enum.Error.html\" title=\"enum iroh_relay::quic::Error\">Error</a>"],["impl ErrorCompat for <a class=\"struct\" href=\"iroh_relay/node_info/struct.MaxLengthExceededError.html\" title=\"struct iroh_relay::node_info::MaxLengthExceededError\">MaxLengthExceededError</a>"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
//{"start":57,"fragment_lengths":[308,466,1527]}
//{"start":57,"fragment_lengths":[1427,466,1527]}
File diff suppressed because one or more lines are too long