mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-30 08:01:44 +00:00
deploy: 98a146a45c1e4ff7c2481bf0de8001203b26e2cc
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh::net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-b21aa549bf6d91ff.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.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh::net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../iroh/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../../index.html">iroh</a>::<wbr><a href="../index.html">net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">default_relay_mode</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../../src/iroh_net/endpoint.rs.html#1245">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -> <a class="enum" href="../relay/enum.RelayMode.html" title="enum iroh::net::relay::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh::net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-b21aa549bf6d91ff.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.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh::net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../iroh/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../../index.html">iroh</a>::<wbr><a href="../index.html">net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">default_relay_mode</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../../src/iroh_net/endpoint.rs.html#1248">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -> <a class="enum" href="../relay/enum.RelayMode.html" title="enum iroh::net::relay::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
|
||||
<p>If the <code>IROH_FORCE_STAGING_RELAYS</code> environment variable is set to <code>1</code>, it will return <code>RelayMode::Staging</code>.
|
||||
Otherwise, it will return <code>RelayMode::Default</code>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extract the `PublicKey` from the peer’s TLS certificate."><title>get_remote_node_id in iroh::net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-b21aa549bf6d91ff.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.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh::net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../iroh/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../../index.html">iroh</a>::<wbr><a href="../index.html">net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">get_remote_node_id</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../../src/iroh_net/endpoint.rs.html#1158">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn get_remote_node_id(connection: &<a class="struct" href="struct.Connection.html" title="struct iroh::net::endpoint::Connection">Connection</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extract the <a href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey"><code>PublicKey</code></a> from the peer’s TLS certificate.</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="Extract the `PublicKey` from the peer’s TLS certificate."><title>get_remote_node_id in iroh::net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-b21aa549bf6d91ff.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.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../iroh/index.html">iroh</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh::net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../../iroh/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../../index.html">iroh</a>::<wbr><a href="../index.html">net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">get_remote_node_id</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../../src/iroh_net/endpoint.rs.html#1161">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn get_remote_node_id(connection: &<a class="struct" href="struct.Connection.html" title="struct iroh::net::endpoint::Connection">Connection</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extract the <a href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey"><code>PublicKey</code></a> from the peer’s TLS certificate.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -18,15 +18,16 @@ once the initiating peer has sent some data on it.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_alpns" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#425">source</a><h4 class="code-header">pub fn <a href="#method.set_alpns" class="fn">set_alpns</a>(&self, alpns: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Sets the list of accepted ALPN protocols.</p>
|
||||
<p>This will only affect new incoming connections.
|
||||
Note that this <em>overrides</em> the current list of ALPNs.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#453">source</a><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#455">source</a><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(
|
||||
&self,
|
||||
node_addr: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>>,
|
||||
alpn: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.Connection.html" title="struct iroh::net::endpoint::Connection">Connection</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Connects to a remote <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>A <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> is required. It must contain the <a href="../type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a> to dial and may also
|
||||
contain a <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> and direct addresses. If direct addresses are provided, they
|
||||
will be used to try and establish a direct connection without involving a relay
|
||||
server.</p>
|
||||
<p>A value that can be converted into a <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> is required. This can be either a
|
||||
<a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a>, a <a href="../type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a> or a <a href="../ticket/struct.NodeTicket.html" title="struct iroh::net::ticket::NodeTicket"><code>iroh_base::ticket::NodeTicket</code></a>.</p>
|
||||
<p>The <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> must contain the <a href="../type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a> to dial and may also contain a <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a>
|
||||
and direct addresses. If direct addresses are provided, they will be used to try and
|
||||
establish a direct connection without involving a relay server.</p>
|
||||
<p>If neither a <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> or direct addresses are configured in the <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> it
|
||||
may still be possible a connection can be established. This depends on other calls
|
||||
to <a href="../struct.Endpoint.html#method.add_node_addr" title="method iroh::net::Endpoint::add_node_addr"><code>Endpoint::add_node_addr</code></a> which may provide contact information, or via the
|
||||
@@ -38,7 +39,7 @@ connection attempt will fail with an error.</p>
|
||||
<p>The <code>alpn</code>, or application-level protocol identifier, is also required. The remote
|
||||
endpoint must support this <code>alpn</code>, otherwise the connection attempt will fail with
|
||||
an error.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect_by_node_id" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#514-518">source</a><h4 class="code-header">pub async fn <a href="#method.connect_by_node_id" class="fn">connect_by_node_id</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect_by_node_id" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#517-521">source</a><h4 class="code-header">pub async fn <a href="#method.connect_by_node_id" class="fn">connect_by_node_id</a>(
|
||||
&self,
|
||||
node_id: <a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>,
|
||||
alpn: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]
|
||||
@@ -47,13 +48,13 @@ an error.</p>
|
||||
information being provided by either the discovery service or using
|
||||
<a href="../struct.Endpoint.html#method.add_node_addr" title="method iroh::net::Endpoint::add_node_addr"><code>Endpoint::add_node_addr</code></a>. See <a href="../struct.Endpoint.html#method.connect" title="method iroh::net::Endpoint::connect"><code>Endpoint::connect</code></a> for the details of how it
|
||||
uses the discovery service to establish a connection to a remote node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#579">source</a><h4 class="code-header">pub fn <a href="#method.accept" class="fn">accept</a>(&self) -> <a class="struct" href="struct.Accept.html" title="struct iroh::net::endpoint::Accept">Accept</a><'_> <a href="#" class="tooltip" data-notable-ty="Accept<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts an incoming connection on the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#582">source</a><h4 class="code-header">pub fn <a href="#method.accept" class="fn">accept</a>(&self) -> <a class="struct" href="struct.Accept.html" title="struct iroh::net::endpoint::Accept">Accept</a><'_> <a href="#" class="tooltip" data-notable-ty="Accept<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts an incoming connection on the endpoint.</p>
|
||||
<p>Only connections with the ALPNs configured in <a href="struct.Builder.html#method.alpns" title="method iroh::net::endpoint::Builder::alpns"><code>Builder::alpns</code></a> will be accepted.
|
||||
If multiple ALPNs have been configured the ALPN can be inspected before accepting
|
||||
the connection using <a href="struct.Connecting.html#method.alpn" title="method iroh::net::endpoint::Connecting::alpn"><code>Connecting::alpn</code></a>.</p>
|
||||
<p>The returned future will yield <code>None</code> if the endpoint is closed by calling
|
||||
<a href="../struct.Endpoint.html#method.close" title="method iroh::net::Endpoint::close"><code>Endpoint::close</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#602">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr" class="fn">add_node_addr</a>(&self, node_addr: <a class="struct" href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Informs this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> about addresses of the iroh-net node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#605">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr" class="fn">add_node_addr</a>(&self, node_addr: <a class="struct" href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Informs this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> about addresses of the iroh-net node.</p>
|
||||
<p>This updates the local state for the remote node. If the provided <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a>
|
||||
contains a <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> this will be used as the new relay server for this node. If
|
||||
it contains any new IP endpoints they will also be stored and tried when next
|
||||
@@ -63,7 +64,7 @@ silently ignored.</p>
|
||||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||||
<p>Will return an error if we attempt to add our own <a href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey"><code>PublicKey</code></a> to the node map or if the
|
||||
direct addresses are a subset of ours.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr_with_source" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#618-622">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr_with_source" class="fn">add_node_addr_with_source</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr_with_source" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#621-625">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr_with_source" class="fn">add_node_addr_with_source</a>(
|
||||
&self,
|
||||
node_addr: <a class="struct" href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>,
|
||||
source: &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>
|
||||
@@ -76,15 +77,15 @@ used for logging exclusively and will not be stored.</p>
|
||||
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
|
||||
<p>Will return an error if we attempt to add our own <a href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey"><code>PublicKey</code></a> to the node map or if the
|
||||
direct addresses are a subset of ours.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.secret_key" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#645">source</a><h4 class="code-header">pub fn <a href="#method.secret_key" class="fn">secret_key</a>(&self) -> &<a class="struct" href="../key/struct.SecretKey.html" title="struct iroh::net::key::SecretKey">SecretKey</a></h4></section></summary><div class="docblock"><p>Returns the secret_key of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_id" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#653">source</a><h4 class="code-header">pub fn <a href="#method.node_id" class="fn">node_id</a>(&self) -> <a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a></h4></section></summary><div class="docblock"><p>Returns the node id of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.secret_key" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#648">source</a><h4 class="code-header">pub fn <a href="#method.secret_key" class="fn">secret_key</a>(&self) -> &<a class="struct" href="../key/struct.SecretKey.html" title="struct iroh::net::key::SecretKey">SecretKey</a></h4></section></summary><div class="docblock"><p>Returns the secret_key of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_id" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#656">source</a><h4 class="code-header">pub fn <a href="#method.node_id" class="fn">node_id</a>(&self) -> <a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a></h4></section></summary><div class="docblock"><p>Returns the node id of this endpoint.</p>
|
||||
<p>This ID is the unique addressing information of this node and other peers must know
|
||||
it to be able to connect to this node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_addr" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#662">source</a><h4 class="code-header">pub async fn <a href="#method.node_addr" class="fn">node_addr</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Returns the current <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> for this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_addr" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#665">source</a><h4 class="code-header">pub async fn <a href="#method.node_addr" class="fn">node_addr</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Returns the current <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> for this endpoint.</p>
|
||||
<p>The returned <a href="../struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> will have the current <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> and local IP endpoints
|
||||
as they would be returned by <a href="../struct.Endpoint.html#method.home_relay" title="method iroh::net::Endpoint::home_relay"><code>Endpoint::home_relay</code></a> and
|
||||
<a href="../struct.Endpoint.html#method.direct_addresses" title="method iroh::net::Endpoint::direct_addresses"><code>Endpoint::direct_addresses</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#685">source</a><h4 class="code-header">pub fn <a href="#method.home_relay" class="fn">home_relay</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> of the Relay server used as home relay.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#688">source</a><h4 class="code-header">pub fn <a href="#method.home_relay" class="fn">home_relay</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> of the Relay server used as home relay.</p>
|
||||
<p>Every endpoint has a home Relay server which it chooses as the server with the
|
||||
lowest latency out of the configured servers provided by <a href="struct.Builder.html#method.relay_mode" title="method iroh::net::endpoint::Builder::relay_mode"><code>Builder::relay_mode</code></a>.
|
||||
This is the server other iroh-net nodes can use to reliably establish a connection
|
||||
@@ -93,14 +94,14 @@ to this node.</p>
|
||||
<p>Note that this will be <code>None</code> right after the <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> is created since it takes
|
||||
some time to connect to find and connect to the home relay server. Use
|
||||
<a href="../struct.Endpoint.html#method.watch_home_relay" title="method iroh::net::Endpoint::watch_home_relay"><code>Endpoint::watch_home_relay</code></a> to wait until the home relay server is available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.watch_home_relay" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#698">source</a><h4 class="code-header">pub fn <a href="#method.watch_home_relay" class="fn">watch_home_relay</a>(&self) -> impl Stream<Item = <a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Watches for changes to the home relay.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.watch_home_relay" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#701">source</a><h4 class="code-header">pub fn <a href="#method.watch_home_relay" class="fn">watch_home_relay</a>(&self) -> impl Stream<Item = <a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Watches for changes to the home relay.</p>
|
||||
<p>If there is currently a home relay it will be yielded immediately as the first item
|
||||
in the stream. This makes it possible to use this function to wait for the initial
|
||||
home relay to be known.</p>
|
||||
<p>Note that it is not guaranteed that a home relay will ever become available. If no
|
||||
servers are configured with <a href="struct.Builder.html#method.relay_mode" title="method iroh::net::endpoint::Builder::relay_mode"><code>Builder::relay_mode</code></a> this stream will never yield an
|
||||
item.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.direct_addresses" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#736">source</a><h4 class="code-header">pub fn <a href="#method.direct_addresses" class="fn">direct_addresses</a>(&self) -> <a class="struct" href="struct.DirectAddrsStream.html" title="struct iroh::net::endpoint::DirectAddrsStream">DirectAddrsStream</a></h4></section></summary><div class="docblock"><p>Returns the direct addresses of this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.direct_addresses" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#739">source</a><h4 class="code-header">pub fn <a href="#method.direct_addresses" class="fn">direct_addresses</a>(&self) -> <a class="struct" href="struct.DirectAddrsStream.html" title="struct iroh::net::endpoint::DirectAddrsStream">DirectAddrsStream</a></h4></section></summary><div class="docblock"><p>Returns the direct addresses of this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>The direct addresses of the <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> are those that could be used by other
|
||||
iroh-net nodes to establish direct connectivity, depending on the network
|
||||
situation. The yielded lists of direct addresses contain both the locally-bound
|
||||
@@ -123,10 +124,10 @@ most recently discovered IP endpoints.</p>
|
||||
|
||||
<span class="kw">let </span>mep = Endpoint::builder().bind().<span class="kw">await</span>.unwrap();
|
||||
<span class="kw">let </span>_addrs = mep.direct_addresses().next().<span class="kw">await</span>;</code></pre></div>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#744">source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> (<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>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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>>)</h4></section></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#747">source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> (<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>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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>>)</h4></section></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
<p>The <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> always binds on an IPv4 address and also tries to bind on an IPv6
|
||||
address if available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#761">source</a><h4 class="code-header">pub fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, node_id: <a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about the remote node identified by a <a href="../type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#764">source</a><h4 class="code-header">pub fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, node_id: <a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about the remote node identified by a <a href="../type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a>.</p>
|
||||
<p>The <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> keeps some information about remote iroh-net nodes, which it uses to find
|
||||
the best path to a node. Having information on a remote node, however, does not mean we have
|
||||
ever connected to it to or even whether a connection is even possible. The information about a
|
||||
@@ -135,14 +136,14 @@ calls may return different information. Furthermore, node information may even b
|
||||
completely evicted as it becomes stale.</p>
|
||||
<p>See also <a href="../struct.Endpoint.html#method.remote_info_iter" title="method iroh::net::Endpoint::remote_info_iter"><code>Endpoint::remote_info_iter</code></a> which returns information on all nodes known
|
||||
by this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info_iter" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#775">source</a><h4 class="code-header">pub fn <a href="#method.remote_info_iter" class="fn">remote_info_iter</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about all the remote nodes this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> knows about.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info_iter" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#778">source</a><h4 class="code-header">pub fn <a href="#method.remote_info_iter" class="fn">remote_info_iter</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about all the remote nodes this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> knows about.</p>
|
||||
<p>This returns the same information as <a href="../struct.Endpoint.html#method.remote_info" title="method iroh::net::Endpoint::remote_info"><code>Endpoint::remote_info</code></a> for each node known to this
|
||||
<a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>The <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> keeps some information about remote iroh-net nodes, which it uses to find
|
||||
the best path to a node. This returns all the nodes it knows about, regardless of whether a
|
||||
connection was ever made or is even possible.</p>
|
||||
<p>See also <a href="../struct.Endpoint.html#method.remote_info" title="method iroh::net::Endpoint::remote_info"><code>Endpoint::remote_info</code></a> to only retrieve information about a single node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.conn_type_stream" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#801">source</a><h4 class="code-header">pub fn <a href="#method.conn_type_stream" class="fn">conn_type_stream</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.conn_type_stream" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#804">source</a><h4 class="code-header">pub fn <a href="#method.conn_type_stream" class="fn">conn_type_stream</a>(
|
||||
&self,
|
||||
node_id: <a class="struct" href="../key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.ConnectionTypeStream.html" title="struct iroh::net::endpoint::ConnectionTypeStream">ConnectionTypeStream</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Returns a stream that reports connection type changes for the remote node.</p>
|
||||
@@ -158,13 +159,13 @@ connection when the switch from a relayed to a direct connection can be so fast
|
||||
the relayed state is never exposed.</p>
|
||||
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
|
||||
<p>Will error if we do not have any address information for the given <code>node_id</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#808">source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#811">source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(
|
||||
&self
|
||||
) -> &AsyncResolver<GenericConnector<TokioRuntimeProvider>></h4></section></summary><div class="docblock"><p>Returns the DNS resolver used in this <a href="../struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>See <a href="struct.Builder.html#method.discovery" title="method iroh::net::endpoint::Builder::discovery"><code>Builder::discovery</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.discovery" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#815">source</a><h4 class="code-header">pub fn <a href="#method.discovery" class="fn">discovery</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="../discovery/trait.Discovery.html" title="trait iroh::net::discovery::Discovery">Discovery</a>></h4></section></summary><div class="docblock"><p>Returns the discovery mechanism, if configured.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.discovery" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#818">source</a><h4 class="code-header">pub fn <a href="#method.discovery" class="fn">discovery</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="../discovery/trait.Discovery.html" title="trait iroh::net::discovery::Discovery">Discovery</a>></h4></section></summary><div class="docblock"><p>Returns the discovery mechanism, if configured.</p>
|
||||
<p>See <a href="struct.Builder.html#method.dns_resolver" title="method iroh::net::endpoint::Builder::dns_resolver"><code>Builder::dns_resolver</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#831">source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#834">source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
<p>On many systems iroh is able to detect network changes by itself, however
|
||||
some systems like android do not expose this functionality to native code.
|
||||
Android does however provide this functionality to Java code. This
|
||||
@@ -172,7 +173,7 @@ function allows for notifying iroh of any potential network changes like
|
||||
this.</p>
|
||||
<p>Even when the network did not change, or iroh was already able to detect
|
||||
the network change itself, there is no harm in calling this function.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#847">source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(self, error_code: <a class="struct" href="struct.VarInt.html" title="struct iroh::net::endpoint::VarInt">VarInt</a>, reason: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the magic socket.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../../src/iroh_net/endpoint.rs.html#850">source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(self, error_code: <a class="struct" href="struct.VarInt.html" title="struct iroh::net::endpoint::VarInt">VarInt</a>, reason: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the magic socket.</p>
|
||||
<p>This will close all open QUIC connections with the provided error_code and
|
||||
reason. See <a href="struct.Connection.html" title="struct iroh::net::endpoint::Connection"><code>quinn::Connection</code></a> for details on how these are interpreted.</p>
|
||||
<p>It will then wait for all connections to actually be shutdown, and afterwards
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -18,15 +18,16 @@ once the initiating peer has sent some data on it.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_alpns" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#425">source</a><h4 class="code-header">pub fn <a href="#method.set_alpns" class="fn">set_alpns</a>(&self, alpns: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Sets the list of accepted ALPN protocols.</p>
|
||||
<p>This will only affect new incoming connections.
|
||||
Note that this <em>overrides</em> the current list of ALPNs.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#453">source</a><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#455">source</a><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(
|
||||
&self,
|
||||
node_addr: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>>,
|
||||
alpn: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="endpoint/struct.Connection.html" title="struct iroh::net::endpoint::Connection">Connection</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Connects to a remote <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>A <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> is required. It must contain the <a href="type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a> to dial and may also
|
||||
contain a <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> and direct addresses. If direct addresses are provided, they
|
||||
will be used to try and establish a direct connection without involving a relay
|
||||
server.</p>
|
||||
<p>A value that can be converted into a <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> is required. This can be either a
|
||||
<a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a>, a <a href="type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a> or a <a href="ticket/struct.NodeTicket.html" title="struct iroh::net::ticket::NodeTicket"><code>iroh_base::ticket::NodeTicket</code></a>.</p>
|
||||
<p>The <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> must contain the <a href="type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a> to dial and may also contain a <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a>
|
||||
and direct addresses. If direct addresses are provided, they will be used to try and
|
||||
establish a direct connection without involving a relay server.</p>
|
||||
<p>If neither a <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> or direct addresses are configured in the <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> it
|
||||
may still be possible a connection can be established. This depends on other calls
|
||||
to <a href="struct.Endpoint.html#method.add_node_addr" title="method iroh::net::Endpoint::add_node_addr"><code>Endpoint::add_node_addr</code></a> which may provide contact information, or via the
|
||||
@@ -38,7 +39,7 @@ connection attempt will fail with an error.</p>
|
||||
<p>The <code>alpn</code>, or application-level protocol identifier, is also required. The remote
|
||||
endpoint must support this <code>alpn</code>, otherwise the connection attempt will fail with
|
||||
an error.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect_by_node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#514-518">source</a><h4 class="code-header">pub async fn <a href="#method.connect_by_node_id" class="fn">connect_by_node_id</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect_by_node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#517-521">source</a><h4 class="code-header">pub async fn <a href="#method.connect_by_node_id" class="fn">connect_by_node_id</a>(
|
||||
&self,
|
||||
node_id: <a class="struct" href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>,
|
||||
alpn: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]
|
||||
@@ -47,13 +48,13 @@ an error.</p>
|
||||
information being provided by either the discovery service or using
|
||||
<a href="struct.Endpoint.html#method.add_node_addr" title="method iroh::net::Endpoint::add_node_addr"><code>Endpoint::add_node_addr</code></a>. See <a href="struct.Endpoint.html#method.connect" title="method iroh::net::Endpoint::connect"><code>Endpoint::connect</code></a> for the details of how it
|
||||
uses the discovery service to establish a connection to a remote node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#579">source</a><h4 class="code-header">pub fn <a href="#method.accept" class="fn">accept</a>(&self) -> <a class="struct" href="endpoint/struct.Accept.html" title="struct iroh::net::endpoint::Accept">Accept</a><'_> <a href="#" class="tooltip" data-notable-ty="Accept<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts an incoming connection on the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#582">source</a><h4 class="code-header">pub fn <a href="#method.accept" class="fn">accept</a>(&self) -> <a class="struct" href="endpoint/struct.Accept.html" title="struct iroh::net::endpoint::Accept">Accept</a><'_> <a href="#" class="tooltip" data-notable-ty="Accept<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts an incoming connection on the endpoint.</p>
|
||||
<p>Only connections with the ALPNs configured in <a href="endpoint/struct.Builder.html#method.alpns" title="method iroh::net::endpoint::Builder::alpns"><code>Builder::alpns</code></a> will be accepted.
|
||||
If multiple ALPNs have been configured the ALPN can be inspected before accepting
|
||||
the connection using <a href="endpoint/struct.Connecting.html#method.alpn" title="method iroh::net::endpoint::Connecting::alpn"><code>Connecting::alpn</code></a>.</p>
|
||||
<p>The returned future will yield <code>None</code> if the endpoint is closed by calling
|
||||
<a href="struct.Endpoint.html#method.close" title="method iroh::net::Endpoint::close"><code>Endpoint::close</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#602">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr" class="fn">add_node_addr</a>(&self, node_addr: <a class="struct" href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Informs this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> about addresses of the iroh-net node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#605">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr" class="fn">add_node_addr</a>(&self, node_addr: <a class="struct" href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Informs this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> about addresses of the iroh-net node.</p>
|
||||
<p>This updates the local state for the remote node. If the provided <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a>
|
||||
contains a <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> this will be used as the new relay server for this node. If
|
||||
it contains any new IP endpoints they will also be stored and tried when next
|
||||
@@ -63,7 +64,7 @@ silently ignored.</p>
|
||||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||||
<p>Will return an error if we attempt to add our own <a href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey"><code>PublicKey</code></a> to the node map or if the
|
||||
direct addresses are a subset of ours.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr_with_source" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#618-622">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr_with_source" class="fn">add_node_addr_with_source</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr_with_source" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#621-625">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr_with_source" class="fn">add_node_addr_with_source</a>(
|
||||
&self,
|
||||
node_addr: <a class="struct" href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>,
|
||||
source: &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>
|
||||
@@ -76,15 +77,15 @@ used for logging exclusively and will not be stored.</p>
|
||||
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
|
||||
<p>Will return an error if we attempt to add our own <a href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey"><code>PublicKey</code></a> to the node map or if the
|
||||
direct addresses are a subset of ours.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.secret_key" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#645">source</a><h4 class="code-header">pub fn <a href="#method.secret_key" class="fn">secret_key</a>(&self) -> &<a class="struct" href="key/struct.SecretKey.html" title="struct iroh::net::key::SecretKey">SecretKey</a></h4></section></summary><div class="docblock"><p>Returns the secret_key of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#653">source</a><h4 class="code-header">pub fn <a href="#method.node_id" class="fn">node_id</a>(&self) -> <a class="struct" href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a></h4></section></summary><div class="docblock"><p>Returns the node id of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.secret_key" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#648">source</a><h4 class="code-header">pub fn <a href="#method.secret_key" class="fn">secret_key</a>(&self) -> &<a class="struct" href="key/struct.SecretKey.html" title="struct iroh::net::key::SecretKey">SecretKey</a></h4></section></summary><div class="docblock"><p>Returns the secret_key of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#656">source</a><h4 class="code-header">pub fn <a href="#method.node_id" class="fn">node_id</a>(&self) -> <a class="struct" href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a></h4></section></summary><div class="docblock"><p>Returns the node id of this endpoint.</p>
|
||||
<p>This ID is the unique addressing information of this node and other peers must know
|
||||
it to be able to connect to this node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#662">source</a><h4 class="code-header">pub async fn <a href="#method.node_addr" class="fn">node_addr</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Returns the current <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> for this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#665">source</a><h4 class="code-header">pub async fn <a href="#method.node_addr" class="fn">node_addr</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr">NodeAddr</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Returns the current <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> for this endpoint.</p>
|
||||
<p>The returned <a href="struct.NodeAddr.html" title="struct iroh::net::NodeAddr"><code>NodeAddr</code></a> will have the current <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> and local IP endpoints
|
||||
as they would be returned by <a href="struct.Endpoint.html#method.home_relay" title="method iroh::net::Endpoint::home_relay"><code>Endpoint::home_relay</code></a> and
|
||||
<a href="struct.Endpoint.html#method.direct_addresses" title="method iroh::net::Endpoint::direct_addresses"><code>Endpoint::direct_addresses</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#685">source</a><h4 class="code-header">pub fn <a href="#method.home_relay" class="fn">home_relay</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> of the Relay server used as home relay.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#688">source</a><h4 class="code-header">pub fn <a href="#method.home_relay" class="fn">home_relay</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl"><code>RelayUrl</code></a> of the Relay server used as home relay.</p>
|
||||
<p>Every endpoint has a home Relay server which it chooses as the server with the
|
||||
lowest latency out of the configured servers provided by <a href="endpoint/struct.Builder.html#method.relay_mode" title="method iroh::net::endpoint::Builder::relay_mode"><code>Builder::relay_mode</code></a>.
|
||||
This is the server other iroh-net nodes can use to reliably establish a connection
|
||||
@@ -93,14 +94,14 @@ to this node.</p>
|
||||
<p>Note that this will be <code>None</code> right after the <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> is created since it takes
|
||||
some time to connect to find and connect to the home relay server. Use
|
||||
<a href="struct.Endpoint.html#method.watch_home_relay" title="method iroh::net::Endpoint::watch_home_relay"><code>Endpoint::watch_home_relay</code></a> to wait until the home relay server is available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.watch_home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#698">source</a><h4 class="code-header">pub fn <a href="#method.watch_home_relay" class="fn">watch_home_relay</a>(&self) -> impl Stream<Item = <a class="struct" href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Watches for changes to the home relay.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.watch_home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#701">source</a><h4 class="code-header">pub fn <a href="#method.watch_home_relay" class="fn">watch_home_relay</a>(&self) -> impl Stream<Item = <a class="struct" href="relay/struct.RelayUrl.html" title="struct iroh::net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Watches for changes to the home relay.</p>
|
||||
<p>If there is currently a home relay it will be yielded immediately as the first item
|
||||
in the stream. This makes it possible to use this function to wait for the initial
|
||||
home relay to be known.</p>
|
||||
<p>Note that it is not guaranteed that a home relay will ever become available. If no
|
||||
servers are configured with <a href="endpoint/struct.Builder.html#method.relay_mode" title="method iroh::net::endpoint::Builder::relay_mode"><code>Builder::relay_mode</code></a> this stream will never yield an
|
||||
item.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.direct_addresses" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#736">source</a><h4 class="code-header">pub fn <a href="#method.direct_addresses" class="fn">direct_addresses</a>(&self) -> <a class="struct" href="endpoint/struct.DirectAddrsStream.html" title="struct iroh::net::endpoint::DirectAddrsStream">DirectAddrsStream</a></h4></section></summary><div class="docblock"><p>Returns the direct addresses of this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.direct_addresses" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#739">source</a><h4 class="code-header">pub fn <a href="#method.direct_addresses" class="fn">direct_addresses</a>(&self) -> <a class="struct" href="endpoint/struct.DirectAddrsStream.html" title="struct iroh::net::endpoint::DirectAddrsStream">DirectAddrsStream</a></h4></section></summary><div class="docblock"><p>Returns the direct addresses of this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>The direct addresses of the <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> are those that could be used by other
|
||||
iroh-net nodes to establish direct connectivity, depending on the network
|
||||
situation. The yielded lists of direct addresses contain both the locally-bound
|
||||
@@ -123,10 +124,10 @@ most recently discovered IP endpoints.</p>
|
||||
|
||||
<span class="kw">let </span>mep = Endpoint::builder().bind().<span class="kw">await</span>.unwrap();
|
||||
<span class="kw">let </span>_addrs = mep.direct_addresses().next().<span class="kw">await</span>;</code></pre></div>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#744">source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> (<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>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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>>)</h4></section></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#747">source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> (<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>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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>>)</h4></section></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> always binds on an IPv4 address and also tries to bind on an IPv6
|
||||
address if available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#761">source</a><h4 class="code-header">pub fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, node_id: <a class="struct" href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="endpoint/struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about the remote node identified by a <a href="type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#764">source</a><h4 class="code-header">pub fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, node_id: <a class="struct" href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="endpoint/struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about the remote node identified by a <a href="type.NodeId.html" title="type iroh::net::NodeId"><code>NodeId</code></a>.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> keeps some information about remote iroh-net nodes, which it uses to find
|
||||
the best path to a node. Having information on a remote node, however, does not mean we have
|
||||
ever connected to it to or even whether a connection is even possible. The information about a
|
||||
@@ -135,14 +136,14 @@ calls may return different information. Furthermore, node information may even b
|
||||
completely evicted as it becomes stale.</p>
|
||||
<p>See also <a href="struct.Endpoint.html#method.remote_info_iter" title="method iroh::net::Endpoint::remote_info_iter"><code>Endpoint::remote_info_iter</code></a> which returns information on all nodes known
|
||||
by this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info_iter" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#775">source</a><h4 class="code-header">pub fn <a href="#method.remote_info_iter" class="fn">remote_info_iter</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="endpoint/struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about all the remote nodes this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> knows about.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info_iter" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#778">source</a><h4 class="code-header">pub fn <a href="#method.remote_info_iter" class="fn">remote_info_iter</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="endpoint/struct.RemoteInfo.html" title="struct iroh::net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about all the remote nodes this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> knows about.</p>
|
||||
<p>This returns the same information as <a href="struct.Endpoint.html#method.remote_info" title="method iroh::net::Endpoint::remote_info"><code>Endpoint::remote_info</code></a> for each node known to this
|
||||
<a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a> keeps some information about remote iroh-net nodes, which it uses to find
|
||||
the best path to a node. This returns all the nodes it knows about, regardless of whether a
|
||||
connection was ever made or is even possible.</p>
|
||||
<p>See also <a href="struct.Endpoint.html#method.remote_info" title="method iroh::net::Endpoint::remote_info"><code>Endpoint::remote_info</code></a> to only retrieve information about a single node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.conn_type_stream" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#801">source</a><h4 class="code-header">pub fn <a href="#method.conn_type_stream" class="fn">conn_type_stream</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.conn_type_stream" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#804">source</a><h4 class="code-header">pub fn <a href="#method.conn_type_stream" class="fn">conn_type_stream</a>(
|
||||
&self,
|
||||
node_id: <a class="struct" href="key/struct.PublicKey.html" title="struct iroh::net::key::PublicKey">PublicKey</a>
|
||||
) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="endpoint/struct.ConnectionTypeStream.html" title="struct iroh::net::endpoint::ConnectionTypeStream">ConnectionTypeStream</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Returns a stream that reports connection type changes for the remote node.</p>
|
||||
@@ -158,13 +159,13 @@ connection when the switch from a relayed to a direct connection can be so fast
|
||||
the relayed state is never exposed.</p>
|
||||
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
|
||||
<p>Will error if we do not have any address information for the given <code>node_id</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#808">source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#811">source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(
|
||||
&self
|
||||
) -> &AsyncResolver<GenericConnector<TokioRuntimeProvider>></h4></section></summary><div class="docblock"><p>Returns the DNS resolver used in this <a href="struct.Endpoint.html" title="struct iroh::net::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>See <a href="endpoint/struct.Builder.html#method.discovery" title="method iroh::net::endpoint::Builder::discovery"><code>Builder::discovery</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.discovery" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#815">source</a><h4 class="code-header">pub fn <a href="#method.discovery" class="fn">discovery</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="discovery/trait.Discovery.html" title="trait iroh::net::discovery::Discovery">Discovery</a>></h4></section></summary><div class="docblock"><p>Returns the discovery mechanism, if configured.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.discovery" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#818">source</a><h4 class="code-header">pub fn <a href="#method.discovery" class="fn">discovery</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="discovery/trait.Discovery.html" title="trait iroh::net::discovery::Discovery">Discovery</a>></h4></section></summary><div class="docblock"><p>Returns the discovery mechanism, if configured.</p>
|
||||
<p>See <a href="endpoint/struct.Builder.html#method.dns_resolver" title="method iroh::net::endpoint::Builder::dns_resolver"><code>Builder::dns_resolver</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#831">source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#834">source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
<p>On many systems iroh is able to detect network changes by itself, however
|
||||
some systems like android do not expose this functionality to native code.
|
||||
Android does however provide this functionality to Java code. This
|
||||
@@ -172,7 +173,7 @@ function allows for notifying iroh of any potential network changes like
|
||||
this.</p>
|
||||
<p>Even when the network did not change, or iroh was already able to detect
|
||||
the network change itself, there is no harm in calling this function.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#847">source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(self, error_code: <a class="struct" href="endpoint/struct.VarInt.html" title="struct iroh::net::endpoint::VarInt">VarInt</a>, reason: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the magic socket.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#850">source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(self, error_code: <a class="struct" href="endpoint/struct.VarInt.html" title="struct iroh::net::endpoint::VarInt">VarInt</a>, reason: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://docs.rs/anyhow/1.0.85/anyhow/struct.Error.html" title="struct anyhow::Error">Error</a>></h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the magic socket.</p>
|
||||
<p>This will close all open QUIC connections with the provided error_code and
|
||||
reason. See <a href="endpoint/struct.Connection.html" title="struct iroh::net::endpoint::Connection"><code>quinn::Connection</code></a> for details on how these are interpreted.</p>
|
||||
<p>It will then wait for all connections to actually be shutdown, and afterwards
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh_net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_net/index.html">iroh_net</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh_net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../iroh_net/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../index.html">iroh_net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">default_relay_mode</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/iroh_net/endpoint.rs.html#1245-1259">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -> <a class="enum" href="../relay/enum.RelayMode.html" title="enum iroh_net::relay::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Returns the default relay mode."><title>default_relay_mode in iroh_net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_net/index.html">iroh_net</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh_net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../iroh_net/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../index.html">iroh_net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">default_relay_mode</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/iroh_net/endpoint.rs.html#1248-1262">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn default_relay_mode() -> <a class="enum" href="../relay/enum.RelayMode.html" title="enum iroh_net::relay::RelayMode">RelayMode</a></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Returns the default relay mode.</p>
|
||||
<p>If the <code>IROH_FORCE_STAGING_RELAYS</code> environment variable is set to <code>1</code>, it will return <code>RelayMode::Staging</code>.
|
||||
Otherwise, it will return <code>RelayMode::Default</code>.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Extract the `PublicKey` from the peer’s TLS certificate."><title>get_remote_node_id in iroh_net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_net/index.html">iroh_net</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh_net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../iroh_net/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../index.html">iroh_net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">get_remote_node_id</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/iroh_net/endpoint.rs.html#1158-1176">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn get_remote_node_id(connection: &<a class="struct" href="struct.Connection.html" title="struct iroh_net::endpoint::Connection">Connection</a>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="../key/struct.PublicKey.html" title="struct iroh_net::key::PublicKey">PublicKey</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extract the <a href="../key/struct.PublicKey.html" title="struct iroh_net::key::PublicKey"><code>PublicKey</code></a> from the peer’s TLS certificate.</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="Extract the `PublicKey` from the peer’s TLS certificate."><title>get_remote_node_id in iroh_net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc fn"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh_net/index.html">iroh_net</a><span class="version">0.26.0</span></h2></div><div class="sidebar-elems"><h2><a href="index.html">In iroh_net::endpoint</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../iroh_net/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Function <a href="../index.html">iroh_net</a>::<wbr><a href="index.html">endpoint</a>::<wbr><a class="fn" href="#">get_remote_node_id</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/iroh_net/endpoint.rs.html#1161-1179">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub fn get_remote_node_id(connection: &<a class="struct" href="struct.Connection.html" title="struct iroh_net::endpoint::Connection">Connection</a>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="../key/struct.PublicKey.html" title="struct iroh_net::key::PublicKey">PublicKey</a>></code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extract the <a href="../key/struct.PublicKey.html" title="struct iroh_net::key::PublicKey"><code>PublicKey</code></a> from the peer’s TLS certificate.</p>
|
||||
</div></details></section></div></main></body></html>
|
||||
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="The `Endpoint` allows establishing connections to other iroh-net nodes."><title>iroh_net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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_net/index.html">iroh_net</a><span class="version">0.26.0</span></h2></div><h2 class="location"><a href="#">Module endpoint</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section><h2><a href="../index.html">In crate iroh_net</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../iroh_net/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">iroh_net</a>::<wbr><a class="mod" href="#">endpoint</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/iroh_net/endpoint.rs.html#1-1748">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> allows establishing connections to other iroh-net nodes.</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="The `Endpoint` allows establishing connections to other iroh-net nodes."><title>iroh_net::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-b21aa549bf6d91ff.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh_net" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (c987ad527 2024-05-01)" data-channel="nightly" data-search-js="search-bf21c90c8c1d92b1.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-e32f0c247825364d.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-09095024cf37855e.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-2c020d218678b618.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_net/index.html">iroh_net</a><span class="version">0.26.0</span></h2></div><h2 class="location"><a href="#">Module endpoint</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#functions">Functions</a></li></ul></section><h2><a href="../index.html">In crate iroh_net</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../../iroh_net/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Type ‘S’ or ‘/’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../settings.html" title="settings">Settings</a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">iroh_net</a>::<wbr><a class="mod" href="#">endpoint</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/iroh_net/endpoint.rs.html#1-1751">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> allows establishing connections to other iroh-net nodes.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> is the main API interface to manage a local iroh-net node. It allows
|
||||
connecting to and accepting connections from other nodes. See the <a href="../index.html" title="mod iroh_net">module docs</a> for
|
||||
more details on how iroh-net connections work.</p>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -14,19 +14,20 @@ behaviour.</p>
|
||||
<a href="struct.Connection.html#method.open_bi" title="method iroh_net::endpoint::Connection::open_bi"><code>Connection::open_bi</code></a> functions.</p>
|
||||
<p>Note that due to the light-weight properties of streams a stream will only be accepted
|
||||
once the initiating peer has sent some data on it.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Endpoint" class="impl"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#369-943">source</a><a href="#impl-Endpoint" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint">Endpoint</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.builder" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#377-379">source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fn">builder</a>() -> <a class="struct" href="struct.Builder.html" title="struct iroh_net::endpoint::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Returns the builder for an <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>, with a production configuration.</p>
|
||||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Endpoint" class="impl"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#369-946">source</a><a href="#impl-Endpoint" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint">Endpoint</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.builder" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#377-379">source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fn">builder</a>() -> <a class="struct" href="struct.Builder.html" title="struct iroh_net::endpoint::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Returns the builder for an <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>, with a production configuration.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.set_alpns" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#425-429">source</a><h4 class="code-header">pub fn <a href="#method.set_alpns" class="fn">set_alpns</a>(&self, alpns: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>>>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Sets the list of accepted ALPN protocols.</p>
|
||||
<p>This will only affect new incoming connections.
|
||||
Note that this <em>overrides</em> the current list of ALPNs.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#453">source</a><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#455">source</a><h4 class="code-header">pub async fn <a href="#method.connect" class="fn">connect</a>(
|
||||
&self,
|
||||
node_addr: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr">NodeAddr</a>>,
|
||||
alpn: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]
|
||||
) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="struct.Connection.html" title="struct iroh_net::endpoint::Connection">Connection</a>></h4></section></summary><div class="docblock"><p>Connects to a remote <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>A <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> is required. It must contain the <a href="../type.NodeId.html" title="type iroh_net::NodeId"><code>NodeId</code></a> to dial and may also
|
||||
contain a <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a> and direct addresses. If direct addresses are provided, they
|
||||
will be used to try and establish a direct connection without involving a relay
|
||||
server.</p>
|
||||
<p>A value that can be converted into a <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> is required. This can be either a
|
||||
<a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a>, a <a href="../type.NodeId.html" title="type iroh_net::NodeId"><code>NodeId</code></a> or a <a href="../ticket/struct.NodeTicket.html" title="struct iroh_net::ticket::NodeTicket"><code>iroh_base::ticket::NodeTicket</code></a>.</p>
|
||||
<p>The <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> must contain the <a href="../type.NodeId.html" title="type iroh_net::NodeId"><code>NodeId</code></a> to dial and may also contain a <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a>
|
||||
and direct addresses. If direct addresses are provided, they will be used to try and
|
||||
establish a direct connection without involving a relay server.</p>
|
||||
<p>If neither a <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a> or direct addresses are configured in the <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> it
|
||||
may still be possible a connection can be established. This depends on other calls
|
||||
to <a href="struct.Endpoint.html#method.add_node_addr" title="method iroh_net::endpoint::Endpoint::add_node_addr"><code>Endpoint::add_node_addr</code></a> which may provide contact information, or via the
|
||||
@@ -38,7 +39,7 @@ connection attempt will fail with an error.</p>
|
||||
<p>The <code>alpn</code>, or application-level protocol identifier, is also required. The remote
|
||||
endpoint must support this <code>alpn</code>, otherwise the connection attempt will fail with
|
||||
an error.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect_by_node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#514-521">source</a><h4 class="code-header">pub async fn <a href="#method.connect_by_node_id" class="fn">connect_by_node_id</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.connect_by_node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#517-524">source</a><h4 class="code-header">pub async fn <a href="#method.connect_by_node_id" class="fn">connect_by_node_id</a>(
|
||||
&self,
|
||||
node_id: <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a>,
|
||||
alpn: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]
|
||||
@@ -47,13 +48,13 @@ an error.</p>
|
||||
information being provided by either the discovery service or using
|
||||
<a href="struct.Endpoint.html#method.add_node_addr" title="method iroh_net::endpoint::Endpoint::add_node_addr"><code>Endpoint::add_node_addr</code></a>. See <a href="struct.Endpoint.html#method.connect" title="method iroh_net::endpoint::Endpoint::connect"><code>Endpoint::connect</code></a> for the details of how it
|
||||
uses the discovery service to establish a connection to a remote node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#579-584">source</a><h4 class="code-header">pub fn <a href="#method.accept" class="fn">accept</a>(&self) -> <a class="struct" href="struct.Accept.html" title="struct iroh_net::endpoint::Accept">Accept</a><'_> <a href="#" class="tooltip" data-notable-ty="Accept<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts an incoming connection on the endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.accept" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#582-587">source</a><h4 class="code-header">pub fn <a href="#method.accept" class="fn">accept</a>(&self) -> <a class="struct" href="struct.Accept.html" title="struct iroh_net::endpoint::Accept">Accept</a><'_> <a href="#" class="tooltip" data-notable-ty="Accept<'_>">ⓘ</a></h4></section></summary><div class="docblock"><p>Accepts an incoming connection on the endpoint.</p>
|
||||
<p>Only connections with the ALPNs configured in <a href="struct.Builder.html#method.alpns" title="method iroh_net::endpoint::Builder::alpns"><code>Builder::alpns</code></a> will be accepted.
|
||||
If multiple ALPNs have been configured the ALPN can be inspected before accepting
|
||||
the connection using <a href="struct.Connecting.html#method.alpn" title="method iroh_net::endpoint::Connecting::alpn"><code>Connecting::alpn</code></a>.</p>
|
||||
<p>The returned future will yield <code>None</code> if the endpoint is closed by calling
|
||||
<a href="struct.Endpoint.html#method.close" title="method iroh_net::endpoint::Endpoint::close"><code>Endpoint::close</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#602-604">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr" class="fn">add_node_addr</a>(&self, node_addr: <a class="struct" href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr">NodeAddr</a>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Informs this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> about addresses of the iroh-net node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#605-607">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr" class="fn">add_node_addr</a>(&self, node_addr: <a class="struct" href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr">NodeAddr</a>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Informs this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> about addresses of the iroh-net node.</p>
|
||||
<p>This updates the local state for the remote node. If the provided <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a>
|
||||
contains a <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a> this will be used as the new relay server for this node. If
|
||||
it contains any new IP endpoints they will also be stored and tried when next
|
||||
@@ -63,7 +64,7 @@ silently ignored.</p>
|
||||
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
|
||||
<p>Will return an error if we attempt to add our own <a href="../key/struct.PublicKey.html" title="struct iroh_net::key::PublicKey"><code>PublicKey</code></a> to the node map or if the
|
||||
direct addresses are a subset of ours.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr_with_source" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#618-629">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr_with_source" class="fn">add_node_addr_with_source</a>(
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.add_node_addr_with_source" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#621-632">source</a><h4 class="code-header">pub fn <a href="#method.add_node_addr_with_source" class="fn">add_node_addr_with_source</a>(
|
||||
&self,
|
||||
node_addr: <a class="struct" href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr">NodeAddr</a>,
|
||||
source: &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>
|
||||
@@ -76,15 +77,15 @@ used for logging exclusively and will not be stored.</p>
|
||||
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
|
||||
<p>Will return an error if we attempt to add our own <a href="../key/struct.PublicKey.html" title="struct iroh_net::key::PublicKey"><code>PublicKey</code></a> to the node map or if the
|
||||
direct addresses are a subset of ours.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.secret_key" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#645-647">source</a><h4 class="code-header">pub fn <a href="#method.secret_key" class="fn">secret_key</a>(&self) -> &<a class="struct" href="../key/struct.SecretKey.html" title="struct iroh_net::key::SecretKey">SecretKey</a></h4></section></summary><div class="docblock"><p>Returns the secret_key of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#653-655">source</a><h4 class="code-header">pub fn <a href="#method.node_id" class="fn">node_id</a>(&self) -> <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a></h4></section></summary><div class="docblock"><p>Returns the node id of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.secret_key" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#648-650">source</a><h4 class="code-header">pub fn <a href="#method.secret_key" class="fn">secret_key</a>(&self) -> &<a class="struct" href="../key/struct.SecretKey.html" title="struct iroh_net::key::SecretKey">SecretKey</a></h4></section></summary><div class="docblock"><p>Returns the secret_key of this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_id" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#656-658">source</a><h4 class="code-header">pub fn <a href="#method.node_id" class="fn">node_id</a>(&self) -> <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a></h4></section></summary><div class="docblock"><p>Returns the node id of this endpoint.</p>
|
||||
<p>This ID is the unique addressing information of this node and other peers must know
|
||||
it to be able to connect to this node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#662-671">source</a><h4 class="code-header">pub async fn <a href="#method.node_addr" class="fn">node_addr</a>(&self) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr">NodeAddr</a>></h4></section></summary><div class="docblock"><p>Returns the current <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> for this endpoint.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.node_addr" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#665-674">source</a><h4 class="code-header">pub async fn <a href="#method.node_addr" class="fn">node_addr</a>(&self) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr">NodeAddr</a>></h4></section></summary><div class="docblock"><p>Returns the current <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> for this endpoint.</p>
|
||||
<p>The returned <a href="../struct.NodeAddr.html" title="struct iroh_net::NodeAddr"><code>NodeAddr</code></a> will have the current <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a> and local IP endpoints
|
||||
as they would be returned by <a href="struct.Endpoint.html#method.home_relay" title="method iroh_net::endpoint::Endpoint::home_relay"><code>Endpoint::home_relay</code></a> and
|
||||
<a href="struct.Endpoint.html#method.direct_addresses" title="method iroh_net::endpoint::Endpoint::direct_addresses"><code>Endpoint::direct_addresses</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#685-687">source</a><h4 class="code-header">pub fn <a href="#method.home_relay" class="fn">home_relay</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a> of the Relay server used as home relay.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#688-690">source</a><h4 class="code-header">pub fn <a href="#method.home_relay" class="fn">home_relay</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Returns the <a href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl"><code>RelayUrl</code></a> of the Relay server used as home relay.</p>
|
||||
<p>Every endpoint has a home Relay server which it chooses as the server with the
|
||||
lowest latency out of the configured servers provided by <a href="struct.Builder.html#method.relay_mode" title="method iroh_net::endpoint::Builder::relay_mode"><code>Builder::relay_mode</code></a>.
|
||||
This is the server other iroh-net nodes can use to reliably establish a connection
|
||||
@@ -93,14 +94,14 @@ to this node.</p>
|
||||
<p>Note that this will be <code>None</code> right after the <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> is created since it takes
|
||||
some time to connect to find and connect to the home relay server. Use
|
||||
<a href="struct.Endpoint.html#method.watch_home_relay" title="method iroh_net::endpoint::Endpoint::watch_home_relay"><code>Endpoint::watch_home_relay</code></a> to wait until the home relay server is available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.watch_home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#698-700">source</a><h4 class="code-header">pub fn <a href="#method.watch_home_relay" class="fn">watch_home_relay</a>(&self) -> impl Stream<Item = <a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Watches for changes to the home relay.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.watch_home_relay" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#701-703">source</a><h4 class="code-header">pub fn <a href="#method.watch_home_relay" class="fn">watch_home_relay</a>(&self) -> impl Stream<Item = <a class="struct" href="../relay/struct.RelayUrl.html" title="struct iroh_net::relay::RelayUrl">RelayUrl</a>></h4></section></summary><div class="docblock"><p>Watches for changes to the home relay.</p>
|
||||
<p>If there is currently a home relay it will be yielded immediately as the first item
|
||||
in the stream. This makes it possible to use this function to wait for the initial
|
||||
home relay to be known.</p>
|
||||
<p>Note that it is not guaranteed that a home relay will ever become available. If no
|
||||
servers are configured with <a href="struct.Builder.html#method.relay_mode" title="method iroh_net::endpoint::Builder::relay_mode"><code>Builder::relay_mode</code></a> this stream will never yield an
|
||||
item.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.direct_addresses" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#736-738">source</a><h4 class="code-header">pub fn <a href="#method.direct_addresses" class="fn">direct_addresses</a>(&self) -> <a class="struct" href="struct.DirectAddrsStream.html" title="struct iroh_net::endpoint::DirectAddrsStream">DirectAddrsStream</a></h4></section></summary><div class="docblock"><p>Returns the direct addresses of this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.direct_addresses" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#739-741">source</a><h4 class="code-header">pub fn <a href="#method.direct_addresses" class="fn">direct_addresses</a>(&self) -> <a class="struct" href="struct.DirectAddrsStream.html" title="struct iroh_net::endpoint::DirectAddrsStream">DirectAddrsStream</a></h4></section></summary><div class="docblock"><p>Returns the direct addresses of this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>The direct addresses of the <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> are those that could be used by other
|
||||
iroh-net nodes to establish direct connectivity, depending on the network
|
||||
situation. The yielded lists of direct addresses contain both the locally-bound
|
||||
@@ -123,10 +124,10 @@ most recently discovered IP endpoints.</p>
|
||||
|
||||
<span class="kw">let </span>mep = Endpoint::builder().bind().<span class="kw">await</span>.unwrap();
|
||||
<span class="kw">let </span>_addrs = mep.direct_addresses().next().<span class="kw">await</span>;</code></pre></div>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#744-746">source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> (<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>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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>>)</h4></section></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.bound_sockets" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#747-749">source</a><h4 class="code-header">pub fn <a href="#method.bound_sockets" class="fn">bound_sockets</a>(&self) -> (<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>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<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>>)</h4></section></summary><div class="docblock"><p>Returns the local socket addresses on which the underlying sockets are bound.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> always binds on an IPv4 address and also tries to bind on an IPv6
|
||||
address if available.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#761-763">source</a><h4 class="code-header">pub fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, node_id: <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.RemoteInfo.html" title="struct iroh_net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about the remote node identified by a <a href="../type.NodeId.html" title="type iroh_net::NodeId"><code>NodeId</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#764-766">source</a><h4 class="code-header">pub fn <a href="#method.remote_info" class="fn">remote_info</a>(&self, node_id: <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a>) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.RemoteInfo.html" title="struct iroh_net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about the remote node identified by a <a href="../type.NodeId.html" title="type iroh_net::NodeId"><code>NodeId</code></a>.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> keeps some information about remote iroh-net nodes, which it uses to find
|
||||
the best path to a node. Having information on a remote node, however, does not mean we have
|
||||
ever connected to it to or even whether a connection is even possible. The information about a
|
||||
@@ -135,14 +136,14 @@ calls may return different information. Furthermore, node information may even b
|
||||
completely evicted as it becomes stale.</p>
|
||||
<p>See also <a href="struct.Endpoint.html#method.remote_info_iter" title="method iroh_net::endpoint::Endpoint::remote_info_iter"><code>Endpoint::remote_info_iter</code></a> which returns information on all nodes known
|
||||
by this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info_iter" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#775-777">source</a><h4 class="code-header">pub fn <a href="#method.remote_info_iter" class="fn">remote_info_iter</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="struct.RemoteInfo.html" title="struct iroh_net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about all the remote nodes this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> knows about.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.remote_info_iter" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#778-780">source</a><h4 class="code-header">pub fn <a href="#method.remote_info_iter" class="fn">remote_info_iter</a>(&self) -> impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = <a class="struct" href="struct.RemoteInfo.html" title="struct iroh_net::endpoint::RemoteInfo">RemoteInfo</a>></h4></section></summary><div class="docblock"><p>Returns information about all the remote nodes this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> knows about.</p>
|
||||
<p>This returns the same information as <a href="struct.Endpoint.html#method.remote_info" title="method iroh_net::endpoint::Endpoint::remote_info"><code>Endpoint::remote_info</code></a> for each node known to this
|
||||
<a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>The <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a> keeps some information about remote iroh-net nodes, which it uses to find
|
||||
the best path to a node. This returns all the nodes it knows about, regardless of whether a
|
||||
connection was ever made or is even possible.</p>
|
||||
<p>See also <a href="struct.Endpoint.html#method.remote_info" title="method iroh_net::endpoint::Endpoint::remote_info"><code>Endpoint::remote_info</code></a> to only retrieve information about a single node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.conn_type_stream" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#801-803">source</a><h4 class="code-header">pub fn <a href="#method.conn_type_stream" class="fn">conn_type_stream</a>(&self, node_id: <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="struct.ConnectionTypeStream.html" title="struct iroh_net::endpoint::ConnectionTypeStream">ConnectionTypeStream</a>></h4></section></summary><div class="docblock"><p>Returns a stream that reports connection type changes for the remote node.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.conn_type_stream" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#804-806">source</a><h4 class="code-header">pub fn <a href="#method.conn_type_stream" class="fn">conn_type_stream</a>(&self, node_id: <a class="type" href="../type.NodeId.html" title="type iroh_net::NodeId">NodeId</a>) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="struct" href="struct.ConnectionTypeStream.html" title="struct iroh_net::endpoint::ConnectionTypeStream">ConnectionTypeStream</a>></h4></section></summary><div class="docblock"><p>Returns a stream that reports connection type changes for the remote node.</p>
|
||||
<p>This returns a stream of <a href="enum.ConnectionType.html" title="enum iroh_net::endpoint::ConnectionType"><code>ConnectionType</code></a> items, each time the underlying
|
||||
connection to a remote node changes it yields an item. These connection changes are
|
||||
when the connection switches between using the Relay server and a direct connection.</p>
|
||||
@@ -155,11 +156,11 @@ connection when the switch from a relayed to a direct connection can be so fast
|
||||
the relayed state is never exposed.</p>
|
||||
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
|
||||
<p>Will error if we do not have any address information for the given <code>node_id</code>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#808-810">source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(&self) -> &<a class="type" href="../dns/type.DnsResolver.html" title="type iroh_net::dns::DnsResolver">DnsResolver</a></h4></section></summary><div class="docblock"><p>Returns the DNS resolver used in this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.dns_resolver" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#811-813">source</a><h4 class="code-header">pub fn <a href="#method.dns_resolver" class="fn">dns_resolver</a>(&self) -> &<a class="type" href="../dns/type.DnsResolver.html" title="type iroh_net::dns::DnsResolver">DnsResolver</a></h4></section></summary><div class="docblock"><p>Returns the DNS resolver used in this <a href="struct.Endpoint.html" title="struct iroh_net::endpoint::Endpoint"><code>Endpoint</code></a>.</p>
|
||||
<p>See <a href="struct.Builder.html#method.discovery" title="method iroh_net::endpoint::Builder::discovery"><code>Builder::discovery</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.discovery" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#815-817">source</a><h4 class="code-header">pub fn <a href="#method.discovery" class="fn">discovery</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="../discovery/trait.Discovery.html" title="trait iroh_net::discovery::Discovery">Discovery</a>></h4></section></summary><div class="docblock"><p>Returns the discovery mechanism, if configured.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.discovery" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#818-820">source</a><h4 class="code-header">pub fn <a href="#method.discovery" class="fn">discovery</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="../discovery/trait.Discovery.html" title="trait iroh_net::discovery::Discovery">Discovery</a>></h4></section></summary><div class="docblock"><p>Returns the discovery mechanism, if configured.</p>
|
||||
<p>See <a href="struct.Builder.html#method.dns_resolver" title="method iroh_net::endpoint::Builder::dns_resolver"><code>Builder::dns_resolver</code></a>.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#831-833">source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.network_change" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#834-836">source</a><h4 class="code-header">pub async fn <a href="#method.network_change" class="fn">network_change</a>(&self)</h4></section></summary><div class="docblock"><p>Notifies the system of potential network changes.</p>
|
||||
<p>On many systems iroh is able to detect network changes by itself, however
|
||||
some systems like android do not expose this functionality to native code.
|
||||
Android does however provide this functionality to Java code. This
|
||||
@@ -167,7 +168,7 @@ function allows for notifying iroh of any potential network changes like
|
||||
this.</p>
|
||||
<p>Even when the network did not change, or iroh was already able to detect
|
||||
the network change itself, there is no harm in calling this function.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#847-865">source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(self, error_code: <a class="struct" href="struct.VarInt.html" title="struct iroh_net::endpoint::VarInt">VarInt</a>, reason: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the magic socket.</p>
|
||||
</div></details><details class="toggle method-toggle" open><summary><section id="method.close" class="method"><a class="src rightside" href="../../src/iroh_net/endpoint.rs.html#850-868">source</a><h4 class="code-header">pub async fn <a href="#method.close" class="fn">close</a>(self, error_code: <a class="struct" href="struct.VarInt.html" title="struct iroh_net::endpoint::VarInt">VarInt</a>, reason: &[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]) -> <a class="type" href="https://docs.rs/anyhow/1.0.85/anyhow/type.Result.html" title="type anyhow::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>></h4></section></summary><div class="docblock"><p>Closes the QUIC endpoint and the magic socket.</p>
|
||||
<p>This will close all open QUIC connections with the provided error_code and
|
||||
reason. See <a href="struct.Connection.html" title="struct iroh_net::endpoint::Connection"><code>quinn::Connection</code></a> for details on how these are interpreted.</p>
|
||||
<p>It will then wait for all connections to actually be shutdown, and afterwards
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1746,6 +1746,9 @@
|
||||
<a href="#1746" id="1746">1746</a>
|
||||
<a href="#1747" id="1747">1747</a>
|
||||
<a href="#1748" id="1748">1748</a>
|
||||
<a href="#1749" id="1749">1749</a>
|
||||
<a href="#1750" id="1750">1750</a>
|
||||
<a href="#1751" id="1751">1751</a>
|
||||
</pre></div><pre class="rust"><code><span class="doccomment">//! The [`Endpoint`] allows establishing connections to other iroh-net nodes.
|
||||
//!
|
||||
//! The [`Endpoint`] is the main API interface to manage a local iroh-net node. It allows
|
||||
@@ -2180,10 +2183,12 @@
|
||||
|
||||
</span><span class="doccomment">/// Connects to a remote [`Endpoint`].
|
||||
///
|
||||
/// A [`NodeAddr`] is required. It must contain the [`NodeId`] to dial and may also
|
||||
/// contain a [`RelayUrl`] and direct addresses. If direct addresses are provided, they
|
||||
/// will be used to try and establish a direct connection without involving a relay
|
||||
/// server.
|
||||
/// A value that can be converted into a [`NodeAddr`] is required. This can be either a
|
||||
/// [`NodeAddr`], a [`NodeId`] or a [`iroh_base::ticket::NodeTicket`].
|
||||
///
|
||||
/// The [`NodeAddr`] must contain the [`NodeId`] to dial and may also contain a [`RelayUrl`]
|
||||
/// and direct addresses. If direct addresses are provided, they will be used to try and
|
||||
/// establish a direct connection without involving a relay server.
|
||||
///
|
||||
/// If neither a [`RelayUrl`] or direct addresses are configured in the [`NodeAddr`] it
|
||||
/// may still be possible a connection can be established. This depends on other calls
|
||||
@@ -2205,6 +2210,7 @@
|
||||
alpn: <span class="kw-2">&</span>[u8],
|
||||
) -> <span class="prelude-ty">Result</span><quinn::Connection> {
|
||||
<span class="kw">let </span>node_addr = node_addr.into();
|
||||
tracing::Span::current().record(<span class="string">"remote"</span>, <span class="kw-2">&</span>node_addr.node_id.fmt_short());
|
||||
<span class="comment">// Connecting to ourselves is not supported.
|
||||
</span><span class="kw">if </span>node_addr.node_id == <span class="self">self</span>.node_id() {
|
||||
<span class="macro">bail!</span>(
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
<span class="self">self</span>.nodes.is_empty()
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Creates a new [`RelayMap] with a single relay server configured.
|
||||
<span class="doccomment">/// Creates a new [`RelayMap`] with a single relay server configured.
|
||||
///
|
||||
/// Allows to set a custom STUN port and different IP addresses for IPv4 and IPv6.
|
||||
/// If IP addresses are provided, no DNS lookup will be performed.
|
||||
@@ -260,15 +260,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns a [`RelayMap] from a [`RelayUrl`].
|
||||
<span class="doccomment">/// Returns a [`RelayMap`] from a [`RelayUrl`].
|
||||
///
|
||||
/// This will use the default STUN port and IP addresses resolved from the URL's host name via DNS.
|
||||
/// relay nodes are specified at <../../../docs/relay_nodes.md>
|
||||
/// relay nodes are specified at <../../docs/relay_nodes.md>
|
||||
</span><span class="kw">pub fn </span>from_url(url: RelayUrl) -> <span class="self">Self </span>{
|
||||
<span class="self">Self</span>::default_from_node(url, DEFAULT_STUN_PORT)
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Constructs the [`RelayMap] from an iterator of [`RelayNode`]s.
|
||||
<span class="doccomment">/// Constructs the [`RelayMap`] from an iterator of [`RelayNode`]s.
|
||||
</span><span class="kw">pub fn </span>from_nodes(value: <span class="kw">impl </span>IntoIterator<Item = RelayNode>) -> <span class="prelude-ty">Result</span><<span class="self">Self</span>> {
|
||||
<span class="kw">let </span><span class="kw-2">mut </span>map = BTreeMap::new();
|
||||
<span class="kw">for </span>node <span class="kw">in </span>value.into_iter() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(function() {var implementors = {
|
||||
"iroh":[["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh/metrics/struct.Metrics.html\" title=\"struct iroh::metrics::Metrics\">Metrics</a>"]],
|
||||
"iroh_blobs":[["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_blobs/metrics/struct.Metrics.html\" title=\"struct iroh_blobs::metrics::Metrics\">Metrics</a>"]],
|
||||
"iroh_dns_server":[["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_dns_server/metrics/struct.Metrics.html\" title=\"struct iroh_dns_server::metrics::Metrics\">Metrics</a>"]],
|
||||
"iroh_dns_server":[["impl Metric for <a class=\"struct\" href=\"iroh_dns_server/metrics/struct.Metrics.html\" title=\"struct iroh_dns_server::metrics::Metrics\">Metrics</a>"]],
|
||||
"iroh_docs":[["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_docs/metrics/struct.Metrics.html\" title=\"struct iroh_docs::metrics::Metrics\">Metrics</a>"]],
|
||||
"iroh_gossip":[["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_gossip/metrics/struct.Metrics.html\" title=\"struct iroh_gossip::metrics::Metrics\">Metrics</a>"]],
|
||||
"iroh_net":[["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_net/metrics/struct.MagicsockMetrics.html\" title=\"struct iroh_net::metrics::MagicsockMetrics\">Metrics</a>"],["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_net/netcheck/struct.Metrics.html\" title=\"struct iroh_net::netcheck::Metrics\">Metrics</a>"],["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_net/portmapper/struct.Metrics.html\" title=\"struct iroh_net::portmapper::Metrics\">Metrics</a>"],["impl <a class=\"trait\" href=\"iroh_metrics/core/trait.Metric.html\" title=\"trait iroh_metrics::core::Metric\">Metric</a> for <a class=\"struct\" href=\"iroh_net/relay/server/struct.Metrics.html\" title=\"struct iroh_net::relay::server::Metrics\">Metrics</a>"]],
|
||||
|
||||
Reference in New Issue
Block a user