Merge Lean's source

This commit is contained in:
CN_SZTL 2020-02-29 01:05:41 +08:00
parent 02441842ed
commit 49de3faaa6
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
4 changed files with 56 additions and 20 deletions

View File

@ -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

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

@ -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))