luci-app-vssr-coexist: update source

This commit is contained in:
CN_SZTL 2020-02-14 23:50:55 +08:00
parent e116bde86b
commit af10c1dd53
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
848 changed files with 278 additions and 24950 deletions

View File

@ -31,7 +31,7 @@ luci-app-autoipsetadder source: [rufengsuixing/luci-app-autoipsetadder](https://
luci-app-adguardhome source: [rufengsuixing/luci-app-adguardhome](https://github.com/rufengsuixing/luci-app-adguardhome).<br/>
Rclone-OpenWrt source: [ElonH/Rclone-OpenWrt](https://github.com/ElonH/Rclone-OpenWrt).<br/>
luci-app-usb3disable source: [rufengsuixing/luci-app-usb3disable](https://github.com/rufengsuixing/luci-app-usb3disable).<br/>
luci-app-vssr source: [Leo-Jo-My/luci-app-vssr](https://github.com/Leo-Jo-My/luci-app-vssr).<br/>
luci-app-vssr-coexist source: [Flowers-in-thorns/luci-app-vssr-coexist](https://github.com/Flowers-in-thorns/luci-app-vssr-coexist).<br/>
luci-app-diskman source: [lisaac/luci-app-diskman](https://github.com/lisaac/luci-app-diskman).<br/>
NanoPi R1s(h5) support: [jerrykuku/openwrt-nanopi-r1s-h5](https://github.com/jerrykuku/openwrt-nanopi-r1s-h5).<br/>
NanoPi support: [speedyworldclub/nlede](https://github.com/speedyworldclub/nlede).<br/>

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vssr
PKG_NAME:=luci-app-vssr-coexist
PKG_VERSION:=1.06
PKG_RELEASE:=20200125-4
PKG_RELEASE:=20200115-4
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
@ -45,7 +45,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
default y
endef
define Package/luci-app-vssr
define Package/luci-app-vssr-coexist
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
@ -67,12 +67,12 @@ endef
define Build/Compile
endef
define Package/luci-app-vssr/conffiles
define Package/luci-app-vssr-coexist/conffiles
/etc/ssr_ip
/etc/dnsmasq.ssr/gfw_list.conf
endef
define Package/luci-app-vssr/install
define Package/luci-app-vssr-coexist/install
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
$(INSTALL_DIR) $(1)/
@ -81,7 +81,7 @@ define Package/luci-app-vssr/install
po2lmo ./po/zh-cn/vssr.po $(1)/usr/lib/lua/luci/i18n/vssr.zh-cn.lmo
endef
define Package/luci-app-vssr/postinst
define Package/luci-app-vssr-coexist/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/luci-vssr ) && rm -f /etc/uci-defaults/luci-vssr
@ -92,7 +92,7 @@ fi
exit 0
endef
define Package/luci-app-vssr/prerm
define Package/luci-app-vssr-coexist/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/vssr disable
@ -101,5 +101,5 @@ fi
exit 0
endef
$(eval $(call BuildPackage,luci-app-vssr))
$(eval $(call BuildPackage,luci-app-vssr-coexist))

View File

@ -6,7 +6,7 @@ function index()
if not nixio.fs.access("/etc/config/vssr") then return end
if nixio.fs.access("/usr/bin/ssr-redir") then
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin", "vpn"}, firstchild(), "VPN", 45).dependent = false
entry({"admin", "vpn", "vssr"},
alias("admin", "vpn", "vssr", "client"), _("vssr"), 10).dependent =
true -- 首页

View File

@ -5,6 +5,7 @@ local server_table = {}
local gfwmode=0
local gfw_count=0
local ip_count=0
local ad_count = 0
if nixio.fs.access("/etc/dnsmasq.ssr/gfw_list.conf") then
gfwmode=1
@ -84,7 +85,12 @@ o.default = 1080
o.rmempty = false
end
-- [[ adblock ]]--
s = m:section(TypedSection, "global", translate("adblock settings"))
s.anonymous = true
o = s:option(Flag, "adblock", translate("Enable adblock"))
o.rmempty = false
-- [[ 更新设置 ]]--

View File

@ -21,12 +21,21 @@ m = Map(vssr)
m:section(SimpleSection).template = "vssr/status"
local server_table = {}
local v2ray_table = {}
uci:foreach(vssr, "servers", function(s)
if s.alias then
server_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
elseif s.server and s.server_port then
server_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
end
if s.type == "v2ray" then
if s.alias then
v2ray_table[s[".name"]] = "[%s]:%s" %{string.upper(s.type), s.alias}
elseif s.server and s.server_port then
v2ray_table[s[".name"]] = "[%s]:%s:%s" %{string.upper(s.type), s.server, s.server_port}
end
end
end)
local key_table = {}
@ -36,6 +45,13 @@ end
table.sort(key_table)
local key_table_v2 = {}
for key,_ in pairs(v2ray_table) do
table.insert(key_table_v2,key)
end
table.sort(key_table_v2)
-- [[ Global Setting ]]--
s = m:section(TypedSection, "global",translate("Basic Settings"))
s.anonymous = true
@ -51,6 +67,45 @@ o:value("", translate("Disable"))
o:value("same", translate("Same as Global Server"))
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
o = s:option(Flag, "v2ray_flow", translate("Open v2ray split-flow"))
o.rmempty = false
o.description = translate("When open v2ray split-flow,your main server must be a v2ray server")
o = s:option(ListValue, "youtube_server", translate("Youtube Proxy"))
o:value("nil", translate("Same as Global Server"))
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "tw_video_server", translate("TaiWan Video Proxy"))
o:value("nil", translate("Same as Global Server"))
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "netflix_server", translate("Netflix Proxy"))
o:value("nil", translate("Same as Global Server"))
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "disney_server", translate("Diseny+ Proxy"))
o:value("nil", translate("Same as Global Server"))
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "prime_server", translate("Prime Video Proxy"))
o:value("nil", translate("Same as Global Server"))
for _,key in pairs(key_table_v2) do o:value(key,v2ray_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"
o = s:option(ListValue, "threads", translate("Multi Threads Option"))
o:value("0", translate("Auto Threads"))
o:value("1", translate("1 Thread"))

View File

@ -11,6 +11,32 @@ msgstr "停用"
msgid "Enable Servers"
msgstr "开启服务"
msgid "Open v2ray split-flow"
msgstr "开启V2ray分流"
msgid "When open v2ray split-flow,your main server must be a v2ray server"
msgstr "当使用v2ray分流功能时 主服务器必须为V2ray"
msgid "Youtube Proxy"
msgstr "Youtube 代理"
msgid "TaiWan Video Proxy"
msgstr "台湾视频服务代理"
msgid "Netflix Proxy"
msgstr "Netflix 代理"
msgid "Diseny+ Proxy"
msgstr "Diseny+ 代理"
msgid "Prime Video Proxy"
msgstr "Prime Video 代理"
msgid "adblock settings"
msgstr "广告屏蔽设置"
msgid "Enable adblock"
msgstr "开启广告屏蔽"
msgid "Socks user"
msgstr "用户名"
@ -37,14 +63,6 @@ msgstr "订阅,请不要刷新!"
msgid "Check Try Count"
msgstr "切换检查重试次数"
msgid "Log"
msgstr "日志"
msgid "Bypass Domain List"
msgstr "不走代理的域名"
msgid "Black Domain List"
msgstr "强制走代理的域名"
msgid "Node List"
msgstr "节点列表"

View File

@ -10,6 +10,7 @@ config global
option switch_timeout '5'
option switch_time '667'
option switch_try_count '3'
option adblock '0'
config socks5_proxy
option server 'nil'

View File

@ -0,0 +1,180 @@
local ucursor = require"luci.model.uci".cursor()
local name = "vssr"
local json = require "luci.jsonc"
local server_section = arg[1]
local proto = arg[2]
local local_port = arg[3]
local host = arg[4]
local v2ray_flow = ucursor:get_first(name, 'global', 'v2ray_flow', '0')
local youtube_server = ucursor:get_first(name, 'global', 'youtube_server')
local tw_video_server = ucursor:get_first(name, 'global', 'tw_video_server')
local netflix_server = ucursor:get_first(name, 'global', 'netflix_server')
local disney_server = ucursor:get_first(name, 'global', 'disney_server')
local prime_server = ucursor:get_first(name, 'global', 'prime_server')
function gen_outbound(server_node, tags)
local bound = {}
if server_node == "nil" then
bound = nil
else
local server = ucursor:get_all(name, server_node)
bound = {
tag = tags,
protocol = "vmess",
settings = {
vnext = {
{
address = server.server,
port = tonumber(server.server_port),
users = {
{
id = server.vmess_id,
alterId = tonumber(server.alter_id),
security = server.security
}
}
}
}
},
-- 底层传输配置
streamSettings = {
network = server.transport,
security = (server.tls == '1') and "tls" or "none",
tlsSettings = {
allowInsecure = (server.insecure == "1") and true or false,
serverName = server.ws_host
},
kcpSettings = (server.transport == "kcp") and {
mtu = tonumber(server.mtu),
tti = tonumber(server.tti),
uplinkCapacity = tonumber(server.uplink_capacity),
downlinkCapacity = tonumber(server.downlink_capacity),
congestion = (server.congestion == "1") and true or false,
readBufferSize = tonumber(server.read_buffer_size),
writeBufferSize = tonumber(server.write_buffer_size),
header = {type = server.kcp_guise}
} or nil,
wsSettings = (server.transport == "ws") and
(server.ws_path ~= nil or server.ws_host ~= nil) and {
path = server.ws_path,
headers = (server.ws_host ~= nil) and
{Host = server.ws_host} or nil
} or nil,
httpSettings = (server.transport == "h2") and
{path = server.h2_path, host = server.h2_host} or nil,
quicSettings = (server.transport == "quic") and {
security = server.quic_security,
key = server.quic_key,
header = {type = server.quic_guise}
} or nil
},
mux = {
enabled = (server.mux == "1") and true or false,
concurrency = tonumber(server.concurrency)
}
}
end
return bound
end
local outbounds_table = {}
table.insert(outbounds_table, gen_outbound(server_section, "main"))
if v2ray_flow == "1" then
table.insert(outbounds_table, gen_outbound(youtube_server, "youtube"))
table.insert(outbounds_table, gen_outbound(tw_video_server, "twvideo"))
table.insert(outbounds_table, gen_outbound(netflix_server, "netflix"))
table.insert(outbounds_table, gen_outbound(disney_server, "disney"))
table.insert(outbounds_table, gen_outbound(prime_server, "prime"))
end
-- rules gen
local youtube_rule = {
type = "field",
domain = {"youtube", "googlevideo.com", "gvt2.com", "youtu.be"},
outboundTag = "youtube"
}
local tw_video_rule = {
type = "field",
domain = {
"vidol.tv", "hinet.net", "books.com", "litv.tv", "pstatic.net",
"app-measurement.com", "kktv.com.tw", "gamer.com.tw"
},
outboundTag = "twvideo"
}
local netflix_rule = {
type = "field",
domain = {
"netflix.com", "netflix.net", "nflxso.net", "nflxext.com",
"nflximg.com", "nflximg.net", "nflxvideo.net"
},
ip = {
"23.246.0.0/12", "37.77.0.0/12", "45.57.0.0/12", "64.120.128.0/17",
"66.197.128.0/17", "108.175.0.0/12", "185.2.0.0/12", "185.9.188.0/22",
"192.173.64.0/18", "198.38.0.0/12", "198.45.0.0/12"
},
outboundTag = "netflix"
}
local disney_rule = {
type = "field",
domain = {
"cdn.registerdisney.go.com", "disneyplus.com", "disney-plus.net",
"dssott.com", "bamgrid.com", "execute-api.us-east-1.amazonaws.com"
},
outboundTag = "disney"
}
local prime_rule = {
type = "field",
domain = {"aiv-cdn.net", "amazonaws.com", "amazonvideo.com", "llnwd.net"},
outboundTag = "prime"
}
local rules_table = {}
if (youtube_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, youtube_rule)
end
if (tw_video_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, tw_video_rule)
end
if (netflix_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, netflix_rule)
end
if (disney_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, disney_rule)
end
if (prime_server ~= "nil" and v2ray_flow == "1") then
table.insert(rules_table, prime_rule)
end
local v2ray = {
log = {
-- error = "/var/ssrplus.log",
loglevel = "warning"
},
-- 传入连接
inbounds = {
{
port = local_port,
protocol = "dokodemo-door",
settings = {network = proto, followRedirect = true},
sniffing = {enabled = true, destOverride = {"http", "tls"}}
}
},
-- 传出连接
outbounds = outbounds_table,
routing = {domainStrategy = "IPIfNonMatch", rules = rules_table}
}
print(json.stringify(v2ray, 1))

Some files were not shown because too many files have changed in this diff Show More