Minor fixes

This commit is contained in:
世界 2024-09-12 07:38:29 +08:00
parent adab7ec47e
commit 383aede207
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
4 changed files with 14 additions and 4 deletions

View File

@ -30,5 +30,15 @@ func filterNullGroupReference(metadata M.Metadata, options *option.Options) erro
} }
options.Outbounds[i] = outbound 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 return nil
} }

View File

@ -41,7 +41,7 @@ func extendTemplate(rawTemplates []option.Template, root, current option.Templat
} }
next = newNext next = newNext
} }
newRawTemplate, err := badjson.MergeJSON(next.RawMessage, current.RawMessage, true) newRawTemplate, err := badjson.MergeJSON(next.RawMessage, current.RawMessage, false)
if err != nil { if err != nil {
return option.Template{}, E.Cause(err, "initialize template[", current.Name, "]: merge extended template: ", current.Extend) return option.Template{}, E.Cause(err, "initialize template[", current.Name, "]: merge extended template: ", current.Extend)
} }

View File

@ -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.GreaterThanOrEqual(semver.ParseVersion("1.9.0-alpha.1"))) {
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{ options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
Type: C.RuleTypeDefault, Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultDNSRule{ DefaultOptions: option.DefaultDNSRule{

View File

@ -30,7 +30,7 @@ func (t *Template) renderExperimental(metadata M.Metadata, options *option.Optio
CacheID: profileName, CacheID: profileName,
StoreFakeIP: t.EnableFakeIP, 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.GreaterThanOrEqual(semver.ParseVersion("1.9.0-alpha.1"))) {
options.Experimental.CacheFile.StoreRDRC = true options.Experimental.CacheFile.StoreRDRC = true
} }
} }
@ -51,7 +51,7 @@ func (t *Template) renderExperimental(metadata M.Metadata, options *option.Optio
} }
if !t.DisableClashMode { 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.GreaterThanOrEqual(semver.ParseVersion("1.9.0-alpha.1"))) {
clashModeLeak := t.ClashModeLeak clashModeLeak := t.ClashModeLeak
if clashModeLeak == "" { if clashModeLeak == "" {
clashModeLeak = "Leak" clashModeLeak = "Leak"