diff --git a/config/config.go b/config/config.go index f5d4941c..bae406d3 100644 --- a/config/config.go +++ b/config/config.go @@ -9,6 +9,7 @@ import ( "net" "net/netip" "net/url" + "runtime" "strings" "time" @@ -472,6 +473,30 @@ func setRoutingOptions(options *option.Options, opt *ConfigOptions) { routeRules := []option.Rule{} rulesets := []option.RuleSet{} + if opt.EnableTun && runtime.GOOS == "android" { + routeRules = append( + routeRules, + option.Rule{ + Type: C.RuleTypeDefault, + + DefaultOptions: option.DefaultRule{ + Inbound: []string{InboundTUNTag}, + PackageName: []string{"app.hiddify.com"}, + Outbound: OutboundBypassTag, + }, + }, + ) + // routeRules = append( + // routeRules, + // option.Rule{ + // Type: C.RuleTypeDefault, + // DefaultOptions: option.DefaultRule{ + // ProcessName: []string{"Hiddify", "Hiddify.exe", "HiddifyCli", "HiddifyCli.exe"}, + // Outbound: OutboundBypassTag, + // }, + // }, + // ) + } routeRules = append(routeRules, option.Rule{ Type: C.RuleTypeDefault, DefaultOptions: option.DefaultRule{ @@ -487,28 +512,7 @@ func setRoutingOptions(options *option.Options, opt *ConfigOptions) { Outbound: OutboundDNSTag, }, }) - if opt.EnableTun { - routeRules = append( - routeRules, - option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - ProcessName: []string{"Hiddify", "Hiddify.exe", "HiddifyCli", "HiddifyCli.exe"}, - Outbound: OutboundBypassTag, - }, - }, - ) - routeRules = append( - routeRules, - option.Rule{ - Type: C.RuleTypeDefault, - DefaultOptions: option.DefaultRule{ - PackageName: []string{"app.hiddify.com"}, - Outbound: OutboundBypassTag, - }, - }, - ) - } + // { // Type: C.RuleTypeDefault, // DefaultOptions: option.DefaultRule{ diff --git a/go.mod b/go.mod index 108d74da..73ef1f4d 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,8 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) +require github.com/akavel/rsrc v0.10.2 // indirect + require ( berty.tech/go-libtor v1.0.385 // indirect github.com/ajg/form v1.5.1 // indirect diff --git a/go.sum b/go.sum index 4999cd4e..fa7d5378 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,8 @@ github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 h1:Wo41lDOevRJS github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0/go.mod h1:FVGavL/QEBQDcBpr3fAojoK17xX5k9bicBphrOpP7uM= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= +github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=