Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeb7308e81 | ||
|
|
bb1ebfda83 | ||
|
|
c05c798221 | ||
|
|
55b1bcc6a5 | ||
|
|
d6eddce420 | ||
|
|
4bf057139b | ||
|
|
a1b28b8282 | ||
|
|
d0aaf71770 | ||
|
|
2f31202c6b | ||
|
|
e4cc510712 | ||
|
|
e329bf6865 | ||
|
|
2badcec765 | ||
|
|
e71c13b1a2 | ||
|
|
a959a67ed3 | ||
|
|
a1044af579 | ||
|
|
a64b57451a | ||
|
|
f0e2318cbd | ||
|
|
ebec308fd8 | ||
|
|
ca094587be | ||
|
|
ca3b86c781 | ||
|
|
5a1d0047b9 | ||
|
|
4669854039 | ||
|
|
2eecdc38a4 | ||
|
|
83581b7c1a | ||
|
|
d346f0023d | ||
|
|
47b7a29cbd | ||
|
|
cffc07579d | ||
|
|
0ef268637e | ||
|
|
50f5a76380 | ||
|
|
20ca05dd36 | ||
|
|
5a792b186a | ||
|
|
3f458064a3 | ||
|
|
5269231df0 |
16
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
16
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -44,13 +44,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Version
|
label: Version
|
||||||
description: If you are using the original command line program, please provide the output of the `sing-box version` command.
|
description: If you are using the original command line program, please provide the output of the `sing-box version` command.
|
||||||
value: |-
|
render: shell
|
||||||
<details>
|
|
||||||
|
|
||||||
```console
|
|
||||||
# Replace this line with the output
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Description
|
label: Description
|
||||||
@@ -70,10 +64,4 @@ body:
|
|||||||
If you encounter a crash with the graphical client, please provide crash logs.
|
If you encounter a crash with the graphical client, please provide crash logs.
|
||||||
For Apple platform clients, please check `Settings - View Service Log` for crash logs.
|
For Apple platform clients, please check `Settings - View Service Log` for crash logs.
|
||||||
For the Android client, please check the `/sdcard/Android/data/io.nekohasekai.sfa/files/stderr.log` file for crash logs.
|
For the Android client, please check the `/sdcard/Android/data/io.nekohasekai.sfa/files/stderr.log` file for crash logs.
|
||||||
value: |-
|
render: shell
|
||||||
<details>
|
|
||||||
|
|
||||||
```console
|
|
||||||
# Replace this line with logs
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
30
.github/ISSUE_TEMPLATE/bug_report_zh.yml
vendored
30
.github/ISSUE_TEMPLATE/bug_report_zh.yml
vendored
@@ -44,13 +44,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: 版本
|
label: 版本
|
||||||
description: 如果您使用原始命令行程序,请提供 `sing-box version` 命令的输出。
|
description: 如果您使用原始命令行程序,请提供 `sing-box version` 命令的输出。
|
||||||
value: |-
|
render: shell
|
||||||
<details>
|
|
||||||
|
|
||||||
```console
|
|
||||||
# 使用输出内容覆盖此行
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: 描述
|
label: 描述
|
||||||
@@ -70,10 +64,18 @@ body:
|
|||||||
如果您遭遇图形界面应用程序崩溃,请提供崩溃日志。
|
如果您遭遇图形界面应用程序崩溃,请提供崩溃日志。
|
||||||
对于 Apple 平台图形客户端程序,请检查 `Settings - View Service Log` 以导出崩溃日志。
|
对于 Apple 平台图形客户端程序,请检查 `Settings - View Service Log` 以导出崩溃日志。
|
||||||
对于 Android 图形客户端程序,请检查 `/sdcard/Android/data/io.nekohasekai.sfa/files/stderr.log` 文件以导出崩溃日志。
|
对于 Android 图形客户端程序,请检查 `/sdcard/Android/data/io.nekohasekai.sfa/files/stderr.log` 文件以导出崩溃日志。
|
||||||
value: |-
|
render: shell
|
||||||
<details>
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
```console
|
label: 完整性要求
|
||||||
# 使用日志内容覆盖此行
|
description: 我保证我提供了完整的可以在本地重现该问题的服务器、客户端配置文件与流程,而不是一个脱敏的复杂客户端配置文件,否则该 issue 将被关闭。
|
||||||
```
|
options:
|
||||||
</details>
|
- label: 我保证
|
||||||
|
required: true
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: 负责性要求
|
||||||
|
description: 我保证我阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值,否则该 issue 将被关闭。
|
||||||
|
options:
|
||||||
|
- label: 我保证
|
||||||
|
required: true
|
||||||
8
.github/workflows/debug.yml
vendored
8
.github/workflows/debug.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ steps.version.outputs.go_version }}
|
go-version: ${{ steps.version.outputs.go_version }}
|
||||||
- name: Add cache to Go proxy
|
- name: Add cache to Go proxy
|
||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.18.10
|
go-version: 1.18.10
|
||||||
- name: Cache go module
|
- name: Cache go module
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.20.7
|
go-version: 1.20.7
|
||||||
- name: Cache go module
|
- name: Cache go module
|
||||||
@@ -209,7 +209,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ steps.version.outputs.go_version }}
|
go-version: ${{ steps.version.outputs.go_version }}
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|||||||
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ steps.version.outputs.go_version }}
|
go-version: ${{ steps.version.outputs.go_version }}
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
|
|||||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v8
|
- uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days'
|
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days'
|
||||||
days-before-stale: 60
|
days-before-stale: 60
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ type OutboundGroup interface {
|
|||||||
|
|
||||||
type URLTestGroup interface {
|
type URLTestGroup interface {
|
||||||
OutboundGroup
|
OutboundGroup
|
||||||
URLTest(ctx context.Context, url string) (map[string]uint16, error)
|
URLTest(ctx context.Context) (map[string]uint16, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func OutboundTag(detour Outbound) string {
|
func OutboundTag(detour Outbound) string {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
|
|
||||||
type Router interface {
|
type Router interface {
|
||||||
Service
|
Service
|
||||||
|
PostStarter
|
||||||
|
|
||||||
Outbounds() []Outbound
|
Outbounds() []Outbound
|
||||||
Outbound(tag string) (Outbound, bool)
|
Outbound(tag string) (Outbound, bool)
|
||||||
|
|||||||
15
box.go
15
box.go
@@ -258,7 +258,7 @@ func (s *Box) start() error {
|
|||||||
return E.Cause(err, "initialize inbound/", in.Type(), "[", tag, "]")
|
return E.Cause(err, "initialize inbound/", in.Type(), "[", tag, "]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return s.postStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Box) postStart() error {
|
func (s *Box) postStart() error {
|
||||||
@@ -269,16 +269,17 @@ func (s *Box) postStart() error {
|
|||||||
return E.Cause(err, "start ", serviceName)
|
return E.Cause(err, "start ", serviceName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for serviceName, service := range s.outbounds {
|
for _, outbound := range s.outbounds {
|
||||||
if lateService, isLateService := service.(adapter.PostStarter); isLateService {
|
if lateOutbound, isLateOutbound := outbound.(adapter.PostStarter); isLateOutbound {
|
||||||
s.logger.Trace("post-starting ", service)
|
s.logger.Trace("post-starting outbound/", outbound.Tag())
|
||||||
err := lateService.PostStart()
|
err := lateOutbound.PostStart()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "post-start ", serviceName)
|
return E.Cause(err, "post-start outbound/", outbound.Tag())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
s.logger.Trace("post-starting router")
|
||||||
|
return s.router.PostStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Box) Close() error {
|
func (s *Box) Close() error {
|
||||||
|
|||||||
@@ -4,6 +4,25 @@ icon: material/alert-decagram
|
|||||||
|
|
||||||
# ChangeLog
|
# ChangeLog
|
||||||
|
|
||||||
|
#### 1.7.6
|
||||||
|
|
||||||
|
* Fixes and improvements
|
||||||
|
|
||||||
|
#### 1.7.5
|
||||||
|
|
||||||
|
* Fixes and improvements
|
||||||
|
|
||||||
|
#### 1.7.4
|
||||||
|
|
||||||
|
* Fixes and improvements
|
||||||
|
|
||||||
|
_Due to the long waiting time, this version is no longer waiting for approval
|
||||||
|
by the Apple App Store, so updates to Apple Platforms will be delayed._
|
||||||
|
|
||||||
|
#### 1.7.2
|
||||||
|
|
||||||
|
* Fixes and improvements
|
||||||
|
|
||||||
#### 1.7.1
|
#### 1.7.1
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
@@ -14,8 +33,8 @@ icon: material/alert-decagram
|
|||||||
|
|
||||||
Important changes since 1.6:
|
Important changes since 1.6:
|
||||||
|
|
||||||
* Add [exclude route support](/configuration/inbound/tun) for TUN inbound
|
* Add [exclude route support](/configuration/inbound/tun/) for TUN inbound
|
||||||
* Add `udp_disable_domain_unmapping` [inbound listen option](/configuration/shared/listen) **1**
|
* Add `udp_disable_domain_unmapping` [inbound listen option](/configuration/shared/listen/) **1**
|
||||||
* Add [HTTPUpgrade V2Ray transport](/configuration/shared/v2ray-transport#HTTPUpgrade) support **2**
|
* Add [HTTPUpgrade V2Ray transport](/configuration/shared/v2ray-transport#HTTPUpgrade) support **2**
|
||||||
* Migrate multiplex and UoT server to inbound **3**
|
* Migrate multiplex and UoT server to inbound **3**
|
||||||
* Add TCP Brutal support for multiplex **4**
|
* Add TCP Brutal support for multiplex **4**
|
||||||
@@ -39,11 +58,13 @@ The new HTTPUpgrade transport has better performance than WebSocket and is bette
|
|||||||
|
|
||||||
**3**:
|
**3**:
|
||||||
|
|
||||||
Starting in 1.7.0, multiplexing support is no longer enabled by default and needs to be turned on explicitly in inbound options.
|
Starting in 1.7.0, multiplexing support is no longer enabled by default
|
||||||
|
and needs to be turned on explicitly in inbound options.
|
||||||
|
|
||||||
**4**
|
**4**
|
||||||
|
|
||||||
Hysteria Brutal Congestion Control Algorithm in TCP. A kernel module needs to be installed on the Linux server, see [TCP Brutal](/configuration/shared/tcp-brutal) for details.
|
Hysteria Brutal Congestion Control Algorithm in TCP. A kernel module needs to be installed on the Linux server,
|
||||||
|
see [TCP Brutal](/configuration/shared/tcp-brutal/) for details.
|
||||||
|
|
||||||
**5**:
|
**5**:
|
||||||
|
|
||||||
@@ -132,7 +153,7 @@ Only supported in graphical clients on Android and iOS.
|
|||||||
|
|
||||||
#### 1.6.1
|
#### 1.6.1
|
||||||
|
|
||||||
* Our [Android client](/installation/clients/sfa) is now available in the Google Play Store ▶️
|
* Our [Android client](/installation/clients/sfa/) is now available in the Google Play Store ▶️
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
#### 1.7.0-alpha.6
|
#### 1.7.0-alpha.6
|
||||||
@@ -146,11 +167,13 @@ Only supported in graphical clients on Android and iOS.
|
|||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
|
|
||||||
Starting in 1.7.0, multiplexing support is no longer enabled by default and needs to be turned on explicitly in inbound options.
|
Starting in 1.7.0, multiplexing support is no longer enabled by default and needs to be turned on explicitly in inbound
|
||||||
|
options.
|
||||||
|
|
||||||
**2**
|
**2**
|
||||||
|
|
||||||
Hysteria Brutal Congestion Control Algorithm in TCP. A kernel module needs to be installed on the Linux server, see [TCP Brutal](/configuration/shared/tcp-brutal) for details.
|
Hysteria Brutal Congestion Control Algorithm in TCP. A kernel module needs to be installed on the Linux server,
|
||||||
|
see [TCP Brutal](/configuration/shared/tcp-brutal/) for details.
|
||||||
|
|
||||||
#### 1.7.0-alpha.3
|
#### 1.7.0-alpha.3
|
||||||
|
|
||||||
@@ -169,13 +192,13 @@ The new HTTPUpgrade transport has better performance than WebSocket and is bette
|
|||||||
|
|
||||||
Important changes since 1.5:
|
Important changes since 1.5:
|
||||||
|
|
||||||
* Our [Apple tvOS client](/installation/clients/sft) is now available in the App Store 🍎
|
* Our [Apple tvOS client](/installation/clients/sft/) is now available in the App Store 🍎
|
||||||
* Update BBR congestion control for TUIC and Hysteria2 **1**
|
* Update BBR congestion control for TUIC and Hysteria2 **1**
|
||||||
* Update brutal congestion control for Hysteria2
|
* Update brutal congestion control for Hysteria2
|
||||||
* Add `brutal_debug` option for Hysteria2
|
* Add `brutal_debug` option for Hysteria2
|
||||||
* Update legacy Hysteria protocol **2**
|
* Update legacy Hysteria protocol **2**
|
||||||
* Add TLS self sign key pair generate command
|
* Add TLS self sign key pair generate command
|
||||||
* Remove [Deprecated Features](/deprecated) by agreement
|
* Remove [Deprecated Features](/deprecated/) by agreement
|
||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
|
|
||||||
@@ -193,8 +216,8 @@ the old protocol (Hysteria 1) have been updated to be consistent with Hysteria 2
|
|||||||
|
|
||||||
#### 1.7.0-alpha.1
|
#### 1.7.0-alpha.1
|
||||||
|
|
||||||
* Add [exclude route support](/configuration/inbound/tun) for TUN inbound
|
* Add [exclude route support](/configuration/inbound/tun/) for TUN inbound
|
||||||
* Add `udp_disable_domain_unmapping` [inbound listen option](/configuration/shared/listen) **1**
|
* Add `udp_disable_domain_unmapping` [inbound listen option](/configuration/shared/listen/) **1**
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
@@ -217,8 +240,8 @@ When `auto_route` is enabled and `strict_route` is disabled, the device can now
|
|||||||
|
|
||||||
**2**:
|
**2**:
|
||||||
|
|
||||||
Built using Go 1.20, the last version that will run on Windows 7, 8, Server 2008, Server 2012 and macOS 10.13 High Sierra, 10.14 Mojave.
|
Built using Go 1.20, the last version that will run on
|
||||||
|
Windows 7, 8, Server 2008, Server 2012 and macOS 10.13 High Sierra, 10.14 Mojave.
|
||||||
|
|
||||||
#### 1.6.0-rc.4
|
#### 1.6.0-rc.4
|
||||||
|
|
||||||
@@ -231,7 +254,8 @@ Built using Go 1.20, the last version that will run on Windows 7, 8, Server 2008
|
|||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
|
|
||||||
Built using Go 1.20, the last version that will run on Windows 7, 8, Server 2008, Server 2012 and macOS 10.13 High Sierra, 10.14 Mojave.
|
Built using Go 1.20, the last version that will run on
|
||||||
|
Windows 7, 8, Server 2008, Server 2012 and macOS 10.13 High Sierra, 10.14 Mojave.
|
||||||
|
|
||||||
#### 1.6.0-beta.4
|
#### 1.6.0-beta.4
|
||||||
|
|
||||||
@@ -311,7 +335,7 @@ introduce new issues.
|
|||||||
|
|
||||||
#### 1.5.2
|
#### 1.5.2
|
||||||
|
|
||||||
* Our [Apple tvOS client](/installation/clients/sft) is now available in the App Store 🍎
|
* Our [Apple tvOS client](/installation/clients/sft/) is now available in the App Store 🍎
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
#### 1.6.0-alpha.3
|
#### 1.6.0-alpha.3
|
||||||
@@ -331,7 +355,7 @@ introduce new issues.
|
|||||||
* Update BBR congestion control for TUIC and Hysteria2 **1**
|
* Update BBR congestion control for TUIC and Hysteria2 **1**
|
||||||
* Update quic-go to v0.39.0
|
* Update quic-go to v0.39.0
|
||||||
* Update gVisor to 20230814.0
|
* Update gVisor to 20230814.0
|
||||||
* Remove [Deprecated Features](/deprecated) by agreement
|
* Remove [Deprecated Features](/deprecated/) by agreement
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
@@ -345,7 +369,7 @@ This update is intended to address the multi-send defects of the old implementat
|
|||||||
|
|
||||||
Important changes since 1.4:
|
Important changes since 1.4:
|
||||||
|
|
||||||
* Add TLS [ECH server](/configuration/shared/tls) support
|
* Add TLS [ECH server](/configuration/shared/tls/) support
|
||||||
* Improve TLS TCH client configuration
|
* Improve TLS TCH client configuration
|
||||||
* Add TLS ECH key pair generator **1**
|
* Add TLS ECH key pair generator **1**
|
||||||
* Add TLS ECH support for QUIC based protocols **2**
|
* Add TLS ECH support for QUIC based protocols **2**
|
||||||
@@ -354,7 +378,7 @@ Important changes since 1.4:
|
|||||||
* Add `interrupt_exist_connections` option for `Selector` and `URLTest` outbounds **4**
|
* Add `interrupt_exist_connections` option for `Selector` and `URLTest` outbounds **4**
|
||||||
* Add DNS01 challenge support for ACME TLS certificate issuer **5**
|
* Add DNS01 challenge support for ACME TLS certificate issuer **5**
|
||||||
* Add `merge` command **6**
|
* Add `merge` command **6**
|
||||||
* Mark [Deprecated Features](/deprecated)
|
* Mark [Deprecated Features](/deprecated/)
|
||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
|
|
||||||
@@ -366,7 +390,7 @@ All inbounds and outbounds are supported, including `Naiveproxy`, `Hysteria[/2]`
|
|||||||
|
|
||||||
**3**:
|
**3**:
|
||||||
|
|
||||||
See [Hysteria2 inbound](/configuration/inbound/hysteria2) and [Hysteria2 outbound](/configuration/outbound/hysteria2)
|
See [Hysteria2 inbound](/configuration/inbound/hysteria2/) and [Hysteria2 outbound](/configuration/outbound/hysteria2/)
|
||||||
|
|
||||||
For protocol description, please refer to [https://v2.hysteria.network](https://v2.hysteria.network)
|
For protocol description, please refer to [https://v2.hysteria.network](https://v2.hysteria.network)
|
||||||
|
|
||||||
@@ -379,7 +403,7 @@ Only inbound connections are affected by this setting, internal connections will
|
|||||||
**5**:
|
**5**:
|
||||||
|
|
||||||
Only `Alibaba Cloud DNS` and `Cloudflare` are supported, see [ACME Fields](/configuration/shared/tls#acme-fields)
|
Only `Alibaba Cloud DNS` and `Cloudflare` are supported, see [ACME Fields](/configuration/shared/tls#acme-fields)
|
||||||
and [DNS01 Challenge Fields](/configuration/shared/dns01_challenge).
|
and [DNS01 Challenge Fields](/configuration/shared/dns01_challenge/).
|
||||||
|
|
||||||
**6**:
|
**6**:
|
||||||
|
|
||||||
@@ -461,7 +485,7 @@ Global Flags:
|
|||||||
|
|
||||||
Only `Alibaba Cloud DNS` and `Cloudflare` are supported,
|
Only `Alibaba Cloud DNS` and `Cloudflare` are supported,
|
||||||
see [ACME Fields](/configuration/shared/tls#acme-fields)
|
see [ACME Fields](/configuration/shared/tls#acme-fields)
|
||||||
and [DNS01 Challenge Fields](/configuration/shared/dns01_challenge).
|
and [DNS01 Challenge Fields](/configuration/shared/dns01_challenge/).
|
||||||
|
|
||||||
#### 1.5.0-beta.10
|
#### 1.5.0-beta.10
|
||||||
|
|
||||||
@@ -490,7 +514,7 @@ Only inbound connections are affected by this setting, internal connections will
|
|||||||
|
|
||||||
* Fix compatibility issues with official Hysteria2 server and client
|
* Fix compatibility issues with official Hysteria2 server and client
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
* Mark [deprecated features](/deprecated)
|
* Mark [deprecated features](/deprecated/)
|
||||||
|
|
||||||
#### 1.5.0-beta.3
|
#### 1.5.0-beta.3
|
||||||
|
|
||||||
@@ -509,13 +533,13 @@ Hysteria2 server and client when using `fastOpen=false` or UDP MTU >= 1200.
|
|||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
|
|
||||||
See [Hysteria2 inbound](/configuration/inbound/hysteria2) and [Hysteria2 outbound](/configuration/outbound/hysteria2)
|
See [Hysteria2 inbound](/configuration/inbound/hysteria2/) and [Hysteria2 outbound](/configuration/outbound/hysteria2/)
|
||||||
|
|
||||||
For protocol description, please refer to [https://v2.hysteria.network](https://v2.hysteria.network)
|
For protocol description, please refer to [https://v2.hysteria.network](https://v2.hysteria.network)
|
||||||
|
|
||||||
#### 1.5.0-beta.1
|
#### 1.5.0-beta.1
|
||||||
|
|
||||||
* Add TLS [ECH server](/configuration/shared/tls) support
|
* Add TLS [ECH server](/configuration/shared/tls/) support
|
||||||
* Improve TLS TCH client configuration
|
* Improve TLS TCH client configuration
|
||||||
* Add TLS ECH key pair generator **1**
|
* Add TLS ECH key pair generator **1**
|
||||||
* Add TLS ECH support for QUIC based protocols **2**
|
* Add TLS ECH support for QUIC based protocols **2**
|
||||||
@@ -548,12 +572,12 @@ Important changes since 1.3:
|
|||||||
|
|
||||||
*1*:
|
*1*:
|
||||||
|
|
||||||
See [TUIC inbound](/configuration/inbound/tuic)
|
See [TUIC inbound](/configuration/inbound/tuic/)
|
||||||
and [TUIC outbound](/configuration/outbound/tuic)
|
and [TUIC outbound](/configuration/outbound/tuic/)
|
||||||
|
|
||||||
**2**:
|
**2**:
|
||||||
|
|
||||||
This is the TUIC port of the [UDP over TCP protocol](/configuration/shared/udp-over-tcp), designed to provide a QUIC
|
This is the TUIC port of the [UDP over TCP protocol](/configuration/shared/udp-over-tcp/), designed to provide a QUIC
|
||||||
stream based UDP relay mode that TUIC does not provide. Since it is an add-on protocol, you will need to use sing-box or
|
stream based UDP relay mode that TUIC does not provide. Since it is an add-on protocol, you will need to use sing-box or
|
||||||
another program compatible with the protocol as a server.
|
another program compatible with the protocol as a server.
|
||||||
|
|
||||||
@@ -584,7 +608,7 @@ Requires sing-box to be compiled with Go 1.21.
|
|||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
|
|
||||||
This is the TUIC port of the [UDP over TCP protocol](/configuration/shared/udp-over-tcp), designed to provide a QUIC
|
This is the TUIC port of the [UDP over TCP protocol](/configuration/shared/udp-over-tcp/), designed to provide a QUIC
|
||||||
stream based UDP relay mode that TUIC does not provide. Since it is an add-on protocol, you will need to use sing-box or
|
stream based UDP relay mode that TUIC does not provide. Since it is an add-on protocol, you will need to use sing-box or
|
||||||
another program compatible with the protocol as a server.
|
another program compatible with the protocol as a server.
|
||||||
|
|
||||||
@@ -622,8 +646,8 @@ Requires sing-box to be compiled with Go 1.21.
|
|||||||
|
|
||||||
*1*:
|
*1*:
|
||||||
|
|
||||||
See [TUIC inbound](/configuration/inbound/tuic)
|
See [TUIC inbound](/configuration/inbound/tuic/)
|
||||||
and [TUIC outbound](/configuration/outbound/tuic)
|
and [TUIC outbound](/configuration/outbound/tuic/)
|
||||||
|
|
||||||
#### 1.3.6
|
#### 1.3.6
|
||||||
|
|
||||||
@@ -632,7 +656,7 @@ and [TUIC outbound](/configuration/outbound/tuic)
|
|||||||
#### 1.3.5
|
#### 1.3.5
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
* Introducing our [Apple tvOS](/installation/clients/sft) client applications **1**
|
* Introducing our [Apple tvOS](/installation/clients/sft/) client applications **1**
|
||||||
* Add per app proxy and app installed/updated trigger support for Android client
|
* Add per app proxy and app installed/updated trigger support for Android client
|
||||||
* Add profile sharing support for Android/iOS/macOS clients
|
* Add profile sharing support for Android/iOS/macOS clients
|
||||||
|
|
||||||
@@ -659,7 +683,7 @@ downloaded through TestFlight.
|
|||||||
|
|
||||||
#### 1.3.1-beta.3
|
#### 1.3.1-beta.3
|
||||||
|
|
||||||
* Introducing our [new iOS](/installation/clients/sfi) and [macOS](/installation/clients/sfm) client applications **1**
|
* Introducing our [new iOS](/installation/clients/sfi/) and [macOS](/installation/clients/sfm/) client applications **1**
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
**1**:
|
**1**:
|
||||||
@@ -680,7 +704,7 @@ The old testflight link and app are no longer valid.
|
|||||||
|
|
||||||
Important changes since 1.2:
|
Important changes since 1.2:
|
||||||
|
|
||||||
* Add [FakeIP](/configuration/dns/fakeip) support **1**
|
* Add [FakeIP](/configuration/dns/fakeip/) support **1**
|
||||||
* Improve multiplex **2**
|
* Improve multiplex **2**
|
||||||
* Add [DNS reverse mapping](/configuration/dns#reverse_mapping) support
|
* Add [DNS reverse mapping](/configuration/dns#reverse_mapping) support
|
||||||
* Add `rewrite_ttl` DNS rule action
|
* Add `rewrite_ttl` DNS rule action
|
||||||
@@ -707,11 +731,11 @@ Important changes since 1.2:
|
|||||||
|
|
||||||
*1*:
|
*1*:
|
||||||
|
|
||||||
See [FAQ](/faq/fakeip) for more information.
|
See [FAQ](/faq/fakeip/) for more information.
|
||||||
|
|
||||||
*2*:
|
*2*:
|
||||||
|
|
||||||
Added new `h2mux` multiplex protocol and `padding` multiplex option, see [Multiplex](/configuration/shared/multiplex).
|
Added new `h2mux` multiplex protocol and `padding` multiplex option, see [Multiplex](/configuration/shared/multiplex/).
|
||||||
|
|
||||||
#### 1.3-rc2
|
#### 1.3-rc2
|
||||||
|
|
||||||
@@ -773,7 +797,7 @@ Improved performance and reduced memory usage.
|
|||||||
|
|
||||||
*1*:
|
*1*:
|
||||||
|
|
||||||
Added new `h2mux` multiplex protocol and `padding` multiplex option, see [Multiplex](/configuration/shared/multiplex).
|
Added new `h2mux` multiplex protocol and `padding` multiplex option, see [Multiplex](/configuration/shared/multiplex/).
|
||||||
|
|
||||||
#### 1.2.6
|
#### 1.2.6
|
||||||
|
|
||||||
@@ -825,25 +849,25 @@ This is an incompatible update for XUDP in VLESS if vision flow is enabled.
|
|||||||
#### 1.3-beta1
|
#### 1.3-beta1
|
||||||
|
|
||||||
* Add [DNS reverse mapping](/configuration/dns#reverse_mapping) support
|
* Add [DNS reverse mapping](/configuration/dns#reverse_mapping) support
|
||||||
* Add [L3 routing](/configuration/route/ip-rule) support **1**
|
* Add [L3 routing](/configuration/route/ip-rule/) support **1**
|
||||||
* Add `rewrite_ttl` DNS rule action
|
* Add `rewrite_ttl` DNS rule action
|
||||||
* Add [FakeIP](/configuration/dns/fakeip) support **2**
|
* Add [FakeIP](/configuration/dns/fakeip/) support **2**
|
||||||
* Add `store_fakeip` Clash API option
|
* Add `store_fakeip` Clash API option
|
||||||
* Add multi-peer support for [WireGuard](/configuration/outbound/wireguard#peers) outbound
|
* Add multi-peer support for [WireGuard](/configuration/outbound/wireguard#peers) outbound
|
||||||
* Add loopback detect
|
* Add loopback detect
|
||||||
|
|
||||||
*1*:
|
*1*:
|
||||||
|
|
||||||
It can currently be used to [route connections directly to WireGuard](/examples/wireguard-direct) or block connections
|
It can currently be used to [route connections directly to WireGuard](/examples/wireguard-direct/) or block connections
|
||||||
at the IP layer.
|
at the IP layer.
|
||||||
|
|
||||||
*2*:
|
*2*:
|
||||||
|
|
||||||
See [FAQ](/faq/fakeip) for more information.
|
See [FAQ](/faq/fakeip/) for more information.
|
||||||
|
|
||||||
#### 1.2.3
|
#### 1.2.3
|
||||||
|
|
||||||
* Introducing our [new Android client application](/installation/clients/sfa)
|
* Introducing our [new Android client application](/installation/clients/sfa/)
|
||||||
* Improve UDP domain destination NAT
|
* Improve UDP domain destination NAT
|
||||||
* Update reality protocol
|
* Update reality protocol
|
||||||
* Fix TTL calculation for DNS response
|
* Fix TTL calculation for DNS response
|
||||||
@@ -872,16 +896,16 @@ to `domain` rule.
|
|||||||
|
|
||||||
Important changes since 1.1:
|
Important changes since 1.1:
|
||||||
|
|
||||||
* Introducing our [new iOS client application](/installation/clients/sfi)
|
* Introducing our [new iOS client application](/installation/clients/sfi/)
|
||||||
* Introducing [UDP over TCP protocol version 2](/configuration/shared/udp-over-tcp)
|
* Introducing [UDP over TCP protocol version 2](/configuration/shared/udp-over-tcp/)
|
||||||
* Add [platform options](/configuration/inbound/tun#platform) for tun inbound
|
* Add [platform options](/configuration/inbound/tun#platform) for tun inbound
|
||||||
* Add [ShadowTLS protocol v3](https://github.com/ihciah/shadow-tls/blob/master/docs/protocol-v3-en.md)
|
* Add [ShadowTLS protocol v3](https://github.com/ihciah/shadow-tls/blob/master/docs/protocol-v3-en.md)
|
||||||
* Add [VLESS server](/configuration/inbound/vless) and [vision](/configuration/outbound/vless#flow) support
|
* Add [VLESS server](/configuration/inbound/vless/) and [vision](/configuration/outbound/vless#flow) support
|
||||||
* Add [reality TLS](/configuration/shared/tls) support
|
* Add [reality TLS](/configuration/shared/tls/) support
|
||||||
* Add [NTP service](/configuration/ntp)
|
* Add [NTP service](/configuration/ntp/)
|
||||||
* Add [DHCP DNS server](/configuration/dns/server) support
|
* Add [DHCP DNS server](/configuration/dns/server/) support
|
||||||
* Add SSH [host key validation](/configuration/outbound/ssh) support
|
* Add SSH [host key validation](/configuration/outbound/ssh/) support
|
||||||
* Add [query_type](/configuration/dns/rule) DNS rule item
|
* Add [query_type](/configuration/dns/rule/) DNS rule item
|
||||||
* Add fallback support for v2ray transport
|
* Add fallback support for v2ray transport
|
||||||
* Add custom TLS server support for http based v2ray transports
|
* Add custom TLS server support for http based v2ray transports
|
||||||
* Add health check support for http-based v2ray transports
|
* Add health check support for http-based v2ray transports
|
||||||
@@ -912,7 +936,7 @@ name.
|
|||||||
|
|
||||||
#### 1.2-beta9
|
#### 1.2-beta9
|
||||||
|
|
||||||
* Introducing the [UDP over TCP protocol version 2](/configuration/shared/udp-over-tcp)
|
* Introducing the [UDP over TCP protocol version 2](/configuration/shared/udp-over-tcp/)
|
||||||
* Add health check support for http-based v2ray transports
|
* Add health check support for http-based v2ray transports
|
||||||
* Remove length limit on short_id for reality TLS config
|
* Remove length limit on short_id for reality TLS config
|
||||||
* Fix bugs and update dependencies
|
* Fix bugs and update dependencies
|
||||||
@@ -929,7 +953,7 @@ name.
|
|||||||
|
|
||||||
#### 1.2-beta6
|
#### 1.2-beta6
|
||||||
|
|
||||||
* Introducing our [new iOS client application](/installation/clients/sfi)
|
* Introducing our [new iOS client application](/installation/clients/sfi/)
|
||||||
* Add [platform options](/configuration/inbound/tun#platform) for tun inbound
|
* Add [platform options](/configuration/inbound/tun#platform) for tun inbound
|
||||||
* Add custom TLS server support for http based v2ray transports
|
* Add custom TLS server support for http based v2ray transports
|
||||||
* Add generate commands
|
* Add generate commands
|
||||||
@@ -942,8 +966,8 @@ name.
|
|||||||
|
|
||||||
#### 1.2-beta5
|
#### 1.2-beta5
|
||||||
|
|
||||||
* Add [VLESS server](/configuration/inbound/vless) and [vision](/configuration/outbound/vless#flow) support
|
* Add [VLESS server](/configuration/inbound/vless/) and [vision](/configuration/outbound/vless#flow) support
|
||||||
* Add [reality TLS](/configuration/shared/tls) support
|
* Add [reality TLS](/configuration/shared/tls/) support
|
||||||
* Fix match private address
|
* Fix match private address
|
||||||
|
|
||||||
#### 1.1.6
|
#### 1.1.6
|
||||||
@@ -958,7 +982,7 @@ name.
|
|||||||
|
|
||||||
#### 1.2-beta4
|
#### 1.2-beta4
|
||||||
|
|
||||||
* Add [NTP service](/configuration/ntp)
|
* Add [NTP service](/configuration/ntp/)
|
||||||
* Add Add multiple server names and multi-user support for shadowtls
|
* Add Add multiple server names and multi-user support for shadowtls
|
||||||
* Add strict mode support for shadowtls v3
|
* Add strict mode support for shadowtls v3
|
||||||
* Add uTLS support for shadowtls v3
|
* Add uTLS support for shadowtls v3
|
||||||
@@ -978,9 +1002,9 @@ name.
|
|||||||
|
|
||||||
#### 1.2-beta1
|
#### 1.2-beta1
|
||||||
|
|
||||||
* Add [DHCP DNS server](/configuration/dns/server) support
|
* Add [DHCP DNS server](/configuration/dns/server/) support
|
||||||
* Add SSH [host key validation](/configuration/outbound/ssh) support
|
* Add SSH [host key validation](/configuration/outbound/ssh/) support
|
||||||
* Add [query_type](/configuration/dns/rule) DNS rule item
|
* Add [query_type](/configuration/dns/rule/) DNS rule item
|
||||||
* Add v2ray [user stats](/configuration/experimental#statsusers) api
|
* Add v2ray [user stats](/configuration/experimental#statsusers) api
|
||||||
* Add new clash DNS query api
|
* Add new clash DNS query api
|
||||||
* Improve vmess request
|
* Improve vmess request
|
||||||
@@ -1209,7 +1233,7 @@ and [ShadowTLS outbound](/configuration/outbound/shadowtls#version)
|
|||||||
|
|
||||||
#### 1.1-beta6
|
#### 1.1-beta6
|
||||||
|
|
||||||
* Add [URLTest outbound](/configuration/outbound/urltest)
|
* Add [URLTest outbound](/configuration/outbound/urltest/)
|
||||||
* Fix bugs in 1.1-beta5
|
* Fix bugs in 1.1-beta5
|
||||||
|
|
||||||
#### 1.1-beta5
|
#### 1.1-beta5
|
||||||
@@ -1241,8 +1265,8 @@ The default tun stack is changed to system.
|
|||||||
#### 1.1-beta4
|
#### 1.1-beta4
|
||||||
|
|
||||||
* Add internal simple-obfs and v2ray-plugin [Shadowsocks plugins](/configuration/outbound/shadowsocks#plugin)
|
* Add internal simple-obfs and v2ray-plugin [Shadowsocks plugins](/configuration/outbound/shadowsocks#plugin)
|
||||||
* Add [ShadowsocksR outbound](/configuration/outbound/shadowsocksr)
|
* Add [ShadowsocksR outbound](/configuration/outbound/shadowsocksr/)
|
||||||
* Add [VLESS outbound and XUDP](/configuration/outbound/vless)
|
* Add [VLESS outbound and XUDP](/configuration/outbound/vless/)
|
||||||
* Skip wait for hysteria tcp handshake response
|
* Skip wait for hysteria tcp handshake response
|
||||||
* Fix socks4 client
|
* Fix socks4 client
|
||||||
* Fix hysteria inbound
|
* Fix hysteria inbound
|
||||||
@@ -1269,7 +1293,7 @@ The default tun stack is changed to system.
|
|||||||
*1*:
|
*1*:
|
||||||
|
|
||||||
Switching modes using the Clash API, and `store-selected` are now supported,
|
Switching modes using the Clash API, and `store-selected` are now supported,
|
||||||
see [Experimental](/configuration/experimental).
|
see [Experimental](/configuration/experimental/).
|
||||||
|
|
||||||
*2*:
|
*2*:
|
||||||
|
|
||||||
@@ -1350,15 +1374,15 @@ and [Listen Fields](/configuration/shared/listen#udp_fragment).
|
|||||||
* Fix write trojan udp
|
* Fix write trojan udp
|
||||||
* Fix DNS routing
|
* Fix DNS routing
|
||||||
* Add attribute support for geosite
|
* Add attribute support for geosite
|
||||||
* Update documentation for [Dial Fields](/configuration/shared/dial)
|
* Update documentation for [Dial Fields](/configuration/shared/dial/)
|
||||||
|
|
||||||
#### 1.0-beta3
|
#### 1.0-beta3
|
||||||
|
|
||||||
* Add [chained inbound](/configuration/shared/listen#detour) support
|
* Add [chained inbound](/configuration/shared/listen#detour) support
|
||||||
* Add process_path rule item
|
* Add process_path rule item
|
||||||
* Add macOS redirect support
|
* Add macOS redirect support
|
||||||
* Add ShadowTLS [Inbound](/configuration/inbound/shadowtls), [Outbound](/configuration/outbound/shadowtls)
|
* Add ShadowTLS [Inbound](/configuration/inbound/shadowtls/), [Outbound](/configuration/outbound/shadowtls/)
|
||||||
and [Examples](/examples/shadowtls)
|
and [Examples](/examples/shadowtls/)
|
||||||
* Fix search android package in non-owner users
|
* Fix search android package in non-owner users
|
||||||
* Fix socksaddr type condition
|
* Fix socksaddr type condition
|
||||||
* Fix smux session status
|
* Fix smux session status
|
||||||
@@ -1402,7 +1426,7 @@ and [Listen Fields](/configuration/shared/listen#udp_fragment).
|
|||||||
|
|
||||||
##### 2022/08/23
|
##### 2022/08/23
|
||||||
|
|
||||||
* Add [V2Ray Transport](/configuration/shared/v2ray-transport) support for VMess and Trojan
|
* Add [V2Ray Transport](/configuration/shared/v2ray-transport/) support for VMess and Trojan
|
||||||
* Allow plain http request in Naive inbound (It can now be used with nginx)
|
* Allow plain http request in Naive inbound (It can now be used with nginx)
|
||||||
* Add proxy protocol support
|
* Add proxy protocol support
|
||||||
* Free memory after start
|
* Free memory after start
|
||||||
@@ -1411,13 +1435,13 @@ and [Listen Fields](/configuration/shared/listen#udp_fragment).
|
|||||||
|
|
||||||
##### 2022/08/22
|
##### 2022/08/22
|
||||||
|
|
||||||
* Add strategy setting for each [DNS server](/configuration/dns/server)
|
* Add strategy setting for each [DNS server](/configuration/dns/server/)
|
||||||
* Add bind address to outbound options
|
* Add bind address to outbound options
|
||||||
|
|
||||||
##### 2022/08/21
|
##### 2022/08/21
|
||||||
|
|
||||||
* Add [Tor outbound](/configuration/outbound/tor)
|
* Add [Tor outbound](/configuration/outbound/tor/)
|
||||||
* Add [SSH outbound](/configuration/outbound/ssh)
|
* Add [SSH outbound](/configuration/outbound/ssh/)
|
||||||
|
|
||||||
##### 2022/08/20
|
##### 2022/08/20
|
||||||
|
|
||||||
@@ -1431,8 +1455,8 @@ and [Listen Fields](/configuration/shared/listen#udp_fragment).
|
|||||||
|
|
||||||
##### 2022/08/19
|
##### 2022/08/19
|
||||||
|
|
||||||
* Add Hysteria [Inbound](/configuration/inbound/hysteria) and [Outbund](/configuration/outbound/hysteria)
|
* Add Hysteria [Inbound](/configuration/inbound/hysteria/) and [Outbund](/configuration/outbound/hysteria/)
|
||||||
* Add [ACME TLS certificate issuer](/configuration/shared/tls)
|
* Add [ACME TLS certificate issuer](/configuration/shared/tls/)
|
||||||
* Allow read config from stdin (-c stdin)
|
* Allow read config from stdin (-c stdin)
|
||||||
* Update gVisor to 20220815.0
|
* Update gVisor to 20220815.0
|
||||||
|
|
||||||
@@ -1450,11 +1474,11 @@ and [Listen Fields](/configuration/shared/listen#udp_fragment).
|
|||||||
##### 2022/08/16
|
##### 2022/08/16
|
||||||
|
|
||||||
* Add ip_version (route/dns) rule item
|
* Add ip_version (route/dns) rule item
|
||||||
* Add [WireGuard](/configuration/outbound/wireguard) outbound
|
* Add [WireGuard](/configuration/outbound/wireguard/) outbound
|
||||||
|
|
||||||
##### 2022/08/15
|
##### 2022/08/15
|
||||||
|
|
||||||
* Add uid, android user and package rules support in [Tun](/configuration/inbound/tun) routing.
|
* Add uid, android user and package rules support in [Tun](/configuration/inbound/tun/) routing.
|
||||||
|
|
||||||
##### 2022/08/13
|
##### 2022/08/13
|
||||||
|
|
||||||
@@ -1463,15 +1487,15 @@ and [Listen Fields](/configuration/shared/listen#udp_fragment).
|
|||||||
##### 2022/08/12
|
##### 2022/08/12
|
||||||
|
|
||||||
* Performance improvements
|
* Performance improvements
|
||||||
* Add UoT option for [SOCKS](/configuration/outbound/socks) outbound
|
* Add UoT option for [SOCKS](/configuration/outbound/socks/) outbound
|
||||||
|
|
||||||
##### 2022/08/11
|
##### 2022/08/11
|
||||||
|
|
||||||
* Add UoT option for [Shadowsocks](/configuration/outbound/shadowsocks) outbound, UoT support for all inbounds
|
* Add UoT option for [Shadowsocks](/configuration/outbound/shadowsocks/) outbound, UoT support for all inbounds
|
||||||
|
|
||||||
##### 2022/08/10
|
##### 2022/08/10
|
||||||
|
|
||||||
* Add full-featured [Naive](/configuration/inbound/naive) inbound
|
* Add full-featured [Naive](/configuration/inbound/naive/) inbound
|
||||||
* Fix default dns server option [#9] by iKirby
|
* Fix default dns server option [#9] by iKirby
|
||||||
|
|
||||||
##### 2022/08/09
|
##### 2022/08/09
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
Maintained by Project S to provide a unified experience and platform-specific functionality.
|
Maintained by Project S to provide a unified experience and platform-specific functionality.
|
||||||
|
|
||||||
| Platform | Client |
|
| Platform | Client |
|
||||||
|---------------------------------------|-----------------------------------------|
|
|---------------------------------------|------------------------------------------|
|
||||||
| :material-android: Android | [sing-box for Android](./android) |
|
| :material-android: Android | [sing-box for Android](./android/) |
|
||||||
| :material-apple: iOS/macOS/Apple tvOS | [sing-box for Apple platforms](./apple) |
|
| :material-apple: iOS/macOS/Apple tvOS | [sing-box for Apple platforms](./apple/) |
|
||||||
| :material-laptop: Desktop | Working in progress |
|
| :material-laptop: Desktop | Working in progress |
|
||||||
|
|
||||||
Some third-party projects that claim to use sing-box or use sing-box as a selling point are not listed here. The core
|
Some third-party projects that claim to use sing-box or use sing-box as a selling point are not listed here. The core
|
||||||
motivation of the maintainers of such projects is to acquire more users, and even though they provide friendly VPN
|
motivation of the maintainers of such projects is to acquire more users, and even though they provide friendly VPN
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
| 平台 | 客户端 |
|
| 平台 | 客户端 |
|
||||||
|---------------------------------------|-----------------------------------------|
|
|---------------------------------------|-----------------------------------------|
|
||||||
| :material-android: Android | [sing-box for Android](./android) |
|
| :material-android: Android | [sing-box for Android](./android/) |
|
||||||
| :material-apple: iOS/macOS/Apple tvOS | [sing-box for Apple platforms](./apple) |
|
| :material-apple: iOS/macOS/Apple tvOS | [sing-box for Apple platforms](./apple/) |
|
||||||
| :material-laptop: Desktop | 施工中 |
|
| :material-laptop: Desktop | 施工中 |
|
||||||
|
|
||||||
此处没有列出一些声称使用或以 sing-box 为卖点的第三方项目。此类项目维护者的动机是获得更多用户,即使它们提供友好的商业
|
此处没有列出一些声称使用或以 sing-box 为卖点的第三方项目。此类项目维护者的动机是获得更多用户,即使它们提供友好的商业
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
| Key | Format |
|
| Key | Format |
|
||||||
|----------|--------------------------------|
|
|----------|--------------------------------|
|
||||||
| `server` | List of [DNS Server](./server) |
|
| `server` | List of [DNS Server](./server/) |
|
||||||
| `rules` | List of [DNS Rule](./rule) |
|
| `rules` | List of [DNS Rule](./rule/) |
|
||||||
| `fakeip` | [FakeIP](./fakeip) |
|
| `fakeip` | [FakeIP](./fakeip/) |
|
||||||
|
|
||||||
#### final
|
#### final
|
||||||
|
|
||||||
@@ -62,4 +62,4 @@ problematic in environments such as macOS, where DNS is proxied and cached by th
|
|||||||
|
|
||||||
#### fakeip
|
#### fakeip
|
||||||
|
|
||||||
[FakeIP](./fakeip) settings.
|
[FakeIP](./fakeip/) settings.
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
| 键 | 格式 |
|
| 键 | 格式 |
|
||||||
|----------|------------------------|
|
|----------|-------------------------|
|
||||||
| `server` | 一组 [DNS 服务器](./server) |
|
| `server` | 一组 [DNS 服务器](./server/) |
|
||||||
| `rules` | 一组 [DNS 规则](./rule) |
|
| `rules` | 一组 [DNS 规则](./rule/) |
|
||||||
|
|
||||||
#### final
|
#### final
|
||||||
|
|
||||||
@@ -60,4 +60,4 @@
|
|||||||
|
|
||||||
#### fakeip
|
#### fakeip
|
||||||
|
|
||||||
[FakeIP](./fakeip) 设置。
|
[FakeIP](./fakeip/) 设置。
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
#### inbound
|
#### inbound
|
||||||
|
|
||||||
Tags of [Inbound](/configuration/inbound).
|
Tags of [Inbound](/configuration/inbound/).
|
||||||
|
|
||||||
#### ip_version
|
#### ip_version
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
#### inbound
|
#### inbound
|
||||||
|
|
||||||
[入站](/zh/configuration/inbound) 标签.
|
[入站](/zh/configuration/inbound/) 标签.
|
||||||
|
|
||||||
#### ip_version
|
#### ip_version
|
||||||
|
|
||||||
|
|||||||
@@ -30,18 +30,18 @@ The tag of the dns server.
|
|||||||
|
|
||||||
The address of the dns server.
|
The address of the dns server.
|
||||||
|
|
||||||
| Protocol | Format |
|
| Protocol | Format |
|
||||||
|-------------------------------------|-------------------------------|
|
|--------------------------------------|-------------------------------|
|
||||||
| `System` | `local` |
|
| `System` | `local` |
|
||||||
| `TCP` | `tcp://1.0.0.1` |
|
| `TCP` | `tcp://1.0.0.1` |
|
||||||
| `UDP` | `8.8.8.8` `udp://8.8.4.4` |
|
| `UDP` | `8.8.8.8` `udp://8.8.4.4` |
|
||||||
| `TLS` | `tls://dns.google` |
|
| `TLS` | `tls://dns.google` |
|
||||||
| `HTTPS` | `https://1.1.1.1/dns-query` |
|
| `HTTPS` | `https://1.1.1.1/dns-query` |
|
||||||
| `QUIC` | `quic://dns.adguard.com` |
|
| `QUIC` | `quic://dns.adguard.com` |
|
||||||
| `HTTP3` | `h3://8.8.8.8/dns-query` |
|
| `HTTP3` | `h3://8.8.8.8/dns-query` |
|
||||||
| `RCode` | `rcode://refused` |
|
| `RCode` | `rcode://refused` |
|
||||||
| `DHCP` | `dhcp://auto` or `dhcp://en0` |
|
| `DHCP` | `dhcp://auto` or `dhcp://en0` |
|
||||||
| [FakeIP](/configuration/dns/fakeip) | `fakeip` |
|
| [FakeIP](/configuration/dns/fakeip/) | `fakeip` |
|
||||||
|
|
||||||
!!! warning ""
|
!!! warning ""
|
||||||
|
|
||||||
|
|||||||
@@ -30,18 +30,18 @@ DNS 服务器的标签。
|
|||||||
|
|
||||||
DNS 服务器的地址。
|
DNS 服务器的地址。
|
||||||
|
|
||||||
| 协议 | 格式 |
|
| 协议 | 格式 |
|
||||||
|-------------------------------------|------------------------------|
|
|--------------------------------------|------------------------------|
|
||||||
| `System` | `local` |
|
| `System` | `local` |
|
||||||
| `TCP` | `tcp://1.0.0.1` |
|
| `TCP` | `tcp://1.0.0.1` |
|
||||||
| `UDP` | `8.8.8.8` `udp://8.8.4.4` |
|
| `UDP` | `8.8.8.8` `udp://8.8.4.4` |
|
||||||
| `TLS` | `tls://dns.google` |
|
| `TLS` | `tls://dns.google` |
|
||||||
| `HTTPS` | `https://1.1.1.1/dns-query` |
|
| `HTTPS` | `https://1.1.1.1/dns-query` |
|
||||||
| `QUIC` | `quic://dns.adguard.com` |
|
| `QUIC` | `quic://dns.adguard.com` |
|
||||||
| `HTTP3` | `h3://8.8.8.8/dns-query` |
|
| `HTTP3` | `h3://8.8.8.8/dns-query` |
|
||||||
| `RCode` | `rcode://refused` |
|
| `RCode` | `rcode://refused` |
|
||||||
| `DHCP` | `dhcp://auto` 或 `dhcp://en0` |
|
| `DHCP` | `dhcp://auto` 或 `dhcp://en0` |
|
||||||
| [FakeIP](/configuration/dns/fakeip) | `fakeip` |
|
| [FakeIP](/configuration/dns/fakeip/) | `fakeip` |
|
||||||
|
|
||||||
!!! warning ""
|
!!! warning ""
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -15,24 +15,24 @@
|
|||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
| Type | Format | Injectable |
|
| Type | Format | Injectable |
|
||||||
|---------------|------------------------------|------------|
|
|---------------|-------------------------------|------------|
|
||||||
| `direct` | [Direct](./direct) | X |
|
| `direct` | [Direct](./direct/) | X |
|
||||||
| `mixed` | [Mixed](./mixed) | TCP |
|
| `mixed` | [Mixed](./mixed/) | TCP |
|
||||||
| `socks` | [SOCKS](./socks) | TCP |
|
| `socks` | [SOCKS](./socks/) | TCP |
|
||||||
| `http` | [HTTP](./http) | TCP |
|
| `http` | [HTTP](./http/) | TCP |
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) | TCP |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks/) | TCP |
|
||||||
| `vmess` | [VMess](./vmess) | TCP |
|
| `vmess` | [VMess](./vmess/) | TCP |
|
||||||
| `trojan` | [Trojan](./trojan) | TCP |
|
| `trojan` | [Trojan](./trojan/) | TCP |
|
||||||
| `naive` | [Naive](./naive) | X |
|
| `naive` | [Naive](./naive/) | X |
|
||||||
| `hysteria` | [Hysteria](./hysteria) | X |
|
| `hysteria` | [Hysteria](./hysteria/) | X |
|
||||||
| `shadowtls` | [ShadowTLS](./shadowtls) | TCP |
|
| `shadowtls` | [ShadowTLS](./shadowtls/) | TCP |
|
||||||
| `tuic` | [TUIC](./tuic) | X |
|
| `tuic` | [TUIC](./tuic/) | X |
|
||||||
| `hysteria2` | [Hysteria2](./hysteria2) | X |
|
| `hysteria2` | [Hysteria2](./hysteria2/) | X |
|
||||||
| `vless` | [VLESS](./vless) | TCP |
|
| `vless` | [VLESS](./vless/) | TCP |
|
||||||
| `tun` | [Tun](./tun) | X |
|
| `tun` | [Tun](./tun/) | X |
|
||||||
| `redirect` | [Redirect](./redirect) | X |
|
| `redirect` | [Redirect](./redirect/) | X |
|
||||||
| `tproxy` | [TProxy](./tproxy) | X |
|
| `tproxy` | [TProxy](./tproxy/) | X |
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
||||||
|
|||||||
@@ -17,22 +17,22 @@
|
|||||||
|
|
||||||
| 类型 | 格式 | 注入支持 |
|
| 类型 | 格式 | 注入支持 |
|
||||||
|---------------|------------------------------|------|
|
|---------------|------------------------------|------|
|
||||||
| `direct` | [Direct](./direct) | X |
|
| `direct` | [Direct](./direct/) | X |
|
||||||
| `mixed` | [Mixed](./mixed) | TCP |
|
| `mixed` | [Mixed](./mixed/) | TCP |
|
||||||
| `socks` | [SOCKS](./socks) | TCP |
|
| `socks` | [SOCKS](./socks/) | TCP |
|
||||||
| `http` | [HTTP](./http) | TCP |
|
| `http` | [HTTP](./http/) | TCP |
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) | TCP |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks/) | TCP |
|
||||||
| `vmess` | [VMess](./vmess) | TCP |
|
| `vmess` | [VMess](./vmess/) | TCP |
|
||||||
| `trojan` | [Trojan](./trojan) | TCP |
|
| `trojan` | [Trojan](./trojan/) | TCP |
|
||||||
| `naive` | [Naive](./naive) | X |
|
| `naive` | [Naive](./naive/) | X |
|
||||||
| `hysteria` | [Hysteria](./hysteria) | X |
|
| `hysteria` | [Hysteria](./hysteria/) | X |
|
||||||
| `shadowtls` | [ShadowTLS](./shadowtls) | TCP |
|
| `shadowtls` | [ShadowTLS](./shadowtls/) | TCP |
|
||||||
| `tuic` | [TUIC](./tuic) | X |
|
| `tuic` | [TUIC](./tuic/) | X |
|
||||||
| `hysteria2` | [Hysteria2](./hysteria2) | X |
|
| `hysteria2` | [Hysteria2](./hysteria2/) | X |
|
||||||
| `vless` | [VLESS](./vless) | TCP |
|
| `vless` | [VLESS](./vless/) | TCP |
|
||||||
| `tun` | [Tun](./tun) | X |
|
| `tun` | [Tun](./tun/) | X |
|
||||||
| `redirect` | [Redirect](./redirect) | X |
|
| `redirect` | [Redirect](./redirect/) | X |
|
||||||
| `tproxy` | [TProxy](./tproxy) | X |
|
| `tproxy` | [TProxy](./tproxy/) | X |
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -15,4 +15,4 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
@@ -66,11 +66,11 @@ Only available in the ShadowTLS protocol 3.
|
|||||||
|
|
||||||
==Required==
|
==Required==
|
||||||
|
|
||||||
Handshake server address and [Dial options](/configuration/shared/dial).
|
Handshake server address and [Dial options](/configuration/shared/dial/).
|
||||||
|
|
||||||
#### handshake_for_server_name
|
#### handshake_for_server_name
|
||||||
|
|
||||||
Handshake server address and [Dial options](/configuration/shared/dial) for specific server name.
|
Handshake server address and [Dial options](/configuration/shared/dial/) for specific server name.
|
||||||
|
|
||||||
Only available in the ShadowTLS protocol 2/3.
|
Only available in the ShadowTLS protocol 2/3.
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
@@ -65,4 +65,4 @@ See [Multiplex](/configuration/shared/multiplex#inbound) for details.
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
|
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport/).
|
||||||
|
|||||||
@@ -67,4 +67,4 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
|
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport/)。
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
"fc00::/7"
|
"fc00::/7"
|
||||||
],
|
],
|
||||||
"endpoint_independent_nat": false,
|
"endpoint_independent_nat": false,
|
||||||
|
"udp_timeout": "5m",
|
||||||
"stack": "system",
|
"stack": "system",
|
||||||
"include_interface": [
|
"include_interface": [
|
||||||
"lan0"
|
"lan0"
|
||||||
@@ -240,4 +241,4 @@ System HTTP proxy settings.
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
"fc00::/7"
|
"fc00::/7"
|
||||||
],
|
],
|
||||||
"endpoint_independent_nat": false,
|
"endpoint_independent_nat": false,
|
||||||
|
"udp_timeout": "5m",
|
||||||
"stack": "system",
|
"stack": "system",
|
||||||
"include_interface": [
|
"include_interface": [
|
||||||
"lan0"
|
"lan0"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
@@ -56,4 +56,4 @@ See [Multiplex](/configuration/shared/multiplex#inbound) for details.
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
|
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport/).
|
||||||
|
|||||||
@@ -56,4 +56,4 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
|
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport/)。
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
### Listen Fields
|
### Listen Fields
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen) for details.
|
See [Listen Fields](/configuration/shared/listen/) for details.
|
||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
@@ -51,4 +51,4 @@ See [Multiplex](/configuration/shared/multiplex#inbound) for details.
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
|
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport/).
|
||||||
|
|||||||
@@ -51,4 +51,4 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
|
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport/)。
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ sing-box uses JSON for configuration files.
|
|||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
| Key | Format |
|
| Key | Format |
|
||||||
|----------------|--------------------------------|
|
|----------------|---------------------------------|
|
||||||
| `log` | [Log](./log) |
|
| `log` | [Log](./log/) |
|
||||||
| `dns` | [DNS](./dns) |
|
| `dns` | [DNS](./dns/) |
|
||||||
| `ntp` | [NTP](./ntp) |
|
| `ntp` | [NTP](./ntp/) |
|
||||||
| `inbounds` | [Inbound](./inbound) |
|
| `inbounds` | [Inbound](./inbound/) |
|
||||||
| `outbounds` | [Outbound](./outbound) |
|
| `outbounds` | [Outbound](./outbound/) |
|
||||||
| `route` | [Route](./route) |
|
| `route` | [Route](./route/) |
|
||||||
| `experimental` | [Experimental](./experimental) |
|
| `experimental` | [Experimental](./experimental/) |
|
||||||
|
|
||||||
### Check
|
### Check
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ sing-box 使用 JSON 作为配置文件格式。
|
|||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
| Key | Format |
|
| Key | Format |
|
||||||
|----------------|-----------------------|
|
|----------------|------------------------|
|
||||||
| `log` | [日志](./log) |
|
| `log` | [日志](./log/) |
|
||||||
| `dns` | [DNS](./dns) |
|
| `dns` | [DNS](./dns/) |
|
||||||
| `inbounds` | [入站](./inbound) |
|
| `inbounds` | [入站](./inbound/) |
|
||||||
| `outbounds` | [出站](./outbound) |
|
| `outbounds` | [出站](./outbound/) |
|
||||||
| `route` | [路由](./route) |
|
| `route` | [路由](./route/) |
|
||||||
| `experimental` | [实验性](./experimental) |
|
| `experimental` | [实验性](./experimental/) |
|
||||||
|
|
||||||
### 检查
|
### 检查
|
||||||
|
|
||||||
|
|||||||
@@ -47,4 +47,4 @@ Time synchronization interval.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
@@ -33,4 +33,4 @@ Protocol value can be `1` or `2`.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -55,4 +55,4 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -113,4 +113,4 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -88,4 +88,4 @@ Enable debug information logging for Hysteria Brutal CC.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -15,27 +15,27 @@
|
|||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
| Type | Format |
|
| Type | Format |
|
||||||
|----------------|--------------------------------|
|
|----------------|---------------------------------|
|
||||||
| `direct` | [Direct](./direct) |
|
| `direct` | [Direct](./direct/) |
|
||||||
| `block` | [Block](./block) |
|
| `block` | [Block](./block/) |
|
||||||
| `socks` | [SOCKS](./socks) |
|
| `socks` | [SOCKS](./socks/) |
|
||||||
| `http` | [HTTP](./http) |
|
| `http` | [HTTP](./http/) |
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks/) |
|
||||||
| `vmess` | [VMess](./vmess) |
|
| `vmess` | [VMess](./vmess/) |
|
||||||
| `trojan` | [Trojan](./trojan) |
|
| `trojan` | [Trojan](./trojan/) |
|
||||||
| `wireguard` | [Wireguard](./wireguard) |
|
| `wireguard` | [Wireguard](./wireguard/) |
|
||||||
| `hysteria` | [Hysteria](./hysteria) |
|
| `hysteria` | [Hysteria](./hysteria/) |
|
||||||
| `shadowsocksr` | [ShadowsocksR](./shadowsocksr) |
|
| `shadowsocksr` | [ShadowsocksR](./shadowsocksr/) |
|
||||||
| `vless` | [VLESS](./vless) |
|
| `vless` | [VLESS](./vless/) |
|
||||||
| `shadowtls` | [ShadowTLS](./shadowtls) |
|
| `shadowtls` | [ShadowTLS](./shadowtls/) |
|
||||||
| `tuic` | [TUIC](./tuic) |
|
| `tuic` | [TUIC](./tuic/) |
|
||||||
| `hysteria2` | [Hysteria2](./hysteria2) |
|
| `hysteria2` | [Hysteria2](./hysteria2/) |
|
||||||
| `tor` | [Tor](./tor) |
|
| `tor` | [Tor](./tor/) |
|
||||||
| `ssh` | [SSH](./ssh) |
|
| `ssh` | [SSH](./ssh/) |
|
||||||
| `dns` | [DNS](./dns) |
|
| `dns` | [DNS](./dns/) |
|
||||||
| `selector` | [Selector](./selector) |
|
| `selector` | [Selector](./selector/) |
|
||||||
| `urltest` | [URLTest](./urltest) |
|
| `urltest` | [URLTest](./urltest/) |
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
||||||
|
|||||||
@@ -15,27 +15,27 @@
|
|||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
| 类型 | 格式 |
|
| 类型 | 格式 |
|
||||||
|----------------|--------------------------------|
|
|----------------|---------------------------------|
|
||||||
| `direct` | [Direct](./direct) |
|
| `direct` | [Direct](./direct/) |
|
||||||
| `block` | [Block](./block) |
|
| `block` | [Block](./block/) |
|
||||||
| `socks` | [SOCKS](./socks) |
|
| `socks` | [SOCKS](./socks/) |
|
||||||
| `http` | [HTTP](./http) |
|
| `http` | [HTTP](./http/) |
|
||||||
| `shadowsocks` | [Shadowsocks](./shadowsocks) |
|
| `shadowsocks` | [Shadowsocks](./shadowsocks/) |
|
||||||
| `vmess` | [VMess](./vmess) |
|
| `vmess` | [VMess](./vmess/) |
|
||||||
| `trojan` | [Trojan](./trojan) |
|
| `trojan` | [Trojan](./trojan/) |
|
||||||
| `wireguard` | [Wireguard](./wireguard) |
|
| `wireguard` | [Wireguard](./wireguard/) |
|
||||||
| `hysteria` | [Hysteria](./hysteria) |
|
| `hysteria` | [Hysteria](./hysteria/) |
|
||||||
| `shadowsocksr` | [ShadowsocksR](./shadowsocksr) |
|
| `shadowsocksr` | [ShadowsocksR](./shadowsocksr/) |
|
||||||
| `vless` | [VLESS](./vless) |
|
| `vless` | [VLESS](./vless/) |
|
||||||
| `shadowtls` | [ShadowTLS](./shadowtls) |
|
| `shadowtls` | [ShadowTLS](./shadowtls/) |
|
||||||
| `tuic` | [TUIC](./tuic) |
|
| `tuic` | [TUIC](./tuic/) |
|
||||||
| `hysteria2` | [Hysteria2](./hysteria2) |
|
| `hysteria2` | [Hysteria2](./hysteria2/) |
|
||||||
| `tor` | [Tor](./tor) |
|
| `tor` | [Tor](./tor/) |
|
||||||
| `ssh` | [SSH](./ssh) |
|
| `ssh` | [SSH](./ssh/) |
|
||||||
| `dns` | [DNS](./dns) |
|
| `dns` | [DNS](./dns/) |
|
||||||
| `selector` | [Selector](./selector) |
|
| `selector` | [Selector](./selector/) |
|
||||||
| `urltest` | [URLTest](./urltest) |
|
| `urltest` | [URLTest](./urltest/) |
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Both is enabled by default.
|
|||||||
|
|
||||||
UDP over TCP configuration.
|
UDP over TCP configuration.
|
||||||
|
|
||||||
See [UDP Over TCP](/configuration/shared/udp-over-tcp) for details.
|
See [UDP Over TCP](/configuration/shared/udp-over-tcp/) for details.
|
||||||
|
|
||||||
Conflict with `multiplex`.
|
Conflict with `multiplex`.
|
||||||
|
|
||||||
@@ -99,4 +99,4 @@ See [Multiplex](/configuration/shared/multiplex#outbound) for details.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Shadowsocks SIP003 插件参数。
|
|||||||
|
|
||||||
UDP over TCP 配置。
|
UDP over TCP 配置。
|
||||||
|
|
||||||
参阅 [UDP Over TCP](/zh/configuration/shared/udp-over-tcp)。
|
参阅 [UDP Over TCP](/zh/configuration/shared/udp-over-tcp/)。
|
||||||
|
|
||||||
与 `multiplex` 冲突。
|
与 `multiplex` 冲突。
|
||||||
|
|
||||||
|
|||||||
@@ -103,4 +103,4 @@ Both is enabled by default.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -53,4 +53,4 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ Both is enabled by default.
|
|||||||
|
|
||||||
UDP over TCP protocol settings.
|
UDP over TCP protocol settings.
|
||||||
|
|
||||||
See [UDP Over TCP](/configuration/shared/udp-over-tcp) for details.
|
See [UDP Over TCP](/configuration/shared/udp-over-tcp/) for details.
|
||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ SOCKS5 密码。
|
|||||||
|
|
||||||
UDP over TCP 配置。
|
UDP over TCP 配置。
|
||||||
|
|
||||||
参阅 [UDP Over TCP](/zh/configuration/shared/udp-over-tcp)。
|
参阅 [UDP Over TCP](/zh/configuration/shared/udp-over-tcp/)。
|
||||||
|
|
||||||
### 拨号字段
|
### 拨号字段
|
||||||
|
|
||||||
|
|||||||
@@ -68,4 +68,4 @@ Client version. Random version will be used if empty.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ See [tor(1)](https://linux.die.net/man/1/tor) for details.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ See [Multiplex](/configuration/shared/multiplex#outbound) for details.
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
|
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport/).
|
||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
|
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport/)。
|
||||||
|
|
||||||
### 拨号字段
|
### 拨号字段
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Conflict with `udp_over_stream`.
|
|||||||
|
|
||||||
#### udp_over_stream
|
#### udp_over_stream
|
||||||
|
|
||||||
This is the TUIC port of the [UDP over TCP protocol](/configuration/shared/udp-over-tcp), designed to provide a QUIC
|
This is the TUIC port of the [UDP over TCP protocol](/configuration/shared/udp-over-tcp/), designed to provide a QUIC
|
||||||
stream based UDP relay mode that TUIC does not provide. Since it is an add-on protocol, you will need to use sing-box or
|
stream based UDP relay mode that TUIC does not provide. Since it is an add-on protocol, you will need to use sing-box or
|
||||||
another program compatible with the protocol as a server.
|
another program compatible with the protocol as a server.
|
||||||
|
|
||||||
@@ -97,4 +97,4 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ UDP 包中继模式
|
|||||||
|
|
||||||
#### udp_over_stream
|
#### udp_over_stream
|
||||||
|
|
||||||
这是 TUIC 的 [UDP over TCP 协议](/configuration/shared/udp-over-tcp) 移植, 旨在提供 TUIC 不提供的 基于 QUIC 流的 UDP 中继模式。 由于它是一个附加协议,因此您需要使用 sing-box 或其他兼容的程序作为服务器。
|
这是 TUIC 的 [UDP over TCP 协议](/configuration/shared/udp-over-tcp/) 移植, 旨在提供 TUIC 不提供的 基于 QUIC 流的 UDP 中继模式。 由于它是一个附加协议,因此您需要使用 sing-box 或其他兼容的程序作为服务器。
|
||||||
|
|
||||||
此模式在正确的 UDP 代理场景中没有任何积极作用,仅适用于中继流式 UDP 流量(基本上是 QUIC 流)。
|
此模式在正确的 UDP 代理场景中没有任何积极作用,仅适用于中继流式 UDP 流量(基本上是 QUIC 流)。
|
||||||
|
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ See [Multiplex](/configuration/shared/multiplex#outbound) for details.
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
|
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport/).
|
||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ UDP 包编码,默认使用 xudp。
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
|
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport/)。
|
||||||
|
|
||||||
### 拨号字段
|
### 拨号字段
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ See [Multiplex](/configuration/shared/multiplex#outbound) for details.
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
|
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport/).
|
||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ UDP 包编码。
|
|||||||
|
|
||||||
#### transport
|
#### transport
|
||||||
|
|
||||||
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
|
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport/)。
|
||||||
|
|
||||||
### 拨号字段
|
### 拨号字段
|
||||||
|
|
||||||
|
|||||||
@@ -139,4 +139,4 @@ Both is enabled by default.
|
|||||||
|
|
||||||
### Dial Fields
|
### Dial Fields
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial) for details.
|
See [Dial Fields](/configuration/shared/dial/) for details.
|
||||||
|
|||||||
@@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
| Key | Format |
|
| Key | Format |
|
||||||
|------------|------------------------------------|
|
|-----------|-------------------------------|
|
||||||
| `geoip` | [GeoIP](./geoip) |
|
| `geoip` | [GeoIP](./geoip/) |
|
||||||
| `geosite` | [Geosite](./geosite) |
|
| `geosite` | [Geosite](./geosite/) |
|
||||||
| `rules` | List of [Route Rule](./rule) |
|
| `rules` | List of [Route Rule](./rule/) |
|
||||||
|
|
||||||
#### final
|
#### final
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,11 @@
|
|||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
|
|
||||||
| 键 | 格式 |
|
| 键 | 格式 |
|
||||||
|------------|-------------------------|
|
|-----------|-----------------------|
|
||||||
| `geoip` | [GeoIP](./geoip) |
|
| `geoip` | [GeoIP](./geoip/) |
|
||||||
| `geosite` | [GeoSite](./geosite) |
|
| `geosite` | [GeoSite](./geosite/) |
|
||||||
| `rules` | 一组 [路由规则](./rule) |
|
| `rules` | 一组 [路由规则](./rule/) |
|
||||||
|
|
||||||
#### final
|
#### final
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
#### inbound
|
#### inbound
|
||||||
|
|
||||||
Tags of [Inbound](/configuration/inbound).
|
Tags of [Inbound](/configuration/inbound/).
|
||||||
|
|
||||||
#### ip_version
|
#### ip_version
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
|
|
||||||
#### inbound
|
#### inbound
|
||||||
|
|
||||||
[入站](/zh/configuration/inbound) 标签。
|
[入站](/zh/configuration/inbound/) 标签。
|
||||||
|
|
||||||
#### ip_version
|
#### ip_version
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"tcp_fast_open": false,
|
"tcp_fast_open": false,
|
||||||
"tcp_multi_path": false,
|
"tcp_multi_path": false,
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
"udp_timeout": 300,
|
"udp_timeout": "5m",
|
||||||
"detour": "another-in",
|
"detour": "another-in",
|
||||||
"sniff": false,
|
"sniff": false,
|
||||||
"sniff_override_destination": false,
|
"sniff_override_destination": false,
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
|
|
||||||
### Fields
|
### Fields
|
||||||
|
|
||||||
| Field | Available Context |
|
| Field | Available Context |
|
||||||
|--------------------------------|-------------------------------------------------------------------|
|
|--------------------------------|---------------------------------------------------------|
|
||||||
| `listen` | Needs to listen on TCP or UDP. |
|
| `listen` | Needs to listen on TCP or UDP. |
|
||||||
| `listen_port` | Needs to listen on TCP or UDP. |
|
| `listen_port` | Needs to listen on TCP or UDP. |
|
||||||
| `tcp_fast_open` | Needs to listen on TCP. |
|
| `tcp_fast_open` | Needs to listen on TCP. |
|
||||||
| `tcp_multi_path` | Needs to listen on TCP. |
|
| `tcp_multi_path` | Needs to listen on TCP. |
|
||||||
| `udp_timeout` | Needs to assemble UDP connections, currently Tun and Shadowsocks. |
|
| `udp_timeout` | Needs to assemble UDP connections. |
|
||||||
| `udp_disable_domain_unmapping` | Needs to listen on UDP and accept domain UDP addresses. |
|
| `udp_disable_domain_unmapping` | Needs to listen on UDP and accept domain UDP addresses. |
|
||||||
|
|
||||||
#### listen
|
#### listen
|
||||||
|
|
||||||
@@ -56,7 +56,9 @@ Enable UDP fragmentation.
|
|||||||
|
|
||||||
#### udp_timeout
|
#### udp_timeout
|
||||||
|
|
||||||
UDP NAT expiration time in seconds, default is 300 (5 minutes).
|
UDP NAT expiration time in seconds.
|
||||||
|
|
||||||
|
`5m` is used by default.
|
||||||
|
|
||||||
#### detour
|
#### detour
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"tcp_fast_open": false,
|
"tcp_fast_open": false,
|
||||||
"tcp_multi_path": false,
|
"tcp_multi_path": false,
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
"udp_timeout": 300,
|
"udp_timeout": "5m",
|
||||||
"detour": "another-in",
|
"detour": "another-in",
|
||||||
"sniff": false,
|
"sniff": false,
|
||||||
"sniff_override_destination": false,
|
"sniff_override_destination": false,
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
| 字段 | 可用上下文 |
|
| 字段 | 可用上下文 |
|
||||||
|-----------------------------------|-------------------------------------|
|
|------------------|-----------------|
|
||||||
| `listen` | 需要监听 TCP 或 UDP。 |
|
| `listen` | 需要监听 TCP 或 UDP。 |
|
||||||
| `listen_port` | 需要监听 TCP 或 UDP。 |
|
| `listen_port` | 需要监听 TCP 或 UDP。 |
|
||||||
| `tcp_fast_open` | 需要监听 TCP。 |
|
| `tcp_fast_open` | 需要监听 TCP。 |
|
||||||
| `tcp_multi_path` | 需要监听 TCP。 |
|
| `tcp_multi_path` | 需要监听 TCP。 |
|
||||||
| `udp_timeout` | 需要组装 UDP 连接, 当前为 Tun 和 Shadowsocks。 |
|
| `udp_timeout` | 需要组装 UDP 连接。 |
|
||||||
|
|
|
|
||||||
|
|
||||||
### 字段
|
### 字段
|
||||||
@@ -57,7 +57,9 @@
|
|||||||
|
|
||||||
#### udp_timeout
|
#### udp_timeout
|
||||||
|
|
||||||
UDP NAT 过期时间,以秒为单位,默认为 300(5 分钟)。
|
UDP NAT 过期时间,以秒为单位。
|
||||||
|
|
||||||
|
默认使用 `5m`。
|
||||||
|
|
||||||
#### detour
|
#### detour
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ If enabled, non-padded connections will be rejected.
|
|||||||
|
|
||||||
#### brutal
|
#### brutal
|
||||||
|
|
||||||
See [TCP Brutal](/configuration/shared/tcp-brutal) for details.
|
See [TCP Brutal](/configuration/shared/tcp-brutal/) for details.
|
||||||
|
|
||||||
### Outbound Fields
|
### Outbound Fields
|
||||||
|
|
||||||
@@ -83,4 +83,4 @@ Enable padding.
|
|||||||
|
|
||||||
#### brutal
|
#### brutal
|
||||||
|
|
||||||
See [TCP Brutal](/configuration/shared/tcp-brutal) for details.
|
See [TCP Brutal](/configuration/shared/tcp-brutal/) for details.
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#### brutal
|
#### brutal
|
||||||
|
|
||||||
参阅 [TCP Brutal](/zh/configuration/shared/tcp-brutal)。
|
参阅 [TCP Brutal](/zh/configuration/shared/tcp-brutal/)。
|
||||||
|
|
||||||
### 出站字段
|
### 出站字段
|
||||||
|
|
||||||
@@ -82,4 +82,4 @@
|
|||||||
|
|
||||||
#### brutal
|
#### brutal
|
||||||
|
|
||||||
参阅 [TCP Brutal](/zh/configuration/shared/tcp-brutal)。
|
参阅 [TCP Brutal](/zh/configuration/shared/tcp-brutal/)。
|
||||||
@@ -353,7 +353,7 @@ The MAC key.
|
|||||||
|
|
||||||
ACME DNS01 challenge field. If configured, other challenge methods will be disabled.
|
ACME DNS01 challenge field. If configured, other challenge methods will be disabled.
|
||||||
|
|
||||||
See [DNS01 Challenge Fields](/configuration/shared/dns01_challenge) for details.
|
See [DNS01 Challenge Fields](/configuration/shared/dns01_challenge/) for details.
|
||||||
|
|
||||||
### Reality Fields
|
### Reality Fields
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ See [DNS01 Challenge Fields](/configuration/shared/dns01_challenge) for details.
|
|||||||
|
|
||||||
==Required==
|
==Required==
|
||||||
|
|
||||||
Handshake server address and [Dial options](/configuration/shared/dial).
|
Handshake server address and [Dial options](/configuration/shared/dial/).
|
||||||
|
|
||||||
#### private_key
|
#### private_key
|
||||||
|
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ MAC 密钥。
|
|||||||
|
|
||||||
ACME DNS01 验证字段。如果配置,将禁用其他验证方法。
|
ACME DNS01 验证字段。如果配置,将禁用其他验证方法。
|
||||||
|
|
||||||
参阅 [DNS01 验证字段](/configuration/shared/dns01_challenge)。
|
参阅 [DNS01 验证字段](/configuration/shared/dns01_challenge/)。
|
||||||
|
|
||||||
### Reality 字段
|
### Reality 字段
|
||||||
|
|
||||||
|
|||||||
@@ -43,21 +43,21 @@ go build -tags "tag_a tag_b" ./cmd/sing-box
|
|||||||
|
|
||||||
## :material-folder-settings: Build Tags
|
## :material-folder-settings: Build Tags
|
||||||
|
|
||||||
| Build Tag | Enabled by default | Description |
|
| Build Tag | Enabled by default | Description |
|
||||||
|------------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|------------------------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `with_quic` | ✔ | Build with QUIC support, see [QUIC and HTTP3 DNS transports](/configuration/dns/server), [Naive inbound](/configuration/inbound/naive), [Hysteria Inbound](/configuration/inbound/hysteria), [Hysteria Outbound](/configuration/outbound/hysteria) and [V2Ray Transport#QUIC](/configuration/shared/v2ray-transport#quic). |
|
| `with_quic` | ✔ | Build with QUIC support, see [QUIC and HTTP3 DNS transports](/configuration/dns/server/), [Naive inbound](/configuration/inbound/naive/), [Hysteria Inbound](/configuration/inbound/hysteria/), [Hysteria Outbound](/configuration/outbound/hysteria/) and [V2Ray Transport#QUIC](/configuration/shared/v2ray-transport#quic). |
|
||||||
| `with_grpc` | ✖️ | Build with standard gRPC support, see [V2Ray Transport#gRPC](/configuration/shared/v2ray-transport#grpc). |
|
| `with_grpc` | ✖️ | Build with standard gRPC support, see [V2Ray Transport#gRPC](/configuration/shared/v2ray-transport#grpc). |
|
||||||
| `with_dhcp` | ✔ | Build with DHCP support, see [DHCP DNS transport](/configuration/dns/server). |
|
| `with_dhcp` | ✔ | Build with DHCP support, see [DHCP DNS transport](/configuration/dns/server/). |
|
||||||
| `with_wireguard` | ✔ | Build with WireGuard support, see [WireGuard outbound](/configuration/outbound/wireguard). |
|
| `with_wireguard` | ✔ | Build with WireGuard support, see [WireGuard outbound](/configuration/outbound/wireguard/). |
|
||||||
| `with_ech` | ✔ | Build with TLS ECH extension support for TLS outbound, see [TLS](/configuration/shared/tls#ech). |
|
| `with_ech` | ✔ | Build with TLS ECH extension support for TLS outbound, see [TLS](/configuration/shared/tls#ech). |
|
||||||
| `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_reality_server` | ✔ | Build with reality TLS server support, see [TLS](/configuration/shared/tls). |
|
| `with_reality_server` | ✔ | Build with reality TLS server support, see [TLS](/configuration/shared/tls/). |
|
||||||
| `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_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). |
|
||||||
|
|
||||||
|
|
||||||
It is not recommended to change the default build tag list unless you really know what you are adding.
|
It is not recommended to change the default build tag list unless you really know what you are adding.
|
||||||
|
|||||||
@@ -35,10 +35,6 @@ but only AEAD 2022 ciphers TCP with multiplexing is recommended.
|
|||||||
|
|
||||||
## :material-server: Server Example
|
## :material-server: Server Example
|
||||||
|
|
||||||
!!! info ""
|
|
||||||
|
|
||||||
Password of cipher `2022-blake3-aes-128-gcm` can be generated by command `sing-box generate rand 16 --base64`
|
|
||||||
|
|
||||||
=== ":material-account: Single-user"
|
=== ":material-account: Single-user"
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func getGroupDelay(server *Server) func(w http.ResponseWriter, r *http.Request)
|
|||||||
|
|
||||||
var result map[string]uint16
|
var result map[string]uint16
|
||||||
if urlTestGroup, isURLTestGroup := group.(adapter.URLTestGroup); isURLTestGroup {
|
if urlTestGroup, isURLTestGroup := group.(adapter.URLTestGroup); isURLTestGroup {
|
||||||
result, err = urlTestGroup.URLTest(ctx, url)
|
result, err = urlTestGroup.URLTest(ctx)
|
||||||
} else {
|
} else {
|
||||||
outbounds := common.FilterNotNil(common.Map(group.All(), func(it string) adapter.Outbound {
|
outbounds := common.FilterNotNil(common.Map(group.All(), func(it string) adapter.Outbound {
|
||||||
itOutbound, _ := server.router.Outbound(it)
|
itOutbound, _ := server.router.Outbound(it)
|
||||||
|
|||||||
@@ -4,10 +4,19 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"net/netip"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box"
|
"github.com/sagernet/sing-box"
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/common/process"
|
||||||
|
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing-tun"
|
||||||
|
"github.com/sagernet/sing/common/control"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
"github.com/sagernet/sing/common/logger"
|
||||||
|
"github.com/sagernet/sing/common/x/list"
|
||||||
)
|
)
|
||||||
|
|
||||||
func parseConfig(configContent string) (option.Options, error) {
|
func parseConfig(configContent string) (option.Options, error) {
|
||||||
@@ -27,8 +36,9 @@ func CheckConfig(configContent string) error {
|
|||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
instance, err := box.New(box.Options{
|
instance, err := box.New(box.Options{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Options: options,
|
Options: options,
|
||||||
|
PlatformInterface: (*platformInterfaceStub)(nil),
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
instance.Close()
|
instance.Close()
|
||||||
@@ -36,6 +46,92 @@ func CheckConfig(configContent string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type platformInterfaceStub struct{}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) Initialize(ctx context.Context, router adapter.Router) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) UsePlatformAutoDetectInterfaceControl() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) AutoDetectInterfaceControl() control.Func {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) OpenTun(options *tun.Options, platformOptions option.TunPlatformOptions) (tun.Tun, error) {
|
||||||
|
return nil, os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) UsePlatformDefaultInterfaceMonitor() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) CreateDefaultInterfaceMonitor(logger logger.Logger) tun.DefaultInterfaceMonitor {
|
||||||
|
return (*interfaceMonitorStub)(nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) UsePlatformInterfaceGetter() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) Interfaces() ([]platform.NetworkInterface, error) {
|
||||||
|
return nil, os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) UnderNetworkExtension() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) ClearDNSCache() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) ReadWIFIState() adapter.WIFIState {
|
||||||
|
return adapter.WIFIState{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *platformInterfaceStub) FindProcessInfo(ctx context.Context, network string, source netip.AddrPort, destination netip.AddrPort) (*process.Info, error) {
|
||||||
|
return nil, os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
type interfaceMonitorStub struct{}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) Start() error {
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) Close() error {
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) DefaultInterfaceName(destination netip.Addr) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) DefaultInterfaceIndex(destination netip.Addr) int {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) DefaultInterface(destination netip.Addr) (string, int) {
|
||||||
|
return "", -1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) OverrideAndroidVPN() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) AndroidVPNEnabled() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) RegisterCallback(callback tun.DefaultInterfaceUpdateCallback) *list.Element[tun.DefaultInterfaceUpdateCallback] {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *interfaceMonitorStub) UnregisterCallback(element *list.Element[tun.DefaultInterfaceUpdateCallback]) {
|
||||||
|
}
|
||||||
|
|
||||||
func FormatConfig(configContent string) (string, error) {
|
func FormatConfig(configContent string) (string, error) {
|
||||||
options, err := parseConfig(configContent)
|
options, err := parseConfig(configContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"github.com/sagernet/sing-tun"
|
"github.com/sagernet/sing-tun"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TunOptions interface {
|
type TunOptions interface {
|
||||||
@@ -20,6 +19,10 @@ type TunOptions interface {
|
|||||||
GetStrictRoute() bool
|
GetStrictRoute() bool
|
||||||
GetInet4RouteAddress() RoutePrefixIterator
|
GetInet4RouteAddress() RoutePrefixIterator
|
||||||
GetInet6RouteAddress() RoutePrefixIterator
|
GetInet6RouteAddress() RoutePrefixIterator
|
||||||
|
GetInet4RouteExcludeAddress() RoutePrefixIterator
|
||||||
|
GetInet6RouteExcludeAddress() RoutePrefixIterator
|
||||||
|
GetInet4RouteRange() RoutePrefixIterator
|
||||||
|
GetInet6RouteRange() RoutePrefixIterator
|
||||||
GetIncludePackage() StringIterator
|
GetIncludePackage() StringIterator
|
||||||
GetExcludePackage() StringIterator
|
GetExcludePackage() StringIterator
|
||||||
IsHTTPProxyEnabled() bool
|
IsHTTPProxyEnabled() bool
|
||||||
@@ -28,18 +31,30 @@ type TunOptions interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RoutePrefix struct {
|
type RoutePrefix struct {
|
||||||
Address string
|
address netip.Addr
|
||||||
Prefix int32
|
prefix int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *RoutePrefix) Address() string {
|
||||||
|
return p.address.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *RoutePrefix) Prefix() int32 {
|
||||||
|
return int32(p.prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *RoutePrefix) Mask() string {
|
func (p *RoutePrefix) Mask() string {
|
||||||
var bits int
|
var bits int
|
||||||
if M.ParseSocksaddr(p.Address).Addr.Is6() {
|
if p.address.Is6() {
|
||||||
bits = 128
|
bits = 128
|
||||||
} else {
|
} else {
|
||||||
bits = 32
|
bits = 32
|
||||||
}
|
}
|
||||||
return net.IP(net.CIDRMask(int(p.Prefix), bits)).String()
|
return net.IP(net.CIDRMask(p.prefix, bits)).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *RoutePrefix) String() string {
|
||||||
|
return netip.PrefixFrom(p.address, p.prefix).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
type RoutePrefixIterator interface {
|
type RoutePrefixIterator interface {
|
||||||
@@ -50,8 +65,8 @@ type RoutePrefixIterator interface {
|
|||||||
func mapRoutePrefix(prefixes []netip.Prefix) RoutePrefixIterator {
|
func mapRoutePrefix(prefixes []netip.Prefix) RoutePrefixIterator {
|
||||||
return newIterator(common.Map(prefixes, func(prefix netip.Prefix) *RoutePrefix {
|
return newIterator(common.Map(prefixes, func(prefix netip.Prefix) *RoutePrefix {
|
||||||
return &RoutePrefix{
|
return &RoutePrefix{
|
||||||
Address: prefix.Addr().String(),
|
address: prefix.Addr(),
|
||||||
Prefix: int32(prefix.Bits()),
|
prefix: prefix.Bits(),
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@@ -92,12 +107,28 @@ func (o *tunOptions) GetStrictRoute() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *tunOptions) GetInet4RouteAddress() RoutePrefixIterator {
|
func (o *tunOptions) GetInet4RouteAddress() RoutePrefixIterator {
|
||||||
|
return mapRoutePrefix(o.Inet4RouteAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *tunOptions) GetInet6RouteAddress() RoutePrefixIterator {
|
||||||
|
return mapRoutePrefix(o.Inet6RouteAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *tunOptions) GetInet4RouteExcludeAddress() RoutePrefixIterator {
|
||||||
|
return mapRoutePrefix(o.Inet4RouteExcludeAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *tunOptions) GetInet6RouteExcludeAddress() RoutePrefixIterator {
|
||||||
|
return mapRoutePrefix(o.Inet6RouteExcludeAddress)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (o *tunOptions) GetInet4RouteRange() RoutePrefixIterator {
|
||||||
return mapRoutePrefix(common.Filter(o.routeRanges, func(it netip.Prefix) bool {
|
return mapRoutePrefix(common.Filter(o.routeRanges, func(it netip.Prefix) bool {
|
||||||
return it.Addr().Is4()
|
return it.Addr().Is4()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *tunOptions) GetInet6RouteAddress() RoutePrefixIterator {
|
func (o *tunOptions) GetInet6RouteRange() RoutePrefixIterator {
|
||||||
return mapRoutePrefix(common.Filter(o.routeRanges, func(it netip.Prefix) bool {
|
return mapRoutePrefix(common.Filter(o.routeRanges, func(it netip.Prefix) bool {
|
||||||
return it.Addr().Is6()
|
return it.Addr().Is6()
|
||||||
}))
|
}))
|
||||||
|
|||||||
28
go.mod
28
go.mod
@@ -4,7 +4,7 @@ go 1.20
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
berty.tech/go-libtor v1.0.385
|
berty.tech/go-libtor v1.0.385
|
||||||
github.com/caddyserver/certmagic v0.19.2
|
github.com/caddyserver/certmagic v0.20.0
|
||||||
github.com/cloudflare/circl v1.3.6
|
github.com/cloudflare/circl v1.3.6
|
||||||
github.com/cretz/bine v0.2.0
|
github.com/cretz/bine v0.2.0
|
||||||
github.com/fsnotify/fsnotify v1.7.0
|
github.com/fsnotify/fsnotify v1.7.0
|
||||||
@@ -12,7 +12,7 @@ require (
|
|||||||
github.com/go-chi/cors v1.2.1
|
github.com/go-chi/cors v1.2.1
|
||||||
github.com/go-chi/render v1.0.3
|
github.com/go-chi/render v1.0.3
|
||||||
github.com/gofrs/uuid/v5 v5.0.0
|
github.com/gofrs/uuid/v5 v5.0.0
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20231126010706-b0416c0f187a
|
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2
|
||||||
github.com/libdns/alidns v1.0.3
|
github.com/libdns/alidns v1.0.3
|
||||||
github.com/libdns/cloudflare v0.1.0
|
github.com/libdns/cloudflare v0.1.0
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible
|
github.com/logrusorgru/aurora v2.0.3+incompatible
|
||||||
@@ -26,31 +26,31 @@ require (
|
|||||||
github.com/sagernet/gvisor v0.0.0-20231119034329-07cfb6aaf930
|
github.com/sagernet/gvisor v0.0.0-20231119034329-07cfb6aaf930
|
||||||
github.com/sagernet/quic-go v0.40.0
|
github.com/sagernet/quic-go v0.40.0
|
||||||
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
|
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
|
||||||
github.com/sagernet/sing v0.2.18-0.20231201054122-bca74039ead5
|
github.com/sagernet/sing v0.2.20
|
||||||
github.com/sagernet/sing-dns v0.1.11
|
github.com/sagernet/sing-dns v0.1.12
|
||||||
github.com/sagernet/sing-mux v0.1.5-0.20231109075101-6b086ed6bb07
|
github.com/sagernet/sing-mux v0.1.6
|
||||||
github.com/sagernet/sing-quic v0.1.5-0.20231123150216-00957d136203
|
github.com/sagernet/sing-quic v0.1.6
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.5
|
github.com/sagernet/sing-shadowsocks v0.2.6
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.1.5
|
github.com/sagernet/sing-shadowsocks2 v0.1.5
|
||||||
github.com/sagernet/sing-shadowtls v0.1.4
|
github.com/sagernet/sing-shadowtls v0.1.4
|
||||||
github.com/sagernet/sing-tun v0.1.21-0.20231119035513-f6ea97c5af71
|
github.com/sagernet/sing-tun v0.1.24
|
||||||
github.com/sagernet/sing-vmess v0.1.8
|
github.com/sagernet/sing-vmess v0.1.8
|
||||||
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37
|
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37
|
||||||
github.com/sagernet/tfo-go v0.0.0-20230816093905-5a5c285d44a6
|
github.com/sagernet/tfo-go v0.0.0-20230816093905-5a5c285d44a6
|
||||||
github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2
|
github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2
|
||||||
github.com/sagernet/wireguard-go v0.0.0-20230807125731-5d4a7ef2dc5f
|
github.com/sagernet/wireguard-go v0.0.0-20230807125731-5d4a7ef2dc5f
|
||||||
github.com/sagernet/ws v0.0.0-20231030053741-7d481eb31bed
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854
|
||||||
github.com/spf13/cobra v1.8.0
|
github.com/spf13/cobra v1.8.0
|
||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
go.uber.org/zap v1.26.0
|
go.uber.org/zap v1.26.0
|
||||||
go4.org/netipx v0.0.0-20230824141953-6213f710f925
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
|
||||||
golang.org/x/crypto v0.16.0
|
golang.org/x/crypto v0.17.0
|
||||||
golang.org/x/net v0.19.0
|
golang.org/x/net v0.19.0
|
||||||
golang.org/x/sys v0.15.0
|
golang.org/x/sys v0.15.0
|
||||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
|
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6
|
||||||
google.golang.org/grpc v1.59.0
|
google.golang.org/grpc v1.59.0
|
||||||
google.golang.org/protobuf v1.31.0
|
google.golang.org/protobuf v1.31.0
|
||||||
howett.net/plist v1.0.0
|
howett.net/plist v1.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
//replace github.com/sagernet/sing => ../sing
|
//replace github.com/sagernet/sing => ../sing
|
||||||
@@ -86,11 +86,11 @@ require (
|
|||||||
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
|
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
|
||||||
github.com/zeebo/blake3 v0.2.3 // indirect
|
github.com/zeebo/blake3 v0.2.3 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
|
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 // indirect
|
||||||
golang.org/x/mod v0.14.0 // indirect
|
golang.org/x/mod v0.14.0 // indirect
|
||||||
golang.org/x/text v0.14.0 // indirect
|
golang.org/x/text v0.14.0 // indirect
|
||||||
golang.org/x/time v0.4.0 // indirect
|
golang.org/x/time v0.4.0 // indirect
|
||||||
golang.org/x/tools v0.15.0 // indirect
|
golang.org/x/tools v0.16.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
|||||||
56
go.sum
56
go.sum
@@ -4,8 +4,8 @@ github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
|
|||||||
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||||
github.com/caddyserver/certmagic v0.19.2 h1:HZd1AKLx4592MalEGQS39DKs2ZOAJCEM/xYPMQ2/ui0=
|
github.com/caddyserver/certmagic v0.20.0 h1:bTw7LcEZAh9ucYCRXyCpIrSAGplplI0vGYJ4BpCQ/Fc=
|
||||||
github.com/caddyserver/certmagic v0.19.2/go.mod h1:fsL01NomQ6N+kE2j37ZCnig2MFosG+MIO4ztnmG/zz8=
|
github.com/caddyserver/certmagic v0.20.0/go.mod h1:N4sXgpICQUskEWpj7zVzvWD41p3NYacrNoZYiRM2jTg=
|
||||||
github.com/cloudflare/circl v1.3.6 h1:/xbKIqSHbZXHwkhbrhrt2YOHIwYJlXH94E3tI/gDlUg=
|
github.com/cloudflare/circl v1.3.6 h1:/xbKIqSHbZXHwkhbrhrt2YOHIwYJlXH94E3tI/gDlUg=
|
||||||
github.com/cloudflare/circl v1.3.6/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
github.com/cloudflare/circl v1.3.6/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
@@ -47,8 +47,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE
|
|||||||
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20231126010706-b0416c0f187a h1:biHpNhTkyeXNEzLqTOM6DkIkMedNh/j+ft+POj0Xcko=
|
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2 h1:9K06NfxkBh25x56yVhWWlKFE8YpicaSfHwoV8SFbueA=
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20231126010706-b0416c0f187a/go.mod h1:3A9PQ1cunSDF/1rbTq99Ts4pVnycWg+vlPkfeD2NLFI=
|
github.com/insomniacslk/dhcp v0.0.0-20231206064809-8c70d406f6d2/go.mod h1:3A9PQ1cunSDF/1rbTq99Ts4pVnycWg+vlPkfeD2NLFI=
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
|
github.com/josharian/native v1.0.1-0.20221213033349-c1e37c09b531/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
|
||||||
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
|
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
|
||||||
@@ -110,22 +110,22 @@ github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 h1:5Th31OC6yj8byL
|
|||||||
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU=
|
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU=
|
||||||
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
|
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
|
||||||
github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
|
github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
|
||||||
github.com/sagernet/sing v0.2.18-0.20231201054122-bca74039ead5 h1:luykfsWNqFh9sdLXlkCQtkuzLUPRd3BMsdQJt0REB1g=
|
github.com/sagernet/sing v0.2.20 h1:ckcCB/5xu8G8wElNeH74IF6Soac5xWN+eQUXRuonjPQ=
|
||||||
github.com/sagernet/sing v0.2.18-0.20231201054122-bca74039ead5/go.mod h1:OL6k2F0vHmEzXz2KW19qQzu172FDgSbUSODylighuVo=
|
github.com/sagernet/sing v0.2.20/go.mod h1:Ce5LNojQOgOiWhiD8pPD6E9H7e2KgtOe3Zxx4Ou5u80=
|
||||||
github.com/sagernet/sing-dns v0.1.11 h1:PPrMCVVrAeR3f5X23I+cmvacXJ+kzuyAsBiWyUKhGSE=
|
github.com/sagernet/sing-dns v0.1.12 h1:1HqZ+ln+Rezx/aJMStaS0d7oPeX2EobSV1NT537kyj4=
|
||||||
github.com/sagernet/sing-dns v0.1.11/go.mod h1:zJ/YjnYB61SYE+ubMcMqVdpaSvsyQ2iShQGO3vuLvvE=
|
github.com/sagernet/sing-dns v0.1.12/go.mod h1:rx/DTOisneQpCgNQ4jbFU/JNEtnz0lYcHXenlVzpjEU=
|
||||||
github.com/sagernet/sing-mux v0.1.5-0.20231109075101-6b086ed6bb07 h1:ncKb5tVOsCQgCsv6UpsA0jinbNb5OQ5GMPJlyQP3EHM=
|
github.com/sagernet/sing-mux v0.1.6 h1:9+LsHgrtG/hgKpJOhtGcEFPeWHXaWeJDO3x4DeDQk5g=
|
||||||
github.com/sagernet/sing-mux v0.1.5-0.20231109075101-6b086ed6bb07/go.mod h1:u/MZf32xPG8jEKe3t+xUV67EBnKtDtCaPhsJQOQGUYU=
|
github.com/sagernet/sing-mux v0.1.6/go.mod h1:UmcVSPrVjsOGe95jDXmGgOyKKIXOcjz6FKbFy+0LeDU=
|
||||||
github.com/sagernet/sing-quic v0.1.5-0.20231123150216-00957d136203 h1:e3C94gdfTDal52fk0BS/BRcDeF3USqBr8OjQc7XBk4E=
|
github.com/sagernet/sing-quic v0.1.6 h1:yNkZiNOlmEGpS+A7I4/Zavhe/fRrLz7yCO/dVMZzt+k=
|
||||||
github.com/sagernet/sing-quic v0.1.5-0.20231123150216-00957d136203/go.mod h1:B6OgRz+qLn3N1114dcZVExkdarArtsAX2MgWJIfB72c=
|
github.com/sagernet/sing-quic v0.1.6/go.mod h1:g1Ogcy2KSwKvC7eDXEUu9AnHbjotC+2xsSP+A1i/VOA=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.5 h1:qxIttos4xu6ii7MTVJYA8EFQR7Q3KG6xMqmLJIFtBaY=
|
github.com/sagernet/sing-shadowsocks v0.2.6 h1:xr7ylAS/q1cQYS8oxKKajhuQcchd5VJJ4K4UZrrpp0s=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.5/go.mod h1:MGWGkcU2xW2G2mfArT9/QqpVLOGU+dBaahZCtPHdt7A=
|
github.com/sagernet/sing-shadowsocks v0.2.6/go.mod h1:j2YZBIpWIuElPFL/5sJAj470bcn/3QQ5lxZUNKLDNAM=
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.1.5 h1:JDeAJ4ZWlYZ7F6qEVdDKPhQEangxKw/JtmU+i/YfCYE=
|
github.com/sagernet/sing-shadowsocks2 v0.1.5 h1:JDeAJ4ZWlYZ7F6qEVdDKPhQEangxKw/JtmU+i/YfCYE=
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.1.5/go.mod h1:KF65y8lI5PGHyMgRZGYXYsH9ilgRc/yr+NYbSNGuBm4=
|
github.com/sagernet/sing-shadowsocks2 v0.1.5/go.mod h1:KF65y8lI5PGHyMgRZGYXYsH9ilgRc/yr+NYbSNGuBm4=
|
||||||
github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k=
|
github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k=
|
||||||
github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4=
|
github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4=
|
||||||
github.com/sagernet/sing-tun v0.1.21-0.20231119035513-f6ea97c5af71 h1:WQi0TwhjbSNFFbxybIgAUSjVvo7uWSsLD28ldoM2avY=
|
github.com/sagernet/sing-tun v0.1.24 h1:cxn8lr8uHMLB1tLU0SzBPE1Q04pG0Fb71GyeeCuic5Q=
|
||||||
github.com/sagernet/sing-tun v0.1.21-0.20231119035513-f6ea97c5af71/go.mod h1:hyzA4gDWbeg2SXklqPDswBKa//QcjlZqKw9aPcNdQ9A=
|
github.com/sagernet/sing-tun v0.1.24/go.mod h1:Mnd7+8iGNb9uGnMAh3bp0ZA+nPFBZNaMHZPMEGdAQJM=
|
||||||
github.com/sagernet/sing-vmess v0.1.8 h1:XVWad1RpTy9b5tPxdm5MCU8cGfrTGdR8qCq6HV2aCNc=
|
github.com/sagernet/sing-vmess v0.1.8 h1:XVWad1RpTy9b5tPxdm5MCU8cGfrTGdR8qCq6HV2aCNc=
|
||||||
github.com/sagernet/sing-vmess v0.1.8/go.mod h1:vhx32UNzTDUkNwOyIjcZQohre1CaytquC5mPplId8uA=
|
github.com/sagernet/sing-vmess v0.1.8/go.mod h1:vhx32UNzTDUkNwOyIjcZQohre1CaytquC5mPplId8uA=
|
||||||
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37 h1:HuE6xSwco/Xed8ajZ+coeYLmioq0Qp1/Z2zczFaV8as=
|
github.com/sagernet/smux v0.0.0-20230312102458-337ec2a5af37 h1:HuE6xSwco/Xed8ajZ+coeYLmioq0Qp1/Z2zczFaV8as=
|
||||||
@@ -136,8 +136,8 @@ github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2 h1:kDUqhc9Vsk5HJuhfI
|
|||||||
github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2/go.mod h1:JKQMZq/O2qnZjdrt+B57olmfgEmLtY9iiSIEYtWvoSM=
|
github.com/sagernet/utls v0.0.0-20230309024959-6732c2ab36f2/go.mod h1:JKQMZq/O2qnZjdrt+B57olmfgEmLtY9iiSIEYtWvoSM=
|
||||||
github.com/sagernet/wireguard-go v0.0.0-20230807125731-5d4a7ef2dc5f h1:Kvo8w8Y9lzFGB/7z09MJ3TR99TFtfI/IuY87Ygcycho=
|
github.com/sagernet/wireguard-go v0.0.0-20230807125731-5d4a7ef2dc5f h1:Kvo8w8Y9lzFGB/7z09MJ3TR99TFtfI/IuY87Ygcycho=
|
||||||
github.com/sagernet/wireguard-go v0.0.0-20230807125731-5d4a7ef2dc5f/go.mod h1:mySs0abhpc/gLlvhoq7HP1RzOaRmIXVeZGCh++zoApk=
|
github.com/sagernet/wireguard-go v0.0.0-20230807125731-5d4a7ef2dc5f/go.mod h1:mySs0abhpc/gLlvhoq7HP1RzOaRmIXVeZGCh++zoApk=
|
||||||
github.com/sagernet/ws v0.0.0-20231030053741-7d481eb31bed h1:90a510OeE9siSJoYsI8nSjPmA+u5ROMDts/ZkdNsuXY=
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
|
||||||
github.com/sagernet/ws v0.0.0-20231030053741-7d481eb31bed/go.mod h1:LtfoSK3+NG57tvnVEHgcuBW9ujgE8enPSgzgwStwCAA=
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854/go.mod h1:LtfoSK3+NG57tvnVEHgcuBW9ujgE8enPSgzgwStwCAA=
|
||||||
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9 h1:rc/CcqLH3lh8n+csdOuDfP+NuykE0U6AeYSJJHKDgSg=
|
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9 h1:rc/CcqLH3lh8n+csdOuDfP+NuykE0U6AeYSJJHKDgSg=
|
||||||
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9/go.mod h1:a/83NAfUXvEuLpmxDssAXxgUgrEy12MId3Wd7OTs76s=
|
github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9/go.mod h1:a/83NAfUXvEuLpmxDssAXxgUgrEy12MId3Wd7OTs76s=
|
||||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||||
@@ -165,14 +165,14 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
|||||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
||||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||||
go4.org/netipx v0.0.0-20230824141953-6213f710f925 h1:eeQDDVKFkx0g4Hyy8pHgmZaK0EqB4SD6rvKbUdN3ziQ=
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
|
||||||
go4.org/netipx v0.0.0-20230824141953-6213f710f925/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
|
||||||
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||||
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
|
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
|
||||||
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
|
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848 h1:+iq7lrkxmFNBM7xx+Rae2W6uyPfhPeDWD+n+JgppptE=
|
||||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
|
golang.org/x/exp v0.0.0-20231219180239-dc181d75b848/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
|
||||||
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
@@ -200,8 +200,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
|||||||
golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY=
|
golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY=
|
||||||
golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
|
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
|
||||||
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
|
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 h1:CawjfCvYQH2OU3/TnxLx97WDSUDRABfT18pCOYwc2GE=
|
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 h1:CawjfCvYQH2OU3/TnxLx97WDSUDRABfT18pCOYwc2GE=
|
||||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6/go.mod h1:3rxYc4HtVcSG9gVaTs2GEBdehh+sYPOwKtyUWEOTb80=
|
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6/go.mod h1:3rxYc4HtVcSG9gVaTs2GEBdehh+sYPOwKtyUWEOTb80=
|
||||||
@@ -220,7 +220,7 @@ gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa
|
|||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
|
howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM=
|
||||||
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
|
howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
|
||||||
lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI=
|
lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI=
|
||||||
lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
|
lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
@@ -47,13 +48,13 @@ func NewDirect(ctx context.Context, router adapter.Router, logger log.ContextLog
|
|||||||
inbound.overrideOption = 3
|
inbound.overrideOption = 3
|
||||||
inbound.overrideDestination = M.Socksaddr{Port: options.OverridePort}
|
inbound.overrideDestination = M.Socksaddr{Port: options.OverridePort}
|
||||||
}
|
}
|
||||||
var udpTimeout int64
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
udpTimeout = options.UDPTimeout
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = C.UDPTimeout
|
||||||
}
|
}
|
||||||
inbound.udpNat = udpnat.New[netip.AddrPort](udpTimeout, adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound))
|
inbound.udpNat = udpnat.New[netip.AddrPort](int64(udpTimeout.Seconds()), adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound))
|
||||||
inbound.connHandler = inbound
|
inbound.connHandler = inbound
|
||||||
inbound.packetHandler = inbound
|
inbound.packetHandler = inbound
|
||||||
inbound.packetUpstream = inbound.udpNat
|
inbound.packetUpstream = inbound.udpNat
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package inbound
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/humanize"
|
"github.com/sagernet/sing-box/common/humanize"
|
||||||
@@ -66,6 +67,12 @@ func NewHysteria(ctx context.Context, router adapter.Router, logger log.ContextL
|
|||||||
} else {
|
} else {
|
||||||
receiveBps = uint64(options.DownMbps) * hysteria.MbpsToBps
|
receiveBps = uint64(options.DownMbps) * hysteria.MbpsToBps
|
||||||
}
|
}
|
||||||
|
var udpTimeout time.Duration
|
||||||
|
if options.UDPTimeout != 0 {
|
||||||
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
|
} else {
|
||||||
|
udpTimeout = C.UDPTimeout
|
||||||
|
}
|
||||||
service, err := hysteria.NewService[int](hysteria.ServiceOptions{
|
service, err := hysteria.NewService[int](hysteria.ServiceOptions{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Logger: logger,
|
Logger: logger,
|
||||||
@@ -73,6 +80,7 @@ func NewHysteria(ctx context.Context, router adapter.Router, logger log.ContextL
|
|||||||
ReceiveBPS: receiveBps,
|
ReceiveBPS: receiveBps,
|
||||||
XPlusPassword: options.Obfs,
|
XPlusPassword: options.Obfs,
|
||||||
TLSConfig: tlsConfig,
|
TLSConfig: tlsConfig,
|
||||||
|
UDPTimeout: udpTimeout,
|
||||||
Handler: adapter.NewUpstreamHandler(adapter.InboundContext{}, inbound.newConnection, inbound.newPacketConnection, nil),
|
Handler: adapter.NewUpstreamHandler(adapter.InboundContext{}, inbound.newConnection, inbound.newPacketConnection, nil),
|
||||||
|
|
||||||
// Legacy options
|
// Legacy options
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/tls"
|
"github.com/sagernet/sing-box/common/tls"
|
||||||
@@ -87,6 +88,12 @@ func NewHysteria2(ctx context.Context, router adapter.Router, logger log.Context
|
|||||||
},
|
},
|
||||||
tlsConfig: tlsConfig,
|
tlsConfig: tlsConfig,
|
||||||
}
|
}
|
||||||
|
var udpTimeout time.Duration
|
||||||
|
if options.UDPTimeout != 0 {
|
||||||
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
|
} else {
|
||||||
|
udpTimeout = C.UDPTimeout
|
||||||
|
}
|
||||||
service, err := hysteria2.NewService[int](hysteria2.ServiceOptions{
|
service, err := hysteria2.NewService[int](hysteria2.ServiceOptions{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Logger: logger,
|
Logger: logger,
|
||||||
@@ -96,6 +103,7 @@ func NewHysteria2(ctx context.Context, router adapter.Router, logger log.Context
|
|||||||
SalamanderPassword: salamanderPassword,
|
SalamanderPassword: salamanderPassword,
|
||||||
TLSConfig: tlsConfig,
|
TLSConfig: tlsConfig,
|
||||||
IgnoreClientBandwidth: options.IgnoreClientBandwidth,
|
IgnoreClientBandwidth: options.IgnoreClientBandwidth,
|
||||||
|
UDPTimeout: udpTimeout,
|
||||||
Handler: adapter.NewUpstreamHandler(adapter.InboundContext{}, inbound.newConnection, inbound.newPacketConnection, nil),
|
Handler: adapter.NewUpstreamHandler(adapter.InboundContext{}, inbound.newConnection, inbound.newPacketConnection, nil),
|
||||||
MasqueradeHandler: masqueradeHandler,
|
MasqueradeHandler: masqueradeHandler,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/mux"
|
"github.com/sagernet/sing-box/common/mux"
|
||||||
@@ -65,19 +66,19 @@ func newShadowsocks(ctx context.Context, router adapter.Router, logger log.Conte
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var udpTimeout int64
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
udpTimeout = options.UDPTimeout
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = C.UDPTimeout
|
||||||
}
|
}
|
||||||
switch {
|
switch {
|
||||||
case options.Method == shadowsocks.MethodNone:
|
case options.Method == shadowsocks.MethodNone:
|
||||||
inbound.service = shadowsocks.NewNoneService(options.UDPTimeout, inbound.upstreamContextHandler())
|
inbound.service = shadowsocks.NewNoneService(int64(udpTimeout.Seconds()), inbound.upstreamContextHandler())
|
||||||
case common.Contains(shadowaead.List, options.Method):
|
case common.Contains(shadowaead.List, options.Method):
|
||||||
inbound.service, err = shadowaead.NewService(options.Method, nil, options.Password, udpTimeout, inbound.upstreamContextHandler())
|
inbound.service, err = shadowaead.NewService(options.Method, nil, options.Password, int64(udpTimeout.Seconds()), inbound.upstreamContextHandler())
|
||||||
case common.Contains(shadowaead_2022.List, options.Method):
|
case common.Contains(shadowaead_2022.List, options.Method):
|
||||||
inbound.service, err = shadowaead_2022.NewServiceWithPassword(options.Method, options.Password, udpTimeout, inbound.upstreamContextHandler(), ntp.TimeFuncFromContext(ctx))
|
inbound.service, err = shadowaead_2022.NewServiceWithPassword(options.Method, options.Password, int64(udpTimeout.Seconds()), inbound.upstreamContextHandler(), ntp.TimeFuncFromContext(ctx))
|
||||||
default:
|
default:
|
||||||
err = E.New("unsupported method: ", options.Method)
|
err = E.New("unsupported method: ", options.Method)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/mux"
|
"github.com/sagernet/sing-box/common/mux"
|
||||||
@@ -53,25 +54,25 @@ func newShadowsocksMulti(ctx context.Context, router adapter.Router, logger log.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var udpTimeout int64
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
udpTimeout = options.UDPTimeout
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = C.UDPTimeout
|
||||||
}
|
}
|
||||||
var service shadowsocks.MultiService[int]
|
var service shadowsocks.MultiService[int]
|
||||||
if common.Contains(shadowaead_2022.List, options.Method) {
|
if common.Contains(shadowaead_2022.List, options.Method) {
|
||||||
service, err = shadowaead_2022.NewMultiServiceWithPassword[int](
|
service, err = shadowaead_2022.NewMultiServiceWithPassword[int](
|
||||||
options.Method,
|
options.Method,
|
||||||
options.Password,
|
options.Password,
|
||||||
udpTimeout,
|
int64(udpTimeout.Seconds()),
|
||||||
adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound),
|
adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound),
|
||||||
ntp.TimeFuncFromContext(ctx),
|
ntp.TimeFuncFromContext(ctx),
|
||||||
)
|
)
|
||||||
} else if common.Contains(shadowaead.List, options.Method) {
|
} else if common.Contains(shadowaead.List, options.Method) {
|
||||||
service, err = shadowaead.NewMultiService[int](
|
service, err = shadowaead.NewMultiService[int](
|
||||||
options.Method,
|
options.Method,
|
||||||
udpTimeout,
|
int64(udpTimeout.Seconds()),
|
||||||
adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound))
|
adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound))
|
||||||
} else {
|
} else {
|
||||||
return nil, E.New("unsupported method: " + options.Method)
|
return nil, E.New("unsupported method: " + options.Method)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/mux"
|
"github.com/sagernet/sing-box/common/mux"
|
||||||
@@ -50,16 +51,16 @@ func newShadowsocksRelay(ctx context.Context, router adapter.Router, logger log.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var udpTimeout int64
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
udpTimeout = options.UDPTimeout
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = C.UDPTimeout
|
||||||
}
|
}
|
||||||
service, err := shadowaead_2022.NewRelayServiceWithPassword[int](
|
service, err := shadowaead_2022.NewRelayServiceWithPassword[int](
|
||||||
options.Method,
|
options.Method,
|
||||||
options.Password,
|
options.Password,
|
||||||
udpTimeout,
|
int64(udpTimeout.Seconds()),
|
||||||
adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound),
|
adapter.NewUpstreamContextHandler(inbound.newConnection, inbound.newPacketConnection, inbound),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/redir"
|
"github.com/sagernet/sing-box/common/redir"
|
||||||
@@ -37,15 +38,15 @@ func NewTProxy(ctx context.Context, router adapter.Router, logger log.ContextLog
|
|||||||
listenOptions: options.ListenOptions,
|
listenOptions: options.ListenOptions,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
var udpTimeout int64
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
udpTimeout = options.UDPTimeout
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = C.UDPTimeout
|
||||||
}
|
}
|
||||||
tproxy.connHandler = tproxy
|
tproxy.connHandler = tproxy
|
||||||
tproxy.oobPacketHandler = tproxy
|
tproxy.oobPacketHandler = tproxy
|
||||||
tproxy.udpNat = udpnat.New[netip.AddrPort](udpTimeout, tproxy.upstreamContextHandler())
|
tproxy.udpNat = udpnat.New[netip.AddrPort](int64(udpTimeout.Seconds()), tproxy.upstreamContextHandler())
|
||||||
tproxy.packetUpstream = tproxy.udpNat
|
tproxy.packetUpstream = tproxy.udpNat
|
||||||
return tproxy
|
return tproxy
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ func NewTUIC(ctx context.Context, router adapter.Router, logger log.ContextLogge
|
|||||||
},
|
},
|
||||||
tlsConfig: tlsConfig,
|
tlsConfig: tlsConfig,
|
||||||
}
|
}
|
||||||
|
var udpTimeout time.Duration
|
||||||
|
if options.UDPTimeout != 0 {
|
||||||
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
|
} else {
|
||||||
|
udpTimeout = C.UDPTimeout
|
||||||
|
}
|
||||||
service, err := tuic.NewService[int](tuic.ServiceOptions{
|
service, err := tuic.NewService[int](tuic.ServiceOptions{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
Logger: logger,
|
Logger: logger,
|
||||||
@@ -60,6 +66,7 @@ func NewTUIC(ctx context.Context, router adapter.Router, logger log.ContextLogge
|
|||||||
AuthTimeout: time.Duration(options.AuthTimeout),
|
AuthTimeout: time.Duration(options.AuthTimeout),
|
||||||
ZeroRTTHandshake: options.ZeroRTTHandshake,
|
ZeroRTTHandshake: options.ZeroRTTHandshake,
|
||||||
Heartbeat: time.Duration(options.Heartbeat),
|
Heartbeat: time.Duration(options.Heartbeat),
|
||||||
|
UDPTimeout: udpTimeout,
|
||||||
Handler: adapter.NewUpstreamHandler(adapter.InboundContext{}, inbound.newConnection, inbound.newPacketConnection, nil),
|
Handler: adapter.NewUpstreamHandler(adapter.InboundContext{}, inbound.newConnection, inbound.newPacketConnection, nil),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
@@ -42,11 +43,11 @@ func NewTun(ctx context.Context, router adapter.Router, logger log.ContextLogger
|
|||||||
if tunMTU == 0 {
|
if tunMTU == 0 {
|
||||||
tunMTU = 9000
|
tunMTU = 9000
|
||||||
}
|
}
|
||||||
var udpTimeout int64
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
udpTimeout = options.UDPTimeout
|
udpTimeout = time.Duration(options.UDPTimeout)
|
||||||
} else {
|
} else {
|
||||||
udpTimeout = int64(C.UDPTimeout.Seconds())
|
udpTimeout = C.UDPTimeout
|
||||||
}
|
}
|
||||||
includeUID := uidToRange(options.IncludeUID)
|
includeUID := uidToRange(options.IncludeUID)
|
||||||
if len(options.IncludeUIDRange) > 0 {
|
if len(options.IncludeUIDRange) > 0 {
|
||||||
@@ -92,7 +93,7 @@ func NewTun(ctx context.Context, router adapter.Router, logger log.ContextLogger
|
|||||||
TableIndex: 2022,
|
TableIndex: 2022,
|
||||||
},
|
},
|
||||||
endpointIndependentNat: options.EndpointIndependentNat,
|
endpointIndependentNat: options.EndpointIndependentNat,
|
||||||
udpTimeout: udpTimeout,
|
udpTimeout: int64(udpTimeout.Seconds()),
|
||||||
stack: options.Stack,
|
stack: options.Stack,
|
||||||
platformInterface: platformInterface,
|
platformInterface: platformInterface,
|
||||||
platformOptions: common.PtrValueOrDefault(options.Platform),
|
platformOptions: common.PtrValueOrDefault(options.Platform),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ type Service struct {
|
|||||||
|
|
||||||
func NewService(ctx context.Context, router adapter.Router, logger logger.Logger, options option.NTPOptions) (*Service, error) {
|
func NewService(ctx context.Context, router adapter.Router, logger logger.Logger, options option.NTPOptions) (*Service, error) {
|
||||||
ctx, cancel := common.ContextWithCancelCause(ctx)
|
ctx, cancel := common.ContextWithCancelCause(ctx)
|
||||||
server := options.ServerOptions.Build()
|
server := M.ParseSocksaddrHostPort(options.Server, options.ServerPort)
|
||||||
if server.Port == 0 {
|
if server.Port == 0 {
|
||||||
server.Port = 123
|
server.Port = 123
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package option
|
package option
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/common/json"
|
"github.com/sagernet/sing-box/common/json"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
@@ -128,15 +130,27 @@ type InboundOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ListenOptions struct {
|
type ListenOptions struct {
|
||||||
Listen *ListenAddress `json:"listen,omitempty"`
|
Listen *ListenAddress `json:"listen,omitempty"`
|
||||||
ListenPort uint16 `json:"listen_port,omitempty"`
|
ListenPort uint16 `json:"listen_port,omitempty"`
|
||||||
TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
|
TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
|
||||||
TCPMultiPath bool `json:"tcp_multi_path,omitempty"`
|
TCPMultiPath bool `json:"tcp_multi_path,omitempty"`
|
||||||
UDPFragment *bool `json:"udp_fragment,omitempty"`
|
UDPFragment *bool `json:"udp_fragment,omitempty"`
|
||||||
UDPFragmentDefault bool `json:"-"`
|
UDPFragmentDefault bool `json:"-"`
|
||||||
UDPTimeout int64 `json:"udp_timeout,omitempty"`
|
UDPTimeout UDPTimeoutCompat `json:"udp_timeout,omitempty"`
|
||||||
ProxyProtocol bool `json:"proxy_protocol,omitempty"`
|
ProxyProtocol bool `json:"proxy_protocol,omitempty"`
|
||||||
ProxyProtocolAcceptNoHeader bool `json:"proxy_protocol_accept_no_header,omitempty"`
|
ProxyProtocolAcceptNoHeader bool `json:"proxy_protocol_accept_no_header,omitempty"`
|
||||||
Detour string `json:"detour,omitempty"`
|
Detour string `json:"detour,omitempty"`
|
||||||
InboundOptions
|
InboundOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UDPTimeoutCompat Duration
|
||||||
|
|
||||||
|
func (u *UDPTimeoutCompat) UnmarshalJSON(data []byte) error {
|
||||||
|
var valueNumber int64
|
||||||
|
err := json.Unmarshal(data, &valueNumber)
|
||||||
|
if err == nil {
|
||||||
|
*u = UDPTimeoutCompat(time.Second * time.Duration(valueNumber))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return json.Unmarshal(data, (*Duration)(u))
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package option
|
package option
|
||||||
|
|
||||||
type NTPOptions struct {
|
type NTPOptions struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled,omitempty"`
|
||||||
|
Server string `json:"server,omitempty"`
|
||||||
|
ServerPort uint16 `json:"server_port,omitempty"`
|
||||||
Interval Duration `json:"interval,omitempty"`
|
Interval Duration `json:"interval,omitempty"`
|
||||||
WriteToSystem bool `json:"write_to_system,omitempty"`
|
WriteToSystem bool `json:"write_to_system,omitempty"`
|
||||||
ServerOptions
|
|
||||||
DialerOptions
|
DialerOptions
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type TunInboundOptions struct {
|
|||||||
IncludePackage Listable[string] `json:"include_package,omitempty"`
|
IncludePackage Listable[string] `json:"include_package,omitempty"`
|
||||||
ExcludePackage Listable[string] `json:"exclude_package,omitempty"`
|
ExcludePackage Listable[string] `json:"exclude_package,omitempty"`
|
||||||
EndpointIndependentNat bool `json:"endpoint_independent_nat,omitempty"`
|
EndpointIndependentNat bool `json:"endpoint_independent_nat,omitempty"`
|
||||||
UDPTimeout int64 `json:"udp_timeout,omitempty"`
|
UDPTimeout UDPTimeoutCompat `json:"udp_timeout,omitempty"`
|
||||||
Stack string `json:"stack,omitempty"`
|
Stack string `json:"stack,omitempty"`
|
||||||
Platform *TunPlatformOptions `json:"platform,omitempty"`
|
Platform *TunPlatformOptions `json:"platform,omitempty"`
|
||||||
InboundOptions
|
InboundOptions
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
"github.com/sagernet/sing-dns"
|
"github.com/sagernet/sing-dns"
|
||||||
"github.com/sagernet/sing/common/buf"
|
|
||||||
"github.com/sagernet/sing/common/bufio"
|
"github.com/sagernet/sing/common/bufio"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
@@ -123,6 +122,7 @@ func (h *Direct) ListenPacket(ctx context.Context, destination M.Socksaddr) (net
|
|||||||
ctx, metadata := adapter.ExtendContext(ctx)
|
ctx, metadata := adapter.ExtendContext(ctx)
|
||||||
metadata.Outbound = h.tag
|
metadata.Outbound = h.tag
|
||||||
metadata.Destination = destination
|
metadata.Destination = destination
|
||||||
|
originDestination := destination
|
||||||
switch h.overrideOption {
|
switch h.overrideOption {
|
||||||
case 1:
|
case 1:
|
||||||
destination = h.overrideDestination
|
destination = h.overrideDestination
|
||||||
@@ -142,11 +142,10 @@ func (h *Direct) ListenPacket(ctx context.Context, destination M.Socksaddr) (net
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if h.overrideOption == 0 {
|
if originDestination != destination {
|
||||||
return conn, nil
|
conn = bufio.NewNATPacketConn(bufio.NewPacketConn(conn), destination, originDestination)
|
||||||
} else {
|
|
||||||
return &overridePacketConn{bufio.NewPacketConn(conn), destination}, nil
|
|
||||||
}
|
}
|
||||||
|
return conn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Direct) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
func (h *Direct) NewConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
||||||
@@ -156,20 +155,3 @@ func (h *Direct) NewConnection(ctx context.Context, conn net.Conn, metadata adap
|
|||||||
func (h *Direct) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
func (h *Direct) NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata adapter.InboundContext) error {
|
||||||
return NewPacketConnection(ctx, h, conn, metadata)
|
return NewPacketConnection(ctx, h, conn, metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
type overridePacketConn struct {
|
|
||||||
N.NetPacketConn
|
|
||||||
overrideDestination M.Socksaddr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *overridePacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
|
|
||||||
return c.NetPacketConn.WritePacket(buffer, c.overrideDestination)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *overridePacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
|
||||||
return c.NetPacketConn.WriteTo(p, c.overrideDestination.UDPAddr())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *overridePacketConn) Upstream() any {
|
|
||||||
return c.NetPacketConn
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package outbound
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -38,7 +37,6 @@ type URLTest struct {
|
|||||||
tolerance uint16
|
tolerance uint16
|
||||||
group *URLTestGroup
|
group *URLTestGroup
|
||||||
interruptExternalConnections bool
|
interruptExternalConnections bool
|
||||||
started bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewURLTest(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.URLTestOutboundOptions) (*URLTest, error) {
|
func NewURLTest(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.URLTestOutboundOptions) (*URLTest, error) {
|
||||||
@@ -84,8 +82,7 @@ func (s *URLTest) Start() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *URLTest) PostStart() error {
|
func (s *URLTest) PostStart() error {
|
||||||
s.started = true
|
s.group.PostStart()
|
||||||
go s.CheckOutbounds()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,8 +100,8 @@ func (s *URLTest) All() []string {
|
|||||||
return s.tags
|
return s.tags
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *URLTest) URLTest(ctx context.Context, link string) (map[string]uint16, error) {
|
func (s *URLTest) URLTest(ctx context.Context) (map[string]uint16, error) {
|
||||||
return s.group.URLTest(ctx, link)
|
return s.group.URLTest(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *URLTest) CheckOutbounds() {
|
func (s *URLTest) CheckOutbounds() {
|
||||||
@@ -112,9 +109,7 @@ func (s *URLTest) CheckOutbounds() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *URLTest) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
|
func (s *URLTest) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {
|
||||||
if s.started {
|
s.group.Touch()
|
||||||
s.group.Start()
|
|
||||||
}
|
|
||||||
outbound := s.group.Select(network)
|
outbound := s.group.Select(network)
|
||||||
conn, err := outbound.DialContext(ctx, network, destination)
|
conn, err := outbound.DialContext(ctx, network, destination)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -126,9 +121,7 @@ func (s *URLTest) DialContext(ctx context.Context, network string, destination M
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *URLTest) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
|
func (s *URLTest) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
|
||||||
if s.started {
|
s.group.Touch()
|
||||||
s.group.Start()
|
|
||||||
}
|
|
||||||
outbound := s.group.Select(N.NetworkUDP)
|
outbound := s.group.Select(N.NetworkUDP)
|
||||||
conn, err := outbound.ListenPacket(ctx, destination)
|
conn, err := outbound.ListenPacket(ctx, destination)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@@ -170,9 +163,11 @@ type URLTestGroup struct {
|
|||||||
interruptGroup *interrupt.Group
|
interruptGroup *interrupt.Group
|
||||||
interruptExternalConnections bool
|
interruptExternalConnections bool
|
||||||
|
|
||||||
access sync.Mutex
|
access sync.Mutex
|
||||||
ticker *time.Ticker
|
ticker *time.Ticker
|
||||||
close chan struct{}
|
close chan struct{}
|
||||||
|
started bool
|
||||||
|
lastActive atomic.TypedValue[time.Time]
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewURLTestGroup(
|
func NewURLTestGroup(
|
||||||
@@ -214,8 +209,18 @@ func NewURLTestGroup(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *URLTestGroup) Start() {
|
func (g *URLTestGroup) PostStart() {
|
||||||
|
g.started = true
|
||||||
|
g.lastActive.Store(time.Now())
|
||||||
|
go g.CheckOutbounds(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *URLTestGroup) Touch() {
|
||||||
|
if !g.started {
|
||||||
|
return
|
||||||
|
}
|
||||||
if g.ticker != nil {
|
if g.ticker != nil {
|
||||||
|
g.lastActive.Store(time.Now())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
g.access.Lock()
|
g.access.Lock()
|
||||||
@@ -266,51 +271,30 @@ func (g *URLTestGroup) Select(network string) adapter.Outbound {
|
|||||||
return minOutbound
|
return minOutbound
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *URLTestGroup) Fallback(used adapter.Outbound) []adapter.Outbound {
|
|
||||||
outbounds := make([]adapter.Outbound, 0, len(g.outbounds)-1)
|
|
||||||
for _, detour := range g.outbounds {
|
|
||||||
if detour != used {
|
|
||||||
outbounds = append(outbounds, detour)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sort.SliceStable(outbounds, func(i, j int) bool {
|
|
||||||
oi := outbounds[i]
|
|
||||||
oj := outbounds[j]
|
|
||||||
hi := g.history.LoadURLTestHistory(RealTag(oi))
|
|
||||||
if hi == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
hj := g.history.LoadURLTestHistory(RealTag(oj))
|
|
||||||
if hj == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return hi.Delay < hj.Delay
|
|
||||||
})
|
|
||||||
return outbounds
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *URLTestGroup) loopCheck() {
|
func (g *URLTestGroup) loopCheck() {
|
||||||
go g.CheckOutbounds(true)
|
if time.Now().Sub(g.lastActive.Load()) > g.interval {
|
||||||
|
g.CheckOutbounds(false)
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
g.pauseManager.WaitActive()
|
|
||||||
select {
|
select {
|
||||||
case <-g.close:
|
case <-g.close:
|
||||||
return
|
return
|
||||||
case <-g.ticker.C:
|
case <-g.ticker.C:
|
||||||
g.CheckOutbounds(false)
|
|
||||||
}
|
}
|
||||||
|
g.pauseManager.WaitActive()
|
||||||
|
g.CheckOutbounds(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *URLTestGroup) CheckOutbounds(force bool) {
|
func (g *URLTestGroup) CheckOutbounds(force bool) {
|
||||||
_, _ = g.urlTest(g.ctx, g.link, force)
|
_, _ = g.urlTest(g.ctx, force)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *URLTestGroup) URLTest(ctx context.Context, link string) (map[string]uint16, error) {
|
func (g *URLTestGroup) URLTest(ctx context.Context) (map[string]uint16, error) {
|
||||||
return g.urlTest(ctx, link, false)
|
return g.urlTest(ctx, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *URLTestGroup) urlTest(ctx context.Context, link string, force bool) (map[string]uint16, error) {
|
func (g *URLTestGroup) urlTest(ctx context.Context, force bool) (map[string]uint16, error) {
|
||||||
result := make(map[string]uint16)
|
result := make(map[string]uint16)
|
||||||
if g.checking.Swap(true) {
|
if g.checking.Swap(true) {
|
||||||
return result, nil
|
return result, nil
|
||||||
@@ -337,7 +321,7 @@ func (g *URLTestGroup) urlTest(ctx context.Context, link string, force bool) (ma
|
|||||||
b.Go(realTag, func() (any, error) {
|
b.Go(realTag, func() (any, error) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), C.TCPTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), C.TCPTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
t, err := urltest.URLTest(ctx, link, p)
|
t, err := urltest.URLTest(ctx, g.link, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
g.logger.Debug("outbound ", tag, " unavailable: ", err)
|
g.logger.Debug("outbound ", tag, " unavailable: ", err)
|
||||||
g.history.DeleteURLTestHistory(realTag)
|
g.history.DeleteURLTestHistory(realTag)
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ type Router struct {
|
|||||||
platformInterface platform.Interface
|
platformInterface platform.Interface
|
||||||
needWIFIState bool
|
needWIFIState bool
|
||||||
wifiState adapter.WIFIState
|
wifiState adapter.WIFIState
|
||||||
|
started bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRouter(
|
func NewRouter(
|
||||||
@@ -571,6 +572,11 @@ func (r *Router) Close() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Router) PostStart() error {
|
||||||
|
r.started = true
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Router) Outbound(tag string) (adapter.Outbound, bool) {
|
func (r *Router) Outbound(tag string) (adapter.Outbound, bool) {
|
||||||
outbound, loaded := r.outboundByTag[tag]
|
outbound, loaded := r.outboundByTag[tag]
|
||||||
return outbound, loaded
|
return outbound, loaded
|
||||||
@@ -1015,8 +1021,11 @@ func (r *Router) notifyNetworkUpdate(event int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r.ResetNetwork()
|
if !r.started {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = r.ResetNetwork()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Router) ResetNetwork() error {
|
func (r *Router) ResetNetwork() error {
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ func newLateGunConn(writer io.Writer) *GunConn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *GunConn) setup(reader io.Reader, err error) {
|
func (c *GunConn) setup(reader io.Reader, err error) {
|
||||||
c.reader = std_bufio.NewReader(reader)
|
if reader != nil {
|
||||||
|
c.reader = std_bufio.NewReader(reader)
|
||||||
|
}
|
||||||
c.err = err
|
c.err = err
|
||||||
close(c.create)
|
close(c.create)
|
||||||
}
|
}
|
||||||
@@ -143,7 +145,7 @@ func (c *GunConn) LocalAddr() net.Addr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *GunConn) RemoteAddr() net.Addr {
|
func (c *GunConn) RemoteAddr() net.Addr {
|
||||||
return nil
|
return M.Socksaddr{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GunConn) SetDeadline(t time.Time) error {
|
func (c *GunConn) SetDeadline(t time.Time) error {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user