Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Sep 11, 2024
1 parent adab7ec commit 877108a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,15 @@ func filterNullGroupReference(metadata M.Metadata, options *option.Options) erro
}
options.Outbounds[i] = outbound
}
options.Route.Rules = common.Filter(options.Route.Rules, func(it option.Rule) bool {
switch it.Type {
case C.RuleTypeDefault:
return common.Contains(outboundTags, it.DefaultOptions.Outbound)
case C.RuleTypeLogical:
return common.Contains(outboundTags, it.LogicalOptions.Outbound)
default:
panic("no")
}
})
return nil
}
2 changes: 1 addition & 1 deletion template/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func extendTemplate(rawTemplates []option.Template, root, current option.Templat
}
next = newNext
}
newRawTemplate, err := badjson.MergeJSON(next.RawMessage, current.RawMessage, true)
newRawTemplate, err := badjson.MergeJSON(next.RawMessage, current.RawMessage, false)
if err != nil {
return option.Template{}, E.Cause(err, "initialize template[", current.Name, "]: merge extended template: ", current.Extend)
}
Expand Down
2 changes: 1 addition & 1 deletion template/render_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
},
})
}
if !t.DisableDNSLeak && (metadata.Version != nil && metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.9.0-alpha.1"))) {
if !t.DisableDNSLeak && (metadata.Version == nil || metadata.Version.LessThan(semver.ParseVersion("1.9.0-alpha.1"))) {
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultDNSRule{
Expand Down
4 changes: 2 additions & 2 deletions template/render_experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (t *Template) renderExperimental(metadata M.Metadata, options *option.Optio
CacheID: profileName,
StoreFakeIP: t.EnableFakeIP,
}
if !t.DisableDNSLeak && (metadata.Version != nil && metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.9.0-alpha.8"))) {
if !t.DisableDNSLeak && (metadata.Version == nil || metadata.Version.LessThan(semver.ParseVersion("1.9.0-alpha.1"))) {
options.Experimental.CacheFile.StoreRDRC = true
}
}
Expand All @@ -51,7 +51,7 @@ func (t *Template) renderExperimental(metadata M.Metadata, options *option.Optio
}

if !t.DisableClashMode {
if !t.DisableDNSLeak && (metadata.Version != nil && metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.9.0-alpha.1"))) {
if !t.DisableDNSLeak && (metadata.Version == nil || metadata.Version.LessThan(semver.ParseVersion("1.9.0-alpha.1"))) {
clashModeLeak := t.ClashModeLeak
if clashModeLeak == "" {
clashModeLeak = "Leak"
Expand Down

0 comments on commit 877108a

Please sign in to comment.