SagerNet / SagerNet/sing-box

[Feature Request] URLTest based backup group outbound selection

Open
#2,130 8 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
38.1k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

Hi!
Currently, the URLTest picks out an outbound by latency and tolerance from a certain group of outbounds.

I suggest a new typeof URLTest based outbound that selects the first available one from a list of outbounds.

Say it like the following structure.

{
  "type": "backup",
  "tag": "auto",
  // select the first available one from the list
  "outbounds": [
    "proxy-a",
    "proxy-b",
    "proxy-c"
  ],
  "url": "",
  "interval": "",
  "tolerance": 50, // takes no effect
  "idle_timeout": "",
  "interrupt_exist_connections": false
  // some extra fields
  //
  // switch_back_policy
  //   n(positive): switch back to the prior outbound only after it passes n times url test
  //   1: always select the first available outbound (a special case of n = 1)
  //   0: as long as the current outbound alive, keep on it
  "switch_back_policy": 0,
}

This will greatly improve the logic of outbound. Makes it more robust.
Similar implement could be found here: Fallback proxy groups

Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing URLTest outbound and the outbound configuration described in this issue, then compare the fallback proxy group behavior linked in the request. Done means a backup outbound can select the first available configured outbound, apply the stated switch-back policy, and handle the listed URL-test settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.