Add bypass_domain and search_domain platform HTTP proxy options

This commit is contained in:
世界 2024-02-19 00:19:33 +08:00
parent a2098c18e1
commit 8a9a77a438
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
12 changed files with 114 additions and 16 deletions

View file

@ -395,7 +395,7 @@ see [TCP Brutal](/configuration/shared/tcp-brutal/) for details.
**5**: **5**:
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
#### 1.7.0-rc.3 #### 1.7.0-rc.3
@ -432,7 +432,7 @@ Only supported in graphical clients on Android and iOS.
**1**: **1**:
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
#### 1.7.0-beta.3 #### 1.7.0-beta.3

View file

@ -287,7 +287,7 @@ Match Clash mode.
!!! quote "" !!! quote ""
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
Match WiFi SSID. Match WiFi SSID.
@ -295,7 +295,7 @@ Match WiFi SSID.
!!! quote "" !!! quote ""
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
Match WiFi BSSID. Match WiFi BSSID.

View file

@ -285,7 +285,7 @@ DNS 查询类型。值可以为整数或者类型名称字符串。
!!! quote "" !!! quote ""
仅在 Android 与 iOS 的图形客户端中支持。 仅在 Android 与 Apple 平台图形客户端中支持。
匹配 WiFi SSID。 匹配 WiFi SSID。
@ -293,7 +293,7 @@ DNS 查询类型。值可以为整数或者类型名称字符串。
!!! quote "" !!! quote ""
仅在 Android 与 iOS 的图形客户端中支持。 仅在 Android 与 Apple 平台图形客户端中支持。
匹配 WiFi BSSID。 匹配 WiFi BSSID。

View file

@ -42,6 +42,6 @@ No authentication required if empty.
!!! warning "" !!! warning ""
To work on Android and iOS without privileges, use tun.platform.http_proxy instead. To work on Android and Apple platforms without privileges, use tun.platform.http_proxy instead.
Automatically set system proxy configuration when start and clean up when stop. Automatically set system proxy configuration when start and clean up when stop.

View file

@ -39,6 +39,6 @@ No authentication required if empty.
!!! warning "" !!! warning ""
To work on Android and iOS without privileges, use tun.platform.http_proxy instead. To work on Android and Apple platforms without privileges, use tun.platform.http_proxy instead.
Automatically set system proxy configuration when start and clean up when stop. Automatically set system proxy configuration when start and clean up when stop.

View file

@ -1,3 +1,12 @@
---
icon: material/new-box
---
!!! quote "Changes in sing-box 1.9.0"
:material-plus: [platform.http_proxy.bypass_domain](#platformhttp_proxybypass_domain)
:material-plus: [platform.http_proxy.match_domain](#platformhttp_proxymatch_domain)
!!! quote "Changes in sing-box 1.8.0" !!! quote "Changes in sing-box 1.8.0"
:material-plus: [gso](#gso) :material-plus: [gso](#gso)
@ -69,7 +78,9 @@
"http_proxy": { "http_proxy": {
"enabled": false, "enabled": false,
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 8080 "server_port": 8080,
"bypass_domain": [],
"match_domain": []
} }
}, },
@ -256,6 +267,38 @@ Platform-specific settings, provided by client applications.
System HTTP proxy settings. System HTTP proxy settings.
#### platform.http_proxy.enabled
Enable system HTTP proxy.
#### platform.http_proxy.server
==Required==
HTTP proxy server address.
#### platform.http_proxy.server_port
==Required==
HTTP proxy server port.
#### platform.http_proxy.bypass_domain
!!! note ""
On Apple platforms, `bypass_domain` items matches hostname **suffixes**.
Hostnames that bypass the HTTP proxy.
#### platform.http_proxy.match_domain
!!! quote ""
Only supported in graphical clients on Apple platforms.
Hostnames that use the HTTP proxy.
### Listen Fields ### Listen Fields
See [Listen Fields](/configuration/shared/listen/) for details. See [Listen Fields](/configuration/shared/listen/) for details.

View file

@ -1,3 +1,12 @@
---
icon: material/new-box
---
!!! quote "sing-box 1.9.0 中的更改"
:material-plus: [platform.http_proxy.bypass_domain](#platformhttp_proxybypass_domain)
:material-plus: [platform.http_proxy.match_domain](#platformhttp_proxymatch_domain)
!!! quote "sing-box 1.8.0 中的更改" !!! quote "sing-box 1.8.0 中的更改"
:material-plus: [gso](#gso) :material-plus: [gso](#gso)
@ -69,7 +78,9 @@
"http_proxy": { "http_proxy": {
"enabled": false, "enabled": false,
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 8080 "server_port": 8080,
"bypass_domain": [],
"match_domain": []
} }
}, },
@ -253,6 +264,38 @@ TCP/IP 栈。
系统 HTTP 代理设置。 系统 HTTP 代理设置。
##### platform.http_proxy.enabled
启用系统 HTTP 代理。
##### platform.http_proxy.server
==必填==
系统 HTTP 代理服务器地址。
##### platform.http_proxy.server_port
==必填==
系统 HTTP 代理服务器端口。
##### platform.http_proxy.bypass_domain
!!! note ""
在 Apple 平台,`bypass_domain` 项匹配主机名 **后缀**.
绕过代理的主机名列表。
##### platform.http_proxy.match_domain
!!! quote ""
仅在 Apple 平台图形客户端中支持。
代理的主机名列表。
### 监听字段 ### 监听字段
参阅 [监听字段](/zh/configuration/shared/listen/)。 参阅 [监听字段](/zh/configuration/shared/listen/)。

View file

@ -281,7 +281,7 @@ Match Clash mode.
!!! quote "" !!! quote ""
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
Match WiFi SSID. Match WiFi SSID.
@ -289,7 +289,7 @@ Match WiFi SSID.
!!! quote "" !!! quote ""
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
Match WiFi BSSID. Match WiFi BSSID.

View file

@ -279,7 +279,7 @@
!!! quote "" !!! quote ""
仅在 Android 与 iOS 的图形客户端中支持。 仅在 Android 与 Apple 平台图形客户端中支持。
匹配 WiFi SSID。 匹配 WiFi SSID。
@ -287,7 +287,7 @@
!!! quote "" !!! quote ""
仅在 Android 与 iOS 的图形客户端中支持。 仅在 Android 与 Apple 平台图形客户端中支持。
匹配 WiFi BSSID。 匹配 WiFi BSSID。

View file

@ -168,7 +168,7 @@ Match android package name.
!!! quote "" !!! quote ""
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
Match WiFi SSID. Match WiFi SSID.
@ -176,7 +176,7 @@ Match WiFi SSID.
!!! quote "" !!! quote ""
Only supported in graphical clients on Android and iOS. Only supported in graphical clients on Android and Apple platforms.
Match WiFi BSSID. Match WiFi BSSID.

View file

@ -28,6 +28,8 @@ type TunOptions interface {
IsHTTPProxyEnabled() bool IsHTTPProxyEnabled() bool
GetHTTPProxyServer() string GetHTTPProxyServer() string
GetHTTPProxyServerPort() int32 GetHTTPProxyServerPort() int32
GetHTTPProxyBypassDomain() StringIterator
GetHTTPProxyMatchDomain() StringIterator
} }
type RoutePrefix struct { type RoutePrefix struct {
@ -156,3 +158,11 @@ func (o *tunOptions) GetHTTPProxyServer() string {
func (o *tunOptions) GetHTTPProxyServerPort() int32 { func (o *tunOptions) GetHTTPProxyServerPort() int32 {
return int32(o.TunPlatformOptions.HTTPProxy.ServerPort) return int32(o.TunPlatformOptions.HTTPProxy.ServerPort)
} }
func (o *tunOptions) GetHTTPProxyBypassDomain() StringIterator {
return newIterator(o.TunPlatformOptions.HTTPProxy.BypassDomain)
}
func (o *tunOptions) GetHTTPProxyMatchDomain() StringIterator {
return newIterator(o.TunPlatformOptions.HTTPProxy.MatchDomain)
}

View file

@ -7,4 +7,6 @@ type TunPlatformOptions struct {
type HTTPProxyOptions struct { type HTTPProxyOptions struct {
Enabled bool `json:"enabled,omitempty"` Enabled bool `json:"enabled,omitempty"`
ServerOptions ServerOptions
BypassDomain Listable[string] `json:"bypass_domain,omitempty"`
MatchDomain Listable[string] `json:"match_domain,omitempty"`
} }