deploy: ed50276962879ec7a05acb6b41c10f4979e9fc58

This commit is contained in:
Frando
2025-12-08 11:15:18 +00:00
parent 2a3664af8e
commit 153c685c8c
26 changed files with 298 additions and 296 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Create and run a client"><title>client in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">client</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_bench/index.html">iroh_<wbr>bench</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></div><h1>Function <span class="fn">client</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#66-82">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn client(
server_addr: EndpointAddr,
relay_url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;,
server_addr: <a class="struct" href="../../iroh_base/endpoint_addr/struct.EndpointAddr.html" title="struct iroh_base::endpoint_addr::EndpointAddr">EndpointAddr</a>,
relay_url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;,
opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>,
) -&gt; Result&lt;<a class="struct" href="../struct.ClientStats.html" title="struct iroh_bench::ClientStats">ClientStats</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Create and run a client</p>
</div></details></section></div></main></body></html>
@@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Create a client endpoint and client connection"><title>connect_client in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">connect_client</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_bench/index.html">iroh_<wbr>bench</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></div><h1>Function <span class="fn">connect_<wbr>client</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#85-127">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn connect_client(
server_addr: EndpointAddr,
relay_url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;,
server_addr: <a class="struct" href="../../iroh_base/endpoint_addr/struct.EndpointAddr.html" title="struct iroh_base::endpoint_addr::EndpointAddr">EndpointAddr</a>,
relay_url: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;,
opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>,
) -&gt; Result&lt;(Endpoint, Connection)&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Create a client endpoint and client connection</p>
) -&gt; Result&lt;(<a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>, <a class="struct" href="../../iroh/endpoint/connection/struct.Connection.html" title="struct iroh::endpoint::connection::Connection">Connection</a>)&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Create a client endpoint and client connection</p>
</div></details></section></div></main></body></html>
@@ -1,5 +1,5 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `handle_client_stream` fn in crate `iroh_bench`."><title>handle_client_stream in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">handle_client_stream</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_bench/index.html">iroh_<wbr>bench</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></div><h1>Function <span class="fn">handle_<wbr>client_<wbr>stream</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#222-243">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn handle_client_stream(
connection: &amp;Connection,
connection: &amp;<a class="struct" href="../../iroh/endpoint/connection/struct.Connection.html" title="struct iroh::endpoint::connection::Connection">Connection</a>,
upload_size: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
read_unordered: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
) -&gt; Result&lt;(<a class="struct" href="../stats/struct.TransferResult.html" title="struct iroh_bench::stats::TransferResult">TransferResult</a>, <a class="struct" href="../stats/struct.TransferResult.html" title="struct iroh_bench::stats::TransferResult">TransferResult</a>)&gt;</code></pre></section></div></main></body></html>
+1 -1
View File
@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Take the provided endpoint and run the server"><title>server in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">server</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_bench/index.html">iroh_<wbr>bench</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></div><h1>Function <span class="fn">server</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#246-297">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn server(endpoint: Endpoint, opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>) -&gt; Result&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Take the provided endpoint and run the server</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Take the provided endpoint and run the server"><title>server in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">server</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_bench/index.html">iroh_<wbr>bench</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></div><h1>Function <span class="fn">server</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#246-297">Source</a> </span></div><pre class="rust item-decl"><code>pub async fn server(endpoint: <a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>, opt: <a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>) -&gt; Result&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Take the provided endpoint and run the server</p>
</div></details></section></div></main></body></html>
@@ -1,6 +1,6 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Creates a server endpoint which runs on the given runtime"><title>server_endpoint in iroh_bench::iroh - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_bench" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">server_endpoint</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_bench/index.html">iroh_<wbr>bench</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><div id="rustdoc-modnav"><h2><a href="index.html">In iroh_<wbr>bench::<wbr>iroh</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_bench</a>::<wbr><a href="index.html">iroh</a></div><h1>Function <span class="fn">server_<wbr>endpoint</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_bench/iroh.rs.html#21-63">Source</a> </span></div><pre class="rust item-decl"><code>pub fn server_endpoint(
rt: &amp;Runtime,
relay_url: &amp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;,
relay_url: &amp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;,
opt: &amp;<a class="struct" href="../struct.Opt.html" title="struct iroh_bench::Opt">Opt</a>,
) -&gt; (EndpointAddr, Endpoint)</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates a server endpoint which runs on the given runtime</p>
) -&gt; (<a class="struct" href="../../iroh_base/endpoint_addr/struct.EndpointAddr.html" title="struct iroh_base::endpoint_addr::EndpointAddr">EndpointAddr</a>, <a class="struct" href="../../iroh/endpoint/struct.Endpoint.html" title="struct iroh::endpoint::Endpoint">Endpoint</a>)</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Creates a server endpoint which runs on the given runtime</p>
</div></details></section></div></main></body></html>
+1 -1
View File
@@ -1,2 +1,2 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="HTTP server part of iroh-dns-server"><title>iroh_dns_server::http - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_dns_server" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module http</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_dns_server/index.html">iroh_<wbr>dns_<wbr>server</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module http</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>dns_<wbr>server</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_dns_server</a></div><h1>Module <span>http</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_dns_server/http.rs.html#1-492">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>HTTP server part of iroh-dns-server</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="HTTP server part of iroh-dns-server"><title>iroh_dns_server::http - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_dns_server" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module http</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_dns_server/index.html">iroh_<wbr>dns_<wbr>server</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module http</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh_<wbr>dns_<wbr>server</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_dns_server</a></div><h1>Module <span>http</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh_dns_server/http.rs.html#1-494">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>HTTP server part of iroh-dns-server</p>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.HttpConfig.html" title="struct iroh_dns_server::http::HttpConfig">Http<wbr>Config</a></dt><dd>Config for the HTTP server</dd><dt><a class="struct" href="struct.HttpServer.html" title="struct iroh_dns_server::http::HttpServer">Http<wbr>Server</a></dt><dd>The HTTP(S) server part of iroh-dns-server</dd><dt><a class="struct" href="struct.HttpsConfig.html" title="struct iroh_dns_server::http::HttpsConfig">Https<wbr>Config</a></dt><dd>Config for the HTTPS server</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.CertMode.html" title="enum iroh_dns_server::http::CertMode">Cert<wbr>Mode</a></dt><dd>The mode how SSL certificates should be created.</dd><dt><a class="enum" href="enum.RateLimitConfig.html" title="enum iroh_dns_server::http::RateLimitConfig">Rate<wbr>Limit<wbr>Config</a></dt><dd>Config for http server rate limit.</dd></dl></section></div></main></body></html>
File diff suppressed because one or more lines are too long
@@ -73,9 +73,9 @@ at T+0ms, T+200ms and T+300ms. The <code>timeout</code> is applied as stated in
summary of all errors otherwise.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_endpoint_by_id" class="method"><a class="src rightside" href="../../src/iroh_relay/dns.rs.html#389-399">Source</a><h4 class="code-header">pub async fn <a href="#method.lookup_endpoint_by_id" class="fn">lookup_endpoint_by_id</a>(
&amp;self,
endpoint_id: &amp;EndpointId,
endpoint_id: &amp;<a class="type" href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId">EndpointId</a>,
origin: &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="../endpoint_info/struct.EndpointInfo.html" title="struct iroh_relay::endpoint_info::EndpointInfo">EndpointInfo</a>, <a class="enum" href="enum.LookupError.html" title="enum iroh_relay::dns::LookupError">LookupError</a>&gt;</h4></section></summary><div class="docblock"><p>Looks up endpoint info by [<code>EndpointId</code>] and origin domain name.</p>
) -&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="../endpoint_info/struct.EndpointInfo.html" title="struct iroh_relay::endpoint_info::EndpointInfo">EndpointInfo</a>, <a class="enum" href="enum.LookupError.html" title="enum iroh_relay::dns::LookupError">LookupError</a>&gt;</h4></section></summary><div class="docblock"><p>Looks up endpoint info by <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> and origin domain name.</p>
<p>To lookup endpoints that published their endpoint info to the DNS servers run by n0,
pass <a href="constant.N0_DNS_ENDPOINT_ORIGIN_PROD.html" title="constant iroh_relay::dns::N0_DNS_ENDPOINT_ORIGIN_PROD"><code>N0_DNS_ENDPOINT_ORIGIN_PROD</code></a> as <code>origin</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_endpoint_by_domain_name" class="method"><a class="src rightside" href="../../src/iroh_relay/dns.rs.html#402-410">Source</a><h4 class="code-header">pub async fn <a href="#method.lookup_endpoint_by_domain_name" class="fn">lookup_endpoint_by_domain_name</a>(
@@ -93,10 +93,10 @@ at T+0ms, T+200ms and T+300ms. The result of the first successful call is return
summary of all errors otherwise.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.lookup_endpoint_by_id_staggered" class="method"><a class="src rightside" href="../../src/iroh_relay/dns.rs.html#433-441">Source</a><h4 class="code-header">pub async fn <a href="#method.lookup_endpoint_by_id_staggered" class="fn">lookup_endpoint_by_id_staggered</a>(
&amp;self,
endpoint_id: &amp;EndpointId,
endpoint_id: &amp;<a class="type" href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId">EndpointId</a>,
origin: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,
delays_ms: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</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="../endpoint_info/struct.EndpointInfo.html" title="struct iroh_relay::endpoint_info::EndpointInfo">EndpointInfo</a>, <a class="struct" href="struct.StaggeredError.html" title="struct iroh_relay::dns::StaggeredError">StaggeredError</a>&lt;<a class="enum" href="enum.LookupError.html" title="enum iroh_relay::dns::LookupError">LookupError</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Looks up endpoint info by [<code>EndpointId</code>] and origin domain name.</p>
) -&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="../endpoint_info/struct.EndpointInfo.html" title="struct iroh_relay::endpoint_info::EndpointInfo">EndpointInfo</a>, <a class="struct" href="struct.StaggeredError.html" title="struct iroh_relay::dns::StaggeredError">StaggeredError</a>&lt;<a class="enum" href="enum.LookupError.html" title="enum iroh_relay::dns::LookupError">LookupError</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Looks up endpoint info by <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> and origin domain name.</p>
<p>From the moment this function is called, each lookup is scheduled after the delays in
<code>delays_ms</code> with the first call being done immediately. <code>[200ms, 300ms]</code> results in calls
at T+0ms, T+200ms and T+300ms. The result of the first successful call is returned, or a
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Support for handling DNS resource records for dialing by `EndpointId`."><title>iroh_relay::endpoint_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module endpoint_info</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module endpoint_<wbr>info</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><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" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a></div><h1>Module <span>endpoint_<wbr>info</span>&nbsp;<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/endpoint_info.rs.html#1-790">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support for handling DNS resource records for dialing by [<code>EndpointId</code>].</p>
<p>Dialing by [<code>EndpointId</code>] is supported by iroh endpoints publishing <a href="https://app.pkarr.org">Pkarr</a> records to DNS
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Support for handling DNS resource records for dialing by `EndpointId`."><title>iroh_relay::endpoint_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module endpoint_info</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module endpoint_<wbr>info</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><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" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a></div><h1>Module <span>endpoint_<wbr>info</span>&nbsp;<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/endpoint_info.rs.html#1-790">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Support for handling DNS resource records for dialing by <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a>.</p>
<p>Dialing by <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> is supported by iroh endpoints publishing <a href="https://app.pkarr.org">Pkarr</a> records to DNS
servers or the Mainline DHT. This module supports creating and parsing these records.</p>
<p>DNS records are published under the following names:</p>
<p><code>_iroh.&lt;z32-endpoint-id&gt;.&lt;origin-domain&gt; TXT</code></p>
@@ -8,7 +8,7 @@ servers or the Mainline DHT. This module supports creating and parsing these re
<p><code>_iroh</code> is the record name as defined by <a href="constant.IROH_TXT_NAME.html" title="constant iroh_relay::endpoint_info::IROH_TXT_NAME"><code>IROH_TXT_NAME</code></a>.</p>
</li>
<li>
<p><code>&lt;z32-endpoint-id&gt;</code> is the <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt">z-base-32</a> encoding of the [<code>EndpointId</code>].</p>
<p><code>&lt;z32-endpoint-id&gt;</code> is the <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt">z-base-32</a> encoding of the <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a>.</p>
</li>
<li>
<p><code>&lt;origin-domain&gt;</code> is the domain name of the publishing DNS server,
@@ -23,12 +23,12 @@ servers or the Mainline DHT. This module supports creating and parsing these re
in <a href="https://www.rfc-editor.org/rfc/rfc1464">RFC1464</a>. The following attributes are defined:</p>
<ul>
<li>
<p><code>relay=&lt;url&gt;</code>: The home <a href="iroh_base::RelayUrl"><code>RelayUrl</code></a> of this endpoint.</p>
<p><code>relay=&lt;url&gt;</code>: The home <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a> of this endpoint.</p>
</li>
<li>
<p><code>addr=&lt;addr&gt; &lt;addr&gt;</code>: A space-separated list of sockets addresses for this iroh endpoint.
Each address is an IPv4 or IPv6 address with a port.</p>
</li>
</ul>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh_relay::endpoint_info::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh_relay::endpoint_info::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.MaxLengthExceededError.html" title="struct iroh_relay::endpoint_info::MaxLengthExceededError">MaxLength<wbr>Exceeded<wbr>Error</a></dt><dd>Error returned when an input value is too long for <a href="struct.UserData.html" title="struct iroh_relay::endpoint_info::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh_relay::endpoint_info::UserData">User<wbr>Data</a></dt><dd>Under the hood this is a UTF-8 String is no longer than <a href="struct.UserData.html#associatedconstant.MAX_LENGTH" title="associated constant iroh_relay::endpoint_info::UserData::MAX_LENGTH"><code>UserData::MAX_LENGTH</code></a> bytes.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">Decoding<wbr>Error</a></dt><dt><a class="enum" href="enum.EncodingError.html" title="enum iroh_relay::endpoint_info::EncodingError">Encoding<wbr>Error</a></dt><dt><a class="enum" href="enum.ParseError.html" title="enum iroh_relay::endpoint_info::ParseError">Parse<wbr>Error</a></dt></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.IROH_TXT_NAME.html" title="constant iroh_relay::endpoint_info::IROH_TXT_NAME">IROH_<wbr>TXT_<wbr>NAME</a></dt><dd>The DNS name for the iroh TXT record.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.EndpointIdExt.html" title="trait iroh_relay::endpoint_info::EndpointIdExt">Endpoint<wbr>IdExt</a></dt><dd>Extension methods for [<code>EndpointId</code>] to encode to and decode from [<code>z32</code>],
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.EndpointData.html" title="struct iroh_relay::endpoint_info::EndpointData">Endpoint<wbr>Data</a></dt><dd>Data about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.EndpointInfo.html" title="struct iroh_relay::endpoint_info::EndpointInfo">Endpoint<wbr>Info</a></dt><dd>Information about an endpoint that may be published to and resolved from discovery services.</dd><dt><a class="struct" href="struct.MaxLengthExceededError.html" title="struct iroh_relay::endpoint_info::MaxLengthExceededError">MaxLength<wbr>Exceeded<wbr>Error</a></dt><dd>Error returned when an input value is too long for <a href="struct.UserData.html" title="struct iroh_relay::endpoint_info::UserData"><code>UserData</code></a>.</dd><dt><a class="struct" href="struct.UserData.html" title="struct iroh_relay::endpoint_info::UserData">User<wbr>Data</a></dt><dd>Under the hood this is a UTF-8 String is no longer than <a href="struct.UserData.html#associatedconstant.MAX_LENGTH" title="associated constant iroh_relay::endpoint_info::UserData::MAX_LENGTH"><code>UserData::MAX_LENGTH</code></a> bytes.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">Decoding<wbr>Error</a></dt><dt><a class="enum" href="enum.EncodingError.html" title="enum iroh_relay::endpoint_info::EncodingError">Encoding<wbr>Error</a></dt><dt><a class="enum" href="enum.ParseError.html" title="enum iroh_relay::endpoint_info::ParseError">Parse<wbr>Error</a></dt></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.IROH_TXT_NAME.html" title="constant iroh_relay::endpoint_info::IROH_TXT_NAME">IROH_<wbr>TXT_<wbr>NAME</a></dt><dd>The DNS name for the iroh TXT record.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.EndpointIdExt.html" title="trait iroh_relay::endpoint_info::EndpointIdExt">Endpoint<wbr>IdExt</a></dt><dd>Extension methods for <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> to encode to and decode from [<code>z32</code>],
which is the encoding used in [<code>pkarr</code>] domain names.</dd></dl></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extension methods for `EndpointId` to encode to and decode from `z32`, which is the encoding used in `pkarr` domain names."><title>EndpointIdExt in iroh_relay::endpoint_info - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_relay" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">EndpointIdExt</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_relay/index.html">iroh_<wbr>relay</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Endpoint<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-EndpointIdExt-for-PublicKey" title="EndpointId">EndpointId</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>endpoint_<wbr>info</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh_relay</a>::<wbr><a href="index.html">endpoint_info</a></div><h1>Trait <span class="trait">Endpoint<wbr>IdExt</span>&nbsp;<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/endpoint_info.rs.html#83-93">Source</a> </span></div><pre class="rust item-decl"><code>pub trait EndpointIdExt {
// 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;EndpointId, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">DecodingError</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 [<code>EndpointId</code>] to encode to and decode from [<code>z32</code>],
<span class="item-spacer"></span> fn <a href="#tymethod.from_z32" class="fn">from_z32</a>(s: &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.EndpointId.html" title="type iroh_base::key::EndpointId">EndpointId</a>, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">DecodingError</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.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</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/endpoint_info.rs.html#87">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 [<code>EndpointId</code>] in <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt"><code>z-base-32</code></a> 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/endpoint_info.rs.html#92">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;EndpointId, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">DecodingError</a>&gt;</h4></section></summary><div class="docblock"><p>Parses a [<code>EndpointId</code>] from <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt"><code>z-base-32</code></a> encoding.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-EndpointIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/endpoint_info.rs.html#95-110">Source</a><a href="#impl-EndpointIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.EndpointIdExt.html" title="trait iroh_relay::endpoint_info::EndpointIdExt">EndpointIdExt</a> for EndpointId</h3></section></summary><div class="impl-items"><section id="method.to_z32" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/endpoint_info.rs.html#96-98">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/endpoint_info.rs.html#100-109">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;EndpointId, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">DecodingError</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/endpoint_info/trait.EndpointIdExt.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/endpoint_info.rs.html#87">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.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> in <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt"><code>z-base-32</code></a> 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/endpoint_info.rs.html#92">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.EndpointId.html" title="type iroh_base::key::EndpointId">EndpointId</a>, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">DecodingError</a>&gt;</h4></section></summary><div class="docblock"><p>Parses a <a href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a> from <a href="https://philzimmermann.com/docs/human-oriented-base-32-encoding.txt"><code>z-base-32</code></a> encoding.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-EndpointIdExt-for-PublicKey" class="impl"><a class="src rightside" href="../../src/iroh_relay/endpoint_info.rs.html#95-110">Source</a><a href="#impl-EndpointIdExt-for-PublicKey" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.EndpointIdExt.html" title="trait iroh_relay::endpoint_info::EndpointIdExt">EndpointIdExt</a> for <a class="type" href="../../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId">EndpointId</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/endpoint_info.rs.html#96-98">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/endpoint_info.rs.html#100-109">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.EndpointId.html" title="type iroh_base::key::EndpointId">EndpointId</a>, <a class="enum" href="enum.DecodingError.html" title="enum iroh_relay::endpoint_info::DecodingError">DecodingError</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/endpoint_info/trait.EndpointIdExt.js" data-ignore-extern-crates="iroh_base" async></script></section></div></main></body></html>
+1 -1
View File
@@ -25,6 +25,6 @@ Tailscale.</p>
QAD support and expose metrics.</p>
</li>
</ul>
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.MAX_PACKET_SIZE"><code>pub use protos::relay::<a class="constant" href="protos/relay/constant.MAX_PACKET_SIZE.html" title="constant iroh_relay::protos::relay::MAX_PACKET_SIZE">MAX_PACKET_SIZE</a>;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="client/index.html" title="mod iroh_relay::client">client</a></dt><dd>Exposes <a href="client/struct.Client.html" title="struct iroh_relay::client::Client"><code>Client</code></a>, which allows to establish connections to a relay server.</dd><dt><a class="mod" href="defaults/index.html" title="mod iroh_relay::defaults">defaults</a></dt><dd>Default values used in the relay.</dd><dt><a class="mod" href="dns/index.html" title="mod iroh_relay::dns">dns</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dd>DNS resolver</dd><dt><a class="mod" href="endpoint_info/index.html" title="mod iroh_relay::endpoint_info">endpoint_<wbr>info</a></dt><dd>Support for handling DNS resource records for dialing by [<code>EndpointId</code>].</dd><dt><a class="mod" href="http/index.html" title="mod iroh_relay::http">http</a></dt><dd>HTTP-specific constants for the relay server and client.</dd><dt><a class="mod" href="protos/index.html" title="mod iroh_relay::protos">protos</a></dt><dd>Protocols used by the iroh-relay</dd><dt><a class="mod" href="quic/index.html" title="mod iroh_relay::quic">quic</a></dt><dd>Create a QUIC server that accepts connections
</div></details><h2 id="reexports" class="section-header">Re-exports<a href="#reexports" class="anchor">§</a></h2><dl class="item-table reexports"><dt id="reexport.MAX_PACKET_SIZE"><code>pub use protos::relay::<a class="constant" href="protos/relay/constant.MAX_PACKET_SIZE.html" title="constant iroh_relay::protos::relay::MAX_PACKET_SIZE">MAX_PACKET_SIZE</a>;</code></dt></dl><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="client/index.html" title="mod iroh_relay::client">client</a></dt><dd>Exposes <a href="client/struct.Client.html" title="struct iroh_relay::client::Client"><code>Client</code></a>, which allows to establish connections to a relay server.</dd><dt><a class="mod" href="defaults/index.html" title="mod iroh_relay::defaults">defaults</a></dt><dd>Default values used in the relay.</dd><dt><a class="mod" href="dns/index.html" title="mod iroh_relay::dns">dns</a><wbr><span class="stab portability" title="Available on non-`wasm_browser` only">Non-<code>wasm_browser</code></span></dt><dd>DNS resolver</dd><dt><a class="mod" href="endpoint_info/index.html" title="mod iroh_relay::endpoint_info">endpoint_<wbr>info</a></dt><dd>Support for handling DNS resource records for dialing by <a href="../iroh_base/key/type.EndpointId.html" title="type iroh_base::key::EndpointId"><code>EndpointId</code></a>.</dd><dt><a class="mod" href="http/index.html" title="mod iroh_relay::http">http</a></dt><dd>HTTP-specific constants for the relay server and client.</dd><dt><a class="mod" href="protos/index.html" title="mod iroh_relay::protos">protos</a></dt><dd>Protocols used by the iroh-relay</dd><dt><a class="mod" href="quic/index.html" title="mod iroh_relay::quic">quic</a></dt><dd>Create a QUIC server that accepts connections
for QUIC address discovery.</dd><dt><a class="mod" href="server/index.html" title="mod iroh_relay::server">server</a><wbr><span class="stab portability" title="Available on crate feature `server` only"><code>server</code></span></dt><dd>A fully-fledged iroh-relay server over HTTP or HTTPS.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.PingTracker.html" title="struct iroh_relay::PingTracker">Ping<wbr>Tracker</a></dt><dd>Tracks pings on a single relay connection.</dd><dt><a class="struct" href="struct.RelayConfig.html" title="struct iroh_relay::RelayConfig">Relay<wbr>Config</a></dt><dd>Information on a specific relay server.</dd><dt><a class="struct" href="struct.RelayMap.html" title="struct iroh_relay::RelayMap">Relay<wbr>Map</a></dt><dd>List of relay server configurations to be used in an iroh endpoint.</dd><dt><a class="struct" href="struct.RelayQuicConfig.html" title="struct iroh_relay::RelayQuicConfig">Relay<wbr>Quic<wbr>Config</a></dt><dd>Configuration for speaking to the QUIC endpoint on the relay
server to do QUIC address discovery.</dd></dl><script type="text/json" id="notable-traits-data">{"&[u8]":"<h3>Notable traits for <code>&amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</code></h3><pre><code><div class=\"where\">impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Read.html\" title=\"trait std::io::Read\">Read</a> for &amp;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]</div>"}</script></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -17,9 +17,9 @@ case there is an error in the server before it is shut down.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_addr" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#503-505">Source</a><h4 class="code-header">pub fn <a href="#method.http_addr" class="fn">http_addr</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>&gt;</h4></section></summary><div class="docblock"><p>The socket address the HTTP server is listening on.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.quic_addr" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#508-510">Source</a><h4 class="code-header">pub fn <a href="#method.quic_addr" class="fn">quic_addr</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/net/socket_addr/enum.SocketAddr.html" title="enum core::net::socket_addr::SocketAddr">SocketAddr</a>&gt;</h4></section></summary><div class="docblock"><p>The socket address the QUIC server is listening on.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.certificates" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#513-515">Source</a><h4 class="code-header">pub fn <a href="#method.certificates" class="fn">certificates</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;CertificateDer&lt;'static&gt;&gt;&gt;</h4></section></summary><div class="docblock"><p>The certificates chain if configured with manual TLS certificates.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.https_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#521-527">Source</a><h4 class="code-header">pub fn <a href="#method.https_url" class="fn">https_url</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s https [<code>RelayUrl</code>].</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.https_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#521-527">Source</a><h4 class="code-header">pub fn <a href="#method.https_url" class="fn">https_url</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s https <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a>.</p>
<p>This uses <a href="struct.Server.html#method.https_addr" title="method iroh_relay::server::Server::https_addr"><code>Self::https_addr</code></a> so it’s mostly useful for local development.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#533-539">Source</a><h4 class="code-header">pub fn <a href="#method.http_url" class="fn">http_url</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;RelayUrl&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s http [<code>RelayUrl</code>].</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.http_url" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#533-539">Source</a><h4 class="code-header">pub fn <a href="#method.http_url" class="fn">http_url</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl">RelayUrl</a>&gt;</h4></section><span class="item-info"><div class="stab portability">Available on <strong>crate feature <code>test-utils</code></strong> only.</div></span></summary><div class="docblock"><p>Get the server’s http <a href="../../iroh_base/relay_url/struct.RelayUrl.html" title="struct iroh_base::relay_url::RelayUrl"><code>RelayUrl</code></a>.</p>
<p>This uses <a href="struct.Server.html#method.http_addr" title="method iroh_relay::server::Server::http_addr"><code>Self::http_addr</code></a> so it’s mostly useful for local development.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.metrics" class="method"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#542-544">Source</a><h4 class="code-header">pub fn <a href="#method.metrics" class="fn">metrics</a>(&amp;self) -&gt; &amp;<a class="struct" href="struct.RelayMetrics.html" title="struct iroh_relay::server::RelayMetrics">RelayMetrics</a></h4></section></summary><div class="docblock"><p>Returns the metrics collected in the relay server.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-Server" class="impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#241">Source</a><a href="#impl-Debug-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../../src/iroh_relay/server.rs.html#241">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, __derive_more_f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-Server" class="impl"><a href="#impl-Freeze-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-RefUnwindSafe-for-Server" class="impl"><a href="#impl-RefUnwindSafe-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Send-for-Server" class="impl"><a href="#impl-Send-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Sync-for-Server" class="impl"><a href="#impl-Sync-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-Unpin-for-Server" class="impl"><a href="#impl-Unpin-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section><section id="impl-UnwindSafe-for-Server" class="impl"><a href="#impl-UnwindSafe-for-Server" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Server.html" title="struct iroh_relay::server::Server">Server</a></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+214 -212
View File
@@ -277,216 +277,218 @@
<a href=#277 id=277 data-nosnippet>277</a>
<a href=#278 id=278 data-nosnippet>278</a><span class="attr">#[cfg(test)]
<a href=#279 id=279 data-nosnippet>279</a></span><span class="kw">mod </span>tests {
<a href=#280 id=280 data-nosnippet>280</a> <span class="kw">use </span>hickory_resolver::{
<a href=#281 id=281 data-nosnippet>281</a> config::{NameServerConfig, ResolverConfig, ResolverOpts},
<a href=#282 id=282 data-nosnippet>282</a> name_server::TokioConnectionProvider,
<a href=#283 id=283 data-nosnippet>283</a> };
<a href=#284 id=284 data-nosnippet>284</a> <span class="kw">use </span>hickory_server::proto::rr::RecordType;
<a href=#285 id=285 data-nosnippet>285</a> <span class="kw">use </span>iroh::{
<a href=#286 id=286 data-nosnippet>286</a> RelayUrl, SecretKey,
<a href=#287 id=287 data-nosnippet>287</a> discovery::{EndpointInfo, pkarr::PkarrRelayClient},
<a href=#288 id=288 data-nosnippet>288</a> endpoint_info::EndpointIdExt,
<a href=#289 id=289 data-nosnippet>289</a> };
<a href=#290 id=290 data-nosnippet>290</a> <span class="kw">use </span>n0_error::StdResultExt;
<a href=#291 id=291 data-nosnippet>291</a> <span class="kw">use </span>rand::SeedableRng;
<a href=#292 id=292 data-nosnippet>292</a>
<a href=#293 id=293 data-nosnippet>293</a> <span class="kw">use crate</span>::{http::HttpsConfig, server::Server};
<a href=#280 id=280 data-nosnippet>280</a> <span class="kw">use </span>std::net::Ipv4Addr;
<a href=#281 id=281 data-nosnippet>281</a>
<a href=#282 id=282 data-nosnippet>282</a> <span class="kw">use </span>hickory_resolver::{
<a href=#283 id=283 data-nosnippet>283</a> config::{NameServerConfig, ResolverConfig, ResolverOpts},
<a href=#284 id=284 data-nosnippet>284</a> name_server::TokioConnectionProvider,
<a href=#285 id=285 data-nosnippet>285</a> };
<a href=#286 id=286 data-nosnippet>286</a> <span class="kw">use </span>hickory_server::proto::rr::RecordType;
<a href=#287 id=287 data-nosnippet>287</a> <span class="kw">use </span>iroh::{
<a href=#288 id=288 data-nosnippet>288</a> RelayUrl, SecretKey,
<a href=#289 id=289 data-nosnippet>289</a> discovery::{EndpointInfo, pkarr::PkarrRelayClient},
<a href=#290 id=290 data-nosnippet>290</a> endpoint_info::EndpointIdExt,
<a href=#291 id=291 data-nosnippet>291</a> };
<a href=#292 id=292 data-nosnippet>292</a> <span class="kw">use </span>n0_error::StdResultExt;
<a href=#293 id=293 data-nosnippet>293</a> <span class="kw">use </span>rand::SeedableRng;
<a href=#294 id=294 data-nosnippet>294</a>
<a href=#295 id=295 data-nosnippet>295</a> <span class="attr">#[tokio::test]
<a href=#296 id=296 data-nosnippet>296</a> </span><span class="kw">async fn </span>test_doh() -&gt; n0_error::Result {
<a href=#297 id=297 data-nosnippet>297</a> tracing_subscriber::fmt::init();
<a href=#298 id=298 data-nosnippet>298</a> <span class="kw">let </span><span class="kw-2">mut </span>rng = rand_chacha::ChaCha12Rng::seed_from_u64(<span class="number">0</span>);
<a href=#299 id=299 data-nosnippet>299</a> <span class="kw">let </span>dir = tempfile::tempdir()<span class="question-mark">?</span>;
<a href=#300 id=300 data-nosnippet>300</a> <span class="kw">let </span>https_config = HttpsConfig {
<a href=#301 id=301 data-nosnippet>301</a> port: <span class="number">0</span>,
<a href=#302 id=302 data-nosnippet>302</a> bind_addr: <span class="prelude-val">None</span>,
<a href=#303 id=303 data-nosnippet>303</a> domains: <span class="macro">vec!</span>[<span class="string">"localhost"</span>.to_string()],
<a href=#304 id=304 data-nosnippet>304</a> cert_mode: <span class="kw">crate</span>::http::CertMode::SelfSigned,
<a href=#305 id=305 data-nosnippet>305</a> letsencrypt_contact: <span class="prelude-val">None</span>,
<a href=#306 id=306 data-nosnippet>306</a> letsencrypt_prod: <span class="prelude-val">None</span>,
<a href=#307 id=307 data-nosnippet>307</a> };
<a href=#308 id=308 data-nosnippet>308</a> <span class="kw">let </span>server =
<a href=#309 id=309 data-nosnippet>309</a> Server::spawn_for_tests_with_options(dir.path(), <span class="prelude-val">None</span>, <span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(https_config))
<a href=#310 id=310 data-nosnippet>310</a> .<span class="kw">await</span><span class="question-mark">?</span>;
<a href=#311 id=311 data-nosnippet>311</a>
<a href=#312 id=312 data-nosnippet>312</a> <span class="kw">let </span>(name_z32, signed_packet) = {
<a href=#313 id=313 data-nosnippet>313</a> <span class="kw">let </span>secret_key = SecretKey::generate(<span class="kw-2">&amp;mut </span>rng);
<a href=#314 id=314 data-nosnippet>314</a> <span class="kw">let </span>endpoint_id = secret_key.public();
<a href=#315 id=315 data-nosnippet>315</a> <span class="kw">let </span>relay_url: RelayUrl = <span class="string">"https://relay.example."</span>.parse()<span class="question-mark">?</span>;
<a href=#316 id=316 data-nosnippet>316</a> <span class="kw">let </span>endpoint_info =
<a href=#317 id=317 data-nosnippet>317</a> EndpointInfo::new(endpoint_id).with_relay_url(<span class="prelude-val">Some</span>(relay_url.clone()));
<a href=#318 id=318 data-nosnippet>318</a> (
<a href=#319 id=319 data-nosnippet>319</a> secret_key.public().to_z32(),
<a href=#320 id=320 data-nosnippet>320</a> endpoint_info.to_pkarr_signed_packet(<span class="kw-2">&amp;</span>secret_key, <span class="number">30</span>)<span class="question-mark">?</span>,
<a href=#321 id=321 data-nosnippet>321</a> )
<a href=#322 id=322 data-nosnippet>322</a> };
<a href=#323 id=323 data-nosnippet>323</a>
<a href=#324 id=324 data-nosnippet>324</a> <span class="kw">let </span>http_url = server.http_url().expect(<span class="string">"http is bound"</span>);
<a href=#325 id=325 data-nosnippet>325</a> <span class="kw">let </span>pkarr = PkarrRelayClient::new(<span class="macro">format!</span>(<span class="string">"{http_url}pkarr"</span>).parse().anyerr()<span class="question-mark">?</span>);
<a href=#326 id=326 data-nosnippet>326</a> pkarr.publish(<span class="kw-2">&amp;</span>signed_packet).<span class="kw">await</span><span class="question-mark">?</span>;
<a href=#327 id=327 data-nosnippet>327</a>
<a href=#328 id=328 data-nosnippet>328</a> <span class="comment">// Create a reqwest client that does not verify certificates.
<a href=#329 id=329 data-nosnippet>329</a> </span><span class="kw">let </span>client = reqwest::Client::builder()
<a href=#330 id=330 data-nosnippet>330</a> .http2_prior_knowledge()
<a href=#331 id=331 data-nosnippet>331</a> .use_preconfigured_tls(<span class="self">self</span>::tls::insecure_tls_config())
<a href=#332 id=332 data-nosnippet>332</a> .build()
<a href=#333 id=333 data-nosnippet>333</a> .anyerr()<span class="question-mark">?</span>;
<a href=#334 id=334 data-nosnippet>334</a>
<a href=#335 id=335 data-nosnippet>335</a> <span class="comment">// Fetch as JSON via HTTP.
<a href=#336 id=336 data-nosnippet>336</a> </span><span class="kw">let </span>url = <span class="macro">format!</span>(
<a href=#337 id=337 data-nosnippet>337</a> <span class="string">"{http_url}dns-query?name={}&amp;type=txt"</span>,
<a href=#338 id=338 data-nosnippet>338</a> <span class="macro">format_args!</span>(<span class="string">"_iroh.{name_z32}."</span>),
<a href=#339 id=339 data-nosnippet>339</a> );
<a href=#340 id=340 data-nosnippet>340</a> <span class="kw">let </span>res = client
<a href=#341 id=341 data-nosnippet>341</a> .get(url)
<a href=#342 id=342 data-nosnippet>342</a> .header(<span class="string">"accept"</span>, <span class="string">"application/dns-json"</span>)
<a href=#343 id=343 data-nosnippet>343</a> .send()
<a href=#344 id=344 data-nosnippet>344</a> .<span class="kw">await
<a href=#345 id=345 data-nosnippet>345</a> </span>.anyerr()<span class="question-mark">?
<a href=#346 id=346 data-nosnippet>346</a> </span>.json::&lt;<span class="kw">super</span>::doh::DnsResponse&gt;()
<a href=#347 id=347 data-nosnippet>347</a> .<span class="kw">await
<a href=#348 id=348 data-nosnippet>348</a> </span>.anyerr()<span class="question-mark">?</span>;
<a href=#349 id=349 data-nosnippet>349</a> <span class="macro">assert_eq!</span>(res.answer.len(), <span class="number">1</span>);
<a href=#350 id=350 data-nosnippet>350</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].name, <span class="macro">format!</span>(<span class="string">"_iroh.{name_z32}."</span>));
<a href=#351 id=351 data-nosnippet>351</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].data, <span class="string">"relay=https://relay.example./"</span>);
<a href=#352 id=352 data-nosnippet>352</a>
<a href=#353 id=353 data-nosnippet>353</a> <span class="comment">// Fetch as JSON via HTTPS.
<a href=#354 id=354 data-nosnippet>354</a> </span><span class="kw">let </span>https_url = server.https_url().expect(<span class="string">"https is bound"</span>);
<a href=#355 id=355 data-nosnippet>355</a> <span class="kw">let </span>url = <span class="macro">format!</span>(
<a href=#356 id=356 data-nosnippet>356</a> <span class="string">"{https_url}dns-query?name={}&amp;type=txt"</span>,
<a href=#357 id=357 data-nosnippet>357</a> <span class="macro">format_args!</span>(<span class="string">"_iroh.{name_z32}."</span>),
<a href=#358 id=358 data-nosnippet>358</a> );
<a href=#359 id=359 data-nosnippet>359</a> <span class="kw">let </span>res = client
<a href=#360 id=360 data-nosnippet>360</a> .get(url)
<a href=#361 id=361 data-nosnippet>361</a> .header(<span class="string">"accept"</span>, <span class="string">"application/dns-json"</span>)
<a href=#362 id=362 data-nosnippet>362</a> .send()
<a href=#363 id=363 data-nosnippet>363</a> .<span class="kw">await
<a href=#364 id=364 data-nosnippet>364</a> </span>.anyerr()<span class="question-mark">?
<a href=#365 id=365 data-nosnippet>365</a> </span>.json::&lt;<span class="kw">super</span>::doh::DnsResponse&gt;()
<a href=#366 id=366 data-nosnippet>366</a> .<span class="kw">await
<a href=#367 id=367 data-nosnippet>367</a> </span>.anyerr()<span class="question-mark">?</span>;
<a href=#368 id=368 data-nosnippet>368</a> <span class="macro">assert_eq!</span>(res.answer.len(), <span class="number">1</span>);
<a href=#369 id=369 data-nosnippet>369</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].name, <span class="macro">format!</span>(<span class="string">"_iroh.{name_z32}."</span>));
<a href=#370 id=370 data-nosnippet>370</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].data, <span class="string">"relay=https://relay.example./"</span>);
<a href=#371 id=371 data-nosnippet>371</a>
<a href=#372 id=372 data-nosnippet>372</a> <span class="comment">// Fetch over HTTPS via hickory-resolver
<a href=#373 id=373 data-nosnippet>373</a> </span><span class="kw">let </span>client = {
<a href=#374 id=374 data-nosnippet>374</a> <span class="kw">let </span>config = {
<a href=#375 id=375 data-nosnippet>375</a> <span class="kw">let </span><span class="kw-2">mut </span>config = ResolverConfig::new();
<a href=#376 id=376 data-nosnippet>376</a> <span class="kw">let </span><span class="kw-2">mut </span>name_server = NameServerConfig::new(
<a href=#377 id=377 data-nosnippet>377</a> server.https_addr().expect(<span class="string">"https is bound"</span>),
<a href=#378 id=378 data-nosnippet>378</a> hickory_server::proto::xfer::Protocol::Https,
<a href=#379 id=379 data-nosnippet>379</a> );
<a href=#380 id=380 data-nosnippet>380</a> name_server.tls_dns_name = <span class="prelude-val">Some</span>(<span class="string">"localhost"</span>.to_string());
<a href=#381 id=381 data-nosnippet>381</a> config.add_name_server(name_server);
<a href=#382 id=382 data-nosnippet>382</a> config
<a href=#383 id=383 data-nosnippet>383</a> };
<a href=#384 id=384 data-nosnippet>384</a>
<a href=#385 id=385 data-nosnippet>385</a> <span class="kw">let </span>opts = {
<a href=#386 id=386 data-nosnippet>386</a> <span class="kw">let </span><span class="kw-2">mut </span>opts = ResolverOpts::default();
<a href=#387 id=387 data-nosnippet>387</a> opts.tls_config = <span class="self">self</span>::tls::insecure_tls_config();
<a href=#388 id=388 data-nosnippet>388</a> opts
<a href=#389 id=389 data-nosnippet>389</a> };
<a href=#390 id=390 data-nosnippet>390</a>
<a href=#391 id=391 data-nosnippet>391</a> hickory_resolver::Resolver::builder_with_config(
<a href=#392 id=392 data-nosnippet>392</a> config,
<a href=#393 id=393 data-nosnippet>393</a> TokioConnectionProvider::default(),
<a href=#394 id=394 data-nosnippet>394</a> )
<a href=#395 id=395 data-nosnippet>395</a> .with_options(opts)
<a href=#396 id=396 data-nosnippet>396</a> .build()
<a href=#397 id=397 data-nosnippet>397</a> };
<a href=#398 id=398 data-nosnippet>398</a>
<a href=#399 id=399 data-nosnippet>399</a> <span class="kw">let </span>res = client
<a href=#400 id=400 data-nosnippet>400</a> .txt_lookup(<span class="macro">format!</span>(<span class="string">"_iroh.{name_z32}."</span>))
<a href=#401 id=401 data-nosnippet>401</a> .<span class="kw">await
<a href=#402 id=402 data-nosnippet>402</a> </span>.anyerr()<span class="question-mark">?</span>;
<a href=#403 id=403 data-nosnippet>403</a> <span class="kw">let </span>records = res.as_lookup().records();
<a href=#404 id=404 data-nosnippet>404</a> <span class="macro">assert_eq!</span>(records.len(), <span class="number">1</span>);
<a href=#405 id=405 data-nosnippet>405</a> <span class="macro">assert_eq!</span>(records[<span class="number">0</span>].record_type(), RecordType::TXT);
<a href=#406 id=406 data-nosnippet>406</a> <span class="kw">let </span>txt_data = records[<span class="number">0</span>].data().as_txt().unwrap().txt_data();
<a href=#407 id=407 data-nosnippet>407</a> <span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>txt_data[<span class="number">0</span>][..], <span class="string">b"relay=https://relay.example./"</span>);
<a href=#408 id=408 data-nosnippet>408</a>
<a href=#409 id=409 data-nosnippet>409</a> server.shutdown().<span class="kw">await</span><span class="question-mark">?</span>;
<a href=#410 id=410 data-nosnippet>410</a> <span class="prelude-val">Ok</span>(())
<a href=#411 id=411 data-nosnippet>411</a> }
<a href=#412 id=412 data-nosnippet>412</a>
<a href=#413 id=413 data-nosnippet>413</a> <span class="kw">mod </span>tls {
<a href=#414 id=414 data-nosnippet>414</a> <span class="kw">use </span>std::sync::Arc;
<a href=#415 id=415 data-nosnippet>415</a>
<a href=#416 id=416 data-nosnippet>416</a> <span class="kw">use </span>rustls::{
<a href=#417 id=417 data-nosnippet>417</a> DigitallySignedStruct, RootCertStore,
<a href=#418 id=418 data-nosnippet>418</a> client::{
<a href=#419 id=419 data-nosnippet>419</a> ClientConfig,
<a href=#420 id=420 data-nosnippet>420</a> danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier},
<a href=#421 id=421 data-nosnippet>421</a> },
<a href=#422 id=422 data-nosnippet>422</a> crypto::{
<a href=#423 id=423 data-nosnippet>423</a> CryptoProvider, ring::default_provider, verify_tls12_signature,
<a href=#424 id=424 data-nosnippet>424</a> verify_tls13_signature,
<a href=#425 id=425 data-nosnippet>425</a> },
<a href=#426 id=426 data-nosnippet>426</a> pki_types::{CertificateDer, ServerName, UnixTime},
<a href=#427 id=427 data-nosnippet>427</a> };
<a href=#428 id=428 data-nosnippet>428</a>
<a href=#429 id=429 data-nosnippet>429</a> <span class="attr">#[derive(Debug)]
<a href=#430 id=430 data-nosnippet>430</a> </span><span class="kw">struct </span>NoCertificateVerification(CryptoProvider);
<a href=#431 id=431 data-nosnippet>431</a>
<a href=#432 id=432 data-nosnippet>432</a> <span class="kw">impl </span>Default <span class="kw">for </span>NoCertificateVerification {
<a href=#433 id=433 data-nosnippet>433</a> <span class="kw">fn </span>default() -&gt; <span class="self">Self </span>{
<a href=#434 id=434 data-nosnippet>434</a> <span class="self">Self</span>(default_provider())
<a href=#435 id=435 data-nosnippet>435</a> }
<a href=#436 id=436 data-nosnippet>436</a> }
<a href=#437 id=437 data-nosnippet>437</a>
<a href=#438 id=438 data-nosnippet>438</a> <span class="kw">impl </span>ServerCertVerifier <span class="kw">for </span>NoCertificateVerification {
<a href=#439 id=439 data-nosnippet>439</a> <span class="kw">fn </span>verify_server_cert(
<a href=#440 id=440 data-nosnippet>440</a> <span class="kw-2">&amp;</span><span class="self">self</span>,
<a href=#441 id=441 data-nosnippet>441</a> _end_entity: <span class="kw-2">&amp;</span>CertificateDer&lt;<span class="lifetime">'_</span>&gt;,
<a href=#442 id=442 data-nosnippet>442</a> _intermediates: <span class="kw-2">&amp;</span>[CertificateDer&lt;<span class="lifetime">'_</span>&gt;],
<a href=#443 id=443 data-nosnippet>443</a> _server_name: <span class="kw-2">&amp;</span>ServerName&lt;<span class="lifetime">'_</span>&gt;,
<a href=#444 id=444 data-nosnippet>444</a> _ocsp: <span class="kw-2">&amp;</span>[u8],
<a href=#445 id=445 data-nosnippet>445</a> _now: UnixTime,
<a href=#446 id=446 data-nosnippet>446</a> ) -&gt; <span class="prelude-ty">Result</span>&lt;ServerCertVerified, rustls::Error&gt; {
<a href=#447 id=447 data-nosnippet>447</a> <span class="prelude-val">Ok</span>(ServerCertVerified::assertion())
<a href=#448 id=448 data-nosnippet>448</a> }
<a href=#449 id=449 data-nosnippet>449</a>
<a href=#450 id=450 data-nosnippet>450</a> <span class="kw">fn </span>verify_tls12_signature(
<a href=#451 id=451 data-nosnippet>451</a> <span class="kw-2">&amp;</span><span class="self">self</span>,
<a href=#452 id=452 data-nosnippet>452</a> message: <span class="kw-2">&amp;</span>[u8],
<a href=#453 id=453 data-nosnippet>453</a> cert: <span class="kw-2">&amp;</span>CertificateDer&lt;<span class="lifetime">'_</span>&gt;,
<a href=#454 id=454 data-nosnippet>454</a> dss: <span class="kw-2">&amp;</span>DigitallySignedStruct,
<a href=#455 id=455 data-nosnippet>455</a> ) -&gt; <span class="prelude-ty">Result</span>&lt;HandshakeSignatureValid, rustls::Error&gt; {
<a href=#456 id=456 data-nosnippet>456</a> verify_tls12_signature(
<a href=#457 id=457 data-nosnippet>457</a> message,
<a href=#458 id=458 data-nosnippet>458</a> cert,
<a href=#459 id=459 data-nosnippet>459</a> dss,
<a href=#460 id=460 data-nosnippet>460</a> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>.signature_verification_algorithms,
<a href=#461 id=461 data-nosnippet>461</a> )
<a href=#462 id=462 data-nosnippet>462</a> }
<a href=#463 id=463 data-nosnippet>463</a>
<a href=#464 id=464 data-nosnippet>464</a> <span class="kw">fn </span>verify_tls13_signature(
<a href=#465 id=465 data-nosnippet>465</a> <span class="kw-2">&amp;</span><span class="self">self</span>,
<a href=#466 id=466 data-nosnippet>466</a> message: <span class="kw-2">&amp;</span>[u8],
<a href=#467 id=467 data-nosnippet>467</a> cert: <span class="kw-2">&amp;</span>CertificateDer&lt;<span class="lifetime">'_</span>&gt;,
<a href=#468 id=468 data-nosnippet>468</a> dss: <span class="kw-2">&amp;</span>DigitallySignedStruct,
<a href=#469 id=469 data-nosnippet>469</a> ) -&gt; <span class="prelude-ty">Result</span>&lt;HandshakeSignatureValid, rustls::Error&gt; {
<a href=#470 id=470 data-nosnippet>470</a> verify_tls13_signature(
<a href=#471 id=471 data-nosnippet>471</a> message,
<a href=#472 id=472 data-nosnippet>472</a> cert,
<a href=#473 id=473 data-nosnippet>473</a> dss,
<a href=#474 id=474 data-nosnippet>474</a> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>.signature_verification_algorithms,
<a href=#475 id=475 data-nosnippet>475</a> )
<a href=#476 id=476 data-nosnippet>476</a> }
<a href=#477 id=477 data-nosnippet>477</a>
<a href=#478 id=478 data-nosnippet>478</a> <span class="kw">fn </span>supported_verify_schemes(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Vec&lt;rustls::SignatureScheme&gt; {
<a href=#479 id=479 data-nosnippet>479</a> <span class="self">self</span>.<span class="number">0</span>.signature_verification_algorithms.supported_schemes()
<a href=#480 id=480 data-nosnippet>480</a> }
<a href=#481 id=481 data-nosnippet>481</a> }
<a href=#482 id=482 data-nosnippet>482</a>
<a href=#483 id=483 data-nosnippet>483</a> <span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>insecure_tls_config() -&gt; ClientConfig {
<a href=#484 id=484 data-nosnippet>484</a> <span class="kw">let </span><span class="kw-2">mut </span>cfg = ClientConfig::builder()
<a href=#485 id=485 data-nosnippet>485</a> .with_root_certificates(RootCertStore::empty())
<a href=#486 id=486 data-nosnippet>486</a> .with_no_client_auth();
<a href=#487 id=487 data-nosnippet>487</a> cfg.dangerous()
<a href=#488 id=488 data-nosnippet>488</a> .set_certificate_verifier(Arc::new(NoCertificateVerification::default()));
<a href=#489 id=489 data-nosnippet>489</a> cfg
<a href=#490 id=490 data-nosnippet>490</a> }
<a href=#491 id=491 data-nosnippet>491</a> }
<a href=#492 id=492 data-nosnippet>492</a>}</code></pre></div></section></main></body></html>
<a href=#295 id=295 data-nosnippet>295</a> <span class="kw">use crate</span>::{http::HttpsConfig, server::Server};
<a href=#296 id=296 data-nosnippet>296</a>
<a href=#297 id=297 data-nosnippet>297</a> <span class="attr">#[tokio::test]
<a href=#298 id=298 data-nosnippet>298</a> </span><span class="kw">async fn </span>test_doh() -&gt; n0_error::Result {
<a href=#299 id=299 data-nosnippet>299</a> tracing_subscriber::fmt::init();
<a href=#300 id=300 data-nosnippet>300</a> <span class="kw">let </span><span class="kw-2">mut </span>rng = rand_chacha::ChaCha12Rng::seed_from_u64(<span class="number">0</span>);
<a href=#301 id=301 data-nosnippet>301</a> <span class="kw">let </span>dir = tempfile::tempdir()<span class="question-mark">?</span>;
<a href=#302 id=302 data-nosnippet>302</a> <span class="kw">let </span>https_config = HttpsConfig {
<a href=#303 id=303 data-nosnippet>303</a> port: <span class="number">0</span>,
<a href=#304 id=304 data-nosnippet>304</a> bind_addr: <span class="prelude-val">Some</span>(Ipv4Addr::LOCALHOST.into()),
<a href=#305 id=305 data-nosnippet>305</a> domains: <span class="macro">vec!</span>[<span class="string">"localhost"</span>.to_string()],
<a href=#306 id=306 data-nosnippet>306</a> cert_mode: <span class="kw">crate</span>::http::CertMode::SelfSigned,
<a href=#307 id=307 data-nosnippet>307</a> letsencrypt_contact: <span class="prelude-val">None</span>,
<a href=#308 id=308 data-nosnippet>308</a> letsencrypt_prod: <span class="prelude-val">None</span>,
<a href=#309 id=309 data-nosnippet>309</a> };
<a href=#310 id=310 data-nosnippet>310</a> <span class="kw">let </span>server =
<a href=#311 id=311 data-nosnippet>311</a> Server::spawn_for_tests_with_options(dir.path(), <span class="prelude-val">None</span>, <span class="prelude-val">None</span>, <span class="prelude-val">Some</span>(https_config))
<a href=#312 id=312 data-nosnippet>312</a> .<span class="kw">await</span><span class="question-mark">?</span>;
<a href=#313 id=313 data-nosnippet>313</a>
<a href=#314 id=314 data-nosnippet>314</a> <span class="kw">let </span>(name_z32, signed_packet) = {
<a href=#315 id=315 data-nosnippet>315</a> <span class="kw">let </span>secret_key = SecretKey::generate(<span class="kw-2">&amp;mut </span>rng);
<a href=#316 id=316 data-nosnippet>316</a> <span class="kw">let </span>endpoint_id = secret_key.public();
<a href=#317 id=317 data-nosnippet>317</a> <span class="kw">let </span>relay_url: RelayUrl = <span class="string">"https://relay.example."</span>.parse()<span class="question-mark">?</span>;
<a href=#318 id=318 data-nosnippet>318</a> <span class="kw">let </span>endpoint_info =
<a href=#319 id=319 data-nosnippet>319</a> EndpointInfo::new(endpoint_id).with_relay_url(<span class="prelude-val">Some</span>(relay_url.clone()));
<a href=#320 id=320 data-nosnippet>320</a> (
<a href=#321 id=321 data-nosnippet>321</a> secret_key.public().to_z32(),
<a href=#322 id=322 data-nosnippet>322</a> endpoint_info.to_pkarr_signed_packet(<span class="kw-2">&amp;</span>secret_key, <span class="number">30</span>)<span class="question-mark">?</span>,
<a href=#323 id=323 data-nosnippet>323</a> )
<a href=#324 id=324 data-nosnippet>324</a> };
<a href=#325 id=325 data-nosnippet>325</a>
<a href=#326 id=326 data-nosnippet>326</a> <span class="kw">let </span>http_url = server.http_url().expect(<span class="string">"http is bound"</span>);
<a href=#327 id=327 data-nosnippet>327</a> <span class="kw">let </span>pkarr = PkarrRelayClient::new(<span class="macro">format!</span>(<span class="string">"{http_url}pkarr"</span>).parse().anyerr()<span class="question-mark">?</span>);
<a href=#328 id=328 data-nosnippet>328</a> pkarr.publish(<span class="kw-2">&amp;</span>signed_packet).<span class="kw">await</span><span class="question-mark">?</span>;
<a href=#329 id=329 data-nosnippet>329</a>
<a href=#330 id=330 data-nosnippet>330</a> <span class="comment">// Create a reqwest client that does not verify certificates.
<a href=#331 id=331 data-nosnippet>331</a> </span><span class="kw">let </span>client = reqwest::Client::builder()
<a href=#332 id=332 data-nosnippet>332</a> .http2_prior_knowledge()
<a href=#333 id=333 data-nosnippet>333</a> .use_preconfigured_tls(<span class="self">self</span>::tls::insecure_tls_config())
<a href=#334 id=334 data-nosnippet>334</a> .build()
<a href=#335 id=335 data-nosnippet>335</a> .anyerr()<span class="question-mark">?</span>;
<a href=#336 id=336 data-nosnippet>336</a>
<a href=#337 id=337 data-nosnippet>337</a> <span class="comment">// Fetch as JSON via HTTP.
<a href=#338 id=338 data-nosnippet>338</a> </span><span class="kw">let </span>url = <span class="macro">format!</span>(
<a href=#339 id=339 data-nosnippet>339</a> <span class="string">"{http_url}dns-query?name={}&amp;type=txt"</span>,
<a href=#340 id=340 data-nosnippet>340</a> <span class="macro">format_args!</span>(<span class="string">"_iroh.{name_z32}."</span>),
<a href=#341 id=341 data-nosnippet>341</a> );
<a href=#342 id=342 data-nosnippet>342</a> <span class="kw">let </span>res = client
<a href=#343 id=343 data-nosnippet>343</a> .get(url)
<a href=#344 id=344 data-nosnippet>344</a> .header(<span class="string">"accept"</span>, <span class="string">"application/dns-json"</span>)
<a href=#345 id=345 data-nosnippet>345</a> .send()
<a href=#346 id=346 data-nosnippet>346</a> .<span class="kw">await
<a href=#347 id=347 data-nosnippet>347</a> </span>.anyerr()<span class="question-mark">?
<a href=#348 id=348 data-nosnippet>348</a> </span>.json::&lt;<span class="kw">super</span>::doh::DnsResponse&gt;()
<a href=#349 id=349 data-nosnippet>349</a> .<span class="kw">await
<a href=#350 id=350 data-nosnippet>350</a> </span>.anyerr()<span class="question-mark">?</span>;
<a href=#351 id=351 data-nosnippet>351</a> <span class="macro">assert_eq!</span>(res.answer.len(), <span class="number">1</span>);
<a href=#352 id=352 data-nosnippet>352</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].name, <span class="macro">format!</span>(<span class="string">"_iroh.{name_z32}."</span>));
<a href=#353 id=353 data-nosnippet>353</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].data, <span class="string">"relay=https://relay.example./"</span>);
<a href=#354 id=354 data-nosnippet>354</a>
<a href=#355 id=355 data-nosnippet>355</a> <span class="comment">// Fetch as JSON via HTTPS.
<a href=#356 id=356 data-nosnippet>356</a> </span><span class="kw">let </span>https_url = server.https_url().expect(<span class="string">"https is bound"</span>);
<a href=#357 id=357 data-nosnippet>357</a> <span class="kw">let </span>url = <span class="macro">format!</span>(
<a href=#358 id=358 data-nosnippet>358</a> <span class="string">"{https_url}dns-query?name={}&amp;type=txt"</span>,
<a href=#359 id=359 data-nosnippet>359</a> <span class="macro">format_args!</span>(<span class="string">"_iroh.{name_z32}."</span>),
<a href=#360 id=360 data-nosnippet>360</a> );
<a href=#361 id=361 data-nosnippet>361</a> <span class="kw">let </span>res = client
<a href=#362 id=362 data-nosnippet>362</a> .get(url)
<a href=#363 id=363 data-nosnippet>363</a> .header(<span class="string">"accept"</span>, <span class="string">"application/dns-json"</span>)
<a href=#364 id=364 data-nosnippet>364</a> .send()
<a href=#365 id=365 data-nosnippet>365</a> .<span class="kw">await
<a href=#366 id=366 data-nosnippet>366</a> </span>.anyerr()<span class="question-mark">?
<a href=#367 id=367 data-nosnippet>367</a> </span>.json::&lt;<span class="kw">super</span>::doh::DnsResponse&gt;()
<a href=#368 id=368 data-nosnippet>368</a> .<span class="kw">await
<a href=#369 id=369 data-nosnippet>369</a> </span>.anyerr()<span class="question-mark">?</span>;
<a href=#370 id=370 data-nosnippet>370</a> <span class="macro">assert_eq!</span>(res.answer.len(), <span class="number">1</span>);
<a href=#371 id=371 data-nosnippet>371</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].name, <span class="macro">format!</span>(<span class="string">"_iroh.{name_z32}."</span>));
<a href=#372 id=372 data-nosnippet>372</a> <span class="macro">assert_eq!</span>(res.answer[<span class="number">0</span>].data, <span class="string">"relay=https://relay.example./"</span>);
<a href=#373 id=373 data-nosnippet>373</a>
<a href=#374 id=374 data-nosnippet>374</a> <span class="comment">// Fetch over HTTPS via hickory-resolver
<a href=#375 id=375 data-nosnippet>375</a> </span><span class="kw">let </span>client = {
<a href=#376 id=376 data-nosnippet>376</a> <span class="kw">let </span>config = {
<a href=#377 id=377 data-nosnippet>377</a> <span class="kw">let </span><span class="kw-2">mut </span>config = ResolverConfig::new();
<a href=#378 id=378 data-nosnippet>378</a> <span class="kw">let </span><span class="kw-2">mut </span>name_server = NameServerConfig::new(
<a href=#379 id=379 data-nosnippet>379</a> server.https_addr().expect(<span class="string">"https is bound"</span>),
<a href=#380 id=380 data-nosnippet>380</a> hickory_server::proto::xfer::Protocol::Https,
<a href=#381 id=381 data-nosnippet>381</a> );
<a href=#382 id=382 data-nosnippet>382</a> name_server.tls_dns_name = <span class="prelude-val">Some</span>(<span class="string">"localhost"</span>.to_string());
<a href=#383 id=383 data-nosnippet>383</a> config.add_name_server(name_server);
<a href=#384 id=384 data-nosnippet>384</a> config
<a href=#385 id=385 data-nosnippet>385</a> };
<a href=#386 id=386 data-nosnippet>386</a>
<a href=#387 id=387 data-nosnippet>387</a> <span class="kw">let </span>opts = {
<a href=#388 id=388 data-nosnippet>388</a> <span class="kw">let </span><span class="kw-2">mut </span>opts = ResolverOpts::default();
<a href=#389 id=389 data-nosnippet>389</a> opts.tls_config = <span class="self">self</span>::tls::insecure_tls_config();
<a href=#390 id=390 data-nosnippet>390</a> opts
<a href=#391 id=391 data-nosnippet>391</a> };
<a href=#392 id=392 data-nosnippet>392</a>
<a href=#393 id=393 data-nosnippet>393</a> hickory_resolver::Resolver::builder_with_config(
<a href=#394 id=394 data-nosnippet>394</a> config,
<a href=#395 id=395 data-nosnippet>395</a> TokioConnectionProvider::default(),
<a href=#396 id=396 data-nosnippet>396</a> )
<a href=#397 id=397 data-nosnippet>397</a> .with_options(opts)
<a href=#398 id=398 data-nosnippet>398</a> .build()
<a href=#399 id=399 data-nosnippet>399</a> };
<a href=#400 id=400 data-nosnippet>400</a>
<a href=#401 id=401 data-nosnippet>401</a> <span class="kw">let </span>res = client
<a href=#402 id=402 data-nosnippet>402</a> .txt_lookup(<span class="macro">format!</span>(<span class="string">"_iroh.{name_z32}."</span>))
<a href=#403 id=403 data-nosnippet>403</a> .<span class="kw">await
<a href=#404 id=404 data-nosnippet>404</a> </span>.anyerr()<span class="question-mark">?</span>;
<a href=#405 id=405 data-nosnippet>405</a> <span class="kw">let </span>records = res.as_lookup().records();
<a href=#406 id=406 data-nosnippet>406</a> <span class="macro">assert_eq!</span>(records.len(), <span class="number">1</span>);
<a href=#407 id=407 data-nosnippet>407</a> <span class="macro">assert_eq!</span>(records[<span class="number">0</span>].record_type(), RecordType::TXT);
<a href=#408 id=408 data-nosnippet>408</a> <span class="kw">let </span>txt_data = records[<span class="number">0</span>].data().as_txt().unwrap().txt_data();
<a href=#409 id=409 data-nosnippet>409</a> <span class="macro">assert_eq!</span>(<span class="kw-2">&amp;</span>txt_data[<span class="number">0</span>][..], <span class="string">b"relay=https://relay.example./"</span>);
<a href=#410 id=410 data-nosnippet>410</a>
<a href=#411 id=411 data-nosnippet>411</a> server.shutdown().<span class="kw">await</span><span class="question-mark">?</span>;
<a href=#412 id=412 data-nosnippet>412</a> <span class="prelude-val">Ok</span>(())
<a href=#413 id=413 data-nosnippet>413</a> }
<a href=#414 id=414 data-nosnippet>414</a>
<a href=#415 id=415 data-nosnippet>415</a> <span class="kw">mod </span>tls {
<a href=#416 id=416 data-nosnippet>416</a> <span class="kw">use </span>std::sync::Arc;
<a href=#417 id=417 data-nosnippet>417</a>
<a href=#418 id=418 data-nosnippet>418</a> <span class="kw">use </span>rustls::{
<a href=#419 id=419 data-nosnippet>419</a> DigitallySignedStruct, RootCertStore,
<a href=#420 id=420 data-nosnippet>420</a> client::{
<a href=#421 id=421 data-nosnippet>421</a> ClientConfig,
<a href=#422 id=422 data-nosnippet>422</a> danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier},
<a href=#423 id=423 data-nosnippet>423</a> },
<a href=#424 id=424 data-nosnippet>424</a> crypto::{
<a href=#425 id=425 data-nosnippet>425</a> CryptoProvider, ring::default_provider, verify_tls12_signature,
<a href=#426 id=426 data-nosnippet>426</a> verify_tls13_signature,
<a href=#427 id=427 data-nosnippet>427</a> },
<a href=#428 id=428 data-nosnippet>428</a> pki_types::{CertificateDer, ServerName, UnixTime},
<a href=#429 id=429 data-nosnippet>429</a> };
<a href=#430 id=430 data-nosnippet>430</a>
<a href=#431 id=431 data-nosnippet>431</a> <span class="attr">#[derive(Debug)]
<a href=#432 id=432 data-nosnippet>432</a> </span><span class="kw">struct </span>NoCertificateVerification(CryptoProvider);
<a href=#433 id=433 data-nosnippet>433</a>
<a href=#434 id=434 data-nosnippet>434</a> <span class="kw">impl </span>Default <span class="kw">for </span>NoCertificateVerification {
<a href=#435 id=435 data-nosnippet>435</a> <span class="kw">fn </span>default() -&gt; <span class="self">Self </span>{
<a href=#436 id=436 data-nosnippet>436</a> <span class="self">Self</span>(default_provider())
<a href=#437 id=437 data-nosnippet>437</a> }
<a href=#438 id=438 data-nosnippet>438</a> }
<a href=#439 id=439 data-nosnippet>439</a>
<a href=#440 id=440 data-nosnippet>440</a> <span class="kw">impl </span>ServerCertVerifier <span class="kw">for </span>NoCertificateVerification {
<a href=#441 id=441 data-nosnippet>441</a> <span class="kw">fn </span>verify_server_cert(
<a href=#442 id=442 data-nosnippet>442</a> <span class="kw-2">&amp;</span><span class="self">self</span>,
<a href=#443 id=443 data-nosnippet>443</a> _end_entity: <span class="kw-2">&amp;</span>CertificateDer&lt;<span class="lifetime">'_</span>&gt;,
<a href=#444 id=444 data-nosnippet>444</a> _intermediates: <span class="kw-2">&amp;</span>[CertificateDer&lt;<span class="lifetime">'_</span>&gt;],
<a href=#445 id=445 data-nosnippet>445</a> _server_name: <span class="kw-2">&amp;</span>ServerName&lt;<span class="lifetime">'_</span>&gt;,
<a href=#446 id=446 data-nosnippet>446</a> _ocsp: <span class="kw-2">&amp;</span>[u8],
<a href=#447 id=447 data-nosnippet>447</a> _now: UnixTime,
<a href=#448 id=448 data-nosnippet>448</a> ) -&gt; <span class="prelude-ty">Result</span>&lt;ServerCertVerified, rustls::Error&gt; {
<a href=#449 id=449 data-nosnippet>449</a> <span class="prelude-val">Ok</span>(ServerCertVerified::assertion())
<a href=#450 id=450 data-nosnippet>450</a> }
<a href=#451 id=451 data-nosnippet>451</a>
<a href=#452 id=452 data-nosnippet>452</a> <span class="kw">fn </span>verify_tls12_signature(
<a href=#453 id=453 data-nosnippet>453</a> <span class="kw-2">&amp;</span><span class="self">self</span>,
<a href=#454 id=454 data-nosnippet>454</a> message: <span class="kw-2">&amp;</span>[u8],
<a href=#455 id=455 data-nosnippet>455</a> cert: <span class="kw-2">&amp;</span>CertificateDer&lt;<span class="lifetime">'_</span>&gt;,
<a href=#456 id=456 data-nosnippet>456</a> dss: <span class="kw-2">&amp;</span>DigitallySignedStruct,
<a href=#457 id=457 data-nosnippet>457</a> ) -&gt; <span class="prelude-ty">Result</span>&lt;HandshakeSignatureValid, rustls::Error&gt; {
<a href=#458 id=458 data-nosnippet>458</a> verify_tls12_signature(
<a href=#459 id=459 data-nosnippet>459</a> message,
<a href=#460 id=460 data-nosnippet>460</a> cert,
<a href=#461 id=461 data-nosnippet>461</a> dss,
<a href=#462 id=462 data-nosnippet>462</a> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>.signature_verification_algorithms,
<a href=#463 id=463 data-nosnippet>463</a> )
<a href=#464 id=464 data-nosnippet>464</a> }
<a href=#465 id=465 data-nosnippet>465</a>
<a href=#466 id=466 data-nosnippet>466</a> <span class="kw">fn </span>verify_tls13_signature(
<a href=#467 id=467 data-nosnippet>467</a> <span class="kw-2">&amp;</span><span class="self">self</span>,
<a href=#468 id=468 data-nosnippet>468</a> message: <span class="kw-2">&amp;</span>[u8],
<a href=#469 id=469 data-nosnippet>469</a> cert: <span class="kw-2">&amp;</span>CertificateDer&lt;<span class="lifetime">'_</span>&gt;,
<a href=#470 id=470 data-nosnippet>470</a> dss: <span class="kw-2">&amp;</span>DigitallySignedStruct,
<a href=#471 id=471 data-nosnippet>471</a> ) -&gt; <span class="prelude-ty">Result</span>&lt;HandshakeSignatureValid, rustls::Error&gt; {
<a href=#472 id=472 data-nosnippet>472</a> verify_tls13_signature(
<a href=#473 id=473 data-nosnippet>473</a> message,
<a href=#474 id=474 data-nosnippet>474</a> cert,
<a href=#475 id=475 data-nosnippet>475</a> dss,
<a href=#476 id=476 data-nosnippet>476</a> <span class="kw-2">&amp;</span><span class="self">self</span>.<span class="number">0</span>.signature_verification_algorithms,
<a href=#477 id=477 data-nosnippet>477</a> )
<a href=#478 id=478 data-nosnippet>478</a> }
<a href=#479 id=479 data-nosnippet>479</a>
<a href=#480 id=480 data-nosnippet>480</a> <span class="kw">fn </span>supported_verify_schemes(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; Vec&lt;rustls::SignatureScheme&gt; {
<a href=#481 id=481 data-nosnippet>481</a> <span class="self">self</span>.<span class="number">0</span>.signature_verification_algorithms.supported_schemes()
<a href=#482 id=482 data-nosnippet>482</a> }
<a href=#483 id=483 data-nosnippet>483</a> }
<a href=#484 id=484 data-nosnippet>484</a>
<a href=#485 id=485 data-nosnippet>485</a> <span class="kw">pub</span>(<span class="kw">super</span>) <span class="kw">fn </span>insecure_tls_config() -&gt; ClientConfig {
<a href=#486 id=486 data-nosnippet>486</a> <span class="kw">let </span><span class="kw-2">mut </span>cfg = ClientConfig::builder()
<a href=#487 id=487 data-nosnippet>487</a> .with_root_certificates(RootCertStore::empty())
<a href=#488 id=488 data-nosnippet>488</a> .with_no_client_auth();
<a href=#489 id=489 data-nosnippet>489</a> cfg.dangerous()
<a href=#490 id=490 data-nosnippet>490</a> .set_certificate_verifier(Arc::new(NoCertificateVerification::default()));
<a href=#491 id=491 data-nosnippet>491</a> cfg
<a href=#492 id=492 data-nosnippet>492</a> }
<a href=#493 id=493 data-nosnippet>493</a> }
<a href=#494 id=494 data-nosnippet>494</a>}</code></pre></div></section></main></body></html>
File diff suppressed because one or more lines are too long
@@ -1,9 +1,9 @@
(function() {
var implementors = Object.fromEntries([["iroh_relay",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html\" title=\"struct alloc::boxed::Box\">Box</a>&lt;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]&gt;&gt; for <a class=\"struct\" href=\"iroh_relay/dns/struct.TxtRecordData.html\" title=\"struct iroh_relay::dns::TxtRecordData\">TxtRecordData</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a>&lt;<a class=\"struct\" href=\"iroh_relay/struct.RelayConfig.html\" title=\"struct iroh_relay::RelayConfig\">RelayConfig</a>&gt;&gt; for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"iroh_relay/struct.RelayConfig.html\" title=\"struct iroh_relay::RelayConfig\">RelayConfig</a>&gt; for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;RelayUrl&gt; for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"]]]]);
var implementors = Object.fromEntries([["iroh_relay",[["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html\" title=\"struct alloc::boxed::Box\">Box</a>&lt;[<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>]&gt;&gt; for <a class=\"struct\" href=\"iroh_relay/dns/struct.TxtRecordData.html\" title=\"struct iroh_relay::dns::TxtRecordData\">TxtRecordData</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html\" title=\"struct alloc::sync::Arc\">Arc</a>&lt;<a class=\"struct\" href=\"iroh_relay/struct.RelayConfig.html\" title=\"struct iroh_relay::RelayConfig\">RelayConfig</a>&gt;&gt; for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"iroh_base/relay_url/struct.RelayUrl.html\" title=\"struct iroh_base::relay_url::RelayUrl\">RelayUrl</a>&gt; for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"],["impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.FromIterator.html\" title=\"trait core::iter::traits::collect::FromIterator\">FromIterator</a>&lt;<a class=\"struct\" href=\"iroh_relay/struct.RelayConfig.html\" title=\"struct iroh_relay::RelayConfig\">RelayConfig</a>&gt; for <a class=\"struct\" href=\"iroh_relay/struct.RelayMap.html\" title=\"struct iroh_relay::RelayMap\">RelayMap</a>"]]]]);
if (window.register_implementors) {
window.register_implementors(implementors);
} else {
window.pending_implementors = implementors;
}
})()
//{"start":57,"fragment_lengths":[1940]}
//{"start":57,"fragment_lengths":[2062]}