Compare commits
4 Commits
v1.7.0-umb
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85db0efc59 | ||
|
|
2ed45f2485 | ||
|
|
0e15babcb3 | ||
|
|
6dfe63ea76 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,4 +9,4 @@ cert
|
||||
**/*.syso
|
||||
node_modules
|
||||
*.db
|
||||
*.json
|
||||
*.json*.backup*
|
||||
|
||||
2
Makefile
2
Makefile
@@ -58,7 +58,7 @@ windows-amd64:
|
||||
go install -mod=readonly github.com/akavel/rsrc@latest ||echo "rsrc error in installation"
|
||||
go run ./cli tunnel exit
|
||||
cp $(BINDIR)/$(LIBNAME).dll ./$(LIBNAME).dll
|
||||
$$(go env GOPATH)/bin/rsrc -ico ./assets/hiddify-cli.ico -o ./cli/bydll/cli.syso ||echo "rsrc error in syso"
|
||||
$$(go env GOPATH)/bin/rsrc -ico ./assets/umbrix-cli.ico -o ./cli/bydll/cli.syso ||echo "rsrc error in syso"
|
||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="$(LIBNAME).dll" $(GOBUILDSRV) -o $(BINDIR)/$(CLINAME).exe ./cli/bydll
|
||||
rm ./$(LIBNAME).dll
|
||||
make webui
|
||||
|
||||
BIN
assets/umbrix-cli.ico
Normal file
BIN
assets/umbrix-cli.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 206 KiB |
@@ -14,6 +14,7 @@ import (
|
||||
"time"
|
||||
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
dns "github.com/sagernet/sing-dns"
|
||||
)
|
||||
@@ -482,17 +483,65 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) {
|
||||
},
|
||||
},
|
||||
)
|
||||
// routeRules = append(
|
||||
// routeRules,
|
||||
// option.Rule{
|
||||
// Type: C.RuleTypeDefault,
|
||||
// DefaultOptions: option.DefaultRule{
|
||||
// ProcessName: []string{"Hiddify", "Hiddify.exe", "HiddifyCli", "HiddifyCli.exe"},
|
||||
// Outbound: OutboundBypassTag,
|
||||
// },
|
||||
// },
|
||||
// )
|
||||
// Exclude Umbrix itself from VPN to avoid routing loops
|
||||
routeRules = append(
|
||||
routeRules,
|
||||
option.Rule{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
ProcessName: []string{"Umbrix", "Umbrix.exe", "Umbrix Start.exe", "UmbrixCli", "UmbrixCli.exe"},
|
||||
Outbound: OutboundBypassTag,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// Per-App Proxy for Desktop platforms (Windows, Linux, macOS)
|
||||
if runtime.GOOS != "android" {
|
||||
if opt.PerAppProxyOptions.Mode == "include" && len(opt.PerAppProxyOptions.IncludedApplications) > 0 {
|
||||
// Mode: Only selected apps use VPN
|
||||
log.Info("[Per-App] Mode: include - ", len(opt.PerAppProxyOptions.IncludedApplications), " apps will use VPN")
|
||||
|
||||
// Rule 1: Selected apps → VPN
|
||||
routeRules = append(
|
||||
routeRules,
|
||||
option.Rule{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
ProcessName: opt.PerAppProxyOptions.IncludedApplications,
|
||||
Outbound: OutboundSelectTag,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
// Rule 2: All other apps → Direct
|
||||
routeRules = append(
|
||||
routeRules,
|
||||
option.Rule{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
Outbound: OutboundDirectTag,
|
||||
},
|
||||
},
|
||||
)
|
||||
} else if opt.PerAppProxyOptions.Mode == "exclude" && len(opt.PerAppProxyOptions.ExcludedApplications) > 0 {
|
||||
// Mode: Excluded apps DON'T use VPN
|
||||
log.Info("[Per-App] Mode: exclude - ", len(opt.PerAppProxyOptions.ExcludedApplications), " apps will bypass VPN")
|
||||
|
||||
// Rule: Excluded apps → Direct (rest goes through VPN by default)
|
||||
routeRules = append(
|
||||
routeRules,
|
||||
option.Rule{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
ProcessName: opt.PerAppProxyOptions.ExcludedApplications,
|
||||
Outbound: OutboundDirectTag,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
routeRules = append(routeRules, option.Rule{
|
||||
Type: C.RuleTypeDefault,
|
||||
DefaultOptions: option.DefaultRule{
|
||||
|
||||
@@ -26,6 +26,13 @@ type HiddifyOptions struct {
|
||||
InboundOptions
|
||||
URLTestOptions
|
||||
RouteOptions
|
||||
PerAppProxyOptions
|
||||
}
|
||||
|
||||
type PerAppProxyOptions struct {
|
||||
Mode string `json:"per-app-proxy-mode"` // "off", "include", "exclude"
|
||||
IncludedApplications []string `json:"included-applications"` // ["chrome.exe", "firefox.exe"]
|
||||
ExcludedApplications []string `json:"excluded-applications"` // ["steam.exe", "uTorrent.exe"]
|
||||
}
|
||||
|
||||
type DNSOptions struct {
|
||||
|
||||
Reference in New Issue
Block a user