Merge Lean's source

This commit is contained in:
CN_SZTL 2020-03-19 23:10:10 +08:00
commit 0dec59280f
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
11 changed files with 371 additions and 230 deletions

View File

@ -1074,3 +1074,25 @@ define KernelPackage/be2net/description
endef
$(eval $(call KernelPackage,be2net))
define KernelPackage/sfc
SUBMENU:=$(NETWORK_DEVICES_MENU)
TITLE:=Solarflare SFC9000/SFC9100-family 10Gbps NIC support
DEPENDS:=@PCI_SUPPORT +kmod-mdio +kmod-i2c-core +kmod-i2c-algo-bit +kmod-hwmon-core +kmod-ptp +kmod-lib-crc32c
# add PCI_IOV
KCONFIG:= \
CONFIG_NET_VENDOR_SOLARFLARE=y \
CONFIG_SFC=y \
CONFIG_MTD=y \
CONFIG_MCDI_MON=y \
CONFIG_SRIOV=n \
CONFIG_MCDI_LOGGING=n \
FILES:=$(LINUX_DIR)/drivers/net/ethernet/sfc/sfc.ko
AUTOLOAD:=$(call AutoProbe, sfc)
endef
define KernelPackage/sfc/description
Solarflare SFC9000/SFC9100-family 10Gbps NIC support
endef
$(eval $(call KernelPackage,sfc))

View File

@ -116,30 +116,10 @@ define Package/$(PKG_NAME)/install
po2lmo ./po/zh-cn/ssr-plus.po $(1)/usr/lib/lua/luci/i18n/ssr-plus.zh-cn.lmo
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/luci-ssr-plus ) && rm -f /etc/uci-defaults/luci-ssr-plus
rm -f /tmp/luci-indexcache
/etc/init.d/shadowsocksr enable >/dev/null 2>&1
fi
exit 0
endef
define Package/$(PKG_NAME)/prerm
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
/etc/init.d/shadowsocksr disable
/etc/init.d/shadowsocksr stop
fi
exit 0
endef
define Package/$(PKG_NAME)/postrm
#!/bin/sh
rm -rf /etc/china_ssr.txt /etc/dnsmasq.ssr /etc/dnsmasq.oversea /etc/config/shadowsocksr /etc/config/black.list \
/etc/config/gfw.list /etc/config/white.list >/dev/null 2>&1
exit 0
/etc/config/gfw.list /etc/config/white.list /etc/config/netflix.list /etc/config/netflixip.list 2>/dev/null
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -26,7 +26,7 @@ function index()
end
function subscribe()
luci.sys.call("/usr/bin/lua /usr/share/shadowsocksr/subscribe.lua >> /tmp/ssrplus.log 2>&1")
luci.sys.call("/usr/bin/lua /usr/share/shadowsocksr/subscribe.lua >> /tmp/ssrplus.log 2>&1")
luci.http.prepare_content("application/json")
luci.http.write_json({ ret = 1 })
end
@ -70,136 +70,127 @@ function check_status()
end
function refresh_data()
local set =luci.http.formvalue("set")
local icount =0
if set == "gfw_data" then
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
luci.sys.call("/usr/bin/ssr-gfw")
icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
if tonumber(icount)>1000 then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf")
luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(math.ceil(tonumber(icount)/2))
else
retstring ="0"
end
else
retstring ="-1"
end
luci.sys.exec("rm -f /tmp/gfwnew.txt ")
else
retstring ="-1"
end
elseif set == "ip_data" then
if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute', '0') == '1') then
refresh_cmd="wget-ssl --no-check-certificate -O - " .. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt 2>/dev/null'
else
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
end
sret=luci.sys.call(refresh_cmd)
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if sret== 0 and tonumber(icount)>1000 then
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
retstring=tostring(tonumber(icount))
local set =luci.http.formvalue("set")
local uci=luci.model.uci.cursor()
local icount =0
if set == "gfw_data" then
refresh_cmd="wget-ssl --no-check-certificate -O - https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt > /tmp/gfw.b64"
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw")
icount=luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
if tonumber(icount) > 1000 then
oldcount= luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf")
luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(tonumber(icount)/2)
else
retstring ="0"
end
else
retstring="-1"
end
luci.sys.exec("rm -f /tmp/gfwnew.txt")
else
retstring ="0"
retstring="-1"
end
else
retstring ="-1"
end
luci.sys.exec("rm -f /tmp/china_ssr.txt ")
elseif set == "nfip_data" then
if (luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'netflix', '0') == '1') then
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'nfip_url', 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
else
refresh_cmd="wget-ssl --no-check-certificate -O - https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt > /tmp/netflixip.list"
end
sret=luci.sys.call(refresh_cmd)
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
if sret== 0 and tonumber(icount)>1 then
oldcount=luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
luci.sys.exec("/etc/init.d/shadowsocksr restart &")
retstring=tostring(tonumber(icount))
elseif set == "ip_data" then
refresh_cmd="wget-ssl --no-check-certificate -O - " .. uci:get_first('shadowsocksr', 'global', 'chnroute_url', 'https://ispip.clang.cn/all_cn.txt') .. ' > /tmp/china_ssr.txt'
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount=luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if sret == 0 and tonumber(icount) > 1000 then
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
luci.sys.exec("/etc/init.d/shadowsocksr restart &")
retstring=tostring(tonumber(icount))
else
retstring="0"
end
else
retstring ="0"
retstring="-1"
end
luci.sys.exec("rm -f /tmp/china_ssr.txt")
elseif set == "nfip_data" then
refresh_cmd="wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'nfip_url','https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount=luci.sys.exec("cat /tmp/netflixip.list | wc -l")
if sret == 0 and tonumber(icount) > 5 then
oldcount=luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
luci.sys.exec("/etc/init.d/shadowsocksr restart &")
retstring=tostring(tonumber(icount))
else
retstring="0"
end
else
retstring="-1"
end
luci.sys.exec("rm -f /tmp/netflixip.list")
else
retstring ="-1"
refresh_cmd="wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
luci.sys.call("/usr/bin/ssr-ad")
icount=luci.sys.exec("cat /tmp/ad.conf | wc -l")
if tonumber(icount) > 100 then
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
else
oldcount="0"
end
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(tonumber(icount))
else
retstring="0"
end
else
retstring="-1"
end
luci.sys.exec("rm -f /tmp/ad.conf")
else
retstring="-1"
end
end
luci.sys.exec("rm -f /tmp/netflixip.list ")
else
if nixio.fs.access("/usr/bin/wget-ssl") then
refresh_cmd="wget-ssl --no-check-certificate -O - ".. luci.model.uci.cursor():get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
end
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
luci.sys.call("/usr/bin/ssr-ad")
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
if tonumber(icount)>1000 then
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
else
oldcount=0
end
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
luci.sys.call("/etc/init.d/dnsmasq restart")
retstring=tostring(math.ceil(tonumber(icount)))
else
retstring ="0"
end
else
retstring ="-1"
end
luci.sys.exec("rm -f /tmp/ad.conf")
else
retstring ="-1"
end
end
luci.http.prepare_content("application/json")
luci.http.write_json({ ret=retstring ,retcount=icount})
luci.http.prepare_content("application/json")
luci.http.write_json({ret=retstring,retcount=icount})
end
function check_port()
local set=""
local retstring="<br /><br />"
local s
local server_name = ""
local shadowsocksr = "shadowsocksr"
local uci = luci.model.uci.cursor()
local iret=1
uci:foreach(shadowsocksr, "servers", function(s)
if s.alias then
server_name=s.alias
elseif s.server and s.server_port then
server_name= "%s:%s" %{s.server, s.server_port}
end
iret=luci.sys.call(" ipset add ss_spec_wan_ac " .. s.server .. " 2>/dev/null")
socket = nixio.socket("inet", "stream")
socket:setopt("socket", "rcvtimeo", 3)
socket:setopt("socket", "sndtimeo", 3)
ret=socket:connect(s.server,s.server_port)
if tostring(ret) == "true" then
socket:close()
retstring =retstring .. "<font color='green'>[" .. server_name .. "] OK.</font><br />"
else
retstring =retstring .. "<font color='red'>[" .. server_name .. "] Error.</font><br />"
end
if iret== 0 then
luci.sys.call(" ipset del ss_spec_wan_ac " .. s.server)
end
end)
luci.http.prepare_content("application/json")
luci.http.write_json({ ret=retstring })
local set=""
local retstring="<br /><br />"
local s
local server_name=""
local shadowsocksr="shadowsocksr"
local uci=luci.model.uci.cursor()
local iret=1
uci:foreach(shadowsocksr, "servers", function(s)
if s.alias then
server_name=s.alias
elseif s.server and s.server_port then
server_name="%s:%s" %{s.server, s.server_port}
end
iret=luci.sys.call(" ipset add ss_spec_wan_ac " .. s.server .. " 2>/dev/null")
socket=nixio.socket("inet", "stream")
socket:setopt("socket", "rcvtimeo", 3)
socket:setopt("socket", "sndtimeo", 3)
ret=socket:connect(s.server,s.server_port)
if tostring(ret) == "true" then
socket:close()
retstring=retstring .. "<font color='green'>[" .. server_name .. "] OK.</font><br />"
else
retstring=retstring .. "<font color='red'>[" .. server_name .. "] Error.</font><br />"
end
if iret == 0 then
luci.sys.call(" ipset del ss_spec_wan_ac " .. s.server)
end
end)
luci.http.prepare_content("application/json")
luci.http.write_json({ret=retstring})
end

View File

@ -1,4 +1,3 @@
m = Map("shadowsocksr")
-- [[ global ]]--
s = m:section(TypedSection, "global", translate("Server failsafe auto swith and custom update settings"))
@ -27,12 +26,8 @@ o.datatype = "uinteger"
o:depends("enable_switch", "1")
o.default = 3
o = s:option(Flag, "chnroute", translate("Enable Custom Chnroute"))
o.rmempty = false
o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
o.default = "https://ispip.clang.cn/all_cn.txt"
o:depends("chnroute", "1")
o = s:option(Flag, "adblock", translate("Enable adblock"))
o.rmempty = false
@ -42,12 +37,8 @@ o.default = "https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-
o:depends("adblock", "1")
o.description = translate("Support AdGuardHome and DNSMASQ format list")
o = s:option(Flag, "netflix", translate("Enable Custom Netflix IP Url"))
o.rmempty = false
o = s:option(Value, "nfip_url", translate("nfip_url"))
o.default = "https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt"
o:depends("netflix", "1")
o.description = translate("Customize Netflix IP Url")
-- [[ SOCKS Proxy ]]--

View File

@ -1,7 +1,6 @@
-- Copyright (C) 2017 yushi studio <ywb94@qq.com>
-- Licensed to the public under the GNU General Public License v3.
local IPK_Version="3.0.9"
local m, s, o
local redir_run=0
local reudp_run=0
@ -9,25 +8,23 @@ local sock5_run=0
local server_run=0
local kcptun_run=0
local tunnel_run=0
local udp2raw_run=0
local udpspeeder_run=0
local gfw_count=0
local ad_count=0
local ip_count=0
local nfip_count=0
local ucic = luci.model.uci.cursor()
local uci = luci.model.uci.cursor()
local shadowsocksr = "shadowsocksr"
-- html constants
font_blue = [[<font color="green">]]
font_off = [[</font>]]
bold_on = [[<strong>]]
bold_on = [[<strong>]]
bold_off = [[</strong>]]
local fs = require "nixio.fs"
local sys = require "luci.sys"
local kcptun_version=translate("Unknown")
local kcp_file="/usr/bin/kcptun-client"
if not fs.access(kcp_file) then
if not fs.access(kcp_file) then
kcptun_version=translate("Not exist")
else
if not fs.access(kcp_file, "rwx", "rx", "rx") then
@ -45,15 +42,15 @@ gfw_count = tonumber(sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l"))/2
end
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
ad_count=tonumber(sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l"))
ad_count = tonumber(sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l"))
end
if nixio.fs.access("/etc/china_ssr.txt") then
ip_count = sys.exec("cat /etc/china_ssr.txt | wc -l")
ip_count = tonumber(sys.exec("cat /etc/china_ssr.txt | wc -l"))
end
if nixio.fs.access("/etc/config/netflixip.list") then
nfip_count = sys.exec("cat /etc/config/netflixip.list | wc -l")
nfip_count = tonumber(sys.exec("cat /etc/config/netflixip.list | wc -l"))
end
local icount=sys.exec("busybox ps -w | grep ssr-reudp |grep -v grep| wc -l")
@ -95,7 +92,7 @@ m.reset = false
m.submit = false
s=m:field(DummyValue,"redir_run",translate("Global Client"))
s.rawhtml = true
s.rawhtml = true
if redir_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
else
@ -103,16 +100,16 @@ s.value = translate("Not Running")
end
s=m:field(DummyValue,"reudp_run",translate("Game Mode UDP Relay"))
s.rawhtml = true
s.rawhtml = true
if reudp_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
else
s.value = translate("Not Running")
end
if ucic:get_first(shadowsocksr, 'global', 'pdnsd_enable', '0') ~= '0' then
if uci:get_first(shadowsocksr, 'global', 'pdnsd_enable', '0') ~= '0' then
s=m:field(DummyValue,"pdnsd_run",translate("DNS Anti-pollution"))
s.rawhtml = true
s.rawhtml = true
if pdnsd_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
else
@ -120,10 +117,10 @@ s.value = translate("Not Running")
end
end
if ucic:get_first(shadowsocksr, 'socks5_proxy', 'socks', '0') == '1' then
if uci:get_first(shadowsocksr, 'socks5_proxy', 'socks', '0') == '1' then
if nixio.fs.access("/usr/bin/microsocks") then
s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy Server"))
s.rawhtml = true
s.rawhtml = true
if sock5_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
else
@ -134,7 +131,7 @@ end
if nixio.fs.access("/usr/bin/ssr-server") then
s=m:field(DummyValue,"server_run",translate("Global SSR Server"))
s.rawhtml = true
s.rawhtml = true
if server_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
else
@ -144,11 +141,10 @@ end
if nixio.fs.access("/usr/bin/kcptun-client") then
s=m:field(DummyValue,"kcp_version",translate("KcpTun Version"))
s.rawhtml = true
s.rawhtml = true
s.value =kcptun_version
s=m:field(DummyValue,"kcptun_run",translate("KcpTun"))
s.rawhtml = true
s.rawhtml = true
if kcptun_run == 1 then
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
else
@ -165,25 +161,25 @@ s.value = translate("No Check")
s.template = "shadowsocksr/check"
s=m:field(DummyValue,"gfw_data",translate("GFW List Data"))
s.rawhtml = true
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value =tostring(math.ceil(gfw_count)) .. " " .. translate("Records")
s.value = gfw_count .. " " .. translate("Records")
s=m:field(DummyValue,"ip_data",translate("China IP Data"))
s.rawhtml = true
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value =ip_count .. " " .. translate("Records")
s.value = ip_count .. " " .. translate("Records")
s=m:field(DummyValue,"nfip_data",translate("Netflix IP Data"))
s.rawhtml = true
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value =nfip_count .. " " .. translate("Records")
s.value = nfip_count .. " " .. translate("Records")
if ucic:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then
if uci:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then
s=m:field(DummyValue,"ad_data",translate("Advertising Data"))
s.rawhtml = true
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value =ad_count .. " " .. translate("Records")
s.value = ad_count .. " " .. translate("Records")
end
s=m:field(DummyValue,"check_port",translate("Check Server Port"))

View File

@ -334,9 +334,6 @@ msgstr "启用广告屏蔽"
msgid "adblock_url"
msgstr "广告屏蔽订阅"
msgid "Enable Custom Netflix IP Url"
msgstr "启用自定义Netflix IP更新URL"
msgid "nfip_url"
msgstr "Netflix IP更新URL"
@ -352,9 +349,6 @@ msgstr "【广告屏蔽】数据库"
msgid "Chnroute Setting"
msgstr "国内IP段数据库更新设置"
msgid "Enable custom chnroute"
msgstr "启用自定义更新地址"
msgid "Update url"
msgstr "更新链接"

View File

@ -13,7 +13,6 @@ config global
option switch_try_count '3'
option adblock '0'
option adblock_url 'https://gitee.com/privacy-protection-tools/anti-ad/raw/master/anti-ad-for-dnsmasq.conf'
option chnroute '1'
option chnroute_url 'https://ispip.clang.cn/all_cn.txt'
option nfip_url 'https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt'
option netflix_server 'same'

View File

@ -13,7 +13,8 @@ uci -q batch <<-EOF >/dev/null
commit firewall
EOF
killall -q -9 ssr-monitor ss-redir ssr-redir v2ray trojan ipt2socks ssr-server kcptun-client srelay
killall -q -9 ssr-monitor ss-redir ssr-redir ss-local ssr-local obfs-local v2ray-plugin v2ray trojan ipt2socks ssr-server kcptun-client dns2socks microsocks redsocks2
/usr/share/shadowsocksr/gfw2ipset.sh
rm -rf /tmp/luci-modulecache/*
rm -f /tmp/luci-indexcache
exit 0

View File

@ -8,20 +8,20 @@ require 'luci.util'
require 'luci.jsonc'
require 'luci.sys'
local icount =0
local ucic = luci.model.uci.cursor()
local uci = luci.model.uci.cursor()
local log = function(...)
print(os.date("%Y-%m-%d %H:%M:%S ") .. table.concat({ ... }, " "))
end
log('正在更新【GFW列表】数据库')
refresh_cmd="wget-ssl --no-check-certificate https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt -O /tmp/gfw.b64"
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
refresh_cmd = "wget-ssl --no-check-certificate -O - https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt > /tmp/gfw.b64"
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw")
icount = luci.sys.exec("cat /tmp/gfwnew.txt | wc -l")
if tonumber(icount)>1000 then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
if tonumber(icount) > 1000 then
oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/gfw_list.conf | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/gfwnew.txt /etc/dnsmasq.ssr/gfw_list.conf")
luci.sys.exec("cp -f /tmp/gfwnew.txt /tmp/dnsmasq.ssr/gfw_list.conf")
@ -30,7 +30,7 @@ log('正在更新【GFW列表】数据库')
log('你已经是最新数据,无需更新!')
end
else
log('更新失败!')
log('更新失败!')
end
luci.sys.exec("rm -f /tmp/gfwnew.txt")
else
@ -38,17 +38,13 @@ else
end
log('正在更新【国内IP段】数据库')
if (ucic:get_first('shadowsocksr', 'global', 'chnroute','0') == '1' ) then
refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'chnroute_url','https://ispip.clang.cn/all_cn.txt') .." > /tmp/china_ssr.txt 2>/dev/null"
else
refresh_cmd="wget -O- 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' 2>/dev/null| awk -F\\| '/CN\\|ipv4/ { printf(\"%s/%d\\n\", $4, 32-log($5)/log(2)) }' > /tmp/china_ssr.txt"
end
sret=luci.sys.call(refresh_cmd)
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'chnroute_url','https://ispip.clang.cn/all_cn.txt') .." > /tmp/china_ssr.txt"
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if sret== 0 then
if sret == 0 then
icount = luci.sys.exec("cat /tmp/china_ssr.txt | wc -l")
if tonumber(icount)>1000 then
oldcount=luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
if tonumber(icount) > 1000 then
oldcount = luci.sys.exec("cat /etc/china_ssr.txt | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/china_ssr.txt /etc/china_ssr.txt")
log('更新成功! 新的总纪录数:'.. icount)
@ -63,35 +59,57 @@ else
log('更新失败!')
end
if ucic:get_first('shadowsocksr', 'global', 'adblock','0') == "1" then
log('正在更新【广告屏蔽】数据库')
if nixio.fs.access("/usr/bin/wget-ssl") then
refresh_cmd="wget-ssl --no-check-certificate -O - ".. ucic:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
if uci:get_first('shadowsocksr', 'global', 'adblock','0') == "1" then
log('正在更新【广告屏蔽】数据库')
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'adblock_url','https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt') .." > /tmp/adnew.conf"
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-ad")
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
if tonumber(icount) > 100 then
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
oldcount = luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
else
oldcount = "0"
end
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
log('更新成功! 新的总纪录数:'.. icount)
else
log('你已经是最新数据,无需更新!')
end
else
log('更新失败!')
end
luci.sys.exec("rm -f /tmp/ad.conf")
else
log('更新失败!')
end
end
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
luci.sys.call("/usr/bin/ssr-ad")
icount = luci.sys.exec("cat /tmp/ad.conf | wc -l")
if tonumber(icount)>1000 then
if nixio.fs.access("/etc/dnsmasq.ssr/ad.conf") then
oldcount=luci.sys.exec("cat /etc/dnsmasq.ssr/ad.conf | wc -l")
--[[
log('正在更新【Netflix IP段】数据库')
refresh_cmd = "wget-ssl --no-check-certificate -O - ".. uci:get_first('shadowsocksr', 'global', 'nfip_url','https://raw.githubusercontent.com/QiuSimons/Netflix_IP/master/NF_only.txt') .." > /tmp/netflixip.list"
sret = luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret == 0 then
luci.sys.call("/usr/bin/ssr-gfw")
icount = luci.sys.exec("cat /tmp/netflixip.list | wc -l")
if tonumber(icount) > 5 then
oldcount = luci.sys.exec("cat /etc/config/netflixip.list | wc -l")
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/netflixip.list /etc/config/netflixip.list")
log('更新成功! 新的总纪录数:'.. icount)
else
log('你已经是最新数据,无需更新!')
end
else
oldcount=0
log('更新失败!')
end
if tonumber(icount) ~= tonumber(oldcount) then
luci.sys.exec("cp -f /tmp/ad.conf /etc/dnsmasq.ssr/ad.conf")
luci.sys.exec("cp -f /tmp/ad.conf /tmp/dnsmasq.ssr/ad.conf")
log('更新成功! 新的总纪录数:'.. icount)
else
log('你已经是最新数据,无需更新!')
end
else
log('更新失败!')
end
luci.sys.exec("rm -f /tmp/ad.conf")
luci.sys.exec("rm -f /tmp/netflixip.list")
else
log('更新失败!')
end
end
--]]
luci.sys.call("/etc/init.d/dnsmasq reload")

View File

@ -0,0 +1,66 @@
#
# Copyright (C) 2019 Daniel Bermond
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=proxychains-ng
PKG_VERSION:=4.14
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/rofl0r/proxychains-ng.git
PKG_SOURCE_VERSION:=b8fa2a7405e4e4ddeb35e9f6cf298944680fc52f
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/proxychains-ng
SECTION:=net
CATEGORY:=Network
TITLE:=Redirect TCP traffic to a HTTP or SOCKS proxy
URL:=https://github.com/rofl0r/proxychains/
endef
define Package/proxychains-ng/description
A hook preloader that allows to redirect TCP traffic of
existing dynamically linked programs through one or more
SOCKS or HTTP proxies.
endef
define Build/Compile
$(call Build/Compile/Default,all)
endef
define Build/Install
$(call Build/Install/Default,install install-config)
endef
define Package/proxychains-ng/conffiles
/etc/proxychains.conf
endef
define Package/proxychains-ng/install
# binary executable
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/proxychains4 $(1)/usr/bin/
$(LN) proxychains4 $(1)/usr/bin/proxychains
# library
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libproxychains4.so $(1)/usr/lib/
# config
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/proxychains.conf $(1)/etc/
endef
$(eval $(call BuildPackage,proxychains-ng))

View File

@ -781,6 +781,65 @@ mt7530_get_port_link(struct switch_dev *dev, int port,
return 0;
}
static int mt7530_set_port_link(struct switch_dev *sw_dev, int port,
struct switch_port_link *link)
{
if (port < 0 || port >= MT7530_NUM_PORTS)
return -EINVAL;
/* Setup autoneg advertise here */
if (link->aneg) {
u16 bmsr, adv, gctrl;
bool ercap;
sw_dev->ops->phy_read16(sw_dev, port, MII_BMSR, &bmsr);
/* ERCAP means we have MII_CTRL1000 register */
ercap = !!(bmsr | BMSR_ERCAP);
adv = ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
gctrl = CTL1000_ENABLE_MASTER;
switch (link->speed) {
case SWITCH_PORT_SPEED_10:
if (link->duplex)
adv |= ADVERTISE_10FULL;
else
adv |= ADVERTISE_10HALF;
break;
case SWITCH_PORT_SPEED_100:
if (link->duplex)
adv |= ADVERTISE_100FULL;
else
adv |= ADVERTISE_100HALF;
break;
case SWITCH_PORT_SPEED_1000:
if (!ercap || !link->duplex)
return -ENOTSUPP;
/* PHY only supports 1000FULL */
gctrl |= ADVERTISE_1000FULL;
break;
default:
/* For unknown input speed just enable all speed grades */
if (link->duplex) {
adv |= ADVERTISE_FULL;
gctrl |= ADVERTISE_1000FULL;
} else {
adv |= ADVERTISE_10HALF | ADVERTISE_100HALF;
gctrl = 0x0;
}
break;
}
sw_dev->ops->phy_write16(sw_dev, port, MII_ADVERTISE, adv);
if (ercap)
sw_dev->ops->phy_write16(sw_dev, port, MII_CTRL1000, gctrl);
/* Autoneg restart will be triggered in switch_generic_set_link */
}
/* Let switch_generic_set_link handle not autoneg case */
return switch_generic_set_link(sw_dev, port, link);
}
static u64 get_mib_counter(struct mt7530_priv *priv, int i, int port)
{
unsigned int port_base;
@ -921,6 +980,24 @@ static int mt7621_get_port_stats(struct switch_dev *dev, int port,
return 0;
}
static int mt7530_phy_read16(struct switch_dev *dev, int addr,
u8 reg, u16 *value)
{
struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev);
*value = mdiobus_read(priv->bus, addr, reg);
return 0;
}
static int mt7530_phy_write16(struct switch_dev *dev, int addr,
u8 reg, u16 value)
{
struct mt7530_priv *priv = container_of(dev, struct mt7530_priv, swdev);
return mdiobus_write(priv->bus, addr, reg, value);
}
static const struct switch_attr mt7530_global[] = {
{
.type = SWITCH_TYPE_INT,
@ -1034,9 +1111,12 @@ static const struct switch_dev_ops mt7621_ops = {
.get_port_pvid = mt7530_get_port_pvid,
.set_port_pvid = mt7530_set_port_pvid,
.get_port_link = mt7530_get_port_link,
.set_port_link = mt7530_set_port_link,
.get_port_stats = mt7621_get_port_stats,
.apply_config = mt7530_apply_config,
.reset_switch = mt7530_reset_switch,
.phy_read16 = mt7530_phy_read16,
.phy_write16 = mt7530_phy_write16,
};
static const struct switch_dev_ops mt7530_ops = {
@ -1057,9 +1137,12 @@ static const struct switch_dev_ops mt7530_ops = {
.get_port_pvid = mt7530_get_port_pvid,
.set_port_pvid = mt7530_set_port_pvid,
.get_port_link = mt7530_get_port_link,
.set_port_link = mt7530_set_port_link,
.get_port_stats = mt7530_get_port_stats,
.apply_config = mt7530_apply_config,
.reset_switch = mt7530_reset_switch,
.phy_read16 = mt7530_phy_read16,
.phy_write16 = mt7530_phy_write16,
};
int