diff --git a/template/render_inbounds.go b/template/render_inbounds.go index 8c20d4f..ecd69f3 100644 --- a/template/render_inbounds.go +++ b/template/render_inbounds.go @@ -26,9 +26,6 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options) } disableTun := t.DisableTUN && !metadata.Platform.TunOnly() if !disableTun { - if options.Route == nil { - options.Route = &option.RouteOptions{} - } options.Route.AutoDetectInterface = true var inet6Address []netip.Prefix diff --git a/template/render_outbounds.go b/template/render_outbounds.go index 1b96b21..4f8f165 100644 --- a/template/render_outbounds.go +++ b/template/render_outbounds.go @@ -15,9 +15,6 @@ func (t *Template) renderOutbounds(metadata M.Metadata, options *option.Options, if defaultTag == "" { defaultTag = DefaultDefaultTag } - if options.Route == nil { - options.Route = &option.RouteOptions{} - } options.Route.Final = defaultTag directTag := t.DirectTag if directTag == "" { diff --git a/template/template.go b/template/template.go index 8ed7402..6dc6067 100644 --- a/template/template.go +++ b/template/template.go @@ -45,6 +45,10 @@ func (t *Template) Render(metadata M.Metadata, profileName string, outbounds [][ if err != nil { 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) if err != nil { return nil, E.Cause(err, "render inbounds") @@ -53,10 +57,6 @@ func (t *Template) Render(metadata M.Metadata, profileName string, outbounds [][ if err != nil { 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) if err != nil { return nil, E.Cause(err, "render experimental")