mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-22 17:46:48 +08:00
Compare commits
15 Commits
v1.3.1
...
issue-temp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8a647c1d8e | ||
![]() |
ea3be76fd5 | ||
![]() |
7abb02ab44 | ||
![]() |
18574aca47 | ||
![]() |
769bed9dbc | ||
![]() |
1233bd5031 | ||
![]() |
039c8e63e7 | ||
![]() |
29db059a87 | ||
![]() |
e1a5392beb | ||
![]() |
24f564b401 | ||
![]() |
54af48a1ae | ||
![]() |
055fb51ed9 | ||
![]() |
6380abca73 | ||
![]() |
1dae2c5636 | ||
![]() |
e9ea658852 |
92
.github/ISSUE_TEMPLATE/bug-en.md
vendored
Normal file
92
.github/ISSUE_TEMPLATE/bug-en.md
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: Create a bug report of Xray.
|
||||
title: '[Bug] <bug you are reporting>'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Thanks for your reporting.
|
||||
1. Please make sure you are submitting a bug of Xray-Core instead of acquiring usage or bug in third-party programs. If you are not sure, please contact us in our official Telegram group.
|
||||
2. Bug: **An error, flaw or fault in a program ** that causes it to produce an incorrect or unexpected result. (Reference: Wikipedia)
|
||||
3. Please check existing Issues and Discussions first and read the documentation in detail. Duplicated issues will be closed.
|
||||
4. Please don't report issue like "I can't use a feature". It's probably your own mistake.
|
||||
5. You should fully complete the following contents or this issue may not be handled.
|
||||
6. Please *make sure* the content you are submitting does not contain your private information.
|
||||
-->
|
||||
|
||||
|
||||
**Describe the bug**
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
**To Reproduce**
|
||||
<!-- Steps to reproduce the bug: -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
**Expected behavior**
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Client Log**
|
||||
|
||||
<details>
|
||||
|
||||
```
|
||||
Please paste your client log here:
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**Server Log**
|
||||
|
||||
<details>
|
||||
|
||||
```
|
||||
Please paste your server log here:
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**Client config**
|
||||
|
||||
<details>
|
||||
|
||||
```json
|
||||
Please paste your client config file here:
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**Server Config**
|
||||
|
||||
<details>
|
||||
|
||||
```json
|
||||
Please paste your server config file here:
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**Client Information**
|
||||
- OS: [e.g. Windows 10]
|
||||
- Xray version [e.g. 1.3.1]
|
||||
- Xray installing approach:[e.g. Xray-install]
|
||||
|
||||
**Server Information**
|
||||
- OS: [e.g. Windows 10]
|
||||
- Xray version [e.g. 1.3.1]
|
||||
- Xray installing approach:[e.g. Xray-install]
|
||||
|
||||
**Additional Information**
|
||||
<!-- Add any other information about the problem here. -->
|
91
.github/ISSUE_TEMPLATE/bug-zh-CN.md
vendored
Normal file
91
.github/ISSUE_TEMPLATE/bug-zh-CN.md
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
name: Bug 反馈
|
||||
about: 这是 Xray 的一个 bug。
|
||||
title: '[Bug] 你发现的bug'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- 感谢您的反馈!
|
||||
1. 请先确认您提交的是 Xray-Core 的 Bug,而非使用咨询,抑或是第三方程序的 Bug。如果您不确定,请在 Telegram 群中反馈。
|
||||
2. Bug:软件运行中因为 **程序本身有错误** 而造成的功能不正常。(Reference: Wikipedia)
|
||||
3. 请先查询已有的 Issues 与 Discussions ,并且详细阅读文档的相关内容。如果您提出的是已知的问题,此 issue 将有可能被关闭。
|
||||
4. 请不要轻易提出类似“不能使用某功能”的问题。这往往是你自己的问题。
|
||||
5. 您需要完整地完成下列内容,否则此 issue 可能不会被处理。
|
||||
6. 请 *务必* 确保不包含任何个人隐私信息。
|
||||
-->
|
||||
|
||||
**问题描述**
|
||||
<!-- 请清晰简洁地描述此问题。-->
|
||||
|
||||
**复现方式**
|
||||
<!-- 复现此步骤的过程: -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
**预期行为**
|
||||
<!-- 请清晰简洁地描述您期望的的行为。-->
|
||||
|
||||
**客户端日志**
|
||||
|
||||
<details>
|
||||
|
||||
```
|
||||
请删除此行,并在此处粘贴客户端日志
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**服务端日志**
|
||||
|
||||
<details>
|
||||
|
||||
```
|
||||
请删除此行,并在此处粘贴服务端日志
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**客户端配置**
|
||||
|
||||
<details>
|
||||
|
||||
```json
|
||||
请删除此行,并在此处粘贴客户端配置
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**服务端配置**
|
||||
|
||||
<details>
|
||||
|
||||
```json
|
||||
请删除此行,并在此处粘贴服务端日志
|
||||
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
**客户端环境**
|
||||
- 系统与版本: [如 Windows 10]
|
||||
- Xray 版本 [如 1.3.1]
|
||||
- Xray 安装方式:[如 Xray-install]
|
||||
|
||||
**服务端环境**
|
||||
- 系统与版本: [如 Windows 10]
|
||||
- Xray 版本 [如 1.3.1]
|
||||
- Xray 安装方式:[如 Xray-install]
|
||||
|
||||
**附加信息**
|
||||
<!-- 如果您有额外的信息,请在此处说明。-->
|
9
.github/ISSUE_TEMPLATE/config.yaml
vendored
Normal file
9
.github/ISSUE_TEMPLATE/config.yaml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
contact_links:
|
||||
- name: 加入 Telegram 群组 / Join Telegram Group
|
||||
url: https://t.me/projectXray
|
||||
- name: 官方文档 / Official Document
|
||||
url: https://xtls.github.io/
|
||||
- name: 安装脚本 / Installing Script
|
||||
url: https://github.com/XTLS/Xray-install
|
||||
- name: 示例配置 / Example Config
|
||||
url: https://github.com/XTLS/Xray-examples
|
32
.github/ISSUE_TEMPLATE/feature-en.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE/feature-en.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: Suggest an idea for Xray
|
||||
title: '[Feature] your idea'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Thanks for your support!
|
||||
1. Please confirm that you are submitting a feature request.
|
||||
2. We do not recommend any inexperienced users to request a new feature.
|
||||
3. Please check existing Issues and Discussions first and read the documentation in detail. Duplicated issues will be closed
|
||||
4. To be clear: none of developers is obliged to meet your needs. In particular, features that do not make any sense.
|
||||
5. You should fully complete the following contents.
|
||||
-->
|
||||
|
||||
**What's your idea?**
|
||||
<!-- A clear and concise description of your idea. -->
|
||||
|
||||
**Is it related to an issue?**
|
||||
<!-- Please specify here if yes. -->
|
||||
|
||||
**What's your solution?**
|
||||
<!-- Describe the solution you'd like. -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
**Is there any additional information?**
|
||||
<!-- Add any other information here. -->
|
32
.github/ISSUE_TEMPLATE/feature-zh-CN.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE/feature-zh-CN.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: 功能请求
|
||||
about: 希望 Xray 添加一个新功能。
|
||||
title: '[Feature] 你的想法'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- 感谢您的反馈!
|
||||
1. 请先确认您提交的是功能请求。
|
||||
2. 我们不建议缺少经验的用户提出功能请求。
|
||||
3. 请先查询已有的 Issues 与 Discussions ,并且详细阅读文档的相关内容。重复的 issue 将有可能被关闭。
|
||||
4. 需要向您明确一点:任何开发者均没有义务满足您的需求。特别是不合理或没有意义的功能。
|
||||
5. 您需要完整地完成下列内容,否则此 issue 可能不会被处理。
|
||||
-->
|
||||
|
||||
**您的想法是什么?**
|
||||
<!-- 请清晰简洁地描述您预期中的功能。-->
|
||||
|
||||
**是否与已知的 issue 相关?**
|
||||
<!-- 如果是,请在此注明 -->
|
||||
|
||||
**您认为应如何实现此功能?**
|
||||
<!-- 请清晰简洁地描述如何实现此功能。-->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
**有没有额外的信息?**
|
||||
<!-- 如果您有额外的信息,请在此处说明。-->
|
17
.github/ISSUE_TEMPLATE/question-en.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/question-en.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Question
|
||||
about: Question of Xray.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Thanks for your support!
|
||||
1. Issue is **NOT** a proper place to ask a question, otherwise your issue may be closed.
|
||||
2. Please check existing Issues, Discussions and documentation in detail first. You may find the answers you want before you ask the question.
|
||||
3. If it is still not resolved, please give feedback in the our official Telegram group or Discussions.
|
||||
4. Wherever you ask a question, please *make sure* the content does not contain your private information.
|
||||
5. We highly recommend you to read https://github.com/tvvocold/How-To-Ask-Questions-The-Smart-Way.
|
||||
-->
|
||||
|
17
.github/ISSUE_TEMPLATE/question-zh-CN.md
vendored
Normal file
17
.github/ISSUE_TEMPLATE/question-zh-CN.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: 使用疑问
|
||||
about: 使用 Xray 时的疑问。
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- 感谢您的支持!
|
||||
1. Issue **不是**用来提问的, 否则将可能会被 close。
|
||||
2. 请先查询已有的 issue、discussion ,并且详细阅读文档的相关内容。那里可能有您需要的答案。
|
||||
3. 如果仍未解决,请在官方 Telegram 群中或 Discussion 区反馈。
|
||||
4. 无论在何处提问,请 *务必确保* 其不包含任何个人隐私信息。
|
||||
5. 我们强烈推荐您阅读 https://github.com/tvvocold/How-To-Ask-Questions-The-Smart-Way。
|
||||
-->
|
||||
|
12
.github/build/friendly-filenames.json
vendored
12
.github/build/friendly-filenames.json
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"android-arm64": { "friendlyName": "android-arm64-v8a"},
|
||||
"android-arm64": { "friendlyName": "android-arm64-v8a" },
|
||||
"darwin-amd64": { "friendlyName": "macos-64" },
|
||||
"darwin-arm64": { "friendlyName": "macos-arm64-v8a" },
|
||||
"dragonfly-amd64": { "friendlyName": "dragonfly-64" },
|
||||
@@ -15,19 +15,19 @@
|
||||
"linux-arm7": { "friendlyName": "linux-arm32-v7a" },
|
||||
"linux-mips64le": { "friendlyName": "linux-mips64le" },
|
||||
"linux-mips64": { "friendlyName": "linux-mips64" },
|
||||
"linux-mipsle": { "friendlyName": "linux-mips32le" },
|
||||
"linux-mipslesoftfloat": { "friendlyName": "linux-mips32le-softfloat" },
|
||||
"linux-mips": { "friendlyName": "linux-mips32" },
|
||||
"linux-mipsle": { "friendlyName": "linux-mips32le" },
|
||||
"linux-mipssoftfloat": { "friendlyName": "linux-mips32-softfloat" },
|
||||
"linux-riscv64": { "friendlyName": "linux-riscv64" },
|
||||
"linux-mips": { "friendlyName": "linux-mips32" },
|
||||
"linux-ppc64le": { "friendlyName": "linux-ppc64le" },
|
||||
"linux-ppc64": { "friendlyName": "linux-ppc64" },
|
||||
"linux-ppc64le": { "friendlyName": "linux-rppc64le" },
|
||||
"linux-riscv64": { "friendlyName": "linux-riscv64" },
|
||||
"linux-s390x": { "friendlyName": "linux-s390x" },
|
||||
"openbsd-386": { "friendlyName": "openbsd-32" },
|
||||
"openbsd-amd64": { "friendlyName": "openbsd-64" },
|
||||
"openbsd-arm64": { "friendlyName": "openbsd-arm64-v8a" },
|
||||
"openbsd-arm7": { "friendlyName": "openbsd-arm32-v7a" },
|
||||
"windows-amd64": { "friendlyName": "windows-64" },
|
||||
"windows-386": { "friendlyName": "windows-32" },
|
||||
"windows-amd64": { "friendlyName": "windows-64" },
|
||||
"windows-arm7": { "friendlyName": "windows-arm32-v7a" }
|
||||
}
|
||||
|
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
@@ -99,8 +99,8 @@ jobs:
|
||||
goarm: 7
|
||||
# END OPENBSD ARM
|
||||
fail-fast: false
|
||||
#配置编译环境
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
@@ -173,16 +173,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
pushd build_assets || exit 1
|
||||
touch -mt 202101010000 *
|
||||
touch -mt $(date +%Y01010000) *
|
||||
zip -9vr ../Xray-$ASSET_NAME.zip .
|
||||
for CORE in $(ls xray*)
|
||||
do
|
||||
COREDGST=$CORE.dgst
|
||||
for METHOD in {"md5","sha1","sha256","sha512"}
|
||||
do
|
||||
openssl dgst -$METHOD $CORE | sed 's/([^)]*)//g' >>$COREDGST
|
||||
done
|
||||
done
|
||||
popd || exit 1
|
||||
FILE=./Xray-$ASSET_NAME.zip
|
||||
DGST=$FILE.dgst
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.14.0
|
||||
// protoc v3.15.4
|
||||
// source: common/protocol/headers.proto
|
||||
|
||||
package protocol
|
||||
@@ -34,6 +34,7 @@ const (
|
||||
SecurityType_AES128_GCM SecurityType = 3
|
||||
SecurityType_CHACHA20_POLY1305 SecurityType = 4
|
||||
SecurityType_NONE SecurityType = 5
|
||||
SecurityType_ZERO SecurityType = 6
|
||||
)
|
||||
|
||||
// Enum value maps for SecurityType.
|
||||
@@ -45,6 +46,7 @@ var (
|
||||
3: "AES128_GCM",
|
||||
4: "CHACHA20_POLY1305",
|
||||
5: "NONE",
|
||||
6: "ZERO",
|
||||
}
|
||||
SecurityType_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
@@ -53,6 +55,7 @@ var (
|
||||
"AES128_GCM": 3,
|
||||
"CHACHA20_POLY1305": 4,
|
||||
"NONE": 5,
|
||||
"ZERO": 6,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -141,19 +144,20 @@ var file_common_protocol_headers_proto_rawDesc = []byte{
|
||||
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x22, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x53, 0x65, 0x63,
|
||||
0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a,
|
||||
0x62, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12,
|
||||
0x6c, 0x0a, 0x0c, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06,
|
||||
0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x41, 0x55, 0x54, 0x4f,
|
||||
0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x45, 0x53, 0x31, 0x32, 0x38, 0x5f, 0x47, 0x43, 0x4d,
|
||||
0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x48, 0x41, 0x43, 0x48, 0x41, 0x32, 0x30, 0x5f, 0x50,
|
||||
0x4f, 0x4c, 0x59, 0x31, 0x33, 0x30, 0x35, 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e,
|
||||
0x45, 0x10, 0x05, 0x42, 0x5e, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x50,
|
||||
0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74,
|
||||
0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61, 0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d,
|
||||
0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xaa, 0x02, 0x14, 0x58,
|
||||
0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x45, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x06, 0x42, 0x5e, 0x0a,
|
||||
0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x78, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x78, 0x74, 0x6c, 0x73, 0x2f, 0x78, 0x72, 0x61,
|
||||
0x79, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0xaa, 0x02, 0x14, 0x58, 0x72, 0x61, 0x79, 0x2e, 0x43, 0x6f,
|
||||
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@@ -13,6 +13,7 @@ enum SecurityType {
|
||||
AES128_GCM = 3;
|
||||
CHACHA20_POLY1305 = 4;
|
||||
NONE = 5;
|
||||
ZERO = 6;
|
||||
}
|
||||
|
||||
message SecurityConfig {
|
||||
|
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/xtls/xray-core
|
||||
|
||||
go 1.15
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
|
||||
|
@@ -32,6 +32,8 @@ func (a *VMessAccount) Build() *vmess.Account {
|
||||
st = protocol.SecurityType_AUTO
|
||||
case "none":
|
||||
st = protocol.SecurityType_NONE
|
||||
case "zero":
|
||||
st = protocol.SecurityType_ZERO
|
||||
default:
|
||||
st = protocol.SecurityType_AUTO
|
||||
}
|
||||
|
@@ -169,7 +169,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||
if destination.Network == net.Network_TCP {
|
||||
reader = buf.NewReader(conn)
|
||||
} else {
|
||||
reader = NewPacketReader(conn)
|
||||
reader = NewPacketReader(conn, UDPOverride)
|
||||
}
|
||||
if err := buf.Copy(reader, output, buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to process response").Base(err)
|
||||
@@ -185,7 +185,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewPacketReader(conn net.Conn) buf.Reader {
|
||||
func NewPacketReader(conn net.Conn, UDPOverride net.Destination) buf.Reader {
|
||||
iConn := conn
|
||||
statConn, ok := iConn.(*internet.StatCouterConnection)
|
||||
if ok {
|
||||
@@ -195,7 +195,7 @@ func NewPacketReader(conn net.Conn) buf.Reader {
|
||||
if statConn != nil {
|
||||
counter = statConn.ReadCounter
|
||||
}
|
||||
if c, ok := iConn.(*internet.PacketConnWrapper); ok {
|
||||
if c, ok := iConn.(*internet.PacketConnWrapper); ok && UDPOverride.Address == nil && UDPOverride.Port == 0 {
|
||||
return &PacketReader{
|
||||
PacketConnWrapper: c,
|
||||
Counter: counter,
|
||||
|
@@ -118,6 +118,11 @@ func NewServerSession(validator *vmess.TimedUserValidator, sessionHistory *Sessi
|
||||
}
|
||||
}
|
||||
|
||||
// SetAEADForced sets isAEADForced for a ServerSession.
|
||||
func (s *ServerSession) SetAEADForced(isAEADForced bool) {
|
||||
s.isAEADForced = isAEADForced
|
||||
}
|
||||
|
||||
func parseSecurityType(b byte) protocol.SecurityType {
|
||||
if _, f := protocol.SecurityType_name[int32(b)]; f {
|
||||
st := protocol.SecurityType(b)
|
||||
|
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/log"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/platform"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/session"
|
||||
"github.com/xtls/xray-core/common/signal"
|
||||
@@ -28,6 +29,10 @@ import (
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
)
|
||||
|
||||
var (
|
||||
aeadForced = false
|
||||
)
|
||||
|
||||
type userByEmail struct {
|
||||
sync.Mutex
|
||||
cache map[string]*protocol.MemoryUser
|
||||
@@ -231,6 +236,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
|
||||
|
||||
reader := &buf.BufferedReader{Reader: buf.NewReader(connection)}
|
||||
svrSession := encoding.NewServerSession(h.clients, h.sessionHistory)
|
||||
svrSession.SetAEADForced(aeadForced)
|
||||
request, err := svrSession.DecodeRequestHeader(reader, isDrain)
|
||||
if err != nil {
|
||||
if errors.Cause(err) != io.EOF {
|
||||
@@ -361,4 +367,9 @@ func init() {
|
||||
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
|
||||
return New(ctx, config.(*Config))
|
||||
}))
|
||||
|
||||
const defaultFlagValue = "NOT_DEFINED_AT_ALL"
|
||||
|
||||
isAeadForced := platform.NewEnvFlag("xray.vmess.aead.forced").GetValue(func() string { return defaultFlagValue })
|
||||
aeadForced = (isAeadForced == "true")
|
||||
}
|
||||
|
@@ -111,6 +111,12 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
||||
request.Option.Set(protocol.RequestOptionGlobalPadding)
|
||||
}
|
||||
|
||||
if request.Security == protocol.SecurityType_ZERO {
|
||||
request.Security = protocol.SecurityType_NONE
|
||||
request.Option.Clear(protocol.RequestOptionChunkStream)
|
||||
request.Option.Clear(protocol.RequestOptionChunkMasking)
|
||||
}
|
||||
|
||||
input := link.Reader
|
||||
output := link.Writer
|
||||
|
||||
|
@@ -1183,3 +1183,106 @@ func TestVMessGCMMuxUDP(t *testing.T) {
|
||||
CloseAllServers(servers)
|
||||
}()
|
||||
}
|
||||
|
||||
func TestVMessZero(t *testing.T) {
|
||||
tcpServer := tcp.Server{
|
||||
MsgProcessor: xor,
|
||||
}
|
||||
dest, err := tcpServer.Start()
|
||||
common.Must(err)
|
||||
defer tcpServer.Close()
|
||||
|
||||
userID := protocol.NewID(uuid.New())
|
||||
serverPort := tcp.PickPort()
|
||||
serverConfig := &core.Config{
|
||||
App: []*serial.TypedMessage{
|
||||
serial.ToTypedMessage(&log.Config{
|
||||
ErrorLogLevel: clog.Severity_Debug,
|
||||
ErrorLogType: log.LogType_Console,
|
||||
}),
|
||||
},
|
||||
Inbound: []*core.InboundHandlerConfig{
|
||||
{
|
||||
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
||||
PortRange: net.SinglePortRange(serverPort),
|
||||
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
||||
}),
|
||||
ProxySettings: serial.ToTypedMessage(&inbound.Config{
|
||||
User: []*protocol.User{
|
||||
{
|
||||
Account: serial.ToTypedMessage(&vmess.Account{
|
||||
Id: userID.String(),
|
||||
AlterId: 64,
|
||||
}),
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
Outbound: []*core.OutboundHandlerConfig{
|
||||
{
|
||||
ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
clientPort := tcp.PickPort()
|
||||
clientConfig := &core.Config{
|
||||
App: []*serial.TypedMessage{
|
||||
serial.ToTypedMessage(&log.Config{
|
||||
ErrorLogLevel: clog.Severity_Debug,
|
||||
ErrorLogType: log.LogType_Console,
|
||||
}),
|
||||
},
|
||||
Inbound: []*core.InboundHandlerConfig{
|
||||
{
|
||||
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
||||
PortRange: net.SinglePortRange(clientPort),
|
||||
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
||||
}),
|
||||
ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
||||
Address: net.NewIPOrDomain(dest.Address),
|
||||
Port: uint32(dest.Port),
|
||||
NetworkList: &net.NetworkList{
|
||||
Network: []net.Network{net.Network_TCP},
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
Outbound: []*core.OutboundHandlerConfig{
|
||||
{
|
||||
ProxySettings: serial.ToTypedMessage(&outbound.Config{
|
||||
Receiver: []*protocol.ServerEndpoint{
|
||||
{
|
||||
Address: net.NewIPOrDomain(net.LocalHostIP),
|
||||
Port: uint32(serverPort),
|
||||
User: []*protocol.User{
|
||||
{
|
||||
Account: serial.ToTypedMessage(&vmess.Account{
|
||||
Id: userID.String(),
|
||||
AlterId: 64,
|
||||
SecuritySettings: &protocol.SecurityConfig{
|
||||
Type: protocol.SecurityType_ZERO,
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
||||
common.Must(err)
|
||||
defer CloseAllServers(servers)
|
||||
|
||||
var errg errgroup.Group
|
||||
for i := 0; i < 10; i++ {
|
||||
errg.Go(testTCPConn(clientPort, 1024*1024, time.Second*30))
|
||||
}
|
||||
if err := errg.Wait(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user