Merge Lean's source
This commit is contained in:
commit
513caa3ef8
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_RELEASE:=133
|
||||
PKG_RELEASE:=135
|
||||
PKG_VERSION:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@ -9,19 +9,15 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/$(PKG_NAME)/config
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
|
||||
bool "Include Shadowsocks New Version"
|
||||
default y
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_v2ray-core
|
||||
bool "Include v2ray-core"
|
||||
default y
|
||||
default y if x86_64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
|
||||
bool "Include V2ray"
|
||||
default n
|
||||
default y if x86_64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
|
||||
bool "Include Trojan"
|
||||
default n
|
||||
default y if x86_64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
||||
bool "Include Kcptun"
|
||||
@ -29,22 +25,21 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
|
||||
bool "Include ShadowsocksR Server"
|
||||
default n
|
||||
default y if x86_64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
|
||||
bool "Include ShadowsocksR Socks and Tunnel"
|
||||
default y
|
||||
default y if x86_64
|
||||
endef
|
||||
|
||||
define Package/luci-app-ssr-plus
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=SS/SSR/V2Ray LuCI interface
|
||||
TITLE:=SS/SSR/V2Ray/Trojan LuCI interface
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_v2ray-core:v2ray-core \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<%+cbi/valueheader%>
|
||||
<span class="socket-connected" hint="<%=self:cfgvalue(section)%>">connecting</:wqspan>
|
||||
<%+cbi/valuefooter%>
|
||||
<span class="socket-connected" hint="<%=self:cfgvalue(section)%>">connecting</span>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
@ -10,8 +10,11 @@ require 'luci.sys'
|
||||
|
||||
-- these global functions are accessed all the time by the event handler
|
||||
-- so caching them is worth the effort
|
||||
local luci = luci
|
||||
local tinsert = table.insert
|
||||
local ssub, slen, schar, srep, sbyte, sformat, sgsub = string.sub, string.len, string.char, string.rep, string.byte, string.format, string.gsub
|
||||
local ssub, slen, schar, sbyte, sformat, sgsub = string.sub, string.len, string.char, string.byte, string.format, string.gsub
|
||||
local jsonParse, jsonStringify = luci.jsonc.parse, luci.jsonc.stringify
|
||||
local b64decode = nixio.bin.b64decode
|
||||
local cache = {}
|
||||
local nodeResult = setmetatable({}, { __index = cache }) -- update result
|
||||
local name = 'shadowsocksr'
|
||||
@ -74,17 +77,15 @@ local function md5(content)
|
||||
return trim(stdout)
|
||||
end
|
||||
-- base64
|
||||
local function base64Decode(text, safe)
|
||||
local function base64Decode(text)
|
||||
local raw = text
|
||||
if not text then return '' end
|
||||
text = text:gsub("%z", "")
|
||||
if safe then
|
||||
text = text:gsub("_", "/")
|
||||
text = text:gsub("-", "+")
|
||||
local mod4 = #text % 4
|
||||
text = text .. string.sub('====', mod4 + 1)
|
||||
end
|
||||
local result = nixio.bin.b64decode(text)
|
||||
text = text:gsub("_", "/")
|
||||
text = text:gsub("-", "+")
|
||||
local mod4 = #text % 4
|
||||
text = text .. string.sub('====', mod4 + 1)
|
||||
local result = b64decode(text)
|
||||
if result then
|
||||
return result:gsub("%z", "")
|
||||
else
|
||||
@ -104,13 +105,7 @@ local function processData(szType, content)
|
||||
kcp_port = 0,
|
||||
kcp_param = '--nocomp'
|
||||
}
|
||||
local hash
|
||||
if type(content) == 'string' then
|
||||
hash = md5(content)
|
||||
else
|
||||
hash = md5(luci.jsonc.stringify(content))
|
||||
end
|
||||
result.hashkey = hash
|
||||
result.hashkey = type(content) == 'string' and md5(content) or md5(jsonStringify(content))
|
||||
if szType == 'ssr' then
|
||||
local dat = split(content, "/\\?")
|
||||
local hostInfo = split(dat[1], ':')
|
||||
@ -119,21 +114,21 @@ local function processData(szType, content)
|
||||
result.protocol = hostInfo[3]
|
||||
result.encrypt_method = hostInfo[4]
|
||||
result.obfs = hostInfo[5]
|
||||
result.password = base64Decode(hostInfo[6], true)
|
||||
result.password = base64Decode(hostInfo[6])
|
||||
local params = {}
|
||||
for k, v in pairs(split(dat[2], '&')) do
|
||||
for _, v in pairs(split(dat[2], '&')) do
|
||||
local t = split(v, '=')
|
||||
params[t[1]] = t[2]
|
||||
end
|
||||
result.obfs_param = base64Decode(params.bfsparam, true)
|
||||
result.protocol_param = base64Decode(params.protoparam, true)
|
||||
local group = base64Decode(params.group, true)
|
||||
result.obfs_param = base64Decode(params.bfsparam)
|
||||
result.protocol_param = base64Decode(params.protoparam)
|
||||
local group = base64Decode(params.group)
|
||||
if group then
|
||||
result.alias = "[" .. group .. "] "
|
||||
end
|
||||
result.alias = result.alias .. base64Decode(params.remarks, true)
|
||||
result.alias = result.alias .. base64Decode(params.remarks)
|
||||
elseif szType == 'vmess' then
|
||||
local info = luci.jsonc.parse(content)
|
||||
local info = jsonParse(content)
|
||||
result.type = 'v2ray'
|
||||
result.server = info.add
|
||||
result.server_port = info.port
|
||||
@ -143,32 +138,32 @@ local function processData(szType, content)
|
||||
result.alias = info.ps
|
||||
result.mux = 1
|
||||
result.concurrency = 8
|
||||
if info.net == 'ws'then
|
||||
result.ws_host = info.host
|
||||
result.ws_path = info.path
|
||||
if info.net == 'ws' then
|
||||
result.ws_host = info.host
|
||||
result.ws_path = info.path
|
||||
end
|
||||
if info.net == 'h2'then
|
||||
result.h2_host = info.host
|
||||
result.h2_path = info.path
|
||||
if info.net == 'h2' then
|
||||
result.h2_host = info.host
|
||||
result.h2_path = info.path
|
||||
end
|
||||
if info.net == 'tcp'then
|
||||
result.tcp_guise = info.type
|
||||
result.http_host = info.host
|
||||
result.http_path = info.path
|
||||
if info.net == 'tcp' then
|
||||
result.tcp_guise = info.type
|
||||
result.http_host = info.host
|
||||
result.http_path = info.path
|
||||
end
|
||||
if info.net == 'kcp'then
|
||||
result.kcp_guise = info.type
|
||||
result.mtu = 1350
|
||||
result.tti = 50
|
||||
result.uplink_capacity = 5
|
||||
result.downlink_capacity = 20
|
||||
result.read_buffer_size = 2
|
||||
result.write_buffer_size = 2
|
||||
if info.net == 'kcp' then
|
||||
result.kcp_guise = info.type
|
||||
result.mtu = 1350
|
||||
result.tti = 50
|
||||
result.uplink_capacity = 5
|
||||
result.downlink_capacity = 20
|
||||
result.read_buffer_size = 2
|
||||
result.write_buffer_size = 2
|
||||
end
|
||||
if info.net == 'quic'then
|
||||
result.quic_guise = info.type
|
||||
result.quic_key = info.key
|
||||
result.quic_security = info.securty
|
||||
if info.net == 'quic' then
|
||||
result.quic_guise = info.type
|
||||
result.quic_key = info.key
|
||||
result.quic_security = info.securty
|
||||
end
|
||||
if not info.security then
|
||||
result.security = "auto"
|
||||
@ -187,9 +182,9 @@ local function processData(szType, content)
|
||||
alias = content:sub(idx_sp + 1, -1)
|
||||
end
|
||||
local info = content:sub(1, idx_sp - 1)
|
||||
local hostInfo = split(base64Decode(info, true), "@")
|
||||
local hostInfo = split(base64Decode(info), "@")
|
||||
local host = split(hostInfo[2], ":")
|
||||
local userinfo = base64Decode(hostInfo[1], true)
|
||||
local userinfo = base64Decode(hostInfo[1])
|
||||
local method = userinfo:sub(1, userinfo:find(":") - 1)
|
||||
local password = userinfo:sub(userinfo:find(":") + 1, #userinfo)
|
||||
result.alias = UrlDecode(alias)
|
||||
@ -199,7 +194,7 @@ local function processData(szType, content)
|
||||
local query = split(host[2], "/\\?")
|
||||
result.server_port = query[1]
|
||||
-- local params = {}
|
||||
-- for k, v in pairs(split(query[2], '&')) do
|
||||
-- for _, v in pairs(split(query[2], '&')) do
|
||||
-- local t = split(v, '=')
|
||||
-- params[t[1]] = t[2]
|
||||
-- end
|
||||
@ -217,8 +212,10 @@ local function processData(szType, content)
|
||||
result.encrypt_method_ss = content.encryption
|
||||
result.alias = "[" .. content.airport .. "] " .. content.remarks
|
||||
end
|
||||
if result.alias == ''then result.alias = result.server ..':'.. result.server_port end
|
||||
return result, hash
|
||||
if not result.alias then
|
||||
result.alias = result.server .. ':' .. result.server_port
|
||||
end
|
||||
return result
|
||||
end
|
||||
-- wget
|
||||
local function wget(url)
|
||||
@ -229,7 +226,6 @@ end
|
||||
local execute = function()
|
||||
-- exec
|
||||
do
|
||||
-- subscribe_url = {'https://www.google.comc'}
|
||||
if proxy == '0' then -- 不使用代理更新的话先暂停
|
||||
log('服务正在暂停')
|
||||
luci.sys.init.stop(name)
|
||||
@ -237,7 +233,7 @@ local execute = function()
|
||||
for k, url in ipairs(subscribe_url) do
|
||||
local raw = wget(url)
|
||||
if #raw > 0 then
|
||||
local node, szType
|
||||
local nodes, szType
|
||||
local groupHash = md5(url)
|
||||
cache[groupHash] = {}
|
||||
tinsert(nodeResult, {})
|
||||
@ -246,61 +242,61 @@ local execute = function()
|
||||
if raw:find('ssd://') then
|
||||
szType = 'ssd'
|
||||
local nEnd = select(2, raw:find('ssd://'))
|
||||
node = base64Decode(raw:sub(nEnd + 1, #raw), true)
|
||||
node = luci.jsonc.parse(node)
|
||||
nodes = base64Decode(raw:sub(nEnd + 1, #raw))
|
||||
nodes = jsonParse(nodes)
|
||||
local extra = {
|
||||
airport = node.airport,
|
||||
port = node.port,
|
||||
encryption = node.encryption,
|
||||
password = node.password
|
||||
airport = nodes.airport,
|
||||
port = nodes.port,
|
||||
encryption = nodes.encryption,
|
||||
password = nodes.password
|
||||
}
|
||||
local servers = {}
|
||||
-- SS里面包着 干脆直接这样
|
||||
for _, server in ipairs(node.servers) do
|
||||
for _, server in ipairs(nodes.servers) do
|
||||
tinsert(servers, setmetatable(server, { __index = extra }))
|
||||
end
|
||||
node = servers
|
||||
nodes = servers
|
||||
else
|
||||
-- ssd 外的格式
|
||||
node = split(base64Decode(raw, true):gsub(" ", "\n"), "\n")
|
||||
nodes = split(base64Decode(raw):gsub(" ", "\n"), "\n")
|
||||
end
|
||||
for _, v in ipairs(node) do
|
||||
for _, v in ipairs(nodes) do
|
||||
if v then
|
||||
v = trim(v)
|
||||
local result, hash
|
||||
local result
|
||||
if szType == 'ssd' then
|
||||
result, hash = processData(szType, v)
|
||||
result = processData(szType, v)
|
||||
elseif not szType then
|
||||
local dat = split(v, "://")
|
||||
local node = trim(v)
|
||||
local dat = split(node, "://")
|
||||
if dat and dat[1] and dat[2] then
|
||||
if dat[1] == 'ss' then
|
||||
result, hash = processData(dat[1], dat[2])
|
||||
result = processData(dat[1], dat[2])
|
||||
else
|
||||
result, hash = processData(dat[1], base64Decode(dat[2], true))
|
||||
result = processData(dat[1], base64Decode(dat[2]))
|
||||
end
|
||||
end
|
||||
else
|
||||
log('跳过未知类型: ' .. szType)
|
||||
end
|
||||
-- log(hash, result)
|
||||
if hash or result then
|
||||
-- log(result)
|
||||
if result then
|
||||
if result.alias:find("过期时间") or
|
||||
result.alias:find("剩余流量") or
|
||||
result.alias:find("QQ群") or
|
||||
result.alias:find("官网") or
|
||||
result.server == ''
|
||||
not result.server
|
||||
then
|
||||
log('丢弃无效节点: ' .. result.type ..' 节点, ' .. result.alias)
|
||||
else
|
||||
log('成功解析: ' .. result.type ..' 节点, ' .. result.alias)
|
||||
result.grouphashkey = groupHash
|
||||
tinsert(nodeResult[index], result)
|
||||
cache[groupHash][hash] = nodeResult[index][#nodeResult[index]]
|
||||
cache[groupHash][result.hashkey] = nodeResult[index][#nodeResult[index]]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
log('成功解析节点数量: ' ..#node)
|
||||
log('成功解析节点数量: ' ..#nodes)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -345,9 +341,9 @@ local execute = function()
|
||||
end
|
||||
end
|
||||
if firstServer then
|
||||
luci.sys.call("/etc/init.d/" .. name .." restart > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早
|
||||
luci.sys.call("/etc/init.d/" .. name .. " restart > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早
|
||||
else
|
||||
luci.sys.call("/etc/init.d/" .. name .." stop > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早
|
||||
luci.sys.call("/etc/init.d/" .. name .. " stop > /dev/null 2>&1 &") -- 不加&的话日志会出现的更早
|
||||
end
|
||||
log('新增节点数量: ' ..add, '删除节点数量: ' .. del)
|
||||
log('更新成功服务正在启动')
|
||||
|
||||
@ -1,304 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2019-2020 Xingwang Liao
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=v2ray-core
|
||||
PKG_VERSION:=4.22.1
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/v2ray/v2ray-core/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=31c1934eeac3552c7ab68eac9dc3e964e05f3c743b3733b0b6a0159c495019d6
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_V2RAY_JSON_V2CTL \
|
||||
CONFIG_V2RAY_JSON_INTERNAL \
|
||||
CONFIG_V2RAY_JSON_NONE \
|
||||
CONFIG_V2RAY_EXCLUDE_V2CTL \
|
||||
CONFIG_V2RAY_EXCLUDE_ASSETS \
|
||||
CONFIG_V2RAY_COMPRESS_UPX \
|
||||
CONFIG_V2RAY_DISABLE_NONE \
|
||||
CONFIG_V2RAY_DISABLE_CUSTOM \
|
||||
CONFIG_V2RAY_DISABLE_DNS \
|
||||
CONFIG_V2RAY_DISABLE_LOG \
|
||||
CONFIG_V2RAY_DISABLE_POLICY \
|
||||
CONFIG_V2RAY_DISABLE_REVERSE \
|
||||
CONFIG_V2RAY_DISABLE_ROUTING \
|
||||
CONFIG_V2RAY_DISABLE_STATISTICS \
|
||||
CONFIG_V2RAY_DISABLE_BLACKHOLE_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_DNS_PROXY \
|
||||
CONFIG_V2RAY_DISABLE_DOKODEMO_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_FREEDOM_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_MTPROTO_PROXY \
|
||||
CONFIG_V2RAY_DISABLE_HTTP_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_SHADOWSOCKS_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_SOCKS_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_VMESS_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_TCP_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_MKCP_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_WEBSOCKET_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_HTTP2_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_DOMAIN_SOCKET_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_QUIC_TRANS
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.cn
|
||||
|
||||
GO_PKG:=v2ray.com/core
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
GO_PKG_LDFLAGS_X:= \
|
||||
v2ray.com/core.version=$(PKG_VERSION) \
|
||||
v2ray.com/core.build=R$(PKG_RELEASE) \
|
||||
v2ray.com/core.codename=OpenWrt
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/v2ray-core
|
||||
TITLE:=A platform for building proxies
|
||||
URL:=https://www.v2ray.com
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Project V
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-certificates
|
||||
endef
|
||||
|
||||
define Package/v2ray-core/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/v2ray-core/description
|
||||
Project V is a set of network tools that help you to build your own computer network.
|
||||
It secures your network connections and thus protects your privacy.
|
||||
|
||||
This package contains v2ray, v2ctl and v2ray-assets.
|
||||
endef
|
||||
|
||||
V2RAY_SED_ARGS:=
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_JSON_INTERNAL),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/main\/json"/\/\/ &/; \
|
||||
/\/\/ _ "v2ray.com\/core\/main\/jsonem"/s/\/\/ //;
|
||||
else ifeq ($(CONFIG_V2RAY_JSON_NONE),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/main\/json"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_CUSTOM),y)
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DNS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/dns"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_LOG),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/log"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/app\/log\/command"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_POLICY),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/policy"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_REVERSE),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/reverse"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_ROUTING),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/router"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_STATISTICS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/stats"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/app\/stats\/command"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_BLACKHOLE_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/blackhole"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DNS_PROXY),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/dns"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DOKODEMO_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/dokodemo"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_FREEDOM_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/freedom"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_MTPROTO_PROXY),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/mtproto"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_HTTP_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/http"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_SHADOWSOCKS_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/shadowsocks"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_SOCKS_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/socks"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_VMESS_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/vmess\/inbound"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/proxy\/vmess\/outbound"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_TCP_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/tcp"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_MKCP_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/kcp"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_WEBSOCKET_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/websocket"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_HTTP2_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/http"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/http"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DOMAIN_SOCKET_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/domainsocket"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_QUIC_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/quic"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_MKCP_TRANS)$(CONFIG_V2RAY_DISABLE_QUIC_TRANS),yy)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/noop"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/srtp"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/tls"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/utp"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/wechat"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/wireguard"/\/\/ &/;
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
GEOIP_VER:=latest
|
||||
GEOIP_FILE:=geoip-$(GEOIP_VER).dat
|
||||
|
||||
define Download/geoip.dat
|
||||
URL:=https://github.com/v2ray/geoip/releases/$(GEOIP_VER)/download
|
||||
URL_FILE:=geoip.dat
|
||||
FILE:=$(GEOIP_FILE)
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=latest
|
||||
GEOSITE_FILE:=geosite-$(GEOSITE_VER).dat
|
||||
|
||||
define Download/geosite.dat
|
||||
URL:=https://github.com/v2ray/domain-list-community/releases/$(GEOSITE_VER)/download
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
|
||||
# move file to make sure download new file every build
|
||||
mv -f $(DL_DIR)/$(GEOIP_FILE) $(PKG_BUILD_DIR)/release/config/geoip.dat
|
||||
mv -f $(DL_DIR)/$(GEOSITE_FILE) $(PKG_BUILD_DIR)/release/config/geosite.dat
|
||||
endif
|
||||
|
||||
ifneq ($(V2RAY_SED_ARGS),)
|
||||
( \
|
||||
sed -i \
|
||||
'$(V2RAY_SED_ARGS)' \
|
||||
$(PKG_BUILD_DIR)/main/distro/all/all.go ; \
|
||||
)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(eval GO_PKG_BUILD_PKG:=v2ray.com/core/main)
|
||||
$(call GoPackage/Build/Compile)
|
||||
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ray
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_COMPRESS_UPX),y)
|
||||
upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ray
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_V2CTL),y)
|
||||
$(eval GO_PKG_BUILD_PKG:=v2ray.com/core/infra/control/main)
|
||||
$(call GoPackage/Build/Compile)
|
||||
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ctl
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_COMPRESS_UPX),y)
|
||||
upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ctl
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/v2ray/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/v2ray
|
||||
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ray $(1)/usr/bin/v2ray
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_V2CTL),y)
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ctl $(1)/usr/bin/v2ray
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/release/config/{geoip,geosite}.dat \
|
||||
$(1)/usr/bin/v2ray
|
||||
endif
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
|
||||
$(eval $(call Download,geoip.dat))
|
||||
$(eval $(call Download,geosite.dat))
|
||||
endif
|
||||
|
||||
$(eval $(call GoBinPackage,v2ray-core))
|
||||
$(eval $(call BuildPackage,v2ray-core))
|
||||
@ -1,5 +1,5 @@
|
||||
menu "V2Ray Configuration"
|
||||
depends on PACKAGE_v2ray-core
|
||||
depends on PACKAGE_v2ray
|
||||
|
||||
choice
|
||||
prompt "JSON Config Support"
|
||||
@ -1,69 +1,303 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
# Copyright (C) 2019-2020 Xingwang Liao
|
||||
# Copyright (C) 2019-2020 KFERMercer
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=v2ray
|
||||
PKG_VERSION:=4.21.3
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=4.22.1
|
||||
PKG_RELEASE:=5
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/v2ray-core-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-core-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/v2ray/v2ray-core/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=31c1934eeac3552c7ab68eac9dc3e964e05f3c743b3733b0b6a0159c495019d6
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Xingwang Liao <kuoruan@gmail.com>
|
||||
|
||||
PKG_CONFIG_DEPENDS := \
|
||||
CONFIG_V2RAY_JSON_V2CTL \
|
||||
CONFIG_V2RAY_JSON_INTERNAL \
|
||||
CONFIG_V2RAY_JSON_NONE \
|
||||
CONFIG_V2RAY_EXCLUDE_V2CTL \
|
||||
CONFIG_V2RAY_EXCLUDE_ASSETS \
|
||||
CONFIG_V2RAY_COMPRESS_UPX \
|
||||
CONFIG_V2RAY_DISABLE_NONE \
|
||||
CONFIG_V2RAY_DISABLE_CUSTOM \
|
||||
CONFIG_V2RAY_DISABLE_DNS \
|
||||
CONFIG_V2RAY_DISABLE_LOG \
|
||||
CONFIG_V2RAY_DISABLE_POLICY \
|
||||
CONFIG_V2RAY_DISABLE_REVERSE \
|
||||
CONFIG_V2RAY_DISABLE_ROUTING \
|
||||
CONFIG_V2RAY_DISABLE_STATISTICS \
|
||||
CONFIG_V2RAY_DISABLE_BLACKHOLE_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_DNS_PROXY \
|
||||
CONFIG_V2RAY_DISABLE_DOKODEMO_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_FREEDOM_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_MTPROTO_PROXY \
|
||||
CONFIG_V2RAY_DISABLE_HTTP_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_SHADOWSOCKS_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_SOCKS_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_VMESS_PROTO \
|
||||
CONFIG_V2RAY_DISABLE_TCP_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_MKCP_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_WEBSOCKET_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_HTTP2_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_DOMAIN_SOCKET_TRANS \
|
||||
CONFIG_V2RAY_DISABLE_QUIC_TRANS
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=v2ray.com/core
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
GO_PKG_LDFLAGS_X:= \
|
||||
v2ray.com/core.version=$(PKG_VERSION) \
|
||||
v2ray.com/core.build=R$(PKG_RELEASE) \
|
||||
v2ray.com/core.codename=OpenWrt
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=V2Ray is a cross-platform proxy software
|
||||
DEPENDS:=+ca-certificates
|
||||
URL:=https://github.com/v2ray/v2ray-core
|
||||
define Package/v2ray
|
||||
TITLE:=A platform for building proxies
|
||||
URL:=https://www.v2ray.com
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Project V
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-certificates
|
||||
endef
|
||||
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
V2Ray is a cross-platform proxy software
|
||||
define Package/v2ray/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
V2RAY_BIN:=v2ray
|
||||
define Package/v2ray/description
|
||||
Project V is a set of network tools that help you to build your own computer network.
|
||||
It secures your network connections and thus protects your privacy.
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
PKG_ARCH_V2RAY:=amd64
|
||||
This package contains v2ray, v2ctl and v2ray-assets.
|
||||
endef
|
||||
|
||||
V2RAY_SED_ARGS:=
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_JSON_INTERNAL),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/main\/json"/\/\/ &/; \
|
||||
/\/\/ _ "v2ray.com\/core\/main\/jsonem"/s/\/\/ //;
|
||||
else ifeq ($(CONFIG_V2RAY_JSON_NONE),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/main\/json"/\/\/ &/;
|
||||
endif
|
||||
ifeq ($(ARCH),mipsel)
|
||||
PKG_ARCH_V2RAY:=mipsle
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_CUSTOM),y)
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DNS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/dns"/\/\/ &/;
|
||||
endif
|
||||
ifeq ($(ARCH),mips)
|
||||
PKG_ARCH_V2RAY:=mips
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_LOG),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/log"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/app\/log\/command"/\/\/ &/;
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
PKG_ARCH_V2RAY:=x86
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_POLICY),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/policy"/\/\/ &/;
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
PKG_ARCH_V2RAY:=arm
|
||||
ifneq ($(BOARD),bcm53xx)
|
||||
V2RAY_BIN:=v2ray_armv7
|
||||
endif
|
||||
ifeq ($(BOARD),kirkwood)
|
||||
V2RAY_BIN:=v2ray
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_REVERSE),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/reverse"/\/\/ &/;
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_ARCH_V2RAY:=arm64
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_ROUTING),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/router"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_STATISTICS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/app\/stats"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/app\/stats\/command"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_BLACKHOLE_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/blackhole"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DNS_PROXY),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/dns"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DOKODEMO_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/dokodemo"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_FREEDOM_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/freedom"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_MTPROTO_PROXY),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/mtproto"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_HTTP_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/http"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_SHADOWSOCKS_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/shadowsocks"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_SOCKS_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/socks"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_VMESS_PROTO),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/proxy\/vmess\/inbound"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/proxy\/vmess\/outbound"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_TCP_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/tcp"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_MKCP_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/kcp"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_WEBSOCKET_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/websocket"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_HTTP2_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/http"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/http"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_DOMAIN_SOCKET_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/domainsocket"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_QUIC_TRANS),y)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/quic"/\/\/ &/;
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_DISABLE_MKCP_TRANS)$(CONFIG_V2RAY_DISABLE_QUIC_TRANS),yy)
|
||||
V2RAY_SED_ARGS += \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/noop"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/srtp"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/tls"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/utp"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/wechat"/\/\/ &/; \
|
||||
s/_ "v2ray.com\/core\/transport\/internet\/headers\/wireguard"/\/\/ &/;
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
GEOIP_VER:=latest
|
||||
GEOIP_FILE:=geoip-$(GEOIP_VER).dat
|
||||
|
||||
define Download/geoip.dat
|
||||
URL:=https://github.com/v2ray/geoip/releases/$(GEOIP_VER)/download
|
||||
URL_FILE:=geoip.dat
|
||||
FILE:=$(GEOIP_FILE)
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=latest
|
||||
GEOSITE_FILE:=geosite-$(GEOSITE_VER).dat
|
||||
|
||||
define Download/geosite.dat
|
||||
URL:=https://github.com/v2ray/domain-list-community/releases/$(GEOSITE_VER)/download
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
define Build/Configure
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
|
||||
# move file to make sure download new file every build
|
||||
mv -f $(DL_DIR)/$(GEOIP_FILE) $(PKG_BUILD_DIR)/release/config/geoip.dat
|
||||
mv -f $(DL_DIR)/$(GEOSITE_FILE) $(PKG_BUILD_DIR)/release/config/geosite.dat
|
||||
endif
|
||||
|
||||
ifneq ($(V2RAY_SED_ARGS),)
|
||||
( \
|
||||
sed -i \
|
||||
'$(V2RAY_SED_ARGS)' \
|
||||
$(PKG_BUILD_DIR)/main/distro/all/all.go ; \
|
||||
)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(eval GO_PKG_BUILD_PKG:=v2ray.com/core/main)
|
||||
$(call GoPackage/Build/Compile)
|
||||
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ray
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_COMPRESS_UPX),y)
|
||||
upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ray
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_V2CTL),y)
|
||||
$(eval GO_PKG_BUILD_PKG:=v2ray.com/core/infra/control/main)
|
||||
$(call GoPackage/Build/Compile)
|
||||
mv -f $(GO_PKG_BUILD_BIN_DIR)/main $(GO_PKG_BUILD_BIN_DIR)/v2ctl
|
||||
|
||||
ifeq ($(CONFIG_V2RAY_COMPRESS_UPX),y)
|
||||
upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/v2ctl
|
||||
endif
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
define Package/v2ray/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/v2ray
|
||||
$(INSTALL_BIN) ./files/$(PKG_ARCH_V2RAY)/$(V2RAY_BIN) $(1)/usr/bin/v2ray/v2ray
|
||||
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ray $(1)/usr/bin/v2ray
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_V2CTL),y)
|
||||
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/v2ctl $(1)/usr/bin/v2ray
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
|
||||
$(INSTALL_DATA) \
|
||||
$(PKG_BUILD_DIR)/release/config/{geoip,geosite}.dat \
|
||||
$(1)/usr/bin/v2ray
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
ifneq ($(CONFIG_V2RAY_EXCLUDE_ASSETS),y)
|
||||
$(eval $(call Download,geoip.dat))
|
||||
$(eval $(call Download,geosite.dat))
|
||||
endif
|
||||
|
||||
$(eval $(call GoBinPackage,v2ray))
|
||||
$(eval $(call BuildPackage,v2ray))
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user