Merge Lean's source

This commit is contained in:
CN_SZTL 2020-03-18 23:07:33 +08:00
commit 2ef4abcb7b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
18 changed files with 10573 additions and 28 deletions

View File

@ -1,18 +1,18 @@
#
# Copyright 2020 Weizheng Li <lwz322@qq.com>
# Copyright 2020 lwz322 <lwz322@qq.com>
# Licensed to the public under the MIT License.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-frps
PKG_VERSION:=0.0.1
PKG_VERSION:=0.0.2
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Weizheng Li <lwz322@qq.com>
PKG_MAINTAINER:=lwz322 <lwz322@qq.com>
LUCI_TITLE:=LuCI support for Frps
LUCI_PKGARCH:=all

View File

@ -1,4 +1,4 @@
-- Copyright 2020 Weizheng Li <lwz322@qq.com>
-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
local http = require "luci.http"

View File

@ -1,4 +1,4 @@
-- Copyright 2020 Weizheng Li <lwz322@qq.com>
-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
local uci = require "luci.model.uci".cursor()

View File

@ -1,4 +1,4 @@
-- Copyright 2020 Weizheng Li <lwz322@qq.com>
-- Copyright 2020 lwz322 <lwz322@qq.com>
-- Licensed to the public under the MIT License.
local dsp = require "luci.dispatcher"
@ -24,6 +24,13 @@ o.disabled = "false"
o.defalut = o.enabled
o.rmempty = false
o = s:option(Flag, "tls_only", translate("Enforce frps only accept TLS connection"),
translatef("Requirements: frpc v0.25.0+, frps v0.32.0+"))
o.enabled = "true"
o.disabled = "false"
o.default = o.disabled
o.rmempty = false
o = s:option(Value, "bind_udp_port", translate("UDP bind port"),
translatef("Optional: udp port to help make udp hole to penetrate nat"))
o.datatype = "port"
@ -40,4 +47,8 @@ o = s:option(Value, "vhost_https_port", translate("vhost https port"),
translatef("Optional: Note: http port and https port can be same with bind_port"))
o.datatype = "port"
o = s:option(DynamicList, "extra_setting", translate("Extra Settings"),
translatef("List of extra settings will be added to config file. Format: option=value, eg. <code>detailed_errors_to_client=false</code>.(NO SPACE!)"))
o.placeholder = "option=value"
return m

View File

@ -1,5 +1,5 @@
<%#
Copyright 2020 Weizheng Li <lwz322@qq.com>
Copyright 2020 lwz322 <lwz322@qq.com>
Licensed to the public under the MIT License.
-%>

View File

@ -172,6 +172,12 @@ msgstr "子域名"
msgid "TCP mux"
msgstr "TCP 复用"
#: luasrc/model/cbi/frps/server.lua:27
msgid "Enforce frps only accept TLS connection"
msgstr "强制frps只接受TLS连接"
msgid "Requirements: frpc v0.25.0+, frps v0.32.0+"
msgstr "要求frpc版本0.25.0+, frps版本0.32.0+"
#: luasrc/model/cbi/frps/server.lua:18
msgid "Token"
msgstr "令牌"
@ -231,3 +237,9 @@ msgstr "虚拟主机http绑定端口"
#: luasrc/model/cbi/frps/server.lua:39
msgid "vhost https port"
msgstr "虚拟主机https绑定端口"
#: luasrc/model/cbi/frps/server.lua:50
msgid "Extra Settings"
msgstr "额外设置"
msgid "List of extra settings will be added to config file. Format: option=value, eg. <code>detailed_errors_to_client=false</code>.(NO SPACE!)"
msgstr "额外设置列表将会被添加到config文件中。 格式option=value<code>detailed_errors_to_client=false</code>.(不含空格!)"

View File

@ -1,6 +1,6 @@
#!/bin/sh /etc/rc.common
#
# Copyright 2020 Weizheng Li <lwz322@qq.com>
# Copyright 2020 lwz322 <lwz322@qq.com>
# Licensed to the public under the MIT License.
#
@ -71,6 +71,7 @@ frps_scetion_validate() {
'bind_port:port' \
'token:string' \
'tcp_mux:or("true", "false"):true' \
'tls_only:or("true", "false"):false' \
'bind_udp_port:port' \
'kcp_bind_port:port' \
'vhost_http_port:port' \
@ -98,7 +99,7 @@ create_config_file() {
echo "[common]" > "$tmp_file"
append_options "$tmp_file" \
"bind_port" "token" "tcp_mux" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port"
"bind_port" "token" "tcp_mux" "tls_only" "bind_udp_port" "kcp_bind_port" "vhost_http_port" "vhost_https_port"
if [ "x$enable_logging" = "x1" ] ; then
@ -130,6 +131,13 @@ create_config_file() {
append_options "$tmp_file" \
"max_pool_count" "max_ports_per_client" "subdomain_host" "dashboard_addr" "dashboard_port" "dashboard_user" "dashboard_pwd"
extra_setting=$(uci get frps.main.extra_setting 2>/dev/null)
if [ -n "$extra_setting" ] ; then
for o in $extra_setting ;do
echo "$o" >> "$tmp_file"
done
fi
sed '/^$/d' "$tmp_file" >"$config_file"
if [ "$?" = "0" ] ; then

View File

@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=automount
PKG_VERSION:=2
PKG_RELEASE:=30
PKG_VERSION:=1
PKG_RELEASE:=31
PKG_ARCH:=all
include $(INCLUDE_DIR)/package.mk
@ -17,7 +17,7 @@ include $(INCLUDE_DIR)/package.mk
define Package/automount
TITLE:=Mount autoconfig hotplug script.
MAINTAINER:=Lean
DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +kmod-fs-vfat +kmod-fs-ext4 +kmod-fs-exfat +ntfs-3g
DEPENDS:=+block-mount +kmod-usb-storage +kmod-usb-storage-extras +!TARGET_ramips:kmod-usb-storage-uas +kmod-fs-vfat +kmod-fs-ext4 +kmod-fs-exfat +ntfs-3g
endef
define Package/automount/description

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=169
PKG_RELEASE:=6
PKG_VERSION:=170
PKG_RELEASE:=5
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -116,6 +116,27 @@ elseif set == "ip_data" then
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))
else
retstring ="0"
end
else
retstring ="-1"
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"

View File

@ -42,6 +42,14 @@ 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 ]]--
if nixio.fs.access("/usr/bin/microsocks") then
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy Server Settings"))

View File

@ -14,6 +14,7 @@ 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 shadowsocksr = "shadowsocksr"
-- html constants
@ -51,6 +52,10 @@ if nixio.fs.access("/etc/china_ssr.txt") then
ip_count = 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")
end
local icount=sys.exec("busybox ps -w | grep ssr-reudp |grep -v grep| wc -l")
if tonumber(icount)>0 then
reudp_run=1
@ -169,6 +174,11 @@ s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value =ip_count .. " " .. translate("Records")
s=m:field(DummyValue,"nfip_data",translate("Netflix IP Data"))
s.rawhtml = true
s.template = "shadowsocksr/refresh"
s.value =nfip_count .. " " .. translate("Records")
if ucic:get_first(shadowsocksr, 'global', 'adblock', '0') == '1' then
s=m:field(DummyValue,"ad_data",translate("Advertising Data"))
s.rawhtml = true

View File

@ -280,6 +280,9 @@ msgstr "【GFW列表】数据库"
msgid "China IP Data"
msgstr "【国内IP段】数据库"
msgid "Netflix IP Data"
msgstr "【Netflix IP段】数据库"
msgid "Records"
msgstr "条记录"
@ -331,6 +334,15 @@ msgstr "启用广告屏蔽"
msgid "adblock_url"
msgstr "广告屏蔽订阅"
msgid "Enable Custom Netflix IP Url"
msgstr "启用自定义Netflix IP更新URL"
msgid "nfip_url"
msgstr "Netflix IP更新URL"
msgid "Customize Netflix IP Url"
msgstr "自定义Netflix IP更新URL默认项目地址https://github.com/QiuSimons/Netflix_IP"
msgid "Enable Process Deamon"
msgstr "启用进程自动守护"

View File

@ -3993,6 +3993,12 @@
103.147.211.0/24
103.148.174.0/23
103.149.6.0/23
103.149.17.0/24
103.149.44.0/23
103.149.110.0/23
103.149.132.0/23
103.149.144.0/23
103.149.156.0/23
103.192.0.0/22
103.192.4.0/22
103.192.8.0/22
@ -4082,7 +4088,6 @@
103.199.248.0/22
103.199.252.0/22
103.200.28.0/22
103.200.32.0/22
103.200.52.0/22
103.200.64.0/22
103.200.68.0/22
@ -6160,7 +6165,10 @@
172.81.192.0/18
175.0.0.0/12
175.16.0.0/13
175.24.0.0/14
175.24.0.0/16
175.25.0.0/16
175.26.0.0/16
175.27.0.0/16
175.30.0.0/15
175.42.0.0/15
175.44.0.0/16

View File

@ -1,9 +1,23 @@
amazonaws.com
aws.amazon.com
awsstatic.com
fast.com
netflix.com
netflix.net
nflximg.net
nflxvideo.net
nflxso.net
nflxext.com
nflximg.net
nflxso.net
nflxvideo.net
netflixdnstest0.com
netflixdnstest1.com
netflixdnstest2.com
netflixdnstest3.com
netflixdnstest4.com
netflixdnstest5.com
netflixdnstest6.com
netflixdnstest7.com
netflixdnstest8.com
netflixdnstest9.com
hulu.com
huluim.com
hbonow.com

View File

@ -2,7 +2,8 @@
config global
option tunnel_forward '8.8.4.4:53'
option tunnel_address '0.0.0.0'
option run_mode 'gfw'
option run_mode 'router'
option dports '2'
option pdnsd_enable '1'
option monitor_enable '1'
option global_server 'nil'
@ -12,9 +13,11 @@ 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 '0'
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'
option threads '0'
config socks5_proxy

View File

@ -47,6 +47,23 @@ uci_get_by_cfgid() {
echo ${ret:=$3}
}
check_host() {
local host=$1
if echo $host | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
hostip=$host
elif [ "$host" != "${host#*:[0-9a-fA-F]}" ]; then
hostip=$host
else
hostip=$(ping $host -W 1 -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1)
if echo $hostip | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
hostip=$hostip
else
hostip="127.0.0.1"
fi
fi
echo -e $hostip
}
add_cron() {
sed -i '/shadowsocksr/d' $CRON_FILE
sed -i '/ssrplus.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/ssrplus.log' >>$CRON_FILE
@ -206,7 +223,7 @@ start_rules() {
else
proxyport="-m multiport --dports 22,53,587,465,995,993,143,80,443"
fi
if [ "$NETFLIX_SERVER" != "same" ]; then
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
netflix="1"
else
netflix="0"
@ -367,7 +384,7 @@ start_redir() {
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd --version 2>&1 | head -1) , $threads Threads Started!" >>/tmp/ssrplus.log
elif [ "$stype" == "socks5" ]; then
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-retcp.conf" socks5 tcp $(uci_get_by_name $GLOBAL_SERVER local_port) \
$(uci_get_by_name $GLOBAL_SERVER server) $(uci_get_by_name $GLOBAL_SERVER server_port) \
$(check_host $(uci_get_by_name $GLOBAL_SERVER server)) $(uci_get_by_name $GLOBAL_SERVER server_port) \
$(uci_get_by_name $GLOBAL_SERVER auth_enable 0) $(uci_get_by_name $GLOBAL_SERVER username) $(uci_get_by_name $GLOBAL_SERVER password)
for i in $(seq 1 $threads); do
$sscmd -c /var/etc/redsocks-ssr-retcp.conf >/dev/null 2>&1
@ -381,7 +398,7 @@ start_redir() {
echo "$(date "+%Y-%m-%d %H:%M:%S") Network Tunnel REDIRECT $threads Threads Started!" >>/tmp/ssrplus.log
fi
if [ "$NETFLIX_SERVER" != "same" ]; then
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
if [ "$ntype" == "ss" -o "$ntype" == "ssr" ]; then
gen_config_file $NETFLIX_SERVER 2 4321
gen_config_file $NETFLIX_SERVER 3 1088
@ -402,7 +419,7 @@ start_redir() {
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
elif [ "$ntype" == "socks5" ]; then
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-netflix.conf" socks5 tcp 4321 \
$(uci_get_by_name $NETFLIX_SERVER server) $(uci_get_by_name $NETFLIX_SERVER server_port) \
$(check_host $(uci_get_by_name $NETFLIX_SERVER server)) $(uci_get_by_name $NETFLIX_SERVER server_port) \
$(uci_get_by_name $NETFLIX_SERVER auth_enable 0) $(uci_get_by_name $NETFLIX_SERVER username) $(uci_get_by_name $NETFLIX_SERVER password)
$ncmd -c /var/etc/redsocks-ssr-netflix.conf >/dev/null 2>&1
microsocks -i 127.0.0.1 -p 1088 ssr-socksdns >/dev/null 2>&1 &
@ -438,7 +455,7 @@ start_redir() {
ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 &
elif [ "$utype" == "socks5" ]; then
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-reudp.conf" socks5 udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) \
$(uci_get_by_name $UDP_RELAY_SERVER server) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
$(check_host $(uci_get_by_name $UDP_RELAY_SERVER server)) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0) $(uci_get_by_name $UDP_RELAY_SERVER username) $(uci_get_by_name $UDP_RELAY_SERVER password)
$ucmd -c /var/etc/redsocks-ssr-reudp.conf >/dev/null 2>&1
elif [ "$stype" == "tun" ]; then
@ -613,13 +630,21 @@ start() {
fi
/usr/share/shadowsocksr/gfw2ipset.sh
if [ "$NETFLIX_SERVER" != "same" ]; then
if [ "$NETFLIX_SERVER" != "$GLOBAL_SERVER" ]; then
cat /etc/config/netflix.list | while read line || [ -n "$line" ];
do
sed -i "/$line/d" /tmp/dnsmasq.ssr/gfw_list.conf
done
awk '!/^$/&&!/^#/{printf("ipset=/.%s/'"netflix"'\n",$0)}' /etc/config/netflix.list > /tmp/dnsmasq.ssr/netflix_forward.conf
awk '!/^$/&&!/^#/{printf("server=/.%s/'"127.0.0.1#5555"'\n",$0)}' /etc/config/netflix.list >> /tmp/dnsmasq.ssr/netflix_forward.conf
ipset -N netflix hash:net 2>/dev/null
cat /etc/config/netflixip.list | while read nip || [ -n "$nip" ];
do
ipset add netflix $nip 2>/dev/null
done
ipset add ss_spec_wan_ac $(check_host $(uci_get_by_name $NETFLIX_SERVER server)) 2>/dev/null
else
rm -f /tmp/dnsmasq.ssr/netflix_forward.conf
fi
@ -694,4 +719,3 @@ stop() {
fi
del_cron
}