Fix render sequence

This commit is contained in:
世界 2024-03-26 19:02:49 +08:00
parent 871aa3919d
commit 06cea13da6
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
3 changed files with 4 additions and 10 deletions

View File

@ -26,9 +26,6 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options)
} }
disableTun := t.DisableTUN && !metadata.Platform.TunOnly() disableTun := t.DisableTUN && !metadata.Platform.TunOnly()
if !disableTun { if !disableTun {
if options.Route == nil {
options.Route = &option.RouteOptions{}
}
options.Route.AutoDetectInterface = true options.Route.AutoDetectInterface = true
var inet6Address []netip.Prefix var inet6Address []netip.Prefix

View File

@ -15,9 +15,6 @@ func (t *Template) renderOutbounds(metadata M.Metadata, options *option.Options,
if defaultTag == "" { if defaultTag == "" {
defaultTag = DefaultDefaultTag defaultTag = DefaultDefaultTag
} }
if options.Route == nil {
options.Route = &option.RouteOptions{}
}
options.Route.Final = defaultTag options.Route.Final = defaultTag
directTag := t.DirectTag directTag := t.DirectTag
if directTag == "" { if directTag == "" {

View File

@ -45,6 +45,10 @@ func (t *Template) Render(metadata M.Metadata, profileName string, outbounds [][
if err != nil { if err != nil {
return nil, E.Cause(err, "render dns") return nil, E.Cause(err, "render dns")
} }
err = t.renderRoute(metadata, &options)
if err != nil {
return nil, E.Cause(err, "render route")
}
err = t.renderInbounds(metadata, &options) err = t.renderInbounds(metadata, &options)
if err != nil { if err != nil {
return nil, E.Cause(err, "render inbounds") return nil, E.Cause(err, "render inbounds")
@ -53,10 +57,6 @@ func (t *Template) Render(metadata M.Metadata, profileName string, outbounds [][
if err != nil { if err != nil {
return nil, E.Cause(err, "render outbounds") return nil, E.Cause(err, "render outbounds")
} }
err = t.renderRoute(metadata, &options)
if err != nil {
return nil, E.Cause(err, "render route")
}
err = t.renderExperimental(metadata, &options, profileName) err = t.renderExperimental(metadata, &options, profileName)
if err != nil { if err != nil {
return nil, E.Cause(err, "render experimental") return nil, E.Cause(err, "render experimental")