浏览代码

Update documentation

世界 3 年之前
父节点
当前提交
c2969bc186

+ 14 - 0
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
 #### 1.1-beta8
 
 
 * Fix leaks on close
 * Fix leaks on close

+ 54 - 5
docs/configuration/experimental/index.md

@@ -9,24 +9,39 @@
       "external_controller": "127.0.0.1:9090",
       "external_controller": "127.0.0.1:9090",
       "external_ui": "folder",
       "external_ui": "folder",
       "secret": "",
       "secret": "",
+      "direct_io": false,
       "default_mode": "rule",
       "default_mode": "rule",
       "store_selected": false,
       "store_selected": false,
       "cache_file": "cache.db"
       "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
 ### Clash API Fields
 
 
 !!! error ""
 !!! error ""
 
 
     Clash API is not included by default, see [Installation](/#installation).
     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
 #### external_controller
 
 
 RESTful web API listening address. Clash API will be disabled if empty.
 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}`
 Authenticate by spedifying HTTP header `Authorization: Bearer ${secret}`
 ALWAYS set a secret if RESTful API is listening on 0.0.0.0
 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
 
 
 Default mode in clash, `rule` will be used if empty.
 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
 
 
-Cache file path, `cache.db` will be used if empty.
+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.

+ 54 - 5
docs/configuration/experimental/index.zh.md

@@ -9,24 +9,39 @@
       "external_controller": "127.0.0.1:9090",
       "external_controller": "127.0.0.1:9090",
       "external_ui": "folder",
       "external_ui": "folder",
       "secret": "",
       "secret": "",
+      "direct_io": false,
       "default_mode": "rule",
       "default_mode": "rule",
       "store_selected": false,
       "store_selected": false,
       "cache_file": "cache.db"
       "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 字段
 ### Clash API 字段
 
 
 !!! error ""
 !!! error ""
 
 
     默认安装不包含 Clash API,参阅 [安装](/zh/#_2)。
     默认安装不包含 Clash API,参阅 [安装](/zh/#_2)。
 
 
-!!! note ""
-
-    流量统计和连接管理将禁用 Linux 中的 TCP splice 并降低性能,使用风险自负。
-
 #### external_controller
 #### external_controller
 
 
 RESTful web API 监听地址。如果为空,则禁用 Clash API。
 RESTful web API 监听地址。如果为空,则禁用 Clash API。
@@ -41,6 +56,10 @@ RESTful API 的密钥(可选)
 通过指定 HTTP 标头 `Authorization: Bearer ${secret}` 进行身份验证
 通过指定 HTTP 标头 `Authorization: Bearer ${secret}` 进行身份验证
 如果 RESTful API 正在监听 0.0.0.0,请始终设置一个密钥。
 如果 RESTful API 正在监听 0.0.0.0,请始终设置一个密钥。
 
 
+#### direct_io
+
+允许像 splice 这样的没有实时流量报告的无损中继。
+
 #### default_mode
 #### default_mode
 
 
 Clash 中的默认模式,默认使用 `rule`。
 Clash 中的默认模式,默认使用 `rule`。
@@ -57,4 +76,34 @@ Clash 中的默认模式,默认使用 `rule`。
 
 
 #### cache_file
 #### cache_file
 
 
-缓存文件路径,默认使用`cache.db`。
+缓存文件路径,默认使用`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
+
+统计流量的出站列表。

+ 9 - 4
docs/configuration/inbound/tun.md

@@ -8,7 +8,6 @@
 {
 {
   "type": "tun",
   "type": "tun",
   "tag": "tun-in",
   "tag": "tun-in",
-  
   "interface_name": "tun0",
   "interface_name": "tun0",
   "inet4_address": "172.19.0.1/30",
   "inet4_address": "172.19.0.1/30",
   "inet6_address": "fdfe:dcba:9876::1/126",
   "inet6_address": "fdfe:dcba:9876::1/126",
@@ -39,8 +38,8 @@
   "exclude_package": [
   "exclude_package": [
     "com.android.captiveportallogin"
     "com.android.captiveportallogin"
   ],
   ],
-
-  ... // Listen Fields
+  ...
+  // Listen Fields
 }
 }
 ```
 ```
 
 
@@ -86,7 +85,9 @@ Set the default route to the Tun.
 
 
 #### strict_route
 #### 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
 * Let unsupported network unreachable
 * Route all connections to tun
 * 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
 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.
 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
 #### endpoint_independent_nat
 
 
 !!! info ""
 !!! info ""

+ 7 - 1
docs/configuration/inbound/tun.zh.md

@@ -86,13 +86,19 @@ tun 接口的 IPv6 前缀。
 
 
 #### strict_route
 #### strict_route
 
 
-在 Linux 中启用 `auto_route` 时执行严格的路由规则。
+*在 Linux 中*:
+
+启用 `auto_route` 时执行严格的路由规则。
 
 
 * 让不支持的网络无法到达
 * 让不支持的网络无法到达
 * 将所有连接路由到 tun
 * 将所有连接路由到 tun
 
 
 它可以防止地址泄漏,并使 DNS 劫持在 Android 和使用 systemd-resolved 的 Linux 上工作,但你的设备将无法其他设备被访问。
 它可以防止地址泄漏,并使 DNS 劫持在 Android 和使用 systemd-resolved 的 Linux 上工作,但你的设备将无法其他设备被访问。
 
 
+*在 Windows 中*:
+
+使用分段的 `auto_route` 路由设置,如果您使用的是拨号网络,这可能会有所帮助。
+
 #### endpoint_independent_nat
 #### endpoint_independent_nat
 
 
 启用独立于端点的 NAT。
 启用独立于端点的 NAT。

+ 1 - 0
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_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_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_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_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_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).                                                                                                                                                                                                                                        |
 | `with_lwip` (CGO required)         | Build with LWIP Tun stack support, see [Tun inbound](./configuration/inbound/tun#stack).                                                                                                                                                                                                                                        |

+ 1 - 0
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_utls`                  | 启用 uTLS 支持,参阅 [实验性](./configuration/experimental#clash-api-fields)。                                                                                                                                                                                                          |
 | `with_acme`                  | 启用 ACME TLS 证书签发支持,参阅 [TLS](./configuration/shared/tls)。                                                                                                                                                                                                                     |
 | `with_acme`                  | 启用 ACME TLS 证书签发支持,参阅 [TLS](./configuration/shared/tls)。                                                                                                                                                                                                                     |
 | `with_clash_api`             | 启用 Clash API 支持,参阅 [实验性](./configuration/experimental#clash-api-fields)。                                                                                                                                                                                                     |
 | `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_gvisor`                | 启用 gVisor 支持,参阅 [Tun 入站](./configuration/inbound/tun#stack) 和 [WireGuard 出站](./configuration/outbound/wireguard#system_interface)。                                                                                                                                           |
 | `with_embedded_tor` (需要 CGO) | 启用 嵌入式 Tor 支持,参阅 [Tor 出站](./configuration/outbound/tor)。                                                                                                                                                                                                                     |
 | `with_embedded_tor` (需要 CGO) | 启用 嵌入式 Tor 支持,参阅 [Tor 出站](./configuration/outbound/tor)。                                                                                                                                                                                                                     |
 | `with_lwip` (需要 CGO)         | 启用 LWIP Tun 栈支持,参阅 [Tun 入站](./configuration/inbound/tun#stack)。                                                                                                                                                                                                              |
 | `with_lwip` (需要 CGO)         | 启用 LWIP Tun 栈支持,参阅 [Tun 入站](./configuration/inbound/tun#stack)。                                                                                                                                                                                                              |

+ 4 - 5
option/clash.go

@@ -4,11 +4,10 @@ type ClashAPIOptions struct {
 	ExternalController string `json:"external_controller,omitempty"`
 	ExternalController string `json:"external_controller,omitempty"`
 	ExternalUI         string `json:"external_ui,omitempty"`
 	ExternalUI         string `json:"external_ui,omitempty"`
 	Secret             string `json:"secret,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 {
 type SelectorOutboundOptions struct {