feat: Trojan URI 支持省略端口号

This commit is contained in:
xream
2024-11-28 13:15:22 +08:00
parent 6aece471aa
commit 9d90369594
2 changed files with 6 additions and 1 deletions

View File

@@ -842,6 +842,11 @@ function URI_Trojan() {
};
const parse = (line) => {
const matched = /^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(line);
const port = matched?.[2];
if (!port) {
line = line.replace(matched[1], `${matched[1]}:443`);
}
let [newLine, name] = line.split(/#(.+)/, 2);
const parser = getTrojanURIParser();
const proxy = parser.parse(newLine);