Skip to content

Commit 100d27d

Browse files
authored
refactor(iroh-net)!: Rename Endpoint::my_relay to home_relay (#2361)
## Description This renames Endpoint::my_relay to Endpoint::home_relay. This is more descriptive, because home relay is how we describe this in other parts of the documentation. There is also no real consistency of the `my_` prefix, there's only one other API currently which I'll independently propose to remove. ## Breaking Changes - Endpoint::my_relay -> Endpoint::home_relay ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - ~~[ ] Tests if relevant.~~ - [x] All breaking changes documented.
1 parent 3a2faea commit 100d27d

File tree

9 files changed

+11
-11
lines changed

9 files changed

+11
-11
lines changed

iroh-cli/src/commands/doctor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ async fn accept(
742742
secret_key.public(),
743743
remote_addrs,
744744
);
745-
if let Some(relay_url) = endpoint.my_relay() {
745+
if let Some(relay_url) = endpoint.home_relay() {
746746
println!(
747747
"\tUsing just the relay url:\niroh doctor connect {} --relay-url {}\n",
748748
secret_key.public(),

iroh-gossip/src/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ impl Actor {
380380
Some(endpoints) => {
381381
let addr = NodeAddr::from_parts(
382382
self.endpoint.node_id(),
383-
self.endpoint.my_relay(),
383+
self.endpoint.home_relay(),
384384
endpoints.into_iter().map(|x| x.addr).collect(),
385385
);
386386
let peer_data = encode_peer_data(&addr.info)?;

iroh-net/examples/connect-unreliable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async fn main() -> anyhow::Result<()> {
6969
}
7070

7171
let relay_url = endpoint
72-
.my_relay()
72+
.home_relay()
7373
.expect("should be connected to a relay server, try calling `endpoint.local_endpoints()` or `endpoint.connect()` first, to ensure the endpoint has actually attempted a connection before checking for the connected relay server");
7474
println!("node relay server url: {relay_url}\n");
7575
// Build a `NodeAddr` from the node_id, relay url, and UDP addresses.

iroh-net/examples/connect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async fn main() -> anyhow::Result<()> {
6666
}
6767

6868
let relay_url = endpoint
69-
.my_relay()
69+
.home_relay()
7070
.expect("should be connected to a relay server, try calling `endpoint.local_endpoints()` or `endpoint.connect()` first, to ensure the endpoint has actually attempted a connection before checking for the connected relay server");
7171
println!("node relay server url: {relay_url}\n");
7272
// Build a `NodeAddr` from the node_id, relay url, and UDP addresses.

iroh-net/examples/listen-unreliable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async fn main() -> anyhow::Result<()> {
5252
.join(" ");
5353

5454
let relay_url = endpoint
55-
.my_relay()
55+
.home_relay()
5656
.expect("should be connected to a relay server, try calling `endpoint.local_endpoints()` or `endpoint.connect()` first, to ensure the endpoint has actually attempted a connection before checking for the connected relay server");
5757
println!("node relay server url: {relay_url}");
5858
println!("\nin a separate terminal run:");

iroh-net/examples/listen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async fn main() -> anyhow::Result<()> {
5252
.join(" ");
5353

5454
let relay_url = endpoint
55-
.my_relay()
55+
.home_relay()
5656
.expect("should be connected to a relay server, try calling `endpoint.local_endpoints()` or `endpoint.connect()` first, to ensure the endpoint has actually attempted a connection before checking for the connected relay server");
5757
println!("node relay server url: {relay_url}");
5858
println!("\nin a separate terminal run:");

iroh-net/src/endpoint.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,15 +566,15 @@ impl Endpoint {
566566
/// Returns the current [`NodeAddr`] for this endpoint.
567567
///
568568
/// The returned [`NodeAddr`] will have the current [`RelayUrl`] and local IP endpoints
569-
/// as they would be returned by [`Endpoint::my_relay`] and
569+
/// as they would be returned by [`Endpoint::home_relay`] and
570570
/// [`Endpoint::local_endpoints`].
571571
pub async fn my_addr(&self) -> Result<NodeAddr> {
572572
let addrs = self
573573
.local_endpoints()
574574
.next()
575575
.await
576576
.ok_or(anyhow!("No IP endpoints found"))?;
577-
let relay = self.my_relay();
577+
let relay = self.home_relay();
578578
let addrs = addrs.into_iter().map(|x| x.addr).collect();
579579
Ok(NodeAddr::from_parts(self.node_id(), relay, addrs))
580580
}
@@ -591,7 +591,7 @@ impl Endpoint {
591591
/// Note that this will be `None` right after the [`Endpoint`] is created since it takes
592592
/// some time to connect to find and connect to the home relay server. Use
593593
/// [`Endpoint::watch_home_relay`] to wait until the home relay server is available.
594-
pub fn my_relay(&self) -> Option<RelayUrl> {
594+
pub fn home_relay(&self) -> Option<RelayUrl> {
595595
self.msock.my_relay()
596596
}
597597

iroh/src/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<D: BaoStore> Node<D> {
147147

148148
/// Get the relay server we are connected to.
149149
pub fn my_relay(&self) -> Option<iroh_net::relay::RelayUrl> {
150-
self.inner.endpoint.my_relay()
150+
self.inner.endpoint.home_relay()
151151
}
152152

153153
/// Aborts the node.

iroh/src/node/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl<D: BaoStore> Handler<D> {
763763

764764
#[allow(clippy::unused_async)]
765765
async fn node_relay(self, _: NodeRelayRequest) -> RpcResult<Option<RelayUrl>> {
766-
Ok(self.inner.endpoint.my_relay())
766+
Ok(self.inner.endpoint.home_relay())
767767
}
768768

769769
#[allow(clippy::unused_async)]

0 commit comments

Comments
 (0)