forked from mirror/serenity
Fix geosite usage
This commit is contained in:
parent
9fb2abc833
commit
17101f7d11
@ -114,48 +114,18 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
|
|||||||
if !t.DisableTrafficBypass {
|
if !t.DisableTrafficBypass {
|
||||||
if t.DisableRuleSet || (metadata.Version != nil && metadata.Version.LessThan(semver.ParseVersion("1.8.0-alpha.10"))) {
|
if t.DisableRuleSet || (metadata.Version != nil && metadata.Version.LessThan(semver.ParseVersion("1.8.0-alpha.10"))) {
|
||||||
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
|
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
|
||||||
Type: C.RuleTypeLogical,
|
Type: C.RuleTypeDefault,
|
||||||
LogicalOptions: option.LogicalDNSRule{
|
DefaultOptions: option.DefaultDNSRule{
|
||||||
Mode: C.LogicalTypeAnd,
|
Geosite: []string{"geolocation-cn"},
|
||||||
Rules: []option.DNSRule{
|
Server: DNSLocalTag,
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultDNSRule{
|
|
||||||
Geosite: []string{"geolocation-!cn"},
|
|
||||||
Invert: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultDNSRule{
|
|
||||||
Geosite: []string{"cn"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Server: DNSLocalTag,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
|
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
|
||||||
Type: C.RuleTypeLogical,
|
Type: C.RuleTypeDefault,
|
||||||
LogicalOptions: option.LogicalDNSRule{
|
DefaultOptions: option.DefaultDNSRule{
|
||||||
Mode: C.LogicalTypeAnd,
|
RuleSet: []string{"geosite-geolocation-cn"},
|
||||||
Rules: []option.DNSRule{
|
Server: DNSLocalTag,
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultDNSRule{
|
|
||||||
RuleSet: []string{"geosite-geolocation-!cn"},
|
|
||||||
Invert: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultDNSRule{
|
|
||||||
RuleSet: []string{"geosite-cn"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Server: DNSLocalTag,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -68,19 +68,10 @@ func (t *Template) renderGeoResources(metadata M.Metadata, options *option.Optio
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: C.RuleSetTypeRemote,
|
Type: C.RuleSetTypeRemote,
|
||||||
Tag: "geosite-cn",
|
Tag: "geosite-geolocation-cn",
|
||||||
Format: C.RuleSetFormatBinary,
|
Format: C.RuleSetFormatBinary,
|
||||||
RemoteOptions: option.RemoteRuleSet{
|
RemoteOptions: option.RemoteRuleSet{
|
||||||
URL: downloadURL + "SagerNet/sing-geosite" + branchSplit + "rule-set/geosite-cn.srs",
|
URL: downloadURL + "SagerNet/sing-geosite" + branchSplit + "rule-set/geosite-geolocation-cn.srs",
|
||||||
DownloadDetour: downloadDetour,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: C.RuleSetTypeRemote,
|
|
||||||
Tag: "geosite-geolocation-!cn",
|
|
||||||
Format: C.RuleSetFormatBinary,
|
|
||||||
RemoteOptions: option.RemoteRuleSet{
|
|
||||||
URL: downloadURL + "SagerNet/sing-geosite" + branchSplit + "rule-set/geosite-geolocation-!cn.srs",
|
|
||||||
DownloadDetour: downloadDetour,
|
DownloadDetour: downloadDetour,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -121,50 +121,19 @@ func (t *Template) renderRoute(metadata M.Metadata, options *option.Options) err
|
|||||||
if !t.DisableTrafficBypass {
|
if !t.DisableTrafficBypass {
|
||||||
if t.DisableRuleSet || disable18Features {
|
if t.DisableRuleSet || disable18Features {
|
||||||
options.Route.Rules = append(options.Route.Rules, option.Rule{
|
options.Route.Rules = append(options.Route.Rules, option.Rule{
|
||||||
Type: C.RuleTypeLogical,
|
Type: C.RuleTypeDefault,
|
||||||
LogicalOptions: option.LogicalRule{
|
DefaultOptions: option.DefaultRule{
|
||||||
Mode: C.LogicalTypeAnd,
|
GeoIP: []string{"cn"},
|
||||||
Rules: []option.Rule{
|
Geosite: []string{"geolocation-cn"},
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultRule{
|
|
||||||
Geosite: []string{"geolocation-!cn"},
|
|
||||||
Invert: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultRule{
|
|
||||||
GeoIP: []string{"cn"},
|
|
||||||
Geosite: []string{"cn"},
|
|
||||||
Domain: []string{"download.jetbrains.com"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Outbound: directTag,
|
Outbound: directTag,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
options.Route.Rules = append(options.Route.Rules, option.Rule{
|
options.Route.Rules = append(options.Route.Rules, option.Rule{
|
||||||
Type: C.RuleTypeLogical,
|
Type: C.RuleTypeDefault,
|
||||||
LogicalOptions: option.LogicalRule{
|
DefaultOptions: option.DefaultRule{
|
||||||
Mode: C.LogicalTypeAnd,
|
RuleSet: []string{"geoip-cn", "geosite-geolocation-cn"},
|
||||||
Rules: []option.Rule{
|
Outbound: directTag,
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultRule{
|
|
||||||
RuleSet: []string{"geosite-geolocation-!cn"},
|
|
||||||
Invert: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Type: C.RuleTypeDefault,
|
|
||||||
DefaultOptions: option.DefaultRule{
|
|
||||||
RuleSet: []string{"geoip-cn", "geosite-cn"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Outbound: "direct",
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user