Feature request: fallback outbound group based on the tunnel's own connection state (WireGuard handshake, OpenVPN/OpenConnect session)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- networking
Direzione di ricerca
Start from the proposed fallback outbound group and the connection-state hooks it needs: SetSessionStateFunc, Peer.ExpireCurrentKeypairs and Peer.SendHandshakeInitiation in the WireGuard endpoint, plus the OpenVPN client and OpenConnect endpoints. The linked branch V1rgul:fallback-outbound-group has commits for both parts, but the issue does not settle the design, so it needs maintainer agreement first. Done means the group selects the first connected outbound with timeout and fast switch-back, backed by tests, docs and the schema entry.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
I want to prefer a WireGuard endpoint (UDP) and automatically use an OpenVPN endpoint over TCP/443 on networks where the WireGuard handshake never completes (UDP filtered), then return to WireGuard as soon as its handshake succeeds again.
This cannot be expressed today:
selectordoes not fail over by itself.urltestselects by the latency of an HTTP(S) request sent through each outbound. It has no strict order of preference, and it measures a third-party URL rather than the tunnel: the signal I need is whether the tunnel itself is connected.- A WireGuard endpoint is started as soon as its local device is up, before any peer has answered, so nothing in the configuration can react to a handshake that does not complete.
Proposal
A fallback outbound group that selects the first outbound in the list whose own connection is established, using the state each tunnel already knows, without URL tests:
{
"type": "fallback",
"tag": "vpn",
"outbounds": [
"wireguard",
"openvpn"
],
"timeout": "10s",
"interrupt_exist_connections": false
}
- The first connected outbound is selected. An outbound that is not connected yet is waited for during
timeoutbefore the next one is considered. - The group switches back to an earlier outbound as soon as it is connected again.
- An outbound that reports a terminal error (for example an OpenVPN authentication failure) is skipped without waiting.
- Outbounds without a connection state (
direct, proxies, other groups) are always considered connected.
| Type | Connected when |
|---|---|
wireguard |
every peer with an address has an established session (completed handshake, not expired) |
openvpn-client |
the tunnel is established and configured |
openconnect |
the tunnel is established and configured |
For WireGuard this needs two things while the endpoint is used by such a group: initiating the handshake without waiting for traffic, and forcing a fresh handshake after a network change, because an established session otherwise stays established for up to 3 minutes on a path that now drops UDP.
Related
- #4627, #2130 and #4065 ask for priority-based selection, and #4217 implements priority tiers, all with URL tests as the health signal. #4436 asks for non-HTTP probes.
- This request is about the health signal: the tunnel's own authenticated state instead of a probe through it. The two are complementary: a URL test could later provide the state of outbounds that have none.
Implementation
I have an implementation with tests and documentation (en + zh): V1rgul:fallback-outbound-group, two commits on top of testing:
ab0a9e303adds a connection state to the WireGuard, OpenVPN client and OpenConnect endpoints. It needs no wireguard-go change: it usesSetSessionStateFunc,Peer.ExpireCurrentKeypairsandPeer.SendHandshakeInitiationof the pinned version.06f2dd943adds the group, its documentation, the schema entry and the tests.
Pull requests on this repository can only be created by collaborators, so I could not open one. I can open it if that is possible, or the branch can be taken as is.
- Lingua principale
- Go
- Stelle
- 40.4k
- Fork
- 5k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SagerNet/sing-box
-
`check` and startup are quadratic in outbound group size since 1.14.4 (duplicate tag check)Forse già presa @Tidehyc l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
database file removal errorsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
Tutte le issue di SagerNet/sing-box
Issue simili
-
good first issue tools
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
Edwin-metcalf/MetCode#76 ·
I maintainer di solito rispondono entro 1 giorno
-
-diff's removed-name budget ignores the names the -ptr pass testedForse già presa @nova-loop l’ha presa oggi. Apertaarea: cli bug good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
TMHSDigital/subenum#495 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort:s impact:med raised-by:worker risk:low to:worker
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
medici-finance/assay#8120 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
factory:subtask
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
reportedBy/community
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openchoreo/openchoreo#5751 ·
I maintainer di solito rispondono entro 1 giorno