From 442994f15a4f2de4fe16ec0c1e37875e83572a35 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Wed, 8 Jan 2025 13:53:20 +0000 Subject: [PATCH 01/18] =?UTF-8?q?=E4=B8=AA=E6=80=A7=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 2 +- v2/standalone.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 383b1194..cce1afd3 100644 --- a/config/config.go +++ b/config/config.go @@ -277,7 +277,7 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { }, CacheFile: &option.CacheFileOptions{ - Enabled: true, + Enabled: false, Path: "clash.db", }, } diff --git a/v2/standalone.go b/v2/standalone.go index 173c9eef..58fe9e42 100644 --- a/v2/standalone.go +++ b/v2/standalone.go @@ -167,7 +167,7 @@ func buildConfig(configContent string, options config.HiddifyOptions) (string, e } finalconfig.Log.Output = "" - finalconfig.Experimental.ClashAPI.ExternalUI = "webui" + finalconfig.Experimental.ClashAPI.ExternalUI = "/etc/s6-overlay/s6-rc.d/hiddify/webui" if options.AllowConnectionFromLAN { finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756" } else { From 3a7f49ec34f77386f6a36d4168994a1fd6844e89 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Wed, 8 Jan 2025 14:24:12 +0000 Subject: [PATCH 02/18] add proxy http srs --- config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index cce1afd3..85752541 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -603,7 +603,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -612,7 +612,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -621,7 +621,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -630,7 +630,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -639,7 +639,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -697,7 +697,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -706,7 +706,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) From af02780bf25abba43983df2fbedfbddd81210a8f Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Wed, 8 Jan 2025 14:45:13 +0000 Subject: [PATCH 03/18] proxy --- config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 85752541..2d4b6b3c 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -603,7 +603,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -612,7 +612,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -621,7 +621,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -630,7 +630,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -639,7 +639,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -697,7 +697,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -706,7 +706,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) From db83a0b4da6be2a208a6ae4a0bba9b6a02ff4f43 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Wed, 8 Jan 2025 15:06:55 +0000 Subject: [PATCH 04/18] proxy --- config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 2d4b6b3c..d1b280a6 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -603,7 +603,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -612,7 +612,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -621,7 +621,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -630,7 +630,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -639,7 +639,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -697,7 +697,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -706,7 +706,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) From 1983bdbee3aa0867726fe1e1d4a3973a4fb3db27 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Thu, 9 Jan 2025 11:18:26 +0000 Subject: [PATCH 05/18] add web_ui_path --- config/config.go | 2 +- config/hiddify_option.go | 1 + v2/standalone.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index d1b280a6..60f088c6 100644 --- a/config/config.go +++ b/config/config.go @@ -274,8 +274,8 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { ClashAPI: &option.ClashAPIOptions{ ExternalController: fmt.Sprintf("%s:%d", "127.0.0.1", opt.ClashApiPort), Secret: opt.ClashApiSecret, + ExternalUI: opt.ClashWebPath, }, - CacheFile: &option.CacheFileOptions{ Enabled: false, Path: "clash.db", diff --git a/config/hiddify_option.go b/config/hiddify_option.go index 5b13242e..98693fae 100644 --- a/config/hiddify_option.go +++ b/config/hiddify_option.go @@ -11,6 +11,7 @@ type HiddifyOptions struct { LogFile string `json:"log-file"` EnableClashApi bool `json:"enable-clash-api"` ClashApiPort uint16 `json:"clash-api-port"` + ClashWebPath string `json:"clash-web-path"` ClashApiSecret string `json:"web-secret"` Region string `json:"region"` BlockAds bool `json:"block-ads"` diff --git a/v2/standalone.go b/v2/standalone.go index 58fe9e42..d0eaae7f 100644 --- a/v2/standalone.go +++ b/v2/standalone.go @@ -167,7 +167,7 @@ func buildConfig(configContent string, options config.HiddifyOptions) (string, e } finalconfig.Log.Output = "" - finalconfig.Experimental.ClashAPI.ExternalUI = "/etc/s6-overlay/s6-rc.d/hiddify/webui" + // finalconfig.Experimental.ClashAPI.ExternalUI = "/etc/s6-overlay/s6-rc.d/hiddify/webui" if options.AllowConnectionFromLAN { finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756" } else { From a4329d630075aad6c11d0353eb13cd4d9a33e1bf Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Fri, 10 Jan 2025 11:32:04 +0000 Subject: [PATCH 06/18] add user auth --- config/config.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 60f088c6..f7503e46 100644 --- a/config/config.go +++ b/config/config.go @@ -9,6 +9,8 @@ import ( "net" "net/netip" "net/url" + "os" + "regexp" "runtime" "strings" "time" @@ -16,6 +18,7 @@ import ( C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/option" dns "github.com/sagernet/sing-dns" + "github.com/sagernet/sing/common/auth" ) const ( @@ -39,6 +42,30 @@ const ( InboundDNSTag = "dns-in" ) +func ReplaceEnvVariables(input string) string { + re := regexp.MustCompile(`\$\{(\w+)\}`) + return re.ReplaceAllStringFunc(input, func(m string) string { + varName := m[2 : len(m)-1] + return os.Getenv(varName) + }) +} + +func GetUsers() []auth.User { + username := os.Getenv("PROXY_USER") + password := os.Getenv("PROXY_PASS") + + if username == "" || password == "" { + return []auth.User{} + } + + return []auth.User{ + { + Username: username, + Password: password, + }, + } +} + var OutboundMainProxyTag = OutboundSelectTag func BuildConfigJson(configOpt HiddifyOptions, input option.Options) (string, error) { @@ -274,7 +301,7 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { ClashAPI: &option.ClashAPIOptions{ ExternalController: fmt.Sprintf("%s:%d", "127.0.0.1", opt.ClashApiPort), Secret: opt.ClashApiSecret, - ExternalUI: opt.ClashWebPath, + ExternalUI: ReplaceEnvVariables(opt.ClashWebPath), }, CacheFile: &option.CacheFileOptions{ Enabled: false, @@ -365,6 +392,7 @@ func setInbound(options *option.Options, opt *HiddifyOptions) { DomainStrategy: inboundDomainStrategy, }, }, + Users: GetUsers(), SetSystemProxy: opt.SetSystemProxy, }, }, From 65439e9c9e8b8ddf4921bf6644e110fcc93eb96d Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Fri, 10 Jan 2025 12:04:27 +0000 Subject: [PATCH 07/18] fix --- config/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.go b/config/config.go index f7503e46..9d68f8f0 100644 --- a/config/config.go +++ b/config/config.go @@ -296,6 +296,8 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { if opt.EnableClashApi { if opt.ClashApiSecret == "" { opt.ClashApiSecret = generateRandomString(16) + } else { + opt.ClashApiSecret = ReplaceEnvVariables(opt.ClashApiSecret) } options.Experimental = &option.ExperimentalOptions{ ClashAPI: &option.ClashAPIOptions{ From 30e654cbda114c46e2075563bd5f413fd9fd0c5c Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sat, 11 Jan 2025 01:15:25 +0000 Subject: [PATCH 08/18] fix users init --- config/config.go | 29 ++++++++++++++--------------- config/hiddify_option.go | 20 +++++++++++--------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/config/config.go b/config/config.go index 9d68f8f0..dd73b271 100644 --- a/config/config.go +++ b/config/config.go @@ -50,20 +50,19 @@ func ReplaceEnvVariables(input string) string { }) } -func GetUsers() []auth.User { - username := os.Getenv("PROXY_USER") - password := os.Getenv("PROXY_PASS") - - if username == "" || password == "" { - return []auth.User{} - } - - return []auth.User{ - { - Username: username, - Password: password, - }, - } +func GetUsers(opt *HiddifyOptions) []auth.User { + var newUsers []auth.User + for _, user := range opt.InboundOptions.Users { + newUsername := ReplaceEnvVariables(user.Username) + newPassword := ReplaceEnvVariables(user.Password) + if newUsername != "" && newPassword != "" { + newUsers = append(newUsers, auth.User{ + Username: newUsername, + Password: newPassword, + }) + } + } + return newUsers } var OutboundMainProxyTag = OutboundSelectTag @@ -394,7 +393,7 @@ func setInbound(options *option.Options, opt *HiddifyOptions) { DomainStrategy: inboundDomainStrategy, }, }, - Users: GetUsers(), + Users: GetUsers(opt), SetSystemProxy: opt.SetSystemProxy, }, }, diff --git a/config/hiddify_option.go b/config/hiddify_option.go index 98693fae..53ed9915 100644 --- a/config/hiddify_option.go +++ b/config/hiddify_option.go @@ -3,6 +3,7 @@ package config import ( "github.com/sagernet/sing-box/option" dns "github.com/sagernet/sing-dns" + "github.com/sagernet/sing/common/auth" ) type HiddifyOptions struct { @@ -40,15 +41,16 @@ type DNSOptions struct { } type InboundOptions struct { - EnableTun bool `json:"enable-tun"` - EnableTunService bool `json:"enable-tun-service"` - SetSystemProxy bool `json:"set-system-proxy"` - MixedPort uint16 `json:"mixed-port"` - TProxyPort uint16 `json:"tproxy-port"` - LocalDnsPort uint16 `json:"local-dns-port"` - MTU uint32 `json:"mtu"` - StrictRoute bool `json:"strict-route"` - TUNStack string `json:"tun-implementation"` + EnableTun bool `json:"enable-tun"` + EnableTunService bool `json:"enable-tun-service"` + SetSystemProxy bool `json:"set-system-proxy"` + MixedPort uint16 `json:"mixed-port"` + TProxyPort uint16 `json:"tproxy-port"` + LocalDnsPort uint16 `json:"local-dns-port"` + MTU uint32 `json:"mtu"` + StrictRoute bool `json:"strict-route"` + TUNStack string `json:"tun-implementation"` + Users []auth.User `json:"users,omitempty"` } type URLTestOptions struct { From 51728305443234548e5114695234e68d2bbe91ea Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sat, 11 Jan 2025 01:51:28 +0000 Subject: [PATCH 09/18] remove download link --- config/config.go | 17 +++++++++-------- config/hiddify_option.go | 13 +++++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index dd73b271..87b9e11c 100644 --- a/config/config.go +++ b/config/config.go @@ -623,7 +623,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: opt.GeositeConfigOptions.GeositeAds, UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -632,7 +632,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: opt.GeositeConfigOptions.GeositeMalware, UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -641,7 +641,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: opt.GeositeConfigOptions.GeositePhishing, UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -650,7 +650,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: opt.GeositeConfigOptions.GeositeCryptominers, UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -659,7 +659,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: opt.GeositeConfigOptions.GeoipPhishing, UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -668,7 +668,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: opt.GeositeConfigOptions.GeoipMalware, UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -701,6 +701,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { }) } + opt.Region = ReplaceEnvVariables(opt.Region) if opt.Region != "other" { dnsRules = append(dnsRules, option.DefaultDNSRule{ DomainSuffix: []string{"." + opt.Region}, @@ -726,7 +727,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: ReplaceEnvVariables(opt.GeositeConfigOptions.GeoipRegion), UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -735,7 +736,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: ReplaceEnvVariables(opt.GeositeConfigOptions.GeositeRegion), UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) diff --git a/config/hiddify_option.go b/config/hiddify_option.go index 53ed9915..af1c828d 100644 --- a/config/hiddify_option.go +++ b/config/hiddify_option.go @@ -28,6 +28,19 @@ type HiddifyOptions struct { InboundOptions URLTestOptions RouteOptions + GeositeConfigOptions +} + +// Move the download link to the configuration file +type GeositeConfigOptions struct { + GeositeAds string `json:"geosite-ads"` + GeositeMalware string `json:"geosite-malware"` + GeositePhishing string `json:"geosite-phishing"` + GeositeCryptominers string `json:"geosite-cryptominers"` + GeoipPhishing string `json:"geoip-phishing"` + GeoipMalware string `json:"geoip-malware"` + GeoipRegion string `json:"geoip-region"` + GeositeRegion string `json:"geosite-region"` } type DNSOptions struct { From 54514e56f7d17f77916f1199791688f05a7f33a1 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:17:57 +0800 Subject: [PATCH 10/18] Revert "remove download link" This reverts commit 51728305443234548e5114695234e68d2bbe91ea. --- config/config.go | 17 ++++++++--------- config/hiddify_option.go | 13 ------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/config/config.go b/config/config.go index 87b9e11c..dd73b271 100644 --- a/config/config.go +++ b/config/config.go @@ -623,7 +623,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: opt.GeositeConfigOptions.GeositeAds, + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -632,7 +632,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: opt.GeositeConfigOptions.GeositeMalware, + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -641,7 +641,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: opt.GeositeConfigOptions.GeositePhishing, + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -650,7 +650,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: opt.GeositeConfigOptions.GeositeCryptominers, + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -659,7 +659,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: opt.GeositeConfigOptions.GeoipPhishing, + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -668,7 +668,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: opt.GeositeConfigOptions.GeoipMalware, + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -701,7 +701,6 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { }) } - opt.Region = ReplaceEnvVariables(opt.Region) if opt.Region != "other" { dnsRules = append(dnsRules, option.DefaultDNSRule{ DomainSuffix: []string{"." + opt.Region}, @@ -727,7 +726,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: ReplaceEnvVariables(opt.GeositeConfigOptions.GeoipRegion), + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -736,7 +735,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: ReplaceEnvVariables(opt.GeositeConfigOptions.GeositeRegion), + URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) diff --git a/config/hiddify_option.go b/config/hiddify_option.go index af1c828d..53ed9915 100644 --- a/config/hiddify_option.go +++ b/config/hiddify_option.go @@ -28,19 +28,6 @@ type HiddifyOptions struct { InboundOptions URLTestOptions RouteOptions - GeositeConfigOptions -} - -// Move the download link to the configuration file -type GeositeConfigOptions struct { - GeositeAds string `json:"geosite-ads"` - GeositeMalware string `json:"geosite-malware"` - GeositePhishing string `json:"geosite-phishing"` - GeositeCryptominers string `json:"geosite-cryptominers"` - GeoipPhishing string `json:"geoip-phishing"` - GeoipMalware string `json:"geoip-malware"` - GeoipRegion string `json:"geoip-region"` - GeositeRegion string `json:"geosite-region"` } type DNSOptions struct { From 85285a248588749855a301d320f3cd23c028c046 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:06 +0800 Subject: [PATCH 11/18] Revert "fix users init" This reverts commit 30e654cbda114c46e2075563bd5f413fd9fd0c5c. --- config/config.go | 29 +++++++++++++++-------------- config/hiddify_option.go | 20 +++++++++----------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/config/config.go b/config/config.go index dd73b271..9d68f8f0 100644 --- a/config/config.go +++ b/config/config.go @@ -50,19 +50,20 @@ func ReplaceEnvVariables(input string) string { }) } -func GetUsers(opt *HiddifyOptions) []auth.User { - var newUsers []auth.User - for _, user := range opt.InboundOptions.Users { - newUsername := ReplaceEnvVariables(user.Username) - newPassword := ReplaceEnvVariables(user.Password) - if newUsername != "" && newPassword != "" { - newUsers = append(newUsers, auth.User{ - Username: newUsername, - Password: newPassword, - }) - } - } - return newUsers +func GetUsers() []auth.User { + username := os.Getenv("PROXY_USER") + password := os.Getenv("PROXY_PASS") + + if username == "" || password == "" { + return []auth.User{} + } + + return []auth.User{ + { + Username: username, + Password: password, + }, + } } var OutboundMainProxyTag = OutboundSelectTag @@ -393,7 +394,7 @@ func setInbound(options *option.Options, opt *HiddifyOptions) { DomainStrategy: inboundDomainStrategy, }, }, - Users: GetUsers(opt), + Users: GetUsers(), SetSystemProxy: opt.SetSystemProxy, }, }, diff --git a/config/hiddify_option.go b/config/hiddify_option.go index 53ed9915..98693fae 100644 --- a/config/hiddify_option.go +++ b/config/hiddify_option.go @@ -3,7 +3,6 @@ package config import ( "github.com/sagernet/sing-box/option" dns "github.com/sagernet/sing-dns" - "github.com/sagernet/sing/common/auth" ) type HiddifyOptions struct { @@ -41,16 +40,15 @@ type DNSOptions struct { } type InboundOptions struct { - EnableTun bool `json:"enable-tun"` - EnableTunService bool `json:"enable-tun-service"` - SetSystemProxy bool `json:"set-system-proxy"` - MixedPort uint16 `json:"mixed-port"` - TProxyPort uint16 `json:"tproxy-port"` - LocalDnsPort uint16 `json:"local-dns-port"` - MTU uint32 `json:"mtu"` - StrictRoute bool `json:"strict-route"` - TUNStack string `json:"tun-implementation"` - Users []auth.User `json:"users,omitempty"` + EnableTun bool `json:"enable-tun"` + EnableTunService bool `json:"enable-tun-service"` + SetSystemProxy bool `json:"set-system-proxy"` + MixedPort uint16 `json:"mixed-port"` + TProxyPort uint16 `json:"tproxy-port"` + LocalDnsPort uint16 `json:"local-dns-port"` + MTU uint32 `json:"mtu"` + StrictRoute bool `json:"strict-route"` + TUNStack string `json:"tun-implementation"` } type URLTestOptions struct { From 3e05399db83db3c2d0ea8940c1eb9f2730fa414d Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:11 +0800 Subject: [PATCH 12/18] Revert "fix" This reverts commit 65439e9c9e8b8ddf4921bf6644e110fcc93eb96d. --- config/config.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/config.go b/config/config.go index 9d68f8f0..f7503e46 100644 --- a/config/config.go +++ b/config/config.go @@ -296,8 +296,6 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { if opt.EnableClashApi { if opt.ClashApiSecret == "" { opt.ClashApiSecret = generateRandomString(16) - } else { - opt.ClashApiSecret = ReplaceEnvVariables(opt.ClashApiSecret) } options.Experimental = &option.ExperimentalOptions{ ClashAPI: &option.ClashAPIOptions{ From 432b2f5ff1159d320e613a73655a7c7e004a7527 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:16 +0800 Subject: [PATCH 13/18] Revert "add user auth" This reverts commit a4329d630075aad6c11d0353eb13cd4d9a33e1bf. --- config/config.go | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/config/config.go b/config/config.go index f7503e46..60f088c6 100644 --- a/config/config.go +++ b/config/config.go @@ -9,8 +9,6 @@ import ( "net" "net/netip" "net/url" - "os" - "regexp" "runtime" "strings" "time" @@ -18,7 +16,6 @@ import ( C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/option" dns "github.com/sagernet/sing-dns" - "github.com/sagernet/sing/common/auth" ) const ( @@ -42,30 +39,6 @@ const ( InboundDNSTag = "dns-in" ) -func ReplaceEnvVariables(input string) string { - re := regexp.MustCompile(`\$\{(\w+)\}`) - return re.ReplaceAllStringFunc(input, func(m string) string { - varName := m[2 : len(m)-1] - return os.Getenv(varName) - }) -} - -func GetUsers() []auth.User { - username := os.Getenv("PROXY_USER") - password := os.Getenv("PROXY_PASS") - - if username == "" || password == "" { - return []auth.User{} - } - - return []auth.User{ - { - Username: username, - Password: password, - }, - } -} - var OutboundMainProxyTag = OutboundSelectTag func BuildConfigJson(configOpt HiddifyOptions, input option.Options) (string, error) { @@ -301,7 +274,7 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { ClashAPI: &option.ClashAPIOptions{ ExternalController: fmt.Sprintf("%s:%d", "127.0.0.1", opt.ClashApiPort), Secret: opt.ClashApiSecret, - ExternalUI: ReplaceEnvVariables(opt.ClashWebPath), + ExternalUI: opt.ClashWebPath, }, CacheFile: &option.CacheFileOptions{ Enabled: false, @@ -392,7 +365,6 @@ func setInbound(options *option.Options, opt *HiddifyOptions) { DomainStrategy: inboundDomainStrategy, }, }, - Users: GetUsers(), SetSystemProxy: opt.SetSystemProxy, }, }, From 338ddf23d0e5b561487324eb82747aa2199790aa Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:23 +0800 Subject: [PATCH 14/18] Revert "add web_ui_path" This reverts commit 1983bdbee3aa0867726fe1e1d4a3973a4fb3db27. --- config/config.go | 2 +- config/hiddify_option.go | 1 - v2/standalone.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 60f088c6..d1b280a6 100644 --- a/config/config.go +++ b/config/config.go @@ -274,8 +274,8 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { ClashAPI: &option.ClashAPIOptions{ ExternalController: fmt.Sprintf("%s:%d", "127.0.0.1", opt.ClashApiPort), Secret: opt.ClashApiSecret, - ExternalUI: opt.ClashWebPath, }, + CacheFile: &option.CacheFileOptions{ Enabled: false, Path: "clash.db", diff --git a/config/hiddify_option.go b/config/hiddify_option.go index 98693fae..5b13242e 100644 --- a/config/hiddify_option.go +++ b/config/hiddify_option.go @@ -11,7 +11,6 @@ type HiddifyOptions struct { LogFile string `json:"log-file"` EnableClashApi bool `json:"enable-clash-api"` ClashApiPort uint16 `json:"clash-api-port"` - ClashWebPath string `json:"clash-web-path"` ClashApiSecret string `json:"web-secret"` Region string `json:"region"` BlockAds bool `json:"block-ads"` diff --git a/v2/standalone.go b/v2/standalone.go index d0eaae7f..58fe9e42 100644 --- a/v2/standalone.go +++ b/v2/standalone.go @@ -167,7 +167,7 @@ func buildConfig(configContent string, options config.HiddifyOptions) (string, e } finalconfig.Log.Output = "" - // finalconfig.Experimental.ClashAPI.ExternalUI = "/etc/s6-overlay/s6-rc.d/hiddify/webui" + finalconfig.Experimental.ClashAPI.ExternalUI = "/etc/s6-overlay/s6-rc.d/hiddify/webui" if options.AllowConnectionFromLAN { finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756" } else { From e984766c2cda88b838cf4bdf634c8f92f93778db Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:26 +0800 Subject: [PATCH 15/18] Revert "proxy" This reverts commit db83a0b4da6be2a208a6ae4a0bba9b6a02ff4f43. --- config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index d1b280a6..2d4b6b3c 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -603,7 +603,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -612,7 +612,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -621,7 +621,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -630,7 +630,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -639,7 +639,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -697,7 +697,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -706,7 +706,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh.api.99988866.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) From 8f756caf7b381e1a09f03b6bd59b4c9cad20568c Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:30 +0800 Subject: [PATCH 16/18] Revert "proxy" This reverts commit af02780bf25abba43983df2fbedfbddd81210a8f. --- config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 2d4b6b3c..85752541 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -603,7 +603,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -612,7 +612,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -621,7 +621,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -630,7 +630,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -639,7 +639,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -697,7 +697,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -706,7 +706,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://gh-proxy.com/raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) From aa8fd26c521b694f9aa9f53ce67485516c8f8b59 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:35 +0800 Subject: [PATCH 17/18] Revert "add proxy http srs" This reverts commit 3a7f49ec34f77386f6a36d4168994a1fd6844e89. --- config/config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 85752541..cce1afd3 100644 --- a/config/config.go +++ b/config/config.go @@ -594,7 +594,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-ads", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-category-ads-all.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -603,7 +603,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -612,7 +612,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -621,7 +621,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-cryptominers", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geosite-cryptominers.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -630,7 +630,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-phishing", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-phishing.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -639,7 +639,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-malware", Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/block/geoip-malware.srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -697,7 +697,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geoip-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geoip-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) @@ -706,7 +706,7 @@ func setRoutingOptions(options *option.Options, opt *HiddifyOptions) { Tag: "geosite-" + opt.Region, Format: C.RuleSetFormatBinary, RemoteOptions: option.RemoteRuleSet{ - URL: "https://ghgo.xyz/https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", + URL: "https://raw.githubusercontent.com/hiddify/hiddify-geo/rule-set/country/geosite-" + opt.Region + ".srs", UpdateInterval: option.Duration(5 * time.Hour * 24), }, }) From 9c98db6355409f5b236c0e548ad4e82b03138c38 Mon Sep 17 00:00:00 2001 From: chenxudong2020 <872603935@qq.com> Date: Sun, 4 May 2025 21:18:38 +0800 Subject: [PATCH 18/18] =?UTF-8?q?Revert=20"=E4=B8=AA=E6=80=A7=E5=8C=96"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 442994f15a4f2de4fe16ec0c1e37875e83572a35. --- config/config.go | 2 +- v2/standalone.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index cce1afd3..383b1194 100644 --- a/config/config.go +++ b/config/config.go @@ -277,7 +277,7 @@ func setClashAPI(options *option.Options, opt *HiddifyOptions) { }, CacheFile: &option.CacheFileOptions{ - Enabled: false, + Enabled: true, Path: "clash.db", }, } diff --git a/v2/standalone.go b/v2/standalone.go index 58fe9e42..173c9eef 100644 --- a/v2/standalone.go +++ b/v2/standalone.go @@ -167,7 +167,7 @@ func buildConfig(configContent string, options config.HiddifyOptions) (string, e } finalconfig.Log.Output = "" - finalconfig.Experimental.ClashAPI.ExternalUI = "/etc/s6-overlay/s6-rc.d/hiddify/webui" + finalconfig.Experimental.ClashAPI.ExternalUI = "webui" if options.AllowConnectionFromLAN { finalconfig.Experimental.ClashAPI.ExternalController = "0.0.0.0:6756" } else {