Merge Mainline

This commit is contained in:
CN_SZTL 2020-08-23 23:48:32 +08:00
commit 520c8d9258
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
26 changed files with 555 additions and 430 deletions

View File

@ -7,7 +7,8 @@ luci-theme-netgearv2 source: [tracemouse/luci-theme-netgear](https://github.com/
luci-app-serverchan source: [tty228/luci-app-serverchan](https://github.com/tty228/luci-app-serverchan).<br/>
OpenAppFilter source: [destan19/OpenAppFilter](https://github.com/destan19/OpenAppFilter).<br/>
luci-app-smartinfo source: [animefansxj/luci-app-smartinfo](https://github.com/animefansxj/luci-app-smartinfo).<br/>
luci-app-k3screenctrl source: [Hill-98/luci-app-k3screenctrl](https://github.com/Hill-98/luci-app-k3screenctrl).<br/>
luci-app-k3screenctrl source: [lwz322/luci-app-k3screenctrl](https://github.com/lwz322/luci-app-k3screenctrl).<br/>
phicomm-k3screenctrl source: [lwz322/k3screenctrl\_build](https://github.com/lwz322/k3screenctrl_build).<br/>
luci-app-smstool source: [f8q8/luci-app-smstool-master](https://github.com/f8q8/luci-app-smstool-master).<br/>
luci-app-airwhu source: [KyleRicardo/luci-app-airwhu](https://github.com/KyleRicardo/luci-app-airwhu).<br/>
Package Lienol: [Lienol/openwrt-package](https://github.com/Lienol/openwrt-package).<br/>

View File

@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for k3screenctrl
LUCI_DESCRIPTION:=LuCI Support for k3screenctrl.
LUCI_DEPENDS:=+phicomm-k3screenctrl +@BUSYBOX_CONFIG_ARPING
LUCI_DEPENDS:=+phicomm-k3screenctrl
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-k3screenctrl

View File

@ -20,16 +20,35 @@ o.default = 10
o.rmempty = false
o = s:option(ListValue, "refresh_time", translate("Refresh interval :"), translate("Screen data refresh interval."))
o:value("1",translate("1 s"))
o:value("2",translate("2 s"))
o:value("5",translate("5 s"))
o:value("10",translate("10 s"))
o.default = 2
o.rmempty = false
o = s:option(ListValue, "update_time", translate("Weather update interval :"))
o:value("0",translate("off"))
o:value("3600",translate("1h"))
o:value("14400",translate("4h"))
o:value("43200",translate("12h"))
o.default = 0
o.rmempty = false
o = s:option(Value, "key", translate("Private Key :"),
translate("Input private key, visit: https://docs.seniverse.com/api/start/key.html"))
o = s:option(Flag, "city_checkip", translate("Check city from ip"), translate("Check city from local ip."))
o.default = 0
o = s:option(Value, "city", translate("City :"),
translate("For more information, visit: https://docs.seniverse.com/api/start/common.html#地点-location"))
--o.rmempty = false
o = s:option(Flag, "psk_hide", translate("Hide Wireless password"))
o.default = 0
o = s:option(Flag, "cputemp", translate("Display CPU temperature"), translate("The first page shows the CPU temperature."))
o = s:option(Flag, "showmore", translate("Display More Info"), translate("The first page shows more information including: CPU temprature, Load, RAM useage, uptime, etc."))
o.default = 0
o = s:option(Button,"test_print",translate("Test"),translate("Execute k3screenctrl -t and return the result"))
@ -52,8 +71,10 @@ luci.sys.net.mac_hints(function(t,a)
end)
o = s:option(Value,"name",translate("Hostname"))
o.rmempty = false
o = s:option(ListValue,"icon",translate("Icon"))
o.rmempty = false
o:value("0",translate("Auto"))
o:value("1",translate("OnePlus"))
o:value("2","360")

View File

@ -20,16 +20,31 @@ msgid "Refresh interval :"
msgstr "刷新间隔:"
msgid "Screen data refresh interval."
msgstr "屏幕数据刷新间隔"
msgstr "屏幕数据刷新间隔。"
msgid "Check city from ip"
msgstr "IP定位"
msgid "Check city from local ip."
msgstr "通过IP得到城市信息。"
msgid "City :"
msgstr "城市:"
msgid "Weather update interval :"
msgstr "天气更新时间间隔:"
msgid "Private Key :"
msgstr "私钥:"
msgid "Hide Wireless password"
msgstr "隐藏无线密码"
msgid "Display CPU temperature"
msgstr "显示 CPU 温度"
msgid "Display More Info"
msgstr "显示更多信息"
msgid "The first page shows the CPU temperature."
msgstr "第一页显示 CPU 温度"
msgid "The first page shows more information including: CPU temprature, Load, RAM useage, uptime, etc."
msgstr "第一页显示更多信息包括CPU温度、负载内存用量运行时间等。"
msgid "Test"
msgstr "测试"
@ -55,6 +70,9 @@ msgstr "设备"
msgid "Icon"
msgstr "图标"
msgid "1 s"
msgstr "1 秒"
msgid "2 s"
msgstr "2 秒"
@ -83,7 +101,19 @@ msgid "30 m"
msgstr "30 分"
msgid "60 m"
msgstr "60 分"
msgid "60 分"
msgid "off"
msgid "关闭"
msgid "1 h"
msgid "1 小时"
msgid "4 h"
msgid "4 小时"
msgid "12 h"
msgid "12 小时"
msgid "Auto"
msgstr "自动"
@ -107,7 +137,7 @@ msgid "Hasee"
msgstr "神舟"
msgid "Honor"
msgstr "荣耀"
msgid "荣耀"
msgid "HP"
msgstr "惠普"
@ -119,7 +149,7 @@ msgid "Apple"
msgstr "苹果"
msgid "Lenovo"
msgstr "联想"
msgid "联想"
msgid "LeEco"
msgstr "乐视"
@ -152,4 +182,4 @@ msgid "XiaoMi"
msgstr "小米"
msgid "ZTE"
msgstr "中兴"
msgstr "中兴"

View File

@ -1,34 +1,40 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-vssr
PKG_VERSION:=1.12
PKG_RELEASE:=20200822
PKG_CONFIG_DEPENDS:= CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
PKG_VERSION:=1.13
PKG_RELEASE:=20200823
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)/config
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin
bool "Include Shadowsocks V2ray Plugin"
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
bool "Include V2ray"
default y
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
bool "Include Trojan"
default y
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
bool "Include Kcptun"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
bool "Include ShadowsocksR Server"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
bool "Include ShadowsocksR Socks and Tunnel"
default y
default y if i386||x86_64||arm||aarch64
endef
PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
define Package/luci-app-vssr
SECTION:=luci
CATEGORY:=LuCI
@ -36,11 +42,13 @@ define Package/luci-app-vssr
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 +coreutils-nohup +lua-maxminddb \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+shadowsocks-libev-ss-local +shadowsocksr-libev-ssr-local +shadowsocks-libev-ss-redir +simple-obfs \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks:shadowsocksr-libev-ssr-local
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server
endef
define Build/Prepare

View File

@ -18,34 +18,85 @@ end
local server_table = {}
local encrypt_methods = {
"none", "table", "rc4", "rc4-md5-6", "rc4-md5", "aes-128-cfb",
"aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr",
"bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb",
"cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "salsa20",
"chacha20", "chacha20-ietf"
"none",
"table",
"rc4",
"rc4-md5-6",
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"cast5-cfb",
"des-cfb",
"idea-cfb",
"rc2-cfb",
"seed-cfb",
"salsa20",
"chacha20",
"chacha20-ietf",
}
local encrypt_methods_ss = {
-- aead
"aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305", -- stream
"table", "rc4", "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb",
"aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb",
"camellia-192-cfb", "camellia-256-cfb", "salsa20", "chacha20",
"chacha20-ietf"
-- aead
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305",
-- stream
"table",
"rc4",
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"bf-cfb",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"salsa20",
"chacha20",
"chacha20-ietf",
}
local protocol = {
"origin", "verify_deflate", "auth_sha1_v4", "auth_aes128_sha1",
"auth_aes128_md5", "auth_chain_a", "auth_chain_b", "auth_chain_c",
"auth_chain_d", "auth_chain_e", "auth_chain_f"
"origin",
"verify_deflate",
"auth_sha1_v4",
"auth_aes128_sha1",
"auth_aes128_md5",
"auth_chain_a",
"auth_chain_b",
"auth_chain_c",
"auth_chain_d",
"auth_chain_e",
"auth_chain_f",
}
obfs = {
"plain", "http_simple", "http_post", "random_head", "tls1.2_ticket_auth"
"plain",
"http_simple",
"http_post",
"random_head",
"tls1.2_ticket_auth",
}
local securitys = {
"auto",
"none",
"aes-128-gcm",
"chacha20-poly1305"
}
local securitys = {"auto", "none", "aes-128-gcm", "chacha20-poly1305"}
m = Map(vssr, translate("Edit vssr Server"))
m.redirect = luci.dispatcher.build_url("admin/services/vssr/servers")
@ -81,7 +132,7 @@ o.description = translate(
o = s:option(Value, "alias", translate("Alias(optional)"))
o = s:option(Value, "flag", translate("Area"))
o = s:option(Value, "flag", translate("Country"))
o.description = translate("请自己指定。格式cn us hk 等")
o.rmempty = true
@ -120,6 +171,16 @@ for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
o.rmempty = true
o:depends("type", "ss")
-- Shadowsocks Plugin
o = s:option(Value, "plugin", translate("Plugin"))
o.rmempty = true
o:depends("type", "ss")
o = s:option(Value, "plugin_opts", translate("Plugin Opts"))
o.rmempty = true
o:depends("type", "ss")
o = s:option(ListValue, "protocol", translate("Protocol"))
for _, v in ipairs(protocol) do o:value(v) end
o.rmempty = true
@ -133,26 +194,7 @@ for _, v in ipairs(obfs) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(Flag, "v2ray_plugin", translate("V2ray-plugin"))
o.rmempty = false
o:depends("type", "ss")
o = s:option(Value, "obfs_transport", translate("V2ray-plugin-transport"))
o.rmempty = true
o.default = "ws"
o:depends("v2ray_plugin", "1")
o = s:option(Value, "obfs_host", translate("V2ray-plugin-host"))
o.rmempty = true
o:depends("v2ray_plugin", "1")
o = s:option(Value, "obfs_path", translate("V2ray-plugin-path"))
o.rmempty = true
o:depends("v2ray_plugin", "1")
o = s:option(Flag, "obfs_opts", translate("TLS"))
o.rmempty = false
o:depends("v2ray_plugin", "1")
o = s:option(Value, "obfs_param", translate("Obfs param(optional)"))
o:depends("type", "ssr")
@ -321,7 +363,6 @@ o = s:option(Flag, "mux", translate("Mux"))
o.rmempty = true
o.default = "0"
o:depends("type", "v2ray")
o:depends("v2ray_plugin", "1")
o = s:option(Value, "concurrency", translate("Concurrency"))
o.datatype = "uinteger"

View File

@ -17,7 +17,7 @@ m = Map(vssr)
m:section(SimpleSection).template = "vssr/status_top"
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}
@ -25,13 +25,6 @@ uci:foreach(vssr, "servers", function(s)
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 = {}
@ -41,15 +34,8 @@ 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 [SS(R)|V2ray|Trojan]"))
s = m:section(TypedSection, "global",translate("Basic Settings [SS|SSR|V2ray|Trojan]"))
s.anonymous = true
o = s:option(ListValue, "global_server", translate("Main Server"))
@ -60,51 +46,51 @@ o.rmempty = false
o = s:option(ListValue, "udp_relay_server", translate("Game Mode UDP Server"))
o:value("", translate("Disable"))
o:value("same", translate("Same as Global Server"))
o:value("same", translate("Same as Main 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 = s:option(Flag, "v2ray_flow", translate("Open v2ray route"))
o.rmempty = false
o.description = translate("When open v2ray split-flow,your main server must be a v2ray server")
o.description = translate("When open v2ray routed,Apply may take more time.")
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:value("nil", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_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:value("nil", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_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:value("nil", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_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:value("nil", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_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:value("nil", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_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:value("nil", translate("Same as Main Server"))
for _,key in pairs(key_table) do o:value(key,server_table[key]) end
o:depends("v2ray_flow", "1")
o.default = "nil"

View File

@ -37,8 +37,8 @@ msgstr "vssr SOCK5代理运行中"
msgid "UDP Relay Server"
msgstr "UDP中继服务器"
msgid "Same as Global Server"
msgstr "与全局服务器相同"
msgid "Same as Main Server"
msgstr "与服务器相同"
msgid "Servers Setting"
msgstr "服务器配置"
@ -386,8 +386,8 @@ msgstr "通过代理更新"
msgid "GFW List"
msgstr "GFW列表"
msgid "Basic Settings [SS(R)|V2ray|Trojan]"
msgstr "基本设置 [SS(R)|V2ray|Trojan]"
msgid "Basic Settings [SS|SSR|V2ray|Trojan]"
msgstr "基本设置 [SS|SSR|V2ray|Trojan]"
msgid "Main Server"
msgstr "主服务器"
@ -615,11 +615,11 @@ msgstr "导入配置信息"
msgid "Configuration Url"
msgstr "配置链接"
msgid "Open v2ray split-flow"
msgstr "开启V2ray分流"
msgid "Open v2ray route"
msgstr "开启分流"
msgid "When open v2ray split-flow,your main server must be a v2ray server"
msgstr "当使用v2ray分流功能时 主服务器必须为V2ray"
msgid "When open v2ray routed,Apply may take more time."
msgstr "(支持全类型分流)当分流开启时,保存并应用的时间可能变长。"
msgid "Youtube Proxy"
msgstr "Youtube 代理"

View File

@ -1,4 +1,4 @@
#!/bin/sh /etc/rc.common
#!/bin/bash /etc/rc.common
#
# Copyright (C) 2017 openwrt-ssr
# Copyright (C) 2017 yushi studio <ywb94@qq.com>
@ -29,11 +29,15 @@ kcp_enable_flag=0
kcp_flag=0
pdnsd_enable_flag=0
switch_enable=0
shunt_enable=0
switch_server=$1
MAXFD=32768
CRON_FILE=/etc/crontabs/root
threads=1
shunt_type=("global" "youtube" "tw_video" "netflix" "disney" "prime" "tvb")
shunt_port=(2080 2081 2082 2083 2084 2085 2086)
shunt_array=("youtube" "tw_video" "netflix" "disney" "prime" "tvb")
scount=0
uci_get_by_name() {
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
echo ${ret:=$3}
@ -45,9 +49,9 @@ uci_get_by_type() {
}
add_cron() {
sed -i '/vssr.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/vssr.log' >> $CRON_FILE
[ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/bin/lua /usr/share/vssr/subscribe.lua" >> $CRON_FILE
[ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/bin/lua /usr/share/vssr/update.lua" >> $CRON_FILE
sed -i '/vssr.log/d' $CRON_FILE && echo '0 1 * * * echo "" > /tmp/vssr.log' >>$CRON_FILE
[ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/bin/lua /usr/share/vssr/subscribe.lua" >>$CRON_FILE
[ $(uci_get_by_type server_subscribe auto_update 0) -eq 1 ] && echo "0 $(uci_get_by_type server_subscribe auto_update_time) * * * /usr/bin/lua /usr/share/vssr/update.lua" >>$CRON_FILE
crontab $CRON_FILE
}
@ -56,7 +60,17 @@ del_cron() {
sed -i '/vssr.log/d' $CRON_FILE
/etc/init.d/cron restart
}
count_shunt() {
scount=0
for ((i = 0; i < ${#shunt_array[@]}; i++)); do
local server_index=$(uci_get_by_type global ${shunt_array[i]}_server)
local server_type=$(uci_get_by_name $server_index type)
if [ "$server_type" != "" ]; then
scount=$(($scount + 1))
fi
done
}
count_shunt
run_mode=$(uci_get_by_type global run_mode)
gen_config_file() {
@ -89,9 +103,14 @@ gen_config_file() {
re_type="nat"
fi
fi
lua /usr/share/vssr/genconfig_${stype}.lua ${server_obj} ${re_type} ${port} ${hostip} >${config_file}
local mport=0
if [ $3 = "1" ]; then
stype="v2ray"
mport=1090
re_type="tcp"
fi
lua /usr/share/vssr/genconfig_${stype}.lua ${server_obj} ${re_type} ${port} ${hostip} ${mport} >${config_file}
sed -i 's/\\//g' $config_file
}
get_arg_out() {
@ -128,11 +147,23 @@ start_rules() {
local lan_ac_ips=$(uci_get_by_type access_control lan_ac_ips)
local lan_ac_mode="b"
local router_proxy=$(uci_get_by_type access_control router_proxy)
if [ "$GLOBAL_SERVER" = "$UDP_RELAY_SERVER" -a $kcp_flag = 0 ]; then
if [ "$GLOBAL_SERVER" == "$UDP_RELAY_SERVER" -a $kcp_flag == 0 ]; then
ARG_UDP="-u"
elif [ -n "$UDP_RELAY_SERVER" ]; then
ARG_UDP="-U"
local udp_server=$(uci_get_by_name $UDP_RELAY_SERVER server)
if echo $udp_server | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
udp_server=${udp_server}
elif [ "$udp_server" != "${udp_server#*:[0-9a-fA-F]}" ]; then
udp_server=${udp_server}
else
udp_server=$(ping ${udp_server} -s 1 -c 1 | grep PING | cut -d'(' -f 2 | cut -d')' -f1)
if echo $udp_server | grep -E "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" >/dev/null; then
echo $udp_server >/etc/ssr_ip
else
udp_server=$(cat /etc/ssr_ip)
fi
fi
local udp_local_port=$(uci_get_by_name $UDP_RELAY_SERVER local_port)
fi
@ -174,7 +205,6 @@ start_rules() {
-G "$(uci_get_by_type access_control lan_gm_ips)" \
-D "$proxyport" \
$(get_arg_out) $gfwmode $ARG_UDP
return $?
}
@ -234,6 +264,48 @@ EOF
/usr/sbin/pdnsd -c /var/etc/pdnsd.conf -d
}
find_bin() {
case "$1" in
ss) ret="/usr/bin/ss-redir" ;;
ss-local) ret="/usr/bin/ss-local" ;;
ssr) ret="/usr/bin/ssr-redir" ;;
ssr-local) ret="/usr/bin/ssr-local" ;;
ssr-server) ret="/usr/bin/ssr-server" ;;
v2ray) ret="/usr/bin/v2ray/v2ray" && [ ! -f "$ret" ] && ret="/usr/bin/v2ray" ;;
trojan) ret="/usr/sbin/trojan" ;;
socks5 | tun) ret="/usr/sbin/redsocks2" ;;
esac
echo $ret
}
#分流节点
start_shunt() {
for ((i = 0; i < ${#shunt_type[@]}; i++)); do
local server_index=$(uci_get_by_type global ${shunt_type[i]}_server)
local server_port=${shunt_port[i]}
local server_type=$(uci_get_by_name $server_index type)
local server_ip=$(uci_get_by_name $server_index server)
[ "$server_type" == "trojan" ] && re_type="client" || re_type="tcp"
if [ "$server_type" != "v2ray" -a "$server_type" != "" ]; then
local config_file=/var/etc/${NAME}_${shunt_type[i]}.json
local bin=$(find_bin $server_type)
lua /usr/share/vssr/genconfig_${server_type}.lua ${server_index} ${re_type} ${server_port} ${server_ip} >${config_file}
sed -i 's/\\//g' $config_file
case "$server_type" in
ss | ssr)
bin=$(find_bin "ss-local")
[ "$server_type" == "ssr" ] && bin=$(find_bin "ssr-local")
$bin -c $config_file $ARG_OTA -f /var/run/vssr-${shunt_type[i]}.pid1 >/dev/null 2>&1
;;
trojan)
$bin --config $config_file >/dev/null 2>&1 &
;;
esac
echo "$(date "+%Y-%m-%d %H:%M:%S") ${shunt_type[i]}: $server_type 分流服务已启动!" >>/tmp/vssr.log
fi
done
return $?
}
start_redir() {
case "$(uci_get_by_name $GLOBAL_SERVER auth_enable)" in
1 | on | true | yes | enabled) ARG_OTA="-A" ;;
@ -258,26 +330,12 @@ start_redir() {
kcp_enable_flag=1
fi
gen_config_file $GLOBAL_SERVER 0
gen_config_file $GLOBAL_SERVER 0 0
local stype=$(uci_get_by_name $GLOBAL_SERVER type)
if [ "$stype" == "ss" -o "$stype" == "v2ray" ]; then
sscmd="/usr/bin/v2ray/v2ray"
[ ! -f "$sscmd" ] && sscmd="/usr/bin/v2ray"
elif [ "$stype" == "ssr" ]; then
sscmd="/usr/bin/ssr-redir"
elif [ "$stype" == "trojan" ]; then
sscmd="/usr/sbin/trojan"
fi
sscmd=$(find_bin $stype)
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
if [ "$utype" == "ss" -o "$utype" == "v2ray" ]; then
ucmd="/usr/bin/v2ray/v2ray"
[ ! -f "$ucmd" ] && ucmd="/usr/bin/v2ray"
elif [ "$utype" == "ssr" ]; then
ucmd="/usr/bin/ssr-redir"
elif [ "$utype" == "trojan" ]; then
ucmd="/usr/sbin/trojan"
fi
ucmd=$(find_bin $utype)
if [ "$(uci_get_by_type global threads 0)" = "0" ]; then
threads=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
@ -286,47 +344,69 @@ start_redir() {
fi
#转发TCP
redir_tcp=1
local last_config_file=$CONFIG_FILE
if [ "$stype" == "ssr" ]; then
local pid_file="/var/run/ssr-retcp.pid"
for i in $(seq 1 $threads); do
$sscmd -c $last_config_file $ARG_OTA -f /var/run/ssr-retcp_$i.pid >/dev/null 2>&1
done
echo "$(date "+%Y-%m-%d %H:%M:%S") SSR $threads 线程 已启动!" >>/tmp/vssr.log
elif [ "$stype" == "v2ray" -o "$stype" == "ss" ]; then
$sscmd -config $last_config_file >/dev/null 2>&1 &
if [ $scount == "0" ]; then
local last_config_file=$CONFIG_FILE
case "$stype" in
ss | ssr)
local pid_file="/var/run/ssr-retcp.pid"
local name="Shadowsocks"
[ "$type" == "ssr" ] && name="ShadowsocksR"
for i in $(seq 1 $threads); do
$sscmd -c $last_config_file $ARG_OTA -f /var/run/ssr-retcp_$i.pid >/dev/null 2>&1
done
echo "$(date "+%Y-%m-%d %H:%M:%S") $name $threads 线程 已启动!" >>/tmp/vssr.log
;;
v2ray)
$sscmd -config $last_config_file >/dev/null 2>&1 &
echo $sscmd
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -version | head -1) 已启动!" >>/tmp/vssr.log
;;
trojan)
for i in $(seq 1 $threads); do
$sscmd -c $last_config_file >/dev/null 2>&1 &
done
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -V 2>&1 | head -1) $threads 线程 已启动!" >>/tmp/vssr.log
;;
esac
else
if [ $stype != "vray" ]; then
#开启 v2ray 路由服务
gen_config_file $GLOBAL_SERVER 0 1
sscmd=$(find_bin "v2ray")
local last_config_file=$CONFIG_FILE
$sscmd -config $last_config_file >/dev/null 2>&1 &
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -version | head -1) 已启动!" >>/tmp/vssr.log
fi
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -version | head -1) 已启动!" >>/tmp/vssr.log
elif [ "$stype" == "trojan" ]; then
for i in $(seq 1 $threads); do
$sscmd -c $last_config_file >/dev/null 2>&1 &
done
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -V 2>&1 | head -1) $threads 线程 已启动!" >>/tmp/vssr.log
fi
#转发UDP
if [ -n "$UDP_RELAY_SERVER" ]; then
redir_udp=1
gen_config_file $UDP_RELAY_SERVER 1
gen_config_file $UDP_RELAY_SERVER 1 0
last_config_file=$CONFIG_UDP_FILE
echo $utype
if [ "$utype" == "ssr" ]; then
case "$stype" in
ss | ssr)
case "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable)" in
1 | on | true | yes | enabled) ARG_OTA="-A" ;;
*) ARG_OTA="" ;;
esac
local name="Shadowsocks"
[ "$type" == "ssr" ] && name="ShadowsocksR"
pid_file="/var/run/ssr-reudp.pid"
#echo $ucmd >> /tmp/vssr.log
$ucmd -c $last_config_file $ARG_OTA -U -f /var/run/ssr-reudp.pid >/tmp/vssr.log 2>&1
#echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd -version | head -1) UDP已启动!" >> /tmp/vssr.log
elif [ "$utype" == "ss" -o "$utype" == "v2ray" ]; then
$ucmd -c $last_config_file $ARG_OTA -U -f /var/run/ssr-reudp.pid >/dev/null 2>&1
echo "$(date "+%Y-%m-%d %H:%M:%S") UDP TPROXY Relay: $name 已启动!" >>/tmp/vssr.log
;;
v2ray)
$ucmd -config $last_config_file >/dev/null 2>&1 &
elif [ "$stype" == "trojan" ]; then
echo "$(date "+%Y-%m-%d %H:%M:%S") UDP TPROXY Relay: V2ray 已启动!" >>/tmp/vssr.log
;;
trojan)
$ucmd --config $last_config_file >/dev/null 2>&1 &
ipt2socks -U -4 -b 0.0.0.0 -s 127.0.0.1 -p 10801 -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/dev/null 2>&1 &
fi
echo "$(date "+%Y-%m-%d %H:%M:%S") UDP TPROXY Relay: Trojan 已启动!" >>/tmp/vssr.log
;;
esac
fi
#deal with dns
@ -430,14 +510,13 @@ start_server() {
start_local() {
local local_server=$(uci_get_by_type socks5_proxy enable_server)
[ "$local_server" = "0" ] && return 0
[ "$local_server" = "0" ] && return 1
mkdir -p /var/run /var/etc
lua /usr/share/vssr/genconfig_v2ray_s.lua >$CONFIG_SOCK5_FILE
lua /usr/share/vssr/genconfig_v2ray_s.lua >$CONFIG_SOCK5_FILE
sed -i 's/\\//g' $config_file
/usr/bin/v2ray/v2ray -config $CONFIG_SOCK5_FILE >/dev/null 2>&1 &
local_enable=1
}
@ -485,7 +564,9 @@ EOF
fi
start_server
start_local
if [ $scount != "0" ]; then
start_shunt
fi
if [ $(uci_get_by_type global monitor_enable) = 1 ]; then
let total_count=server_count+redir_tcp+redir_udp+tunnel_enable+kcp_enable_flag+local_enable+pdnsd_enable_flag+switch_enable
if [ $total_count -gt 0 ]; then
@ -503,6 +584,7 @@ boot() {
}
stop() {
echo "stop"
/usr/bin/vssr-rules -f
srulecount=$(iptables -L | grep SSR-SERVER-RULE | wc -l)
if [ $srulecount -gt 0 ]; then
@ -516,15 +598,7 @@ stop() {
if [ $(uci_get_by_type global monitor_enable) = 1 ]; then
kill -9 $(busybox ps -w | grep vssr-monitor | grep -v grep | awk '{print $1}') >/dev/null 2>&1
fi
killall -q -9 vssr-monitor
killall -q -9 ssr-redir
killall -q -9 v2ray
killall -q -9 trojan
killall -q -9 ipt2socks
killall -q -9 ssr-server
killall -q -9 kcptun-client
killall -q -9 ssr-local
killall -q -9 pdnsd
killall -q -9 ss-redir ss-local obfs-local ssr-redir ssr-local ssr-server v2ray v2ray-plugin trojan microsocks ipt2socks dns2socks redsocks2 pdnsd
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf

View File

@ -75,41 +75,41 @@ flush_r() {
ipset_r() {
ipset -N gmlan hash:net 2>/dev/null
for ip in $LAN_GM_IP; do ipset -! add gmlan $ip ; done
if [ "$RUNMODE" = "router" ] ;then
ipset -! -R <<-EOF || return 1
create ss_spec_wan_ac hash:net
$(gen_iplist | sed -e "s/^/add ss_spec_wan_ac /")
EOF
ipset -N gfwlist hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
$IPT -A SS_SPEC_WAN_AC -m set --match-set ss_spec_wan_ac dst -j RETURN
$IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
elif [ "$RUNMODE" = "gfw" ] ;then
ipset -N gfwlist hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
$IPT -A SS_SPEC_WAN_AC -m set --match-set gfwlist dst -j SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_AC -m set --match-set gmlan src -m set ! --match-set china dst -j SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j RETURN
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
elif [ "$RUNMODE" = "oversea" ] ;then
ipset -N oversea hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
ipset -N gmlan hash:net 2>/dev/null
for ip in $LAN_GM_IP; do ipset -! add gmlan $ip ; done
$IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j SS_SPEC_WAN_FW
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
elif [ "$RUNMODE" = "all" ] ;then
$IPT -N SS_SPEC_WAN_AC
$IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
$IPT -I SS_SPEC_WAN_AC -d $server -j RETURN
fi
for ip in $LAN_GM_IP; do ipset -! add gmlan $ip; done
case "$RUNMODE" in
router)
ipset -! -R <<-EOF || return 1
create ss_spec_wan_ac hash:net
$(gen_iplist | sed -e "s/^/add ss_spec_wan_ac /")
EOF
ipset -N gfwlist hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
$IPT -A SS_SPEC_WAN_AC -m set --match-set ss_spec_wan_ac dst -j RETURN
$IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
;;
gfw)
ipset -N gfwlist hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
$IPT -A SS_SPEC_WAN_AC -m set --match-set gfwlist dst -j SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_AC -m set --match-set gmlan src -m set ! --match-set china dst -j SS_SPEC_WAN_FW
$IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j RETURN
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
;;
oversea)
ipset -N oversea hash:net 2>/dev/null
$IPT -N SS_SPEC_WAN_AC
ipset -N gmlan hash:net 2>/dev/null
for ip in $LAN_GM_IP; do ipset -! add gmlan $ip; done
$IPT -A SS_SPEC_WAN_AC -m set --match-set china dst -j SS_SPEC_WAN_FW
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
;;
all)
$IPT -N SS_SPEC_WAN_AC
$IPT -A SS_SPEC_WAN_AC -j SS_SPEC_WAN_FW
$IPT -I SS_SPEC_WAN_AC -p tcp ! --dport 53 -d $server -j RETURN
;;
esac
ipset -N fplan hash:net 2>/dev/null
for ip in $LAN_FP_IP; do ipset -! add fplan $ip ; done
@ -147,37 +147,37 @@ fw_rule() {
ac_rule() {
if [ -n "$LAN_AC_IP" ]; then
case "${LAN_AC_IP:0:1}" in
w|W)
MATCH_SET="-m set --match-set ss_spec_lan_ac src"
;;
b|B)
MATCH_SET="-m set ! --match-set ss_spec_lan_ac src"
;;
*)
loger 3 "Bad argument \`-a $LAN_AC_IP\`."
return 2
;;
w | W)
MATCH_SET="-m set --match-set ss_spec_lan_ac src"
;;
b | B)
MATCH_SET="-m set ! --match-set ss_spec_lan_ac src"
;;
*)
loger 3 "Bad argument \`-a $LAN_AC_IP\`."
return 2
;;
esac
fi
IFNAME=$(uci get -P/var/state network.lan.ifname 2>/dev/null)
ipset -! -R <<-EOF || return 1
create ss_spec_lan_ac hash:net
$(for ip in ${LAN_AC_IP:1}; do echo "add ss_spec_lan_ac $ip"; done)
EOF
EOF
$IPT -I PREROUTING 1 ${IFNAME:+-i $IFNAME} -p tcp $EXT_ARGS $MATCH_SET \
-m comment --comment "$TAG" -j SS_SPEC_WAN_AC
-m comment --comment "$TAG" -j SS_SPEC_WAN_AC
if [ "$OUTPUT" = 1 ]; then
$IPT -I OUTPUT 1 -p tcp $EXT_ARGS \
-m comment --comment "$TAG" -j SS_SPEC_WAN_AC
-m comment --comment "$TAG" -j SS_SPEC_WAN_AC
elif [ "$OUTPUT" = 2 ]; then
ipset -! -R <<-EOF || return 1
create ssr_gen_router hash:net
$(gen_spec_iplist | sed -e "s/^/add ssr_gen_router /")
EOF
create ssr_gen_router hash:net
$(gen_spec_iplist | sed -e "s/^/add ssr_gen_router /")
EOF
$IPT -N SS_SPEC_ROUTER && \
$IPT -A SS_SPEC_ROUTER -m set --match-set ssr_gen_router dst -j RETURN && \
$IPT -A SS_SPEC_ROUTER -j SS_SPEC_WAN_FW
$IPT -I OUTPUT 1 -p tcp -m comment --comment "$TAG" -j SS_SPEC_ROUTER
$IPT -I OUTPUT 1 -p tcp -m comment --comment "$TAG" -j SS_SPEC_ROUTER
fi
return $?
}
@ -188,6 +188,8 @@ tp_rule() {
ip route add local 0.0.0.0/0 dev lo table 100
local ipt="iptables -t mangle"
$ipt -N SS_SPEC_TPROXY
$ipt -A SS_SPEC_TPROXY -p udp --dport 443 -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp --dport 80 -j RETURN
$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
@ -197,35 +199,33 @@ tp_rule() {
$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 \
$ipt -A SS_SPEC_TPROXY -p udp ! --dport 53 -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
case "$RUNMODE" in
router)
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
if [ "$RUNMODE" = "router" ] ;then
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst \
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set ! --match-set ss_spec_wan_ac dst \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set ! --match-set ss_spec_wan_ac dst \
;;
gfw)
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set china dst -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
elif [ "$RUNMODE" = "gfw" ] ;then
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set china dst -j RETURN
$ipt -A SS_SPEC_TPROXY -p udp -m set --match-set gmlan src -m set ! --match-set china dst \
$ipt -A SS_SPEC_TPROXY -p udp -m set $PROXY_PORTS --match-set gfwlist dst \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
$ipt -A SS_SPEC_TPROXY -p udp -m set $PROXY_PORTS --match-set gfwlist dst \
;;
oversea)
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set china dst \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
elif [ "$RUNMODE" = "oversea" ] ;then
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -m set --match-set china dst \
-j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
elif [ "$RUNMODE" = "all" ] ;then
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
fi
;;
all)
$ipt -A SS_SPEC_TPROXY -p udp $PROXY_PORTS -j TPROXY --on-port "$LOCAL_PORT" --tproxy-mark 0x01/0x01
;;
esac
$ipt -I PREROUTING 1 ${IFNAME:+-i $IFNAME} -p udp $EXT_ARGS $MATCH_SET \
-m comment --comment "$TAG" -j SS_SPEC_TPROXY
-m comment --comment "$TAG" -j SS_SPEC_TPROXY
return $?
}
@ -376,14 +376,14 @@ if [ -z "$server" -o -z "$local_port" ]; then
usage 2
fi
if [ "$TPROXY" = 1 ]; then
if [ "$TPROXY" == 1 ]; then
SERVER=$server
LOCAL_PORT=$local_port
elif [ "$TPROXY" = 2 ]; then
elif [ "$TPROXY" == 2 ]; then
: ${SERVER:?"You must assign an ip for the udp relay server."}
: ${LOCAL_PORT:?"You must assign a port for the udp relay server."}
fi
flush_r && fw_rule && ipset_r && ac_rule && tp_rule && gen_include
[ "$?" = 0 ] || loger 3 "Start failed!"
[ "$?" == 0 ] || loger 3 "Start failed!"
exit $?

View File

@ -1,61 +1,23 @@
local ucursor = require"luci.model.uci".cursor()
local ucursor = require "luci.model.uci".cursor()
local json = require "luci.jsonc"
local server_section = arg[1]
local proto = arg[2]
local proto = arg[2]
local local_port = arg[3]
local host = arg[4]
local server = ucursor:get_all("vssr", server_section)
local v2ray = {
log = {
-- error = "/var/ssrplus.log",
loglevel = "info"
},
-- 传入连接
inbound = {
port = local_port,
protocol = "dokodemo-door",
settings = {network = proto, followRedirect = true},
sniffing = {enabled = true, destOverride = {"http", "tls"}}
},
-- 传出连接
outbounds = {
{
tag = "protocol_layer",
protocol = "shadowsocks",
settings = {
servers = {
{
address = host,
port = tonumber(server.server_port),
method = server.encrypt_method_ss,
password = server.password
}
}
},
proxySettings = {tag = "transport_layer"}
}, {
tag = "transport_layer",
protocol = "freedom",
settings = (server.obfs_host ~= nil) and{
redirect = server.obfs_host .. ":" ..
tonumber(server.server_port)
} or nil,
streamSettings = (server.obfs_transport ~= nil) and{
network = server.obfs_transport,
security = (server.obfs_opts == '1') and "tls" or "none",
wsSettings = {
path = server.obfs_path,
headers = (server.obfs_host ~= nil) and {host = server.obfs_host} or nil
}
} or nil,
mux = {enabled = (server.mux == "1") and true or false}
}
}
local ss = {
server = host,
server_port = server.server_port,
local_address = "0.0.0.0",
local_port = local_port,
password = server.password,
timeout = (server.timeout ~= nil) and server.timeout or 60,
method = server.encrypt_method_ss,
reuse_port = true,
fast_open = (server.fast_open == "1") and true or false,
plugin = (server.plugin ~= nil) and server.plugin or nil,
plugin_opts = (server.plugin ~= nil) and server.plugin_opts or nil,
}
print(json.stringify(v2ray, 1))
print(json.stringify(ss, 1))

View File

@ -18,7 +18,7 @@ local trojan = {
password = {server.password},
-- 传出连接
ssl = {
verify = false,
verify = (server.insecure == "0") and true or false,
verify_hostname = (server.tls == "1") and false or true,
cert = "",
cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA",

View File

@ -5,6 +5,7 @@ local server_section = arg[1]
local proto = arg[2]
local local_port = arg[3]
local host = arg[4]
local main_port = arg[5]
local v2ray_flow = ucursor:get_first(name, 'global', 'v2ray_flow', '0')
local youtube_server = ucursor:get_first(name, 'global', 'youtube_server')
@ -14,81 +15,100 @@ 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)
function gen_outbound(server_node, tags, local_ports)
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
}
if server.type ~= "v2ray" then
bound = {
tag = tags,
protocol = "socks",
settings = {
servers = {
{
address = "127.0.0.1",
port = tonumber(local_ports)
}
}
}
},
-- 底层传输配置
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)
}
}
else
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
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"))
table.insert(outbounds_table, gen_outbound(tvb_server, "tvb"))
table.insert(outbounds_table, gen_outbound(server_section, "global",2080))
table.insert(outbounds_table, gen_outbound(youtube_server, "youtube",2081))
table.insert(outbounds_table, gen_outbound(tw_video_server, "twvideo",2082))
table.insert(outbounds_table, gen_outbound(netflix_server, "netflix",2083))
table.insert(outbounds_table, gen_outbound(disney_server, "disney",2084))
table.insert(outbounds_table, gen_outbound(prime_server, "prime",2085))
table.insert(outbounds_table, gen_outbound(tvb_server, "tvb",2086))
else
table.insert(outbounds_table, gen_outbound(server_section, "main",local_port))
end
-- rules gen
@ -215,17 +235,18 @@ end
local v2ray = {
log = {
-- error = "/var/ssrplus.log",
-- error = "/var/vssrsss.log",
-- access = "/var/v2rays.log",
loglevel = "warning"
},
-- 传入连接
inbounds = {
{
port = local_port,
port = tonumber(local_port),
protocol = "dokodemo-door",
settings = {network = proto, followRedirect = true},
sniffing = {enabled = true, destOverride = {"http", "tls"}}
sniffing = {enabled = true, destOverride = {"http", "tls"}},
streamSettings = {sockopt = { tproxy = (proto == "tcp") and "redirect" or "tproxy"}}
}
},

View File

@ -224,6 +224,7 @@ local function processData(szType, content)
result.alias = UrlDecode(alias)
result.type = "trojan"
result.server = host[1]
result.insecure = "0"
if host[2]:find("?") then
local query = split(host[2], "?")
result.server_port = query[1]

View File

@ -16,7 +16,9 @@ include $(INCLUDE_DIR)/package.mk
define Package/autocore-arm
TITLE:=Arm auto core loadbalance script.
MAINTAINER:=CN_SZTL
DEPENDS:=@(TARGET_bcm27xx||TARGET_ipq40xx||TARGET_ipq806x||TARGET_rockchip) +TARGET_ipq40xx:lm-sensors
DEPENDS:=@(TARGET_bcm27xx||TARGET_bcm53xx||TARGET_ipq40xx||TARGET_ipq806x||TARGET_rockchip) \
+TARGET_bcm53xx:nvram \
+TARGET_ipq40xx:lm-sensors
VARIANT:=arm
endef

View File

@ -4,7 +4,12 @@ cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': '
[ -z "${cpu_arch}" ] && cpu_arch="ARMv8 Processor"
cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)"
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
if grep -q "bcm53xx" "/etc/openwrt_release"; then
cpu_freq="$(nvram get clkfreq | awk -F ',' '{print $1}')MHz"
else
cpu_freq="$(expr $(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq) / 1000)MHz"
fi
if grep -q "ipq40xx" "/etc/openwrt_release"; then
sys_temp="$(sensors | grep -Eo '\+[0-9]+.+C' | sed ':a;N;$!ba;s/\n/ /g;s/+//g')"
else

View File

@ -49,6 +49,7 @@ upthreshold.rmempty = false
upthreshold.description = translate("Kernel make a decision on whether it should increase the frequency (%)")
upthreshold.placeholder = 50
upthreshold.default = 50
upthreshold:depends("governor", "ondemand")
factor = s:option(Value, "factor", translate("CPU Switching Sampling rate"))
factor.datatype="range(1,100000)"
@ -56,5 +57,6 @@ factor.rmempty = false
factor.description = translate("The sampling rate determines how frequently the governor checks to tune the CPU (ms)")
factor.placeholder = 10
factor.default = 10
factor:depends("governor", "ondemand")
return mp

View File

@ -346,7 +346,7 @@ run_socks() {
[ "$protocol" == "wsclient" ] && {
[ "$brook_tls" == "1" ] && server_host="wss://${server_host}" || server_host="ws://${server_host}"
}
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_socks_$5" "$protocol" -l "$bind:$local_port" -i "$bind" -s "$server_host:$port" -p "$(config_n_get $node password)"
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_socks_$5" "$protocol" --socks5 "$bind:$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
elif [ "$type" == "ssr" ] || [ "$type" == "ss" ]; then
lua $API_GEN_SS $node $local_port > $config_file
ln_start_bin "$(first_type ${type}-local)" "${type}-local" -c "$config_file" -b "$bind" -u
@ -401,7 +401,7 @@ run_redir() {
if [ "$protocol" == "wsclient" ]; then
echolog "Brook的WebSocket不支持UDP转发"
else
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_udp_$6" tproxy -l "0.0.0.0:$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_udp_$6" tproxy -l ":$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
fi
elif [ "$type" == "ssr" ] || [ "$type" == "ss" ]; then
lua $API_GEN_SS $node $local_port > $config_file
@ -474,7 +474,7 @@ run_redir() {
if [ "$protocol" == "wsclient" ]; then
[ "$brook_tls" == "1" ] && server_ip="wss://${server_ip}" || server_ip="ws://${server_ip}"
socks_port=$(get_new_port 2081 tcp)
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_$6" wsclient -l "127.0.0.1:$socks_port" -i 127.0.0.1 -s "$server_ip:$port" -p "$(config_n_get $node password)"
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_$6" wsclient --socks5 "127.0.0.1:$socks_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
eval port=\$TCP_REDIR_PORT$6
ln_start_bin "$(first_type ipt2socks)" "ipt2socks_tcp_$6" -T -l "$port" -b 0.0.0.0 -s 127.0.0.1 -p "$socks_port" -R
echolog "Brook的WebSocket不支持透明代理将使用ipt2socks转换透明代理"
@ -484,7 +484,7 @@ run_redir() {
server_ip=127.0.0.1
port=$KCPTUN_REDIR_PORT
}
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_$6" tproxy -l "0.0.0.0:$local_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_$6" tproxy -l ":$local_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
fi
fi
fi

View File

@ -266,13 +266,10 @@ filter_node() {
[ "$_ipt" == "6" ] && _ipt=$ip6t_tmp
$_ipt -n -L PSW_OUTPUT | grep -q "${address}:${port}"
if [ $? -ne 0 ]; then
unset dst_rule
local dst_rule=$(REDIRECT 1 MARK)
msg2="按规则路由(${msg})"
[ "$_ipt" == "$ipt_m" ] || {
dst_rule=$(REDIRECT $_port)
msg2="套娃使用(${msg}:${port}>>${_port})"
}
[ "$_ipt" == "$ip6t_tmp" ] || {
[ "$_ipt" == "$ipt_m" -o "$_ipt" == "$ip6t_m" ] || {
dst_rule=$(REDIRECT $_port)
msg2="套娃使用(${msg}:${port}>>${_port})"
}

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=curl
PKG_VERSION:=7.72.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \
@ -92,7 +92,7 @@ define Package/libcurl
CATEGORY:=Libraries
DEPENDS:= +LIBCURL_WOLFSSL:libwolfssl +LIBCURL_OPENSSL:libopenssl +LIBCURL_GNUTLS:libgnutls +LIBCURL_MBEDTLS:libmbedtls
DEPENDS += +LIBCURL_ZLIB:zlib +LIBCURL_THREADED_RESOLVER:libpthread +LIBCURL_LDAP:libopenldap +LIBCURL_LIBIDN2:libidn2
DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle +libzstd
DEPENDS += +LIBCURL_SSH2:libssh2 +LIBCURL_NGHTTP2:libnghttp2 +ca-bundle
TITLE:=A client-side URL transfer library
MENU:=1
ABI_VERSION:=4
@ -118,6 +118,7 @@ CONFIGURE_ARGS += \
--without-libidn \
--without-ca-path \
--without-libpsl \
--without-zstd \
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
\
$(call autoconf_bool,CONFIG_IPV6,ipv6) \

View File

@ -5,10 +5,8 @@ PKG_VERSION:=1.0
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
#PKG_SOURCE_URL:=https://github.com/Hill-98/k3screenctrl
#PKG_SOURCE_VERSION:=3257090decf7de1e70ef6e7bf28d0491ffe78854
PKG_SOURCE_URL:=https://github.com/zxlhhyccc/Hill-98-k3screenctrl.git
PKG_SOURCE_VERSION:=81c1cb35022082262c28e87b5b0d7141d0d2432b
PKG_SOURCE_URL:=https://github.com/lwz322/k3screenctrl.git
PKG_SOURCE_VERSION:=7b81497bb3719d7f3a741307417e39a4505d309d
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
@ -22,9 +20,9 @@ TARGET_CFLAGS+= -D_GNU_SOURCE
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=@TARGET_bcm53xx_generic_DEVICE_phicomm-k3 +@BUSYBOX_CONFIG_ARPING +@KERNEL_DEVMEM +bash +bc +jq +@BUSYBOX_CONFIG_ARP +@BUSYBOX_CONFIG_OD
DEPENDS:=@TARGET_bcm53xx_generic_DEVICE_phicomm-k3 +@KERNEL_DEVMEM +@BUSYBOX_CONFIG_ARPING +bc +bash +curl +coreutils +coreutils-od +jq
TITLE:=LCD screen controller on PHICOMM K3
URL:=https://github.com/zxlhhyccc/Hill-98-k3screenctrl
URL:=https://github.com/lwz322/k3screenctrl.git
endef
define Package/$(PKG_NAME)/description
@ -32,32 +30,17 @@ define Package/$(PKG_NAME)/description
the LCD screen on PHICOMM K3 to display some stats.
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
if [ -f /etc/uci-defaults/k3screenctrl ]; then
( . /etc/uci-defaults/k3screenctrl ) && \
rm -f /etc/uci-defaults/k3screenctrl
fi
rm -rf /tmp/luci-indexcache /tmp/luci-modulecache
fi
exit 0
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/lib/k3screenctrl
$(INSTALL_DIR) $(1)/lib/k3screenctrl/oui
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/k3screenctrl $(1)/usr/bin/
$(INSTALL_DIR) $(1)/lib/k3screenctrl $(1)/lib/k3screenctrl/oui
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/*.sh $(1)/lib/k3screenctrl/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/k3screenctrl/oui/update_oui.sh $(1)/lib/k3screenctrl/oui/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/k3screenctrl/oui/oui.txt $(1)/lib/k3screenctrl/oui/
$(INSTALL_DATA) ./files/k3screenctrl.config $(1)/etc/config/k3screenctrl
$(INSTALL_BIN) ./files/k3screenctrl.init $(1)/etc/init.d/k3screenctrl
$(INSTALL_BIN) ./files/k3screenctrl.uci $(1)/etc/uci-defaults/k3screenctrl
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
$(INSTALL_CONF) $(CURDIR)/files/k3screenctrl.config $(1)/etc/config/k3screenctrl
$(INSTALL_BIN) $(CURDIR)/files/k3screenctrl.init $(1)/etc/init.d/k3screenctrl
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -1,11 +1,9 @@
config general
option screen_time '10'
option refresh_time '5'
option pawd_hide '1'
option disp_cputemp '1'
option psk_hide '1'
option cputemp '1'
option city_checkip '1'
option update_time '3600'
option screen_time '30'
option refresh_time '2'
option pawd_hide '1'
option psk_hide '1'
option showmore '1'
option city_checkip '0'
option update_time '0'

View File

@ -7,21 +7,13 @@ SCRIPTS_BASE=/lib/k3screenctrl/
TEMP_DIR=/tmp/k3screenctrl
start() {
[ -z "$(grep "/lib/k3screenctrl/oui/update_oui.sh" /etc/crontabs/root)" ] && echo "0 6 * * * /lib/k3screenctrl/oui/update_oui.sh" >> /etc/crontabs/root
mkdir -p $TEMP_DIR
mkdir -p $TEMP_DIR/device_speed
[ -z "$(iptables --list | grep K3_SEREEN_U)" ] && iptables -N K3_SEREEN_U
[ -z "$(iptables --list | grep K3_SEREEN_D)" ] && iptables -N K3_SEREEN_D
$SCRIPTS_BASE"device_custom.sh"
$SCRIPTS_BASE"device_online.sh" &
# [ -z "$(grep "/lib/k3screenctrl/device_online.sh" /etc/crontabs/root)" ] && echo "*/5 * * * * /lib/k3screenctrl/device_online.sh" >> /etc/crontabs/root
m=$(uci get k3screenctrl.@general[0].screen_time) && [ $m -lt 10 ] && m=10
d=$(uci get k3screenctrl.@general[0].refresh_time) && [ $d -lt 2 ] && d=2
d=$(uci get k3screenctrl.@general[0].refresh_time) && [ $d -lt 1 ] && d=1
/usr/bin/k3screenctrl -m $m -d $d &
}
stop() {
killall k3screenctrl device_online.sh
kill -9 $(pidof device_online.sh) >/dev/null 2>&1
rm -rf $TEMP_DIR
}
killall k3screenctrl
}

View File

@ -7,11 +7,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bison
PKG_VERSION:=3.5.1
PKG_VERSION:=3.7.1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
PKG_HASH:=3e7e097bd9709a2d5e40e69446b74b149733b3de864fadb7a9b54eca7b2a4dd0
PKG_HASH:=55c215521a13982a9bee68cd42eed51a65713f96c530a739a57de4438ac1bb69
HOST_BUILD_PARALLEL:=1

View File

@ -1,6 +1,6 @@
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -778,14 +778,6 @@ _GL_WARN_ON_USE (getline, "getline is un
@@ -816,14 +816,6 @@ _GL_WARN_ON_USE (getline, "getline is un
# endif
#endif