luci: drop Trojan-Go
The author seems to no longer maintain, so delete it. Please use Xray or Sing-Box instead. Don't want to maintain too many Go application, please use Socks.
This commit is contained in:
parent
8e9d1ba88e
commit
1844925291
@ -23,7 +23,6 @@ PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Server \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SingBox \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_GO \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Plus \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_tuic_client \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Geodata \
|
||||
@ -126,11 +125,6 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_SingBox
|
||||
select PACKAGE_sing-box
|
||||
default y if aarch64||arm||i386||x86_64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_GO
|
||||
bool "Include Trojan-GO"
|
||||
select PACKAGE_trojan-go
|
||||
default n
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Plus
|
||||
bool "Include Trojan-Plus"
|
||||
select PACKAGE_trojan-plus
|
||||
|
@ -5,7 +5,6 @@ local has_ss_rust = api.is_finded("sslocal")
|
||||
local has_trojan_plus = api.is_finded("trojan-plus")
|
||||
local has_singbox = api.finded_com("singbox")
|
||||
local has_xray = api.finded_com("xray")
|
||||
local has_trojan_go = api.finded_com("trojan-go")
|
||||
local has_hysteria2 = api.finded_com("hysteria")
|
||||
local ss_aead_type = {}
|
||||
local trojan_type = {}
|
||||
@ -39,10 +38,6 @@ if has_xray then
|
||||
table.insert(vmess_type, s)
|
||||
table.insert(vless_type, s)
|
||||
end
|
||||
if has_trojan_go then
|
||||
local s = "trojan-go"
|
||||
table.insert(trojan_type, s)
|
||||
end
|
||||
if has_hysteria2 then
|
||||
local s = "hysteria2"
|
||||
table.insert(hysteria2_type, s)
|
||||
|
@ -5,7 +5,6 @@ local has_ss_rust = api.is_finded("sslocal")
|
||||
local has_trojan_plus = api.is_finded("trojan-plus")
|
||||
local has_singbox = api.finded_com("singbox")
|
||||
local has_xray = api.finded_com("xray")
|
||||
local has_trojan_go = api.finded_com("trojan-go")
|
||||
local has_hysteria2 = api.finded_com("hysteria")
|
||||
local ss_aead_type = {}
|
||||
local trojan_type = {}
|
||||
@ -39,10 +38,6 @@ if has_xray then
|
||||
table.insert(vmess_type, s)
|
||||
table.insert(vless_type, s)
|
||||
end
|
||||
if has_trojan_go then
|
||||
local s = "trojan-go"
|
||||
table.insert(trojan_type, s)
|
||||
end
|
||||
if has_hysteria2 then
|
||||
local s = "hysteria2"
|
||||
table.insert(hysteria2_type, s)
|
||||
|
@ -23,22 +23,6 @@ _M.hysteria = {
|
||||
}
|
||||
}
|
||||
|
||||
_M["trojan-go"] = {
|
||||
name = "Trojan-Go",
|
||||
repo = "p4gefau1t/trojan-go",
|
||||
get_url = gh_release_url,
|
||||
cmd_version = "-version | awk '{print $2}' | sed -n 1P",
|
||||
zipped = true,
|
||||
default_path = "/usr/bin/trojan-go",
|
||||
match_fmt_str = "linux%%-%s%%.zip",
|
||||
file_tree = {
|
||||
aarch64 = "armv8",
|
||||
armv8 = "armv8",
|
||||
mips = "mips%-hardfloat",
|
||||
mipsel = "mipsle%-hardfloat"
|
||||
}
|
||||
}
|
||||
|
||||
_M.singbox = {
|
||||
name = "Sing-Box",
|
||||
repo = "SagerNet/sing-box",
|
||||
|
@ -152,9 +152,6 @@ local function start()
|
||||
elseif type == "Trojan-Plus" then
|
||||
config = require(require_dir .. "util_trojan").gen_config_server(user)
|
||||
bin = ln_run("/usr/sbin/trojan-plus", "trojan-plus", "-c " .. config_file, log_path)
|
||||
elseif type == "Trojan-Go" then
|
||||
config = require(require_dir .. "util_trojan").gen_config_server(user)
|
||||
bin = ln_run(api.get_app_path("trojan-go"), "trojan-go", "-config " .. config_file, log_path)
|
||||
elseif type == "Hysteria2" then
|
||||
config = require(require_dir .. "util_hysteria2").gen_config_server(user)
|
||||
bin = ln_run(api.get_app_path("hysteria"), "hysteria", "-c " .. config_file .. " server", log_path)
|
||||
|
@ -37,30 +37,6 @@ function gen_config_server(node)
|
||||
fast_open_qlen = 20
|
||||
}
|
||||
}
|
||||
if node.type == "Trojan-Go" then
|
||||
config.ssl.cipher = nil
|
||||
config.ssl.cipher_tls13 = nil
|
||||
config.udp_timeout = 60
|
||||
config.disable_http_check = true
|
||||
config.transport_plugin = ((node.tls == nil or node.tls ~= "1") and node.trojan_transport == "original") and {
|
||||
enabled = node.plugin_type ~= nil,
|
||||
type = node.plugin_type or "plaintext",
|
||||
command = node.plugin_type ~= "plaintext" and node.plugin_cmd or nil,
|
||||
option = node.plugin_type ~= "plaintext" and node.plugin_option or nil,
|
||||
arg = node.plugin_type ~= "plaintext" and { node.plugin_arg } or nil,
|
||||
env = {}
|
||||
} or nil
|
||||
config.websocket = (node.trojan_transport == 'ws') and {
|
||||
enabled = true,
|
||||
path = node.ws_path or "/",
|
||||
host = node.ws_host or ""
|
||||
} or nil
|
||||
config.shadowsocks = (node.ss_aead == "1") and {
|
||||
enabled = true,
|
||||
method = node.ss_aead_method or "aes_128_gcm",
|
||||
password = node.ss_aead_pwd or ""
|
||||
} or nil
|
||||
end
|
||||
return config
|
||||
end
|
||||
|
||||
@ -115,36 +91,6 @@ function gen_config(var)
|
||||
fast_open_qlen = 20
|
||||
}
|
||||
}
|
||||
if node.type == "Trojan-Go" then
|
||||
trojan.ssl.cipher = nil
|
||||
trojan.ssl.cipher_tls13 = nil
|
||||
trojan.ssl.fingerprint = (node.fingerprint ~= "disable") and node.fingerprint or ""
|
||||
trojan.ssl.alpn = (node.trojan_transport == 'ws') and {} or {"h2", "http/1.1"}
|
||||
if node.tls ~= "1" and node.trojan_transport == "original" then trojan.ssl = nil end
|
||||
trojan.transport_plugin = ((not node.tls or node.tls ~= "1") and node.trojan_transport == "original") and {
|
||||
enabled = node.plugin_type ~= nil,
|
||||
type = node.plugin_type or "plaintext",
|
||||
command = node.plugin_type ~= "plaintext" and node.plugin_cmd or nil,
|
||||
option = node.plugin_type ~= "plaintext" and node.plugin_option or nil,
|
||||
arg = node.plugin_type ~= "plaintext" and { node.plugin_arg } or nil,
|
||||
env = {}
|
||||
} or nil
|
||||
trojan.websocket = (node.trojan_transport == 'ws') and {
|
||||
enabled = true,
|
||||
path = node.ws_path or "/",
|
||||
host = node.ws_host or (node.tls_serverName or server)
|
||||
} or nil
|
||||
trojan.shadowsocks = (node.ss_aead == "1") and {
|
||||
enabled = true,
|
||||
method = node.ss_aead_method or "aes_128_gcm",
|
||||
password = node.ss_aead_pwd or ""
|
||||
} or nil
|
||||
trojan.mux = (node.smux == "1") and {
|
||||
enabled = true,
|
||||
concurrency = tonumber(node.mux_concurrency),
|
||||
idle_timeout = tonumber(node.smux_idle_timeout)
|
||||
} or nil
|
||||
end
|
||||
return json.stringify(trojan, 1)
|
||||
end
|
||||
|
||||
|
@ -140,9 +140,6 @@ local api = require "luci.passwall.api"
|
||||
} else if (v_type === "Trojan-Plus") {
|
||||
dom_prefix = "trojan_plus_"
|
||||
protocol = "trojan"
|
||||
} else if (v_type === "Trojan-Go") {
|
||||
dom_prefix = "trojan_go_"
|
||||
protocol = "trojan-go"
|
||||
} else if (v_type === "Hysteria2") {
|
||||
dom_prefix = "hysteria2_"
|
||||
protocol = "hysteria2"
|
||||
@ -343,46 +340,6 @@ local api = require "luci.passwall.api"
|
||||
params = params.substring(1);
|
||||
}
|
||||
url += params;
|
||||
} else if (v_type === "Trojan-Go") {
|
||||
var v_password = opt.get(dom_prefix + "password");
|
||||
var v_port = opt.get(dom_prefix + "port");
|
||||
url = encodeURIComponent(v_password.value) +
|
||||
"@" + _address +
|
||||
":" + v_port.value + "/?";
|
||||
var params = "";
|
||||
if (opt.get(dom_prefix + "tls").checked) {
|
||||
params += opt.query("sni", dom_prefix + "tls_serverName");
|
||||
} else {
|
||||
if (opt.get(dom_prefix + "transport").value === "original") {
|
||||
var plugin = {};
|
||||
plugin.type = opt.get(dom_prefix + "plugin_type").value;
|
||||
if (plugin.type !== "plaintext") {
|
||||
plugin.command = opt.get(dom_prefix + "plugin_cmd").value;
|
||||
plugin.option = opt.get(dom_prefix + "plugin_option").value;
|
||||
plugin.arg = opt.getlist(dom_prefix + "plugin_arg");
|
||||
}
|
||||
params += "&plugin=" + encodeURIComponent(JSON.stringify(plugin));
|
||||
}
|
||||
}
|
||||
params += opt.query("type", dom_prefix + "transport");
|
||||
var ws = (opt.get(dom_prefix + "transport").value.indexOf("ws") !== -1);
|
||||
var h2 = (opt.get(dom_prefix + "transport").value.indexOf("h2") !== -1);
|
||||
if (ws) {
|
||||
params += opt.query("host", dom_prefix + "ws_host");
|
||||
params += opt.query("path", dom_prefix + "ws_path");
|
||||
}
|
||||
var enc = "none";
|
||||
if (opt.get(dom_prefix + "ss_aead").checked === true) {
|
||||
enc = "ss;" +
|
||||
opt.get(dom_prefix + "ss_aead_method").value +
|
||||
":" + opt.get(dom_prefix + "ss_aead_pwd").value;
|
||||
}
|
||||
params += "&encryption=" + encodeURIComponent(enc);
|
||||
params += "#" + encodeURI(v_alias.value);
|
||||
if (params[0] == "&") {
|
||||
params = params.substring(1);
|
||||
}
|
||||
url += params;
|
||||
} else if ((v_type === "Hysteria2") || (v_type === "sing-box" && opt.get(dom_prefix + "protocol").value === "hysteria2")) {
|
||||
protocol = "hysteria2"
|
||||
var v_port = opt.get(dom_prefix + "port");
|
||||
@ -694,9 +651,6 @@ local api = require "luci.passwall.api"
|
||||
queryParam[decodeURIComponent(params[0]).toLowerCase()] = decodeURIComponent(params[1] || '');
|
||||
}
|
||||
}
|
||||
if (queryParam.mux || queryParam.ws || queryParam.h2 || queryParam.ss || queryParam.plugin) {
|
||||
ssu[0] = "trojan-go"
|
||||
}
|
||||
opt.set(dom_prefix + 'address', m.hostname);
|
||||
opt.set(dom_prefix + 'port', m.port || "443");
|
||||
opt.set(dom_prefix + 'password', decodeURIComponent(password));
|
||||
@ -706,80 +660,6 @@ local api = require "luci.passwall.api"
|
||||
if (m.hash) {
|
||||
opt.set('remarks', decodeURI(m.hash.substr(1)));
|
||||
}
|
||||
} if (ssu[0] === "trojan-go") {
|
||||
dom_prefix = "trojan_go_"
|
||||
var m = parseNodeUrl(ssrurl);
|
||||
var password = m.passwd;
|
||||
if (password === "") {
|
||||
s.innerHTML = "<font color='red'><%:Invalid Share URL Format%></font>";
|
||||
return false;
|
||||
}
|
||||
var queryParam = {};
|
||||
if (m.search.length > 1) {
|
||||
var query = m.search.split('?');
|
||||
var queryParams = query[1];
|
||||
var queryArray = queryParams.split('&');
|
||||
for (i = 0; i < queryArray.length; i++) {
|
||||
var params = queryArray[i].split('=');
|
||||
queryParam[decodeURIComponent(params[0]).toLowerCase()] = decodeURIComponent(params[1] || '');
|
||||
}
|
||||
}
|
||||
opt.set('type', 'Trojan-Go');
|
||||
opt.set(dom_prefix + 'address', m.hostname);
|
||||
opt.set(dom_prefix + 'port', m.port || "443");
|
||||
opt.set(dom_prefix + 'password', decodeURIComponent(password));
|
||||
opt.set(dom_prefix + 'tls', true);
|
||||
opt.set(dom_prefix + 'tls_allowInsecure', '0');
|
||||
opt.set(dom_prefix + 'tls_serverName', queryParam.peer || queryParam.sni || '');
|
||||
var plugin = queryParam.plugin !== undefined;
|
||||
if (plugin) {
|
||||
opt.set(dom_prefix + 'transport', 'original');
|
||||
var plugin = JSON.parse(queryParam.plugin);
|
||||
if (plugin) {
|
||||
opt.set(dom_prefix + 'plugin_type', plugin.type);
|
||||
if (plugin.type !== "plaintext") {
|
||||
opt.set(dom_prefix + 'plugin_cmd', plugin.command);
|
||||
opt.set(dom_prefix + 'plugin_option', plugin.option);
|
||||
opt.setlist(dom_prefix + 'plugin_arg', plugin.arg);
|
||||
}
|
||||
} else
|
||||
alert(queryParam.plugin);
|
||||
}
|
||||
var tran = 'original';
|
||||
var or = queryParam.type === undefined || queryParam.type === 'original';
|
||||
var ws = null;
|
||||
var h2 = null;
|
||||
if (queryParam.type) {
|
||||
ws = queryParam.type.indexOf('ws') !== -1;
|
||||
h2 = queryParam.type.indexOf('h2') !== -1;
|
||||
}
|
||||
if (ws && h2) {
|
||||
tran = 'h2+ws'
|
||||
} else {
|
||||
if (ws) tran = 'ws';
|
||||
if (h2) tran = 'h2';
|
||||
}
|
||||
opt.set(dom_prefix + 'transport', tran);
|
||||
if (ws) {
|
||||
opt.set(dom_prefix + 'ws_host', queryParam.host || '');
|
||||
opt.set(dom_prefix + 'ws_path', queryParam.path || '/');
|
||||
}
|
||||
var enc = {};
|
||||
var ss = false;
|
||||
if (queryParam.encryption) {
|
||||
var r = queryParam.encryption.match(/^(ss);([^;:]*)[;:](.*)$/),
|
||||
enc = { type: r[1], method: r[2], password: r[3] };
|
||||
}
|
||||
ss = enc.type === 'ss';
|
||||
opt.set(dom_prefix + 'ss_aead', ss);
|
||||
if (ss) {
|
||||
opt.set(dom_prefix + 'ss_aead_method', enc.method.toLowerCase() || '');
|
||||
opt.set(dom_prefix + 'ss_aead_pwd', enc.password || '');
|
||||
}
|
||||
opt.set(dom_prefix + 'smux', '1');
|
||||
if (m.hash) {
|
||||
opt.set('remarks', decodeURI(m.hash.substr(1)));
|
||||
}
|
||||
}
|
||||
if (ssu[0] === "vmess") {
|
||||
var sstr = b64DecodeUnicode(ssu[1]);
|
||||
|
@ -898,9 +898,6 @@ msgstr "%s 程序路径"
|
||||
msgid "%s Client App Path"
|
||||
msgstr "%s 客户端程序路径"
|
||||
|
||||
msgid "Trojan-Go Version API"
|
||||
msgstr "Trojan-Go 版本 API"
|
||||
|
||||
msgid "alternate API URL for version checking"
|
||||
msgstr "用于版本检查的 API URL"
|
||||
|
||||
|
@ -75,7 +75,6 @@ config global_rules
|
||||
config global_app
|
||||
option singbox_file '/usr/bin/sing-box'
|
||||
option xray_file '/usr/bin/xray'
|
||||
option trojan_go_file '/usr/bin/trojan-go'
|
||||
option hysteria_file '/usr/bin/hysteria'
|
||||
option chinadns_ng '/usr/bin/chinadns-ng'
|
||||
|
||||
|
@ -608,10 +608,6 @@ run_socks() {
|
||||
[ -n "$relay_port" ] && _args="${_args} -server_host $server_host -server_port $port"
|
||||
run_xray flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args}
|
||||
;;
|
||||
trojan-go)
|
||||
lua $UTIL_TROJAN gen_config -node $node -run_type client -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_run "$(first_type $(config_t_get global_app trojan_go_file) trojan-go)" trojan-go $log_file -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
lua $UTIL_TROJAN gen_config -node $node -run_type client -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_run "$(first_type ${type})" "${type}" $log_file -c "$config_file"
|
||||
@ -718,11 +714,6 @@ run_redir() {
|
||||
xray)
|
||||
run_xray flag=UDP node=$node udp_redir_port=$local_port config_file=$config_file log_file=$log_file
|
||||
;;
|
||||
trojan-go)
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $UTIL_TROJAN gen_config -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_run "$(first_type $(config_t_get global_app trojan_go_file) trojan-go)" trojan-go $log_file -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $UTIL_TROJAN gen_config -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
@ -875,16 +866,6 @@ run_redir() {
|
||||
}
|
||||
run_xray flag=$_flag node=$node tcp_redir_port=$local_port config_file=$config_file log_file=$log_file ${_args}
|
||||
;;
|
||||
trojan-go)
|
||||
[ "$TCP_UDP" = "1" ] && {
|
||||
config_file=$(echo $config_file | sed "s/TCP/TCP_UDP/g")
|
||||
UDP_REDIR_PORT=$TCP_REDIR_PORT
|
||||
UDP_NODE="nil"
|
||||
}
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $UTIL_TROJAN gen_config -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_run "$(first_type $(config_t_get global_app trojan_go_file) trojan-go)" trojan-go $log_file -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
[ "$tcp_proxy_way" = "tproxy" ] && lua_tproxy_arg="-use_tproxy true"
|
||||
[ "$TCP_UDP" = "1" ] && {
|
||||
@ -1717,8 +1698,8 @@ USE_DEFAULT_DNS=$(config_t_get global use_default_dns direct)
|
||||
FILTER_PROXY_IPV6=$(config_t_get global filter_proxy_ipv6 0)
|
||||
dns_listen_port=${DNS_PORT}
|
||||
|
||||
REDIRECT_LIST="socks ss ss-rust ssr sing-box xray trojan-go trojan-plus naiveproxy hysteria2"
|
||||
TPROXY_LIST="socks ss ss-rust ssr sing-box xray trojan-go trojan-plus hysteria2"
|
||||
REDIRECT_LIST="socks ss ss-rust ssr sing-box xray trojan-plus naiveproxy hysteria2"
|
||||
TPROXY_LIST="socks ss ss-rust ssr sing-box xray trojan-plus hysteria2"
|
||||
RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto
|
||||
[ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto
|
||||
|
||||
|
@ -27,7 +27,6 @@ local has_ss_rust = api.is_finded("sslocal")
|
||||
local has_trojan_plus = api.is_finded("trojan-plus")
|
||||
local has_singbox = api.finded_com("singbox")
|
||||
local has_xray = api.finded_com("xray")
|
||||
local has_trojan_go = api.finded_com("trojan-go")
|
||||
local has_hysteria2 = api.finded_com("hysteria")
|
||||
local allowInsecure_default = nil
|
||||
local ss_aead_type_default = uci:get(appname, "@global_subscribe[0]", "ss_aead_type") or "shadowsocks-libev"
|
||||
@ -606,23 +605,7 @@ local function processData(szType, content, add_mode, add_from)
|
||||
local peer, sni = nil, ""
|
||||
if params.peer then peer = params.peer end
|
||||
sni = params.sni and params.sni or ""
|
||||
if params.ws and params.ws == "1" then
|
||||
result.trojan_transport = "ws"
|
||||
if params.wshost then result.ws_host = params.wshost end
|
||||
if params.wspath then result.ws_path = params.wspath end
|
||||
if sni == "" and params.wshost then sni = params.wshost end
|
||||
end
|
||||
if params.ss and params.ss == "1" then
|
||||
result.ss_aead = "1"
|
||||
if params.ssmethod then result.ss_aead_method = string.lower(params.ssmethod) end
|
||||
if params.sspasswd then result.ss_aead_pwd = params.sspasswd end
|
||||
end
|
||||
result.port = port
|
||||
if result.trojan_transport == "ws" or result.ss_aead then
|
||||
result.type = "Trojan-Go"
|
||||
result.fingerprint = "firefox"
|
||||
result.mux = "1"
|
||||
end
|
||||
result.tls = '1'
|
||||
result.tls_serverName = peer and peer or sni
|
||||
if params.allowinsecure then
|
||||
@ -644,65 +627,6 @@ local function processData(szType, content, add_mode, add_from)
|
||||
elseif trojan_type_default == "xray" and has_xray then
|
||||
result.type = 'Xray'
|
||||
result.protocol = 'trojan'
|
||||
elseif trojan_type_default == "trojan-go" and has_trojan_go then
|
||||
result.type = 'Trojan-Go'
|
||||
end
|
||||
elseif szType == "trojan-go" then
|
||||
local alias = ""
|
||||
if content:find("#") then
|
||||
local idx_sp = content:find("#")
|
||||
alias = content:sub(idx_sp + 1, -1)
|
||||
content = content:sub(0, idx_sp - 1)
|
||||
end
|
||||
result.remarks = UrlDecode(alias)
|
||||
if has_trojan_go then
|
||||
result.type = "Trojan-Go"
|
||||
end
|
||||
if content:find("@") then
|
||||
local Info = split(content, "@")
|
||||
result.password = UrlDecode(Info[1])
|
||||
local port = "443"
|
||||
Info[2] = (Info[2] or ""):gsub("/%?", "?")
|
||||
local query = split(Info[2], "?")
|
||||
local host_port = query[1]
|
||||
local params = {}
|
||||
for _, v in pairs(split(query[2], '&')) do
|
||||
local t = split(v, '=')
|
||||
params[string.lower(t[1])] = UrlDecode(t[2])
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
local peer, sni = nil, ""
|
||||
if params.peer then peer = params.peer end
|
||||
sni = params.sni and params.sni or ""
|
||||
if params.type and params.type == "ws" then
|
||||
result.trojan_transport = "ws"
|
||||
if params.host then result.ws_host = params.host end
|
||||
if params.path then result.ws_path = params.path end
|
||||
if sni == "" and params.host then sni = params.host end
|
||||
end
|
||||
if params.encryption and params.encryption:match('^ss;[^;:]*[;:].*$') then
|
||||
result.ss_aead = "1"
|
||||
result.ss_aead_method, result.ss_aead_pwd = params.encryption:match('^ss;([^;:]*)[;:](.*)$')
|
||||
result.ss_aead_method = string.lower(result.ss_aead_method)
|
||||
end
|
||||
result.port = port
|
||||
result.fingerprint = "firefox"
|
||||
result.tls = "1"
|
||||
result.tls_serverName = peer and peer or sni
|
||||
result.tls_allowInsecure = "0"
|
||||
result.mux = "1"
|
||||
end
|
||||
elseif szType == "ssd" then
|
||||
result.type = "SS"
|
||||
@ -1218,7 +1142,7 @@ local function parse_link(raw, add_mode, add_from)
|
||||
local node = trim(v)
|
||||
local dat = split(node, "://")
|
||||
if dat and dat[1] and dat[2] then
|
||||
if dat[1] == 'ss' or dat[1] == 'trojan' or dat[1] == 'trojan-go' then
|
||||
if dat[1] == 'ss' or dat[1] == 'trojan' then
|
||||
result = processData(dat[1], dat[2], add_mode, add_from)
|
||||
else
|
||||
result = processData(dat[1], base64Decode(dat[2]), add_mode, add_from)
|
||||
|
Loading…
Reference in New Issue
Block a user