Skip to content

refactor: Simplify path selection#3870

Merged
dignifiedquire merged 13 commits intomainfrom
simplify-path-selection
Feb 17, 2026
Merged

refactor: Simplify path selection#3870
dignifiedquire merged 13 commits intomainfrom
simplify-path-selection

Conversation

@rklaehn
Copy link
Copy Markdown
Contributor

@rklaehn rklaehn commented Jan 19, 2026

Description

Fewer special cases in selection of the best path, in preparation to integrating user transports into path selection.

This should keep the current logic completey unchanged, but make it easier to add additional paths without a maze of special cases.

Implemented rules:

  • bias for ipv6 (IPV6_RTT_ADVANTAGE)
  • available (currently ipv4/ipv6) takes precendence over backup (currently relay)
  • switching between different transports in the same category (available or backup) only happens if the advantage is bigger than RTT_SWITCHING_MIN_IP to avoid toggling

The purpose is to be able to integrate user transports more easily. Each user transport id would get a flag if it is considered available or backup (default backup?), and a rtt bias (default 0). Then you would add user transports to the selection process without any special cases.

I guess available or backup are not the right categories here. The meaning would be standard (a transport that has a theoretical chance to become the best transport) and fallback (a transport of last resort that you want to get rid of asap as soon as you have another option, regardless of rtt). E.g. a BLE transport would always be a fallback transport because available bandwidth is very limited regardless of rtt.

Breaking Changes

None

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.
    • List all breaking changes in the above "Breaking Changes" section.
    • Open an issue or PR on any number0 repos that are affected by this breaking change. Give guidance on how the updates should be handled or do the actual updates themselves. The major ones are:

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 19, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3870/docs/iroh/

Last updated: 2026-02-17T14:15:54Z

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 19, 2026

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 0ce2ab3

@rklaehn rklaehn force-pushed the simplify-path-selection branch 2 times, most recently from 8f4f1f1 to f2807e1 Compare January 19, 2026 14:55
@rklaehn rklaehn force-pushed the simplify-path-selection branch from f2807e1 to 0c7a026 Compare January 19, 2026 14:56
@n0bot n0bot bot added this to iroh Jan 19, 2026
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Jan 19, 2026
@rklaehn rklaehn requested a review from flub January 21, 2026 16:35
@rklaehn rklaehn force-pushed the simplify-path-selection branch from 405fda6 to c05c0e0 Compare January 21, 2026 16:36
@dignifiedquire
Copy link
Copy Markdown
Contributor

I like the structural idea, as well as the ability to expand the test coverage. What's missing to finish this @rklaehn ?

@rklaehn
Copy link
Copy Markdown
Contributor Author

rklaehn commented Jan 27, 2026

I like the structural idea, as well as the ability to expand the test coverage. What's missing to finish this @rklaehn ?

Not much. I guess we can merge it as is, since it carefully tries to exactly replicate the existing logic while making things more generic, and then as a next step provide another 2 case enum in the public transport configuration API. That would happen in #3845 or in a subsequent PR to main. But it feels a bit silly to provide a bias API before adding custom transports.

@rklaehn rklaehn marked this pull request as ready for review January 27, 2026 10:14
@rklaehn rklaehn force-pushed the simplify-path-selection branch from 6976892 to ebde742 Compare January 27, 2026 11:11
@rklaehn rklaehn force-pushed the simplify-path-selection branch from 41d3ec0 to bb5058b Compare January 27, 2026 15:48
@rklaehn rklaehn requested a review from flub January 27, 2026 15:50
@rklaehn rklaehn force-pushed the simplify-path-selection branch from cc6b755 to f32e6e1 Compare January 28, 2026 09:49
@dignifiedquire dignifiedquire merged commit df6c396 into main Feb 17, 2026
27 of 29 checks passed
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Feb 17, 2026
@dignifiedquire dignifiedquire deleted the simplify-path-selection branch February 17, 2026 14:24
@ramfox ramfox added this to the iroh: v0.97 milestone Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants