mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
luci-app-ssr-plus: refine trojan subscribe and import (#3435)
* luci-app-ssr-plus: refine trojan subscribe * luci-app-ssr-plus: refine trojan import * luci-app-ssr-plus: bump versio 154-2
This commit is contained in:
parent
703cb9ce6e
commit
91485387cc
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=154
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
@ -212,15 +212,32 @@
|
||||
url0 = ssu[1]
|
||||
}
|
||||
var sstr = url0;
|
||||
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.type').value = "trojan";
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.type').dispatchEvent(event);
|
||||
var team = sstr.split('@');
|
||||
var password = team[0]
|
||||
var serverPart = team[1].split(':');
|
||||
var port = serverPart[1].split('?')[0];
|
||||
var others = serverPart[1].split('?');
|
||||
var port = others[0]
|
||||
var queryParam = {}
|
||||
if(others.length > 0) {
|
||||
var queryParams = others[1]
|
||||
var queryArray = queryParams.split('&')
|
||||
for (i = 0; i < queryArray.length; i++) {
|
||||
var params = queryArray[i].split('=');
|
||||
queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.server').value = serverPart[0];
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.server_port').value = port;
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.password').value = password;
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.tls').checked = true;
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.tls').dispatchEvent(event);
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.tls_host').value = queryParam.peer || '';
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.insecure').checked = queryParam.allowInsecure === '1';
|
||||
|
||||
if (param != undefined) {
|
||||
document.getElementById('cbid.shadowsocksr.' + sid + '.alias').value = decodeURI(param);
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ local trojan = {
|
||||
password = {server.password},
|
||||
-- 传出连接
|
||||
ssl = {
|
||||
verify = false,
|
||||
verify_hostname = (server.tls == "1") and false or true,
|
||||
verify = (server.insecure == "0") and true or false,
|
||||
verify_hostname = (server.tls == "1") and true or false,
|
||||
cert = "",
|
||||
cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA",
|
||||
cipher_tls13 = "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384",
|
||||
|
@ -238,6 +238,9 @@ local function processData(szType, content)
|
||||
result.alias = UrlDecode(alias)
|
||||
result.type = "trojan"
|
||||
result.server = host[1]
|
||||
-- 按照官方的建议 默认验证ssl证书
|
||||
result.insecure = "0"
|
||||
result.tls = "1"
|
||||
if host[2]:find("?") then
|
||||
local query = split(host[2], "?")
|
||||
result.server_port = query[1]
|
||||
@ -246,10 +249,17 @@ local function processData(szType, content)
|
||||
local t = split(v, '=')
|
||||
params[t[1]] = t[2]
|
||||
end
|
||||
|
||||
if params.peer then
|
||||
result.tls = "1"
|
||||
-- 未指定peer(sni)默认使用remote addr
|
||||
result.tls_host = params.peer
|
||||
end
|
||||
|
||||
if params.allowInsecure == "1" then
|
||||
result.insecure = "1"
|
||||
else
|
||||
result.insecure = "0"
|
||||
end
|
||||
else
|
||||
result.server_port = host[2]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user