deploy: ae61224ef51b33991cfbcb555e9d9674cd718690

This commit is contained in:
dignifiedquire
2025-02-10 16:35:36 +00:00
parent 449b4956ac
commit 28618afbc9
5 changed files with 20 additions and 12 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Tools for spawning an accept loop that routes incoming requests to the right protocol."><title>iroh::protocol - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.32.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module protocol</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>protocol</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/protocol.rs.html#1-499">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Tools for spawning an accept loop that routes incoming requests to the right protocol.</p>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Tools for spawning an accept loop that routes incoming requests to the right protocol."><title>iroh::protocol - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-dbdb5eec.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0-nightly (d10a6823f 2024-11-29)" data-channel="nightly" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.32.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module protocol</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#traits" title="Traits">Traits</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate iroh</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a></span><h1>Module <span>protocol</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/iroh/protocol.rs.html#1-501">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Tools for spawning an accept loop that routes incoming requests to the right protocol.</p>
<h3 id="example"><a class="doc-anchor" href="#example">§</a>Example</h3>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>endpoint = Endpoint::builder().discovery_n0().bind().<span class="kw">await</span><span class="question-mark">?</span>;
@@ -26,4 +26,5 @@
})
}
}</code></pre></div>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AccessLimit.html" title="struct iroh::protocol::AccessLimit">Access<wbr>Limit</a></div><div class="desc docblock-short">Limit</div></li><li><div class="item-name"><a class="struct" href="struct.Router.html" title="struct iroh::protocol::Router">Router</a></div><div class="desc docblock-short">The built router.</div></li><li><div class="item-name"><a class="struct" href="struct.RouterBuilder.html" title="struct iroh::protocol::RouterBuilder">Router<wbr>Builder</a></div><div class="desc docblock-short">Builder for creating a <a href="struct.Router.html" title="struct iroh::protocol::Router"><code>Router</code></a> for accepting protocols.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.ProtocolHandler.html" title="trait iroh::protocol::ProtocolHandler">Protocol<wbr>Handler</a></div><div class="desc docblock-short">Handler for incoming connections.</div></li></ul></section></div></main></body></html>
</div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.AccessLimit.html" title="struct iroh::protocol::AccessLimit">Access<wbr>Limit</a></div><div class="desc docblock-short">Wraps an existing protocol, limiting its access,
based on the provided function.</div></li><li><div class="item-name"><a class="struct" href="struct.Router.html" title="struct iroh::protocol::Router">Router</a></div><div class="desc docblock-short">The built router.</div></li><li><div class="item-name"><a class="struct" href="struct.RouterBuilder.html" title="struct iroh::protocol::RouterBuilder">Router<wbr>Builder</a></div><div class="desc docblock-short">Builder for creating a <a href="struct.Router.html" title="struct iroh::protocol::Router"><code>Router</code></a> for accepting protocols.</div></li></ul><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="trait" href="trait.ProtocolHandler.html" title="trait iroh::protocol::ProtocolHandler">Protocol<wbr>Handler</a></div><div class="desc docblock-short">Handler for incoming connections.</div></li></ul></section></div></main></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8 -4
View File
@@ -497,7 +497,9 @@
<a href="#496" id="496">496</a>
<a href="#497" id="497">497</a>
<a href="#498" id="498">498</a>
<a href="#499" id="499">499</a></pre></div><pre class="rust"><code><span class="doccomment">//! Tools for spawning an accept loop that routes incoming requests to the right protocol.
<a href="#499" id="499">499</a>
<a href="#500" id="500">500</a>
<a href="#501" id="501">501</a></pre></div><pre class="rust"><code><span class="doccomment">//! Tools for spawning an accept loop that routes incoming requests to the right protocol.
//!
//! ## Example
//!
@@ -880,7 +882,8 @@
}
}
<span class="doccomment">/// Limit
<span class="doccomment">/// Wraps an existing protocol, limiting its access,
/// based on the provided function.
</span><span class="attr">#[derive(derive_more::Debug, Clone)]
</span><span class="kw">pub struct </span>AccessLimit&lt;P: ProtocolHandler + Clone&gt; {
proto: P,
@@ -890,6 +893,9 @@
<span class="kw">impl</span>&lt;P: ProtocolHandler + Clone&gt; AccessLimit&lt;P&gt; {
<span class="doccomment">/// Create a new `AccessLimit`.
///
/// The function should return `true` for nodes that are allowed to
/// connect, and `false` otherwise.
</span><span class="kw">pub fn </span>new&lt;F&gt;(proto: P, limiter: F) -&gt; <span class="self">Self
</span><span class="kw">where
</span>F: Fn(NodeId) -&gt; bool + Send + Sync + <span class="lifetime">'static</span>,
@@ -907,12 +913,10 @@
}
<span class="kw">fn </span>accept(<span class="kw-2">&amp;</span><span class="self">self</span>, conn: Connection) -&gt; BoxFuture&lt;<span class="prelude-ty">Result</span>&lt;()&gt;&gt; {
<span class="macro">println!</span>(<span class="string">"accepting limiter"</span>);
<span class="kw">let </span>this = <span class="self">self</span>.clone();
Box::pin(<span class="kw">async move </span>{
<span class="kw">let </span>remote = conn.remote_node_id()<span class="question-mark">?</span>;
<span class="kw">let </span>is_allowed = (this.limiter)(remote);
<span class="macro">dbg!</span>(is_allowed);
<span class="kw">if </span>!is_allowed {
conn.close(<span class="number">0u32</span>.into(), <span class="string">b"not allowed"</span>);
<span class="macro">anyhow::bail!</span>(<span class="string">"not allowed"</span>);