Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RandomStrategy AliveOnly #2850

Merged
merged 6 commits into from Mar 10, 2024
Merged

Conversation

mkmark
Copy link
Contributor

@mkmark mkmark commented Jan 9, 2024

Address #1841.

New optional settings to strategy random: aliveOnly and observerTag.

If aliveOnly == true, enable the strategy to choose only from alive outbounds. Outbounds are considered alive unless proven otherwise (by observatory).

Very useful when one has several unstable outbounds, this improves reliability by making these outbounds fail-safe to each other.

Also useful when one wants to combine bandwidth of several unstable outbounds.

Use like

{
  "selector": [
    "a",
    "b"
  ],
  "tag": "c",
  "strategy": {
    "type": "random",
    "settings": {
       "aliveOnly": true
    }
  }
}

Need observatory.

FAQ

How much does this affect the original random strategy?

Fully compatible with the original random strategy, i.e. no strategy at all.

It adds a check upon picking an outbound, i.e. whether ones has a random strategy. Almost no performance effect.

obsolete New balancer strategy: `randomalive`.

Random, but only choose from alive outbounds.

Use like

{
  "selector": [
    "a",
    "b"
  ],
  "tag": "c",
  "strategy": {
    "type": "randomalive"
  }
}

@mkmark mkmark marked this pull request as draft January 9, 2024 10:06
@mkmark mkmark marked this pull request as ready for review January 9, 2024 11:15
@mkmark mkmark changed the title feat: strategy_randomalive feat: RandomStrategy AliveOnly Jan 9, 2024
@xiaokangwang
Copy link
Contributor

Thanks for you contribution. I think this merge request is ready to be merged.

@xiaokangwang xiaokangwang merged commit a339721 into v2fly:master Mar 10, 2024
1 check passed
@xiaokangwang
Copy link
Contributor

This pull request have been merged. Please send a pull request to the document if you are willing and able.

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.

None yet

2 participants