diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index 9758f8b4b5..6fc7385cc4 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -55,7 +55,7 @@ define Package/$(PKG_NAME) +PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \ +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \ +PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \ - +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \ + +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:openwrt-kcptun-client \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \ +PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks:srelay endef diff --git a/package/lean/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po b/package/lean/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po index 3045687daa..02c40f7ba3 100644 --- a/package/lean/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po +++ b/package/lean/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po @@ -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 "更新" diff --git a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua index 2819b978c9..131919ad8b 100644 --- a/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua +++ b/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -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 diff --git a/package/lean/openwrt-kcptun/Makefile b/package/lean/openwrt-kcptun/Makefile index 155edfba6a..580aabad8e 100644 --- a/package/lean/openwrt-kcptun/Makefile +++ b/package/lean/openwrt-kcptun/Makefile @@ -32,7 +32,7 @@ ifeq ($(ARCH),aarch64) endif PKG_NAME:=openwrt-kcptun -PKG_VERSION:=20200201 +PKG_VERSION:=20200226 PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=kcptun-linux-$(PKG_ARCH_KCPTUN)-$(PKG_VERSION).tar.gz @@ -41,20 +41,23 @@ PKG_HASH:=skip include $(INCLUDE_DIR)/package.mk -define Package/$(PKG_NAME)-client +define Package/$(PKG_NAME)/default SECTION:=net CATEGORY:=Network TITLE:=Kcptun is a cross-platform proxy software - DEPENDS:= URL:=https://github.com/xtaci/kcptun endef define Package/$(PKG_NAME)-server - SECTION:=net - CATEGORY:=Network - TITLE:=Kcptun is a cross-platform proxy software - DEPENDS:= - URL:=https://github.com/xtaci/kcptun + $(call Package/$(PKG_NAME)/default) + TITLE+= (Server) + VARIANT:=server +endef + +define Package/$(PKG_NAME)-client + $(call Package/$(PKG_NAME)/default) + TITLE+= (Client) + VARIANT:=client endef define Build/Prepare @@ -62,20 +65,22 @@ define Build/Prepare endef define Build/Configure + $(STAGING_DIR_HOST)/bin/upx --lzma --best $(PKG_BUILD_DIR)/server_linux_$(PKG_ARCH_KCPTUN) + $(STAGING_DIR_HOST)/bin/upx --lzma --best $(PKG_BUILD_DIR)/client_linux_$(PKG_ARCH_KCPTUN) endef define Build/Compile endef -define Package/$(PKG_NAME)-client/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/client_linux_$(PKG_ARCH_KCPTUN) $(1)/usr/bin/kcptun-client -endef - define Package/$(PKG_NAME)-server/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/server_linux_$(PKG_ARCH_KCPTUN) $(1)/usr/bin/kcptun-server endef -$(eval $(call BuildPackage,$(PKG_NAME)-client)) +define Package/$(PKG_NAME)-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/client_linux_$(PKG_ARCH_KCPTUN) $(1)/usr/bin/kcptun-client +endef + $(eval $(call BuildPackage,$(PKG_NAME)-server)) +$(eval $(call BuildPackage,$(PKG_NAME)-client))