Skip to content

Conversation

alx0x10
Copy link

@alx0x10 alx0x10 commented Sep 18, 2025

Hello I'm back!

I thought this issue would be a good first step to get familiar with Iroh, so I started implementing the possibility to define a custom relay.
As mentioned in the issue, Sendme already supports this, so I mostly adapted that code.

Before going further and adding tests, I’d like your feedback on a few points:

  • Do you think this feature makes sense here? Since Sendme already demonstrates it, maybe you prefer to keep dumbpipe shorter and focused only on the listen/connect logic?
  • I introduced the anyhow dependency like in Sendme. Would you prefer a different error-handling approach? I could just implement the From<> myself.
  • Like in Sendme, I wrapped RelayMode into RelayModeOption, which removes the Staging option. I haven’t really looked into how staging works, would you like me to explore that for this implementation?

@n0bot n0bot bot added this to iroh Sep 18, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Sep 18, 2025
Cargo.toml Outdated
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
data-encoding = "2.9.0"
n0-snafu = "0.2.1"
anyhow = "1.0.99"
Copy link
Contributor

@eminence eminence Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like anyhow is used in your PR?

Edit: disregard, sorry, I see it now

src/main.rs Outdated
}

impl FromStr for RelayModeOption {
type Err = anyhow::Error;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the error type here be iroh::RelayUrlParseError?

@dignifiedquire
Copy link
Contributor

would be nice to avoid the anyhow error, but other than that, looks reasonable

@alx0x10 alx0x10 force-pushed the feat/add-custom-relay-option branch from 4339481 to 5728467 Compare September 26, 2025 06:57
@alx0x10
Copy link
Author

alx0x10 commented Sep 26, 2025

Ok, thank you for the feedback, I hadn't seen this RelayUrlParseError.
I made the modification and I also prefer it much more like that!

I'll look into the testing soon then and come back to you 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running with a relay disabled, this call to home_relay().initialized() never returns, and so a ticket is never printed

@dignifiedquire
Copy link
Contributor

This looks pretty good, can you fix the lint issues and move it to ready (it is still marked as draft)?

@alx0x10
Copy link
Author

alx0x10 commented Oct 3, 2025

Actually, as @eminence says, when running dumbpipe with the --relay disable, the code blocks at endpoint.home_relay().initialized().await; since no home relay is initialized.

I've added a condition to not run this check if we disable the use of a relay.

    if args.common.relay != RelayModeOption::Disabled {
        endpoint.home_relay().initialized().await;
    }

And I noticed that this check is not made for the connect_stdio()... I couldn't understand the reason for it.

Also, the same issue is present on Sendme.
I opened an issue about it, once you validate the fix I can propagate it there.

Beside that I added some tests and info in the readme.

@alx0x10 alx0x10 marked this pull request as ready for review October 3, 2025 15:57
Comment on lines +126 to +132
/// The relay URL to use as a home relay,
///
/// Can be set to "disabled" to disable relay servers and "custom"
/// to configure custom servers. The default is the n0 quickest responding
/// relay if the flag is not set.
#[clap(long, default_value_t = RelayModeOption::Default)]
pub relay: RelayModeOption,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This help text needs a little tweaking I think.

You don't set this option to the literal value of "custom", but rather you give your relay url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

3 participants