Add route address set

This commit is contained in:
世界 2024-06-16 22:22:29 +08:00
parent a56df2aae1
commit 6a68e63049
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 7 additions and 2 deletions

View File

@ -12,13 +12,15 @@ func init() {
} }
func filter1100(metadata metadata.Metadata, options *option.Options) { 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 return
} }
newInbounds := make([]option.Inbound, 0, len(options.Inbounds)) newInbounds := make([]option.Inbound, 0, len(options.Inbounds))
for _, inbound := range 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.AutoRedirect = false
inbound.TunOptions.RouteAddressSet = nil
inbound.TunOptions.RouteExcludeAddressSet = nil
} }
newInbounds = append(newInbounds, inbound) newInbounds = append(newInbounds, inbound)
} }

View File

@ -50,6 +50,9 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options)
} }
if autoRedirect { if autoRedirect {
tunInbound.TunOptions.AutoRedirect = true tunInbound.TunOptions.AutoRedirect = true
if !t.DisableTrafficBypass {
tunInbound.TunOptions.RouteExcludeAddressSet = []string{"geoip-cn"}
}
} }
if t.EnableFakeIP { if t.EnableFakeIP {
tunInbound.TunOptions.InboundOptions.DomainStrategy = domainStrategy tunInbound.TunOptions.InboundOptions.DomainStrategy = domainStrategy