Skip to content

Commit ad3a982

Browse files
author
jiangwy
committed
feat(protocol/vless): 添加WebSocket选项恢复功能,优化代理配置
1 parent 917e89f commit ad3a982

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/core/parser/protocol/vless.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,21 @@ export class VlessParser extends Faker {
6565
this.#confuseLink = this.#confuseConfig.href!;
6666
}
6767

68+
#restoreWs(proxy: Record<string, string | number | any>): void {
69+
if (proxy.network === 'ws') {
70+
proxy['ws-opts'] = {
71+
...proxy['ws-opts'],
72+
path: decodeURIComponent(this.originConfig.searchParams?.get('path') ?? '/'),
73+
headers: {
74+
...proxy['ws-opts'].headers,
75+
Host: this.originConfig.host
76+
}
77+
};
78+
}
79+
}
80+
6881
public restoreClash(proxy: Record<string, any>, ps: string): Record<string, any> {
82+
this.#restoreWs(proxy);
6983
proxy.name = ps;
7084
proxy.server = this.originConfig.hostname ?? '';
7185
proxy.port = Number(this.originConfig?.port ?? 0);

0 commit comments

Comments
 (0)