Skip to content

Commit 8ab68e7

Browse files
committed
Sockopt: Add network
1 parent b280396 commit 8ab68e7

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

docs/config/transports/sockopt.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ PS: 如果有正常上网的域名流量被 AsIs 的 freedom 出站送过来,
244244
"customSockopt": [
245245
{
246246
"system": "linux",
247+
"network": "tcp",
247248
"type": "str",
248249
"level": "6",
249250
"opt": "13",
@@ -257,13 +258,17 @@ PS: 如果有正常上网的域名流量被 AsIs 的 freedom 出站送过来,
257258
258259
可选,指定生效的系统,如果运行的系统不匹配则跳过该 sockopt. 目前可选 `linux` `windows` `darwin` (全部小写). 若留空则直接执行
259260

261+
> `network`: ""
262+
263+
可选,指定生效的网络类型,目前可选 `tcp` `tcp4` `tcp6` `udp` `udp4` `udp6`. 无后缀数字代表执行双栈都应用该 sockopt。 注意目标是 IPv4 **不代表**标准库传入的 network 一定是 `tcp4`/`udp4`,比如系统有可能使用 IPv6 Socket 来连接一个 IPv4 地址,使用前请确认标准库行为。
264+
260265
> `type`: ""
261266
262-
必填,设置的类型,目前可选int或str.
267+
必填,设置的类型,目前可选 `int``str`.
263268

264269
> `level`: ""
265270
266-
可选,协议级别,用于指定生效范围,默认为6, 即TCP.
271+
可选,协议级别,用于指定生效范围,默认为 `6`, 即TCP.
267272

268273
> `opt`: ""
269274

docs/en/config/transports/sockopt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ Make sure you understand socket programming before using it.
240240
"customSockopt": [
241241
{
242242
"system": "linux",
243+
"network": "tcp",
243244
"type": "str",
244245
"level": "6",
245246
"opt": "13",
@@ -253,6 +254,10 @@ Make sure you understand socket programming before using it.
253254
254255
Optional. Restricts the option to a specific operating system. If the current system does not match, the option is skipped. Supported values are `linux`, `windows`, and `darwin`, all in lowercase. If left empty, the option is applied directly.
255256

257+
> `network`: ""
258+
259+
Optional. Restricts the option to a specific network type. Supported values are `tcp`, `tcp4`, `tcp6`, `udp`, `udp4`, and `udp6`. A value without a numeric suffix means the sockopt is applied to both stacks. Note that an IPv4 target does **not** guarantee that the network passed in by the standard library is `tcp4`/`udp4` — for example, the system may use an IPv6 socket to connect to an IPv4 address. Verify the standard library behavior before using this.
260+
256261
> `type`: ""
257262
258263
Required. The value type to set. Currently `int` and `str` are supported.

docs/ru/config/transports/sockopt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ Sockopt используется для настройки низкоуровн
238238
"customSockopt": [
239239
{
240240
"system": "linux",
241+
"network": "tcp",
241242
"type": "str",
242243
"level": "6",
243244
"opt": "13",
@@ -251,6 +252,10 @@ Sockopt используется для настройки низкоуровн
251252
252253
Необязательный параметр. Ограничивает применение конкретной ОС. Если текущая система не совпадает, эта настройка пропускается. Поддерживаются `linux`, `windows` и `darwin`, все в нижнем регистре. Если поле пустое, настройка применяется напрямую.
253254

255+
> `network`: ""
256+
257+
Необязательный параметр. Ограничивает применение конкретным типом сети. Поддерживаются `tcp`, `tcp4`, `tcp6`, `udp`, `udp4`, `udp6`. Значение без числового суффикса означает, что sockopt применяется к обоим стекам. Обратите внимание: цель IPv4 **не означает**, что стандартная библиотека передаст network `tcp4`/`udp4` — например, система может использовать IPv6-сокет для подключения к IPv4-адресу. Перед использованием проверьте поведение стандартной библиотеки.
258+
254259
> `type`: ""
255260
256261
Обязательный параметр. Тип значения. Сейчас поддерживаются `int` и `str`.

0 commit comments

Comments
 (0)