diff --git a/option/template.go b/option/template.go index f8c6b70..9dd4bb8 100644 --- a/option/template.go +++ b/option/template.go @@ -1,11 +1,9 @@ package option import ( - M "github.com/sagernet/serenity/common/metadata" "github.com/sagernet/serenity/common/semver" "github.com/sagernet/sing-box/option" "github.com/sagernet/sing-dns" - "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/json/badjson" ) @@ -69,20 +67,6 @@ func (t Template) DisableIPv6() bool { return t.DomainStrategy == option.DomainStrategy(dns.DomainStrategyUseIPv4) } -func (t Template) ChinaGeositeList(metadata M.Metadata) []string { - chinaCodes := []string{"cn", "category-companies@cn"} - if metadata.Platform.IsApple() { - chinaCodes = append(chinaCodes, "apple-update") - } - return chinaCodes -} - -func (t Template) ChinaGeositeRuleSetList(metadata M.Metadata) []string { - return common.Map(t.ChinaGeositeList(metadata), func(it string) string { - return "geosite-" + it - }) -} - type ExtraGroup struct { Tag string `json:"tag,omitempty"` Type string `json:"type,omitempty"` diff --git a/template/render_dns.go b/template/render_dns.go index 3b9e56f..2d0901f 100644 --- a/template/render_dns.go +++ b/template/render_dns.go @@ -128,7 +128,7 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error { Type: C.RuleTypeDefault, DefaultOptions: option.DefaultDNSRule{ - Geosite: t.ChinaGeositeList(metadata), + Geosite: []string{"cn"}, }, }, }, @@ -151,8 +151,7 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error { Type: C.RuleTypeDefault, DefaultOptions: option.DefaultDNSRule{ - RuleSet: t.ChinaGeositeRuleSetList(metadata), - DomainSuffix: []string{"download.jetbrains.com"}, + RuleSet: []string{"geosite-cn"}, }, }, }, diff --git a/template/render_geo_resources.go b/template/render_geo_resources.go index b40c2aa..c82e714 100644 --- a/template/render_geo_resources.go +++ b/template/render_geo_resources.go @@ -84,26 +84,6 @@ func (t *Template) renderGeoResources(metadata M.Metadata, options *option.Optio DownloadDetour: downloadDetour, }, }, - { - Type: C.RuleSetTypeRemote, - Tag: "geosite-category-companies@cn", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: downloadURL + "SagerNet/sing-geosite" + branchSplit + "rule-set/geosite-category-companies@cn.srs", - DownloadDetour: downloadDetour, - }, - }, - } - if metadata.Platform.IsApple() { - options.Route.RuleSet = append(options.Route.RuleSet, option.RuleSet{ - Type: C.RuleSetTypeRemote, - Tag: "geosite-apple-update", - Format: C.RuleSetFormatBinary, - RemoteOptions: option.RemoteRuleSet{ - URL: downloadURL + "SagerNet/sing-geosite" + branchSplit + "rule-set/geosite-apple-update.srs", - DownloadDetour: downloadDetour, - }, - }) } } } diff --git a/template/render_route.go b/template/render_route.go index 8193995..06056de 100644 --- a/template/render_route.go +++ b/template/render_route.go @@ -136,7 +136,7 @@ func (t *Template) renderRoute(metadata M.Metadata, options *option.Options) err Type: C.RuleTypeDefault, DefaultOptions: option.DefaultRule{ GeoIP: []string{"cn"}, - Geosite: t.ChinaGeositeList(metadata), + Geosite: []string{"cn"}, Domain: []string{"download.jetbrains.com"}, }, }, @@ -160,8 +160,7 @@ func (t *Template) renderRoute(metadata M.Metadata, options *option.Options) err { Type: C.RuleTypeDefault, DefaultOptions: option.DefaultRule{ - RuleSet: append([]string{"geoip-cn"}, t.ChinaGeositeRuleSetList(metadata)...), - Domain: []string{"download.jetbrains.com"}, + RuleSet: []string{"geoip-cn", "geosite-cn"}, }, }, },