luci-app-vssr: bump to 1.12
This commit is contained in:
parent
472eae7111
commit
ecdf1da9df
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-vssr
|
||||
PKG_VERSION:=1.11
|
||||
PKG_RELEASE:=20200719
|
||||
PKG_VERSION:=1.12
|
||||
PKG_RELEASE:=20200822
|
||||
|
||||
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
|
||||
@ -35,7 +35,7 @@ define Package/luci-app-vssr
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=A New SS/SSR/V2Ray/Trojan LuCI interface
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget +luasocket +jshn +lua-cjson +coreutils-nohup +lua-maxminddb \
|
||||
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +bash +pdnsd-alt +wget +luasocket +coreutils-nohup +lua-maxminddb \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
|
||||
|
||||
@ -57,7 +57,7 @@ end
|
||||
-- 执行订阅
|
||||
function get_subscribe()
|
||||
|
||||
local cjson = require "cjson"
|
||||
local cjson = require "luci.jsonc"
|
||||
local e = {}
|
||||
local uci = luci.model.uci.cursor()
|
||||
local auto_update = luci.http.formvalue("auto_update")
|
||||
@ -74,7 +74,7 @@ function get_subscribe()
|
||||
luci.sys.call(cmd1)
|
||||
luci.sys.call(cmd2)
|
||||
luci.sys.call(cmd3)
|
||||
for k, v in ipairs(cjson.decode(subscribe_url)) do
|
||||
for k, v in ipairs(cjson.parse(subscribe_url)) do
|
||||
luci.sys.call(
|
||||
'uci add_list vssr.@server_subscribe[0].subscribe_url="' .. v ..
|
||||
'"')
|
||||
@ -292,46 +292,6 @@ function check_port()
|
||||
|
||||
end
|
||||
|
||||
function JudgeIPString(ipStr)
|
||||
if type(ipStr) ~= "string" then return false end
|
||||
|
||||
-- 判断长度
|
||||
local len = string.len(ipStr)
|
||||
if len < 7 or len > 15 then -- 长度不对
|
||||
return false
|
||||
end
|
||||
|
||||
-- 判断出现的非数字字符
|
||||
local point = string.find(ipStr, "%p", 1) -- 字符"."出现的位置
|
||||
local pointNum = 0 -- 字符"."出现的次数 正常ip有3个"."
|
||||
while point ~= nil do
|
||||
if string.sub(ipStr, point, point) ~= "." then -- 得到非数字符号不是字符"."
|
||||
return false
|
||||
end
|
||||
pointNum = pointNum + 1
|
||||
point = string.find(ipStr, "%p", point + 1)
|
||||
if pointNum > 3 then return false end
|
||||
end
|
||||
if pointNum ~= 3 then -- 不是正确的ip格式
|
||||
return false
|
||||
end
|
||||
|
||||
-- 判断数字对不对
|
||||
local num = {}
|
||||
for w in string.gmatch(ipStr, "%d+") do
|
||||
num[#num + 1] = w
|
||||
local kk = tonumber(w)
|
||||
if kk == nil or kk > 255 then -- 不是数字或超过ip正常取值范围了
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if #num ~= 4 then -- 不是4段数字
|
||||
return false
|
||||
end
|
||||
|
||||
return ipStr
|
||||
end
|
||||
|
||||
-- 检测 当前节点ip 和 网站访问情况
|
||||
function check_ip()
|
||||
@ -341,7 +301,8 @@ function check_ip()
|
||||
local d = {}
|
||||
local mm = require 'maxminddb'
|
||||
local db = mm.open('/usr/share/vssr/GeoLite2-Country.mmdb')
|
||||
local ip = string.gsub(luci.sys.exec("content=`wget --no-check-certificate -q -O - https://api.ip.sb/ip`;echo $content"), "\n", "")
|
||||
local http = require "luci.sys"
|
||||
local ip = string.gsub(http.httpget("https://api.ip.sb/ip"), "\n", "")
|
||||
local res = db:lookup(ip)
|
||||
d.flag = string.lower(res:get("country", "iso_code"))
|
||||
d.country = res:get("country", "names", "zh-CN")
|
||||
|
||||
@ -102,6 +102,11 @@ 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, "tvb_server", translate("TVB 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"))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- Licensed to the public under the GNU General Public License v3.
|
||||
local m, s, o
|
||||
local vssr = "vssr"
|
||||
local cjson = require("cjson")
|
||||
local json = require "luci.jsonc"
|
||||
|
||||
local uci = luci.model.uci.cursor()
|
||||
local server_count = 0
|
||||
@ -27,7 +27,7 @@ s.sortable = false
|
||||
|
||||
s.des = server_count
|
||||
s.current = uci:get("vssr", name, "global_server")
|
||||
s.servers = cjson.encode(server_table)
|
||||
s.servers = json.stringify(server_table)
|
||||
s.template = "vssr/tblsection"
|
||||
s.extedit = luci.dispatcher.build_url("admin/services/vssr/servers/%s")
|
||||
function s.create(...)
|
||||
|
||||
@ -636,6 +636,9 @@ msgstr "Diseny+ 代理"
|
||||
msgid "Prime Video Proxy"
|
||||
msgstr "Prime Video 代理"
|
||||
|
||||
msgid "TVB Video Proxy"
|
||||
msgstr "TVB 视频代理"
|
||||
|
||||
msgid "adblock settings"
|
||||
msgstr "广告屏蔽设置"
|
||||
|
||||
|
||||
@ -1 +1,22 @@
|
||||
api.ip.sb
|
||||
api.ip.sb
|
||||
fast.com
|
||||
netflix.ca
|
||||
netflix.com
|
||||
netflix.net
|
||||
netflixinvestor.com
|
||||
netflixtechblog.com
|
||||
nflxext.com
|
||||
nflximg.com
|
||||
nflximg.net
|
||||
nflxsearch.net
|
||||
nflxso.net
|
||||
nflxvideo.net
|
||||
amazonprimevideos.com
|
||||
amazonvideo.cc
|
||||
amazonvideo.com
|
||||
prime-video.com
|
||||
primevideo.cc
|
||||
primevideo.com
|
||||
primevideo.info
|
||||
primevideo.org
|
||||
primevideo.tv
|
||||
@ -128,14 +128,14 @@ EOF
|
||||
|
||||
fw_rule() {
|
||||
$IPT -N SS_SPEC_WAN_FW
|
||||
$IPT -A SS_SPEC_WAN_FW -d 0.0.0.0/8 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 10.0.0.0/8 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 127.0.0.0/8 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 169.254.0.0/16 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 172.16.0.0/12 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 0.0.0.0/8 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 10.0.0.0/8 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 127.0.0.0/8 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 169.254.0.0/16 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 172.16.0.0/12 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 192.168.0.0/16 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 224.0.0.0/4 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -d 240.0.0.0/4 -j RETURN
|
||||
$IPT -A SS_SPEC_WAN_FW -p tcp $PROXY_PORTS \
|
||||
-j REDIRECT --to-ports $local_port 2>/dev/null || {
|
||||
loger 3 "Can't redirect, please check the iptables."
|
||||
@ -189,15 +189,15 @@ tp_rule() {
|
||||
local ipt="iptables -t mangle"
|
||||
$ipt -N SS_SPEC_TPROXY
|
||||
$ipt -A SS_SPEC_TPROXY -p udp --dport 53 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 0.0.0.0/8 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 10.0.0.0/8 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 127.0.0.0/8 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 169.254.0.0/16 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 172.16.0.0/12 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 192.168.0.0/16 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 224.0.0.0/4 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 240.0.0.0/4 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d $SERVER -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 0.0.0.0/8 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 10.0.0.0/8 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 127.0.0.0/8 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 169.254.0.0/16 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 172.16.0.0/12 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 192.168.0.0/16 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 224.0.0.0/4 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d 240.0.0.0/4 -j RETURN
|
||||
$ipt -A SS_SPEC_TPROXY -p udp -d $SERVER -j RETURN
|
||||
|
||||
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set fplan src \
|
||||
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
|
||||
|
||||
@ -12,6 +12,7 @@ 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')
|
||||
local tvb_server = ucursor:get_first(name, 'global', 'tvb_server')
|
||||
|
||||
function gen_outbound(server_node, tags)
|
||||
local bound = {}
|
||||
@ -87,21 +88,44 @@ if v2ray_flow == "1" then
|
||||
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"))
|
||||
table.insert(outbounds_table, gen_outbound(tvb_server, "tvb"))
|
||||
end
|
||||
|
||||
-- rules gen
|
||||
|
||||
local youtube_rule = {
|
||||
type = "field",
|
||||
domain = {"youtube", "googlevideo.com", "gvt2.com", "youtu.be"},
|
||||
domain = {
|
||||
"youtube",
|
||||
"ggpht.com",
|
||||
"googlevideo.com",
|
||||
"withyoutube.com",
|
||||
"youtu.be",
|
||||
"youtube-nocookie.com",
|
||||
"youtube.com",
|
||||
"youtubeeducation.com",
|
||||
"youtubegaming.com",
|
||||
"youtubei.googleapis.com",
|
||||
"youtubekids.com",
|
||||
"youtubemobilesupport.com",
|
||||
"yt.be",
|
||||
"ytimg.com"
|
||||
},
|
||||
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","wetv.vip"
|
||||
"vidol.tv",
|
||||
"hinet.net",
|
||||
"books.com",
|
||||
"litv.tv",
|
||||
"pstatic.net",
|
||||
"app-measurement.com",
|
||||
"kktv.com.tw",
|
||||
"gamer.com.tw",
|
||||
"wetv.vip"
|
||||
},
|
||||
outboundTag = "twvideo"
|
||||
}
|
||||
@ -109,8 +133,18 @@ local tw_video_rule = {
|
||||
local netflix_rule = {
|
||||
type = "field",
|
||||
domain = {
|
||||
"netflix", "nflxso.net", "nflxext.com",
|
||||
"nflximg.com", "nflximg.net", "nflxvideo.net"
|
||||
"fast.com",
|
||||
"netflix.ca",
|
||||
"netflix.com",
|
||||
"netflix.net",
|
||||
"netflixinvestor.com",
|
||||
"netflixtechblog.com",
|
||||
"nflxext.com",
|
||||
"nflximg.com",
|
||||
"nflximg.net",
|
||||
"nflxsearch.net",
|
||||
"nflxso.net",
|
||||
"nflxvideo.net"
|
||||
},
|
||||
|
||||
outboundTag = "netflix"
|
||||
@ -127,10 +161,32 @@ local disney_rule = {
|
||||
|
||||
local prime_rule = {
|
||||
type = "field",
|
||||
domain = {"aiv-cdn.net", "amazonaws.com", "amazonvideo.com", "llnwd.net"},
|
||||
domain = {
|
||||
"aiv-cdn.net",
|
||||
"amazonaws.com",
|
||||
"amazonvideo.com",
|
||||
"llnwd.net",
|
||||
"amazonprimevideos.com",
|
||||
"amazonvideo.cc",
|
||||
"prime-video.com",
|
||||
"primevideo.cc",
|
||||
"primevideo.com",
|
||||
"primevideo.info",
|
||||
"primevideo.org",
|
||||
"rimevideo.tv"
|
||||
},
|
||||
outboundTag = "prime"
|
||||
}
|
||||
|
||||
local tvb_rule = {
|
||||
type = "field",
|
||||
domain = {
|
||||
"tvsuper.com",
|
||||
"tvb.com"
|
||||
},
|
||||
outboundTag = "tvb"
|
||||
}
|
||||
|
||||
local rules_table = {}
|
||||
|
||||
if (youtube_server ~= "nil" and v2ray_flow == "1") then
|
||||
@ -153,6 +209,10 @@ if (prime_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, prime_rule)
|
||||
end
|
||||
|
||||
if (tvb_server ~= "nil" and v2ray_flow == "1") then
|
||||
table.insert(rules_table, tvb_rule)
|
||||
end
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = "/var/ssrplus.log",
|
||||
@ -171,6 +231,6 @@ local v2ray = {
|
||||
},
|
||||
-- 传出连接
|
||||
outbounds = outbounds_table,
|
||||
routing = {domainStrategy = "IPIfNonMatch", rules = rules_table}
|
||||
routing = {domainStrategy = "AsIs", rules = rules_table}
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
|
||||
mkdir -p /tmp/dnsmasq.ssr
|
||||
|
||||
@ -9,3 +10,36 @@ awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"blacklist"'\n",$0)}' /etc/config/black.li
|
||||
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5335"'\n",$0)}' /etc/config/black.list >> /tmp/dnsmasq.ssr/blacklist_forward.conf
|
||||
|
||||
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"whitelist"'\n",$0)}' /etc/config/white.list > /tmp/dnsmasq.ssr/whitelist_forward.conf
|
||||
|
||||
|
||||
function valid_ip()
|
||||
{
|
||||
ip=$1
|
||||
read_ip=$(echo $ip|awk -F. '$1<=255&&$2<=255&&$3<=255&&$4<=255{print "yes"}')
|
||||
if echo $ip|grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$' >/dev/null
|
||||
then
|
||||
if [ $read_ip == "yes" ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
config_load vssr
|
||||
|
||||
function addWhiteList() {
|
||||
local iface="$1"
|
||||
local host
|
||||
config_get host "$iface" server
|
||||
if valid_ip $host; then
|
||||
ipset -! add whitelist $host
|
||||
else
|
||||
[ ! -z "$host" ] && echo "ipset=/.$host/whitelist" >> /tmp/dnsmasq.ssr/whitelist_forward.conf
|
||||
fi
|
||||
}
|
||||
|
||||
config_foreach addWhiteList
|
||||
Loading…
Reference in New Issue
Block a user