From c2969bc186a9241e9932d0c4ff03602075b0487d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 1 Oct 2022 11:48:46 +0800 Subject: [PATCH] Update documentation --- docs/changelog.md | 14 +++++ docs/configuration/experimental/index.md | 59 +++++++++++++++++++-- docs/configuration/experimental/index.zh.md | 59 +++++++++++++++++++-- docs/configuration/inbound/tun.md | 13 +++-- docs/configuration/inbound/tun.zh.md | 8 ++- docs/index.md | 1 + docs/index.zh.md | 1 + option/clash.go | 9 ++-- 8 files changed, 144 insertions(+), 20 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index db49a406..5627512a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,17 @@ +#### 1.1-beta9 + +* Fix windows route **1**: +* Add direct io option for clash api +* Add v2ray statistics api +* Improve TLS writer +* Other fixes + +**1**: + +* Fix DNS leak caused by + Windows' [ordinary multihomed DNS resolution behavior](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/dd197552%28v%3Dws.10%29) +* Flush Windows DNS cache when start/close + #### 1.1-beta8 * Fix leaks on close diff --git a/docs/configuration/experimental/index.md b/docs/configuration/experimental/index.md index ca145741..e03aa03d 100644 --- a/docs/configuration/experimental/index.md +++ b/docs/configuration/experimental/index.md @@ -9,24 +9,39 @@ "external_controller": "127.0.0.1:9090", "external_ui": "folder", "secret": "", + "direct_io": false, "default_mode": "rule", "store_selected": false, "cache_file": "cache.db" + }, + "v2ray_api": { + "listen": "127.0.0.1:8080", + "stats": { + "enabled": true, + "direct_io": false, + "inbounds": [ + "socks-in" + ], + "outbounds": [ + "proxy", + "direct" + ] + } } } } ``` +!!! note "" + + Traffic statistics and connection management can degrade performance. + ### Clash API Fields !!! error "" Clash API is not included by default, see [Installation](/#installation). -!!! note "" - - Traffic statistics and connection management will disable TCP splice in linux and reduce performance, use at your own risk. - #### external_controller RESTful web API listening address. Clash API will be disabled if empty. @@ -43,6 +58,10 @@ Secret for the RESTful API (optional) Authenticate by spedifying HTTP header `Authorization: Bearer ${secret}` ALWAYS set a secret if RESTful API is listening on 0.0.0.0 +#### direct_io + +Allows lossless relays like splice without real-time traffic reporting. + #### default_mode Default mode in clash, `rule` will be used if empty. @@ -59,4 +78,34 @@ Store selected outbound for the `Selector` outbound in cache file. #### cache_file -Cache file path, `cache.db` will be used if empty. \ No newline at end of file +Cache file path, `cache.db` will be used if empty. + +### V2Ray API Fields + +!!! error "" + + V2Ray API is not included by default, see [Installation](/#installation). + +#### listen + +gRPC API listening address. V2Ray API will be disabled if empty. + +#### stats + +Traffic statistics service settings. + +#### stats.enabled + +Enable statistics service. + +#### stats.direct_io + +Allows lossless relays like splice without real-time traffic reporting. + +#### stats.inbounds + +Inbound list to count traffic. + +#### stats.outbounds + +Outbound list to count traffic. diff --git a/docs/configuration/experimental/index.zh.md b/docs/configuration/experimental/index.zh.md index 66456532..ed8c2473 100644 --- a/docs/configuration/experimental/index.zh.md +++ b/docs/configuration/experimental/index.zh.md @@ -9,24 +9,39 @@ "external_controller": "127.0.0.1:9090", "external_ui": "folder", "secret": "", + "direct_io": false, "default_mode": "rule", "store_selected": false, "cache_file": "cache.db" + }, + "v2ray_api": { + "listen": "127.0.0.1:8080", + "stats": { + "enabled": true, + "direct_io": false, + "inbounds": [ + "socks-in" + ], + "outbounds": [ + "proxy", + "direct" + ] + } } } } ``` +!!! note "" + + 流量统计和连接管理会降低性能。 + ### Clash API 字段 !!! error "" 默认安装不包含 Clash API,参阅 [安装](/zh/#_2)。 -!!! note "" - - 流量统计和连接管理将禁用 Linux 中的 TCP splice 并降低性能,使用风险自负。 - #### external_controller RESTful web API 监听地址。如果为空,则禁用 Clash API。 @@ -41,6 +56,10 @@ RESTful API 的密钥(可选) 通过指定 HTTP 标头 `Authorization: Bearer ${secret}` 进行身份验证 如果 RESTful API 正在监听 0.0.0.0,请始终设置一个密钥。 +#### direct_io + +允许像 splice 这样的没有实时流量报告的无损中继。 + #### default_mode Clash 中的默认模式,默认使用 `rule`。 @@ -57,4 +76,34 @@ Clash 中的默认模式,默认使用 `rule`。 #### cache_file -缓存文件路径,默认使用`cache.db`。 \ No newline at end of file +缓存文件路径,默认使用`cache.db`。 + +### V2Ray API 字段 + +!!! error "" + + 默认安装不包含 V2Ray API,参阅 [安装](/zh/#_2)。 + +#### listen + +gRPC API 监听地址。如果为空,则禁用 V2Ray API。 + +#### stats + +流量统计服务设置。 + +#### stats.enabled + +启用统计服务。 + +#### stats.direct_io + +允许像 splice 这样的没有实时流量报告的无损中继。 + +#### stats.inbounds + +统计流量的入站列表。 + +#### stats.outbounds + +统计流量的出站列表。 diff --git a/docs/configuration/inbound/tun.md b/docs/configuration/inbound/tun.md index 27afe10a..2575b589 100644 --- a/docs/configuration/inbound/tun.md +++ b/docs/configuration/inbound/tun.md @@ -8,7 +8,6 @@ { "type": "tun", "tag": "tun-in", - "interface_name": "tun0", "inet4_address": "172.19.0.1/30", "inet6_address": "fdfe:dcba:9876::1/126", @@ -39,8 +38,8 @@ "exclude_package": [ "com.android.captiveportallogin" ], - - ... // Listen Fields + ... + // Listen Fields } ``` @@ -86,7 +85,9 @@ Set the default route to the Tun. #### strict_route -Enforce strict routing rules in Linux when `auto_route` is enabled: +*In Linux*: + +Enforce strict routing rules when `auto_route` is enabled: * Let unsupported network unreachable * Route all connections to tun @@ -94,6 +95,10 @@ Enforce strict routing rules in Linux when `auto_route` is enabled: It prevents address leaks and makes DNS hijacking work on Android and Linux with systemd-resolved, but your device will not be accessible by others. +*In Windows*: + +Use segmented `auto_route` routing settings, which may help if you're using a dial-up network. + #### endpoint_independent_nat !!! info "" diff --git a/docs/configuration/inbound/tun.zh.md b/docs/configuration/inbound/tun.zh.md index fcac5635..f4756660 100644 --- a/docs/configuration/inbound/tun.zh.md +++ b/docs/configuration/inbound/tun.zh.md @@ -86,13 +86,19 @@ tun 接口的 IPv6 前缀。 #### strict_route -在 Linux 中启用 `auto_route` 时执行严格的路由规则。 +*在 Linux 中*: + +启用 `auto_route` 时执行严格的路由规则。 * 让不支持的网络无法到达 * 将所有连接路由到 tun 它可以防止地址泄漏,并使 DNS 劫持在 Android 和使用 systemd-resolved 的 Linux 上工作,但你的设备将无法其他设备被访问。 +*在 Windows 中*: + +使用分段的 `auto_route` 路由设置,如果您使用的是拨号网络,这可能会有所帮助。 + #### endpoint_independent_nat 启用独立于端点的 NAT。 diff --git a/docs/index.md b/docs/index.md index 9e60ef64..abfd78e8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -32,6 +32,7 @@ go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@lat | `with_utls` | Build with [uTLS](https://github.com/refraction-networking/utls) support for TLS outbound, see [TLS](./configuration/shared/tls#utls). | | `with_acme` | Build with ACME TLS certificate issuer support, see [TLS](./configuration/shared/tls). | | `with_clash_api` | Build with Clash API support, see [Experimental](./configuration/experimental#clash-api-fields). | +| `with_v2ray_api` | Build with V2Ray API support, see [Experimental](./configuration/experimental#v2ray-api-fields). | | `with_gvisor` | Build with gVisor support, see [Tun inbound](./configuration/inbound/tun#stack) and [WireGuard outbound](./configuration/outbound/wireguard#system_interface). | | `with_embedded_tor` (CGO required) | Build with embedded Tor support, see [Tor outbound](./configuration/outbound/tor). | | `with_lwip` (CGO required) | Build with LWIP Tun stack support, see [Tun inbound](./configuration/inbound/tun#stack). | diff --git a/docs/index.zh.md b/docs/index.zh.md index 047ff831..79f72ee5 100644 --- a/docs/index.zh.md +++ b/docs/index.zh.md @@ -32,6 +32,7 @@ go install -v -tags with_clash_api github.com/sagernet/sing-box/cmd/sing-box@lat | `with_utls` | 启用 uTLS 支持,参阅 [实验性](./configuration/experimental#clash-api-fields)。 | | `with_acme` | 启用 ACME TLS 证书签发支持,参阅 [TLS](./configuration/shared/tls)。 | | `with_clash_api` | 启用 Clash API 支持,参阅 [实验性](./configuration/experimental#clash-api-fields)。 | +| `with_v2ray_api` | 启用 V2Rat API 支持,参阅 [实验性](./configuration/experimental#v2ray-api-fields)。 | | `with_gvisor` | 启用 gVisor 支持,参阅 [Tun 入站](./configuration/inbound/tun#stack) 和 [WireGuard 出站](./configuration/outbound/wireguard#system_interface)。 | | `with_embedded_tor` (需要 CGO) | 启用 嵌入式 Tor 支持,参阅 [Tor 出站](./configuration/outbound/tor)。 | | `with_lwip` (需要 CGO) | 启用 LWIP Tun 栈支持,参阅 [Tun 入站](./configuration/inbound/tun#stack)。 | diff --git a/option/clash.go b/option/clash.go index a473e21a..135a6300 100644 --- a/option/clash.go +++ b/option/clash.go @@ -4,11 +4,10 @@ type ClashAPIOptions struct { ExternalController string `json:"external_controller,omitempty"` ExternalUI string `json:"external_ui,omitempty"` Secret string `json:"secret,omitempty"` - - DirectIO bool `json:"direct_io,omitempty"` - DefaultMode string `json:"default_mode,omitempty"` - StoreSelected bool `json:"store_selected,omitempty"` - CacheFile string `json:"cache_file,omitempty"` + DirectIO bool `json:"direct_io,omitempty"` + DefaultMode string `json:"default_mode,omitempty"` + StoreSelected bool `json:"store_selected,omitempty"` + CacheFile string `json:"cache_file,omitempty"` } type SelectorOutboundOptions struct {