Merge branch 'dev' of git.puqns67.icu:mirror/serenity into dev

This commit is contained in:
Puqns67 2025-01-04 20:03:42 +08:00
commit ea629c413d
Signed by: Puqns67
GPG Key ID: 9669DF042554F536
8 changed files with 22 additions and 18 deletions

View File

@ -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

View File

@ -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.

View File

@ -1,10 +1,10 @@
---
description: 欢迎来到该 sing-box 项目的文档页。
description: 欢迎来到该 serenity 项目的文档页。
---
# :material-home: 开始
欢迎来到该 sing-box 项目的文档页。
欢迎来到该 serenity 项目的文档页。
sing-box 配置生成器。

View File

@ -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"`

View File

@ -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
}

View File

@ -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)
}

View File

@ -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,

View File

@ -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
@ -39,17 +40,15 @@ func (t *Template) renderInbounds(metadata M.Metadata, options *option.Options)
tunOptions := &option.TunInboundOptions{
AutoRoute: true,
Address: address,
AutoRedirect: autoRedirect,
}
tunInbound := option.Inbound{
Type: C.TypeTun,
Options: tunOptions,
}
if autoRedirect {
tunOptions.AutoRedirect = true
if !t.DisableTrafficBypass && metadata.Platform == "" {
if tunExclude && !t.DisableTrafficBypass {
tunOptions.RouteExcludeAddressSet = []string{"geoip-cn"}
}
}
if metadata.Platform == M.PlatformUnknown {
tunOptions.StrictRoute = true
}