diff --git a/docs/changelog.md b/docs/changelog.md index 9c1a6de..204b0b6 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,8 +2,10 @@ icon: material/alert-decagram --- -#### 1.1.0-alpha.4 +#### 1.1.0-beta.3 +* Rename `template.servers` to `template.dns_servers` +* Set `tun.route_exclude_address_set` for traffic bypassing * Fixes and improvements #### 1.1.0-alpha.3 diff --git a/docs/configuration/template.md b/docs/configuration/template.md index d4a5e34..04f0b09 100644 --- a/docs/configuration/template.md +++ b/docs/configuration/template.md @@ -19,6 +19,7 @@ "dns": "", "dns_local": "", + "dns_servers": [], "enable_fakeip": false, "pre_dns_rules": [], "custom_dns_rules": [], @@ -143,6 +144,12 @@ DNS server used for China DNS requests. `114.114.114.114` is used by default. +#### dns_servers + +List of [DNS Server](https://sing-box.sagernet.org/configuration/dns/server/). + +Will be append to DNS servers. + #### enable_fakeip Enable FakeIP. diff --git a/docs/index.zh.md b/docs/index.zh.md index 54060c0..88b5bf4 100644 --- a/docs/index.zh.md +++ b/docs/index.zh.md @@ -1,10 +1,10 @@ --- -description: 欢迎来到该 sing-box 项目的文档页。 +description: 欢迎来到该 serenity 项目的文档页。 --- # :material-home: 开始 -欢迎来到该 sing-box 项目的文档页。 +欢迎来到该 serenity 项目的文档页。 sing-box 配置生成器。 diff --git a/option/template.go b/option/template.go index e9d22a5..8b689c6 100644 --- a/option/template.go +++ b/option/template.go @@ -28,7 +28,7 @@ type _Template struct { RemoteResolve bool `json:"remote_resolve,omitempty"` // DNS - CustomDNSServers []option.DNSServerOptions `json:"custom_dns_servers,omitempty"` + DNSServers []option.DNSServerOptions `json:"dns_servers,omitempty"` DNS string `json:"dns,omitempty"` DNSLocal string `json:"dns_local,omitempty"` DNSSetup string `json:"dns_setup,omitempty"` diff --git a/subscription/parser/raw.go b/subscription/parser/raw.go index aa7a75c..72205c3 100644 --- a/subscription/parser/raw.go +++ b/subscription/parser/raw.go @@ -39,6 +39,6 @@ func decodeBase64URLSafe(content string) (string, error) { content = strings.ReplaceAll(content, "/", "_") content = strings.ReplaceAll(content, "+", "-") content = strings.ReplaceAll(content, "=", "") - result, err := base64.StdEncoding.DecodeString(content) + result, err := base64.RawURLEncoding.DecodeString(content) return string(result), err } diff --git a/template/manager.go b/template/manager.go index b6fa0ae..0f7bdb9 100644 --- a/template/manager.go +++ b/template/manager.go @@ -45,7 +45,7 @@ func extendTemplate(ctx context.Context, rawTemplates []option.Template, root, c if err != nil { return option.Template{}, E.Cause(err, "initialize template[", current.Name, "]: merge extended template: ", current.Extend) } - newTemplate, err := json.UnmarshalExtended[option.Template](newRawTemplate) + newTemplate, err := json.UnmarshalExtendedContext[option.Template](ctx, newRawTemplate) if err != nil { return option.Template{}, E.Cause(err, "initialize template[", current.Name, "]: unmarshal extended template: ", current.Extend) } diff --git a/template/render_dns.go b/template/render_dns.go index 08bf61f..2b40885 100644 --- a/template/render_dns.go +++ b/template/render_dns.go @@ -130,11 +130,7 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error Address: "fakeip", }) } - - if len(t.CustomDNSServers) > 0 { - options.DNS.Servers = append(options.DNS.Servers, t.CustomDNSServers...) - } - + options.DNS.Servers = append(options.DNS.Servers, t.DNSServers...) options.DNS.Rules = []option.DNSRule{ { Type: C.RuleTypeDefault, diff --git a/template/render_inbounds.go b/template/render_inbounds.go index 6121070..e5fa620 100644 --- a/template/render_inbounds.go +++ b/template/render_inbounds.go @@ -29,6 +29,7 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options) autoRedirect := t.AutoRedirect && !metadata.Platform.IsApple() && (metadata.Version == nil || metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.10.0-alpha.2"))) + tunExclude := metadata.Platform != M.PlatformAndroid && (metadata.Version == nil || metadata.Version.GreaterThanOrEqual(semver.ParseVersion("1.11.0-beta.14"))) disableTun := t.DisableTUN && !metadata.Platform.TunOnly() if !disableTun { options.Route.AutoDetectInterface = true @@ -37,18 +38,16 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options) address = append(address, netip.MustParsePrefix("fdfe:dcba:9876::1/126")) } tunOptions := &option.TunInboundOptions{ - AutoRoute: true, - Address: address, + AutoRoute: true, + Address: address, + AutoRedirect: autoRedirect, } tunInbound := option.Inbound{ Type: C.TypeTun, Options: tunOptions, } - if autoRedirect { - tunOptions.AutoRedirect = true - if !t.DisableTrafficBypass && metadata.Platform == "" { - tunOptions.RouteExcludeAddressSet = []string{"geoip-cn"} - } + if tunExclude && !t.DisableTrafficBypass { + tunOptions.RouteExcludeAddressSet = []string{"geoip-cn"} } if metadata.Platform == M.PlatformUnknown { tunOptions.StrictRoute = true