Skip to content

Commit

Permalink
feat: add support for more VMESS transport protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Mar 5, 2024
1 parent 8ed380a commit 08b88b9
Show file tree
Hide file tree
Showing 33 changed files with 2,748 additions and 1,974 deletions.
12 changes: 6 additions & 6 deletions docs/guide/custom-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ module.exports = {
- 类型: `boolean`
- 默认值: `false`

目前仅 Stash 支持 Tuic,如果你希望在 Clash 订阅中输出 Tuic 节点请开启此项。
目前仅 Clash Meta 内核和 Stash 支持 Tuic,如果你希望在 Clash 订阅中输出 Tuic 节点请开启此项。

### clashConfig.enableShadowTls

Expand Down Expand Up @@ -261,11 +261,11 @@ Clash 核心版本。默认使用 Clash 核心,如果你希望输出针对 Cla

下面是目前支持的变化:

| 核心 | 变化 |
| --- |----------------------------------------------------------------------------------|
| `clash` | 默认值,不输出任何变化 |
| `clash.meta` | 不输出任何变化 |
| `stash` | - Hysteria 协议的密码字段改为 `auth` |
| 核心 | 变化 |
| --- |--------------------------------------------------------------|
| `clash` | 默认值 |
| `clash.meta` | 模板 `clash` 过滤器会改为过滤 Clash Meta 不支持的规则 |
| `stash` | - Hysteria 协议的密码字段改为 `auth`;模板 `clash` 过滤器会改为过滤 Stash 不支持的规则 |

:::warning 注意
`enableTuic`, `enableShadowTls`, `enableHysteria2` 这三个配置项和 `clashCore` 目前互不影响,但是将来会合并到 `clashCore` 中。
Expand Down
99 changes: 92 additions & 7 deletions docs/guide/custom-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,109 @@ module.exports = defineCustomProvider({

### Vmess

从 v3.5.0 开始 Surgio 支持了更多 Vmess 协议。为了更好地区分不同协议的参数,原有的 `host`, `path`, `wsHeaders` 将会在后面的版本中废弃,请使用下面列出的新属性。 Surgio 会忽略代理客户端不支持的协议类型。

#### `network: 'tcp'`

```json5
{
nodeName: '🇭🇰HK',
type: 'vmess',
hostname: 'hk.example.com',
method: 'auto', // 仅支持 auto/aes-128-gcm/chacha20-ietf-poly1305/none
network: 'ws', // 仅支持 tcp/ws
network: 'tcp',
alterId: '64',
path: '/',
port: 8080,
tls: false,
host: 'example.com', // 此属性相当于 wsHeaders.host,但推荐配置在 wsHeaders.host 上
uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd',
tfo: false, // TCP Fast Open
tls13: false, // TLS 1.3, TLS 开启时有效
udpRelay: true, // 开启 UDP 转发
wsHeaders: {
key: 'value',
}
```

#### `network: 'http'`

```json5
{
nodeName: '🇭🇰HK',
type: 'vmess',
hostname: 'hk.example.com',
method: 'auto',
network: 'http',
alterId: '64',
port: 8080,
tls: false,
uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd',
udpRelay: true,
httpOpts: {
method: 'GET',
path: ['/', '/video'],
headers: {
'x-key': 'x-value',
},
},
}
```

#### `network: 'ws'`

```json5
{
nodeName: '🇭🇰HK',
type: 'vmess',
hostname: 'hk.example.com',
method: 'auto',
network: 'ws',
alterId: '64',
port: 8080,
tls: false,
uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd',
udpRelay: true,
wsOpts: {
path: '/',
headers: {
'Host': 'www.example.com',
},
},
}
```

#### `network: 'grpc'`

```json5
{
nodeName: '🇭🇰HK',
type: 'vmess',
hostname: 'hk.example.com',
method: 'auto',
network: 'grpc',
alterId: '64',
port: 8080,
tls: false,
uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd',
udpRelay: true,
grpcOpts: {
serviceName: 'example',
},
}
```

#### `network: 'h2'`

```json5
{
nodeName: '🇭🇰HK',
type: 'vmess',
hostname: 'hk.example.com',
method: 'auto',
network: 'h2',
alterId: '64',
port: 8080,
tls: false,
uuid: '1386f85e-657b-4d6e-9d56-78badb75e1fd',
udpRelay: true,
h2Opts: {
path: '/',
host: ['www.example.com'],
},
}
```
Expand Down
83 changes: 42 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,33 @@
"topics": {}
},
"dependencies": {
"@babel/parser": "^7.23.0",
"@babel/parser": "^7.24.0",
"@brillout/import": "^0.2.3",
"@oclif/core": "^2.15.0",
"@oclif/plugin-help": "^5.2.20",
"@oclif/plugin-plugins": "^3.9.1",
"@oclif/plugin-plugins": "^3.9.4",
"@royli/hygen": "^6.2.0",
"@surgio/eslint-config-surgio": "^1.0.6",
"@surgio/logger": "^1.3.0",
"@types/eslint": "^8.44.4",
"@types/eslint": "^8.56.5",
"agentkeepalive": "^4.5.0",
"ali-oss": "^6.18.1",
"ali-oss": "^6.20.0",
"bluebird": "^3.7.2",
"bytes": "^3.1.2",
"cache-manager": "^5.2.4",
"cache-manager": "^5.4.0",
"cache-manager-ioredis-yet": "^1.2.2",
"chalk": "^4.1.2",
"change-case": "^4.1.2",
"check-node-version": "^4.2.1",
"compare-versions": "^6.1.0",
"date-fns": "^2.30.0",
"detect-newline": "^3.1.0",
"dotenv": "^16.3.1",
"emoji-regex": "^10.2.1",
"eslint": "^8.51.0",
"dotenv": "^16.4.5",
"emoji-regex": "^10.3.0",
"eslint": "^8.57.0",
"execa": "^4.1.0",
"filesize": "^10.1.0",
"fs-extra": "^11.1.1",
"fs-extra": "^11.2.0",
"got": "^11.8.6",
"hpagent": "^1.2.0",
"inquirer": "^8.2.6",
Expand All @@ -112,39 +112,40 @@
"query-string": "^7.1.3",
"rimraf": "^4.4.1",
"source-map-support": "^0.5.21",
"ts-expect": "^1.3.0",
"type-fest": "^3.13.1",
"update-notifier": "^5.1.0",
"urlsafe-base64": "^1.0.0",
"yaml": "^2.3.2",
"yaml": "^2.4.0",
"zod": "^3.22.4",
"zod-validation-error": "^1.5.0"
},
"devDependencies": {
"@algolia/client-search": "^4.20.0",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-angular": "^17.7.0",
"@algolia/client-search": "^4.22.1",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-angular": "^17.8.1",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@oclif/test": "^2.5.6",
"@types/ali-oss": "^6.16.9",
"@types/bluebird": "^3.5.40",
"@types/bytes": "^3.1.2",
"@types/chai": "^4.3.8",
"@types/debug": "^4.1.9",
"@types/fs-extra": "^11.0.2",
"@types/ini": "^1.3.31",
"@types/inquirer": "^8.2.7",
"@types/ioredis-mock": "^8.2.3",
"@types/lodash": "^4.14.199",
"@types/micromatch": "^4.0.3",
"@types/mocha": "^10.0.2",
"@types/ms": "^0.7.32",
"@types/node": "^18.18.5",
"@types/ali-oss": "^6.16.11",
"@types/bluebird": "^3.5.42",
"@types/bytes": "^3.1.4",
"@types/chai": "^4.3.12",
"@types/debug": "^4.1.12",
"@types/fs-extra": "^11.0.4",
"@types/ini": "^1.3.34",
"@types/inquirer": "^8.2.10",
"@types/ioredis-mock": "^8.2.5",
"@types/lodash": "^4.14.202",
"@types/micromatch": "^4.0.6",
"@types/mocha": "^10.0.6",
"@types/ms": "^0.7.34",
"@types/node": "^18.19.21",
"@types/node-dir": "^0.0.35",
"@types/nunjucks": "^3.2.4",
"@types/sinon": "^10.0.19",
"@types/urlsafe-base64": "^1.0.29",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@types/nunjucks": "^3.2.6",
"@types/sinon": "^10.0.20",
"@types/urlsafe-base64": "^1.0.31",
"@typescript-eslint/eslint-plugin": "^7",
"@typescript-eslint/parser": "^7",
"@vuepress/client": "2.0.0-beta.62",
"@vuepress/plugin-docsearch": "2.0.0-beta.62",
"@vuepress/plugin-google-analytics": "2.0.0-beta.62",
Expand All @@ -153,8 +154,8 @@
"@vuepress/utils": "2.0.0-beta.62",
"ava": "^5.3.1",
"benchmark": "^2.1.4",
"bumpp": "^9.2.0",
"chai": "^4.3.10",
"bumpp": "^9.4.0",
"chai": "^4.4.1",
"chai-jest-snapshot": "^2.0.0",
"conventional-changelog-cli": "^2.2.2",
"eslint-config-prettier": "^8.10.0",
Expand All @@ -163,21 +164,21 @@
"ini": "^3.0.1",
"ioredis-mock": "^8.9.0",
"lint-staged": "^13.3.0",
"mocha": "^10.2.0",
"nock": "^13.3.4",
"mocha": "^10.3.0",
"nock": "^13.5.4",
"np": "^6.5.0",
"npm-debug-log-cleaner": "^1.0.3",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"sass": "^1.69.3",
"sass": "^1.71.1",
"sinon": "^15.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.2.2",
"vue": "^3.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vue": "^3.4.21",
"vuepress": "2.0.0-beta.62",
"vuepress-plugin-sitemap2": "2.0.0-beta.205",
"vuepress-plugin-umami-analytics": "^1.5.0"
"vuepress-plugin-umami-analytics": "^1.8.1"
},
"ava": {
"failFast": false,
Expand Down
Loading

0 comments on commit 08b88b9

Please sign in to comment.