luci-app-ssr-plus: add Trojan subscribe support (#3388)

* add tl-wr720n-v3-16m

* luci-app-ssr-plus: support trojan subscribe.
This commit is contained in:
练亮斌 2020-02-28 23:19:38 +08:00 committed by GitHub
parent 5fdbf8a364
commit 581d6c22cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 5 deletions

View File

@ -422,7 +422,7 @@ msgid "Auto Update Server subscription, GFW list and CHN route"
msgstr "自动更新服务器订阅、GFW列表和 CHN路由表"
msgid "Subscribe URL"
msgstr "SS/SSR/V2RAY订阅URL地址"
msgstr "SS/SSR/V2RAY/Trojan订阅URL地址"
msgid "Update"
msgstr "更新"

View File

@ -223,6 +223,37 @@ local function processData(szType, content)
result.plugin = content.plugin
result.plugin_opts = content.plugin_options
result.alias = "[" .. content.airport .. "] " .. content.remarks
elseif szType == "trojan" then
local idx_sp = 0
local alias = ""
if content:find("#") then
idx_sp = content:find("#")
alias = content:sub(idx_sp + 1, -1)
end
local info = content:sub(1, idx_sp - 1)
local hostInfo = split(info, "@")
local host = split(hostInfo[2], ":")
local userinfo = hostInfo[1]
local password = userinfo
result.alias = UrlDecode(alias)
result.type = "trojan"
result.server = host[1]
if host[2]:find("?") then
local query = split(host[2], "?")
result.server_port = query[1]
local params = {}
for _, v in pairs(split(query[2], '&')) do
local t = split(v, '=')
params[t[1]] = t[2]
end
if params.peer then
result.tls = "1"
result.tls_host = params.peer
end
else
result.server_port = host[2]
end
result.password = password
end
if not result.alias then
result.alias = result.server .. ':' .. result.server_port
@ -289,7 +320,7 @@ local execute = function()
local node = trim(v)
local dat = split(node, "://")
if dat and dat[1] and dat[2] then
if dat[1] == 'ss' then
if dat[1] == 'ss' or dat[1] == 'trojan' then
result = processData(dat[1], dat[2])
else
result = processData(dat[1], base64Decode(dat[2]))
@ -342,9 +373,9 @@ local execute = function()
setmetatable(nodeResult[old.grouphashkey][old.hashkey], { __index = { _ignore = true } })
end
else
if not old.alias then
old.alias = old.server .. ':' .. old.server_port
end
if not old.alias then
old.alias = old.server .. ':' .. old.server_port
end
log('忽略手动添加的节点: ' .. old.alias)
end

View File

@ -383,6 +383,17 @@ define Device/tl-wr720n-v3
endef
TARGET_DEVICES += tl-wr720n-v3
define Device/tl-wr720n-v3-16m
$(Device/tplink-16mlzma)
DEVICE_TITLE := TP-LINK TL-WR720N v3 16M
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME := TL-WR720N-v3
DEVICE_PROFILE := TLWR720
TPLINK_HWID := 0x07200103
CONSOLE := ttyATH0,115200
endef
TARGET_DEVICES += tl-wr720n-v3-16m
define Device/tl-wr720n-v4
$(Device/tl-wr720n-v3)
DEVICE_TITLE := TP-LINK TL-WR720N v4