From 0ba0cdd18ea265529f53d24e1cf9138028fcdfb0 Mon Sep 17 00:00:00 2001 From: enximi <70036307+enximi@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:22:48 +0800 Subject: [PATCH] Fix #569 #448 #431 (#637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 支持v2rayN等使用的trojan链接格式 --- src/parser/subparser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/parser/subparser.cpp b/src/parser/subparser.cpp index 6a51eaf50..1434e6a68 100644 --- a/src/parser/subparser.cpp +++ b/src/parser/subparser.cpp @@ -759,6 +759,15 @@ void explodeTrojan(std::string trojan, Proxy &node) path = getUrlArg(addition, "wspath"); network = "ws"; } + // support the trojan link format used by v2ryaN and X-ui. + // format: trojan://{password}@{server}:{port}?type=ws&security=tls&path={path (urlencoded)}&sni={host}#{name} + else if(getUrlArg(addition, "type") == "ws") + { + path = getUrlArg(addition, "path"); + if(path.substr(0, 3) == "%2F") + path = urlDecode(path); + network = "ws"; + } if(remark.empty()) remark = server + ":" + port;