Improve VPN video routing, profile storage and authorization reuse
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/netip"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
@@ -217,6 +218,10 @@ func resolver(value, tag, detour string) (map[string]any, error) {
|
||||
return result, nil
|
||||
}
|
||||
func (c Config) managedJSON() ([]byte, error) {
|
||||
return c.managedJSONForPlatform(runtime.GOOS)
|
||||
}
|
||||
|
||||
func (c Config) managedJSONForPlatform(platform string) ([]byte, error) {
|
||||
feature := c.Feature
|
||||
if feature == "" {
|
||||
feature = "mesh"
|
||||
@@ -515,6 +520,14 @@ func (c Config) managedJSON() ([]byte, error) {
|
||||
if c.FakeIP && !internet {
|
||||
return nil, errors.New("FakeIP requires ordinary proxy feature")
|
||||
}
|
||||
if internet && final == "proxy" && (bypassCN || mode == "global") && c.preferVideoTCPOn(platform) {
|
||||
// Keep mesh, private, GeoIP and explicit routes ahead of this policy.
|
||||
// Detect QUIC first: other UDP/443 traffic must remain usable.
|
||||
routeRules = append(routeRules,
|
||||
map[string]any{"network": "udp", "port": 443, "action": "sniff", "sniffer": []string{"quic"}},
|
||||
map[string]any{"network": "udp", "port": 443, "protocol": "quic", "domain_suffix": []string{"googlevideo.com"}, "action": "reject"},
|
||||
)
|
||||
}
|
||||
inbounds := []any{map[string]any{"type": "socks", "tag": "local", "listen": "127.0.0.1", "listen_port": c.ListenPort}}
|
||||
route := map[string]any{"rules": routeRules, "final": final}
|
||||
if len(ruleSets) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user