Skip to content

Commit

Permalink
Add bypass_domain and search_domain platform HTTP proxy options
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Mar 24, 2024
1 parent ea04c16 commit b221a4d
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ see [TCP Brutal](/configuration/shared/tcp-brutal/) for details.

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

Expand Down Expand Up @@ -408,7 +408,7 @@ Only supported in graphical clients on Android and iOS.

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

Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/dns/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,15 @@ Match Clash mode.

!!! quote ""

Only supported in graphical clients on Android and iOS.
Only supported in graphical clients on Android and Apple platforms.

Match WiFi SSID.

#### wifi_bssid

!!! quote ""

Only supported in graphical clients on Android and iOS.
Only supported in graphical clients on Android and Apple platforms.

Match WiFi BSSID.

Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/dns/rule.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,15 @@ DNS 查询类型。值可以为整数或者类型名称字符串。

!!! quote ""

仅在 Android 与 iOS 的图形客户端中支持
仅在 Android 与 Apple 平台图形客户端中支持

匹配 WiFi SSID。

#### wifi_bssid

!!! quote ""

仅在 Android 与 iOS 的图形客户端中支持
仅在 Android 与 Apple 平台图形客户端中支持

匹配 WiFi BSSID。

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/inbound/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ No authentication required if empty.

!!! 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.
2 changes: 1 addition & 1 deletion docs/configuration/inbound/mixed.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ No authentication required if empty.

!!! 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.
45 changes: 44 additions & 1 deletion docs/configuration/inbound/tun.md
Original file line number Diff line number Diff line change
@@ -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"

:material-plus: [gso](#gso)
Expand Down Expand Up @@ -69,7 +78,9 @@
"http_proxy": {
"enabled": false,
"server": "127.0.0.1",
"server_port": 8080
"server_port": 8080,
"bypass_domain": [],
"match_domain": []
}
},

Expand Down Expand Up @@ -256,6 +267,38 @@ Platform-specific settings, provided by client applications.

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

See [Listen Fields](/configuration/shared/listen/) for details.
45 changes: 44 additions & 1 deletion docs/configuration/inbound/tun.zh.md
Original file line number Diff line number Diff line change
@@ -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 中的更改"

:material-plus: [gso](#gso)
Expand Down Expand Up @@ -69,7 +78,9 @@
"http_proxy": {
"enabled": false,
"server": "127.0.0.1",
"server_port": 8080
"server_port": 8080,
"bypass_domain": [],
"match_domain": []
}
},

Expand Down Expand Up @@ -253,6 +264,38 @@ TCP/IP 栈。

系统 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/)
4 changes: 2 additions & 2 deletions docs/configuration/route/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,15 @@ Match Clash mode.

!!! quote ""

Only supported in graphical clients on Android and iOS.
Only supported in graphical clients on Android and Apple platforms.

Match WiFi SSID.

#### wifi_bssid

!!! quote ""

Only supported in graphical clients on Android and iOS.
Only supported in graphical clients on Android and Apple platforms.

Match WiFi BSSID.

Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/route/rule.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,15 @@

!!! quote ""

仅在 Android 与 iOS 的图形客户端中支持
仅在 Android 与 Apple 平台图形客户端中支持

匹配 WiFi SSID。

#### wifi_bssid

!!! quote ""

仅在 Android 与 iOS 的图形客户端中支持
仅在 Android 与 Apple 平台图形客户端中支持

匹配 WiFi BSSID。

Expand Down
4 changes: 2 additions & 2 deletions docs/configuration/rule-set/headless-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ Match android package name.

!!! quote ""

Only supported in graphical clients on Android and iOS.
Only supported in graphical clients on Android and Apple platforms.

Match WiFi SSID.

#### wifi_bssid

!!! quote ""

Only supported in graphical clients on Android and iOS.
Only supported in graphical clients on Android and Apple platforms.

Match WiFi BSSID.

Expand Down
10 changes: 10 additions & 0 deletions experimental/libbox/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type TunOptions interface {
IsHTTPProxyEnabled() bool
GetHTTPProxyServer() string
GetHTTPProxyServerPort() int32
GetHTTPProxyBypassDomain() StringIterator
GetHTTPProxyMatchDomain() StringIterator
}

type RoutePrefix struct {
Expand Down Expand Up @@ -156,3 +158,11 @@ func (o *tunOptions) GetHTTPProxyServer() string {
func (o *tunOptions) GetHTTPProxyServerPort() int32 {
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)
}
2 changes: 2 additions & 0 deletions option/tun_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ type TunPlatformOptions struct {
type HTTPProxyOptions struct {
Enabled bool `json:"enabled,omitempty"`
ServerOptions
BypassDomain Listable[string] `json:"bypass_domain,omitempty"`
MatchDomain Listable[string] `json:"match_domain,omitempty"`
}

0 comments on commit b221a4d

Please sign in to comment.