Skip to content

Conversation

@Jauler
Copy link
Contributor

@Jauler Jauler commented Dec 2, 2025

Problem

Whenever there exists multiple paths between two devices to connect within meshnet - we were choosing any valid path. But those paths are not always equal, therefore it was entirely possible that unpreferable path would be chosen (e.g. going via STUN via public IP and hairpining on router instead of LAN IPs).

Solution

This PR introduces the following preference of endpoint providers:

  • Most prefered - local
  • Medium prefered - UPnP
  • Least prefered - STUN

And this order is evaluated everytime there is a transition from relayed path to direct.

Note: There is a limitation, that if one endpoint is published significnalty earlier than "more" prefered one - then there preference will only be evaluated after next path transition from relay to direct.

☑️ Definition of Done checklist

  • Commit history is clean (requirements)
  • README.md is updated
  • Functionality is covered by unit or integration tests

@Jauler Jauler requested a review from a team as a code owner December 2, 2025 15:01
@@ -0,0 +1 @@
LLT-6880: Introduce endpoint provider preference order. Prefer Local endpoints more than others.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will result in line like

  • LLT-6880: LLT-6880: Introduce....

generate_changelog.py takes the ticket from the filename (_match_ticket(filename)) and always prepends it when entry_ticket_id is present:

it uses ENTRY_FORMAT_W_TICKET = "* {}: {}\n" and calls ENTRY_FORMAT_W_TICKET.format(entry_ticket_id, line.strip())
it does not strip a leading ticket from the file content, so if line.strip() already begins with LLT-6880:, the output becomes * LLT-6880: LLT-6880: Introduce...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point!

Fixed.

Whenever there exists multiple paths between two devices to connect
within meshnet - we were choosing _any_ valid path. But those paths are
not always equal, therefore it was entirely possible that unpreferable
path would be chosen (e.g. going via STUN via public IP and hairpining
on router instead of LAN IPs).

This PR introduces the following preference of endpoint providers:
* Most prefered - local
* Medium prefered - UPnP
* Least prefered - STUN
and whenever an upgrade is required - this preference is reflected in
the endpoint choice.

Note: There is a limitation, that if one endpoint is published
significnalty earlier than "more" prefered one - then there preference
will only be evaluated after next path transition from relay to direct.
@Jauler Jauler force-pushed the LLT-6880_introduce_ep_preference branch from c023b33 to 9b746ab Compare December 8, 2025 12:45
Copy link
Contributor

@sfraczek sfraczek left a comment

Choose a reason for hiding this comment

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

+1

Copy link
Contributor

@Hasan6979 Hasan6979 left a comment

Choose a reason for hiding this comment

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

Other than that. +1

// Define Endpoint-Provider preference
// higher == more preferred
let ep_preference_score = |ep| match ep {
ApiEndpointProvider::Local => 4,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 4 instead of 3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants