From 6a68e63049040bfed749606be49eb57a910845cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 16 Jun 2024 22:22:29 +0800 Subject: [PATCH] Add route address set --- template/filter/filter_1100.go | 6 ++++-- template/render_inbounds.go | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/template/filter/filter_1100.go b/template/filter/filter_1100.go index c0c0d55..22f1811 100644 --- a/template/filter/filter_1100.go +++ b/template/filter/filter_1100.go @@ -12,13 +12,15 @@ func init() { } func filter1100(metadata metadata.Metadata, options *option.Options) { - if metadata.Version == nil || metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.10.0-alpha.2")) { + if metadata.Version == nil || metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.10.0-alpha.13")) { return } newInbounds := make([]option.Inbound, 0, len(options.Inbounds)) for _, inbound := range options.Inbounds { - if inbound.Type == C.TypeTun && inbound.TunOptions.AutoRedirect { + if inbound.Type == C.TypeTun { inbound.TunOptions.AutoRedirect = false + inbound.TunOptions.RouteAddressSet = nil + inbound.TunOptions.RouteExcludeAddressSet = nil } newInbounds = append(newInbounds, inbound) } diff --git a/template/render_inbounds.go b/template/render_inbounds.go index b31832f..634159f 100644 --- a/template/render_inbounds.go +++ b/template/render_inbounds.go @@ -50,6 +50,9 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options) } if autoRedirect { tunInbound.TunOptions.AutoRedirect = true + if !t.DisableTrafficBypass { + tunInbound.TunOptions.RouteExcludeAddressSet = []string{"geoip-cn"} + } } if t.EnableFakeIP { tunInbound.TunOptions.InboundOptions.DomainStrategy = domainStrategy