luci-app-ssr-plus: sync with upstream source

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
Mattraks 2021-01-21 12:10:48 +08:00 committed by CN_SZTL
parent ef7eb87d5f
commit 05422bfe13
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 123 additions and 71 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=182
PKG_RELEASE:=5
PKG_RELEASE:=9
define Package/$(PKG_NAME)/conffiles
/etc/config/shadowsocksr
@ -10,69 +10,89 @@ define Package/$(PKG_NAME)/conffiles
endef
define Package/$(PKG_NAME)/config
config PACKAGE_$(PKG_NAME)_INCLUDE_Xray
bool "Include Xray"
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
bool "Include Trojan"
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
bool "Include Redsocks2"
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
bool "Include Kcptun"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
bool "Include NaiveProxy"
depends on !(arc||armeb||mips||mips64||powerpc)
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
bool "Include V2ray"
config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
bool "Include Redsocks2"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Go
bool "Include Trojan-Go"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
bool "Include Shadowsocks-libev"
default y
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
bool "Include Kcptun"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin
bool "Include Shadowsocks V2ray Plugin"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR
bool "Include ShadowsocksR-libev"
default y
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
bool "Include ShadowsocksR Server"
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs
bool "Include Shadowsocks Simple Obfs Plugin"
default y
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
bool "Include Trojan"
default y if i386||arm
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Go
bool "Include Trojan-Go"
default y if x86_64||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
bool "Include V2ray"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin
bool "Include Shadowsocks V2ray Plugin"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Xray
bool "Include Xray"
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_Xray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Go \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Go \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray
LUCI_TITLE:=SS/SSR/V2Ray/Trojan/NaiveProxy/Socks5/Tun LuCI interface
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget-ssl +lua +libuci-lua \
+microsocks +dns2socks +shadowsocks-libev-ss-local +shadowsocksr-libev-ssr-local +shadowsocks-libev-ss-redir +simple-obfs +tcping +resolveip\
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Go:trojan-go \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
LUCI_DEPENDS:=+coreutils +coreutils-base64 +dns2socks +dnsmasq-full +ipset +ip-full \
+iptables-mod-tproxy +lua +libuci-lua +microsocks +pdnsd-alt +tcping +resolveip \
+shadowsocksr-libev-alt +wget-ssl \
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-local \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR:shadowsocksr-libev-ssr-local \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_Obfs:simple-obfs \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Go:trojan-go \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_Plugin:v2ray-plugin \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -361,8 +361,8 @@ function import_ssr_url(btn, urlname, sid) {
document.getElementsByName('cbid.shadowsocksr.' + sid + '.vless_encryption')[0].value = queryParam.encryption || "none";
if (queryParam.security == "tls") {
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls')[0].checked = true;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_host')[0].value = queryParam.sni || serverPart[0];
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls')[0].dispatchEvent(event);
document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_host')[0].value = queryParam.sni || serverPart[0];
}
switch (queryParam.type) {
case "ws":

View File

@ -44,7 +44,6 @@ CRON_FILE=/etc/crontabs/root
EXTRA_COMMANDS='reset'
EXTRA_HELP=" reset Reset to default settings"
#extra_command "reset" "Reset to default settings"
trap 'rm -f "$LOCK_FILE"; exit $?' INT TERM EXIT
uci_get_by_name() {
local ret=$(uci get $NAME.$1.$2 2>/dev/null)
@ -283,7 +282,7 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
vmess | vless)
lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 $5 >$config_file
;;
trojan | trojan-go)
trojan)
case "$3" in
1)
lua /usr/share/shadowsocksr/gen_config.lua $1 nat $4 >$config_file
@ -292,10 +291,25 @@ gen_config_file() { #server1 type2 code3 local_port4 socks_port5 threads5
lua /usr/share/shadowsocksr/gen_config.lua $1 client $4 >$config_file
;;
3)
lua /usr/share/shadowsocksr/gen_config.lua $1 nat $4 >$config_file
lua /usr/share/shadowsocksr/gen_config.lua $1 client $tmp_port >$shunt_dns_config_file
;;
4)
lua /usr/share/shadowsocksr/gen_config.lua $1 $mode $4 >$config_file
lua /usr/share/shadowsocksr/gen_config.lua $1 client $4 >$config_file
;;
esac
;;
trojan-go)
case "$3" in
1 | 2)
lua /usr/share/shadowsocksr/gen_config.lua $1 nat $4 >$config_file
;;
3)
lua /usr/share/shadowsocksr/gen_config.lua $1 nat $4 >$config_file
lua /usr/share/shadowsocksr/gen_config.lua $1 client $tmp_port >$shunt_dns_config_file
;;
4)
lua /usr/share/shadowsocksr/gen_config.lua $1 client $4 >$config_file
;;
esac
;;
@ -342,20 +356,29 @@ start_udp() {
ln_start_bin $(first_type xray v2ray) v2ray -config $udp_config_file
echolog "UDP TPROXY Relay:$($(first_type "xray" "v2ray") -version | head -1) Started!"
;;
trojan | trojan-go) #client
trojan) #client
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_local_port
ln_start_bin $(first_type trojan-go trojan) $type --config $udp_config_file
ln_start_bin $(first_type ipt2socks) ipt2socks -U -b 0.0.0.0 -4 -s 127.0.0.1 -p $tmp_udp_local_port -l $tmp_udp_port
echolog "UDP TPROXY Relay:$($(first_type trojan-go trojan) --version 2>&1 | head -1) Started!"
;;
trojan-go)
gen_config_file $UDP_RELAY_SERVER $type 2 $udp_config_file
ln_start_bin $(first_type trojan-go trojan) $type --config $udp_config_file
echolog "UDP TPROXY Relay:$($(first_type trojan-go trojan) --version 2>&1 | head -1) Started!"
;;
naiveproxy)
echolog "NaïveProxy UDP TPROXY Relay not supported!"
redir_udp=0
ARG_UDP=""
;;
socks5)
gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
ln_start_bin $(first_type redsocks2) redsocks2 -c $udp_config_file
if [ "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0)" == "1" ]; then
local auth="-a $(uci_get_by_name $UDP_RELAY_SERVER username) -k $(uci_get_by_name $UDP_RELAY_SERVER password)"
fi
ln_start_bin $(first_type ipt2socks) ipt2socks $udp_config_file -U -4 -s $(uci_get_by_name $UDP_RELAY_SERVER server) -p $(uci_get_by_name $UDP_RELAY_SERVER server_port) -l $tmp_udp_port $auth
#gen_config_file $UDP_RELAY_SERVER $type 2 $tmp_udp_port
#ln_start_bin $(first_type redsocks2) redsocks2 -c $udp_config_file
echolog "UDP TPROXY Relay:Socks5 REDIRECT/TPROXY Started!"
;;
tun)
@ -371,7 +394,6 @@ start_shunt() {
case "$type" in
ss | ssr)
gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port
#gen_config_file $SHUNT_SERVER $type 3 $tmp_local_port
ln_start_bin $(first_type ${type}-redir) ${type}-redir -c $shunt_config_file
if [ -n "$tmp_local_port" ]; then
local tmp_port=$tmp_local_port
@ -418,6 +440,22 @@ start_shunt() {
echolog "shunt:$($(first_type "naive") --version 2>&1 | head -1) Started!"
redir_udp=0
;;
socks5)
if [ "$(uci_get_by_name $SHUNT_SERVER auth_enable 0)" == "1" ]; then
local auth="-a $(uci_get_by_name $SHUNT_SERVER username) -k $(uci_get_by_name $SHUNT_SERVER password)"
fi
ln_start_bin $(first_type ipt2socks) ipt2socks $shunt_config_file -R -4 -s $(uci_get_by_name $SHUNT_SERVER server) -p $(uci_get_by_name $SHUNT_SERVER server_port) -l $tmp_shunt_port $auth
#gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port
#ln_start_bin $(first_type redsocks2) redsocks2 -c $shunt_config_file
if [ -n "$tmp_local_port" ]; then
local tmp_port=$tmp_local_port
else
local tmp_port=$tmp_shunt_local_port
ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_port shunt-dns-ssr-plus
fi
ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_port 8.8.8.8:53 127.0.0.1:$tmp_shunt_dns_port -q
echolog "shunt:$type REDIRECT/TPROXY Started!"
;;
*)
gen_config_file $SHUNT_SERVER $type 3 $tmp_shunt_port
ln_start_bin $(first_type redsocks2) redsocks2 -c $shunt_config_file
@ -445,7 +483,7 @@ start_local() {
echolog "Global_Socks5:$(get_name $type) Started!"
;;
vmess | vless)
if [ "_local" == "1" ]; then
if [ "$_local" == "2" ]; then
gen_config_file $LOCAL_SERVER $type 4 0 $local_port
ln_start_bin $(first_type xray v2ray) v2ray -config $local_config_file
echolog "Global_Socks5:$($(first_type "xray" "v2ray") -version | head -1) Started!"
@ -514,7 +552,7 @@ Start_Run() {
trojan | trojan-go)
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
ln_start_bin $(first_type trojan-go trojan) $type --config $tcp_config_file
echolog "Main node:$($(first_type $type) --version 2>&1 | head -1) Started!"
echolog "Main node:$($(first_type trojan-go trojan) --version 2>&1 | head -1) Started!"
;;
naiveproxy)
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
@ -522,10 +560,14 @@ Start_Run() {
echolog "Main node:$($(first_type naive) --version 2>&1 | head -1) , $threads Threads Started!"
;;
socks5)
gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
for i in $(seq 1 $threads); do
ln_start_bin $(first_type redsocks2) redsocks2 -c $tcp_config_file
done
if [ "$(uci_get_by_name $GLOBAL_SERVER auth_enable 0)" == "1" ]; then
local auth="-a $(uci_get_by_name $GLOBAL_SERVER username) -k $(uci_get_by_name $GLOBAL_SERVER password)"
fi
ln_start_bin $(first_type ipt2socks) ipt2socks $tcp_config_file -R -4 -j $threads -s $(uci_get_by_name $GLOBAL_SERVER server) -p $(uci_get_by_name $GLOBAL_SERVER server_port) -l $tcp_port $auth
#gen_config_file $GLOBAL_SERVER $type 1 $tcp_port
#for i in $(seq 1 $threads); do
# ln_start_bin $(first_type redsocks2) redsocks2 -c $tcp_config_file
#done
echolog "Main node:Socks5 REDIRECT/TPROXY $threads Threads Started!"
;;
tun)
@ -729,7 +771,6 @@ start_rules() {
w | W | b | B) local ac_ips="$lan_ac_mode$lan_ac_ips" ;;
esac
fi
#deal gfw firewall rule
gfwmode() {
case "$(uci_get_by_type global run_mode)" in
gfw) echo "-g" ;;
@ -830,7 +871,6 @@ stop() {
ps -w | grep -v "grep" | grep ssr-monitor | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
ps -w | grep -v "grep" | grep "sleep 0000" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
ps -w | grep -v "grep" | grep "$TMP_PATH" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
#killall -q -9 ss-redir ss-local obfs-local ssr-redir ssr-local ssr-server v2ray v2ray-plugin xray trojan naive microsocks ipt2socks dns2socks redsocks2 pdnsd
killall -q -9 v2ray-plugin obfs-local
rm -f /var/lock/ssr-monitor.lock
if [ -f "/var/dnsmasq.d/dnsmasq-ssrplus.conf" ]; then

View File

@ -18,7 +18,7 @@ local Xray = {
sniffing = {enabled = true, destOverride = {"http", "tls"}}
} or nil,
-- 开启 socks 代理
inboundDetour = (proto == "tcp" and socks_port ~= "0") and {
inboundDetour = (proto:find("tcp") and socks_port ~= "0") and {
{
protocol = "socks",
port = tonumber(socks_port),

View File

@ -23,18 +23,19 @@ PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
define Package/shadowsocksr-libev
define Package/shadowsocksr-libev/Default
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=Lightweight Secured Socks5 Proxy
URL:=https://github.com/shadowsocksrr/shadowsocksr-libev
DEPENDS:=+libev +libsodium +libopenssl +libpthread +libpcre +libudns +zlib
PROVIDES:=shadowsocksr-libev
endef
Package/shadowsocksr-libev-server = $(Package/shadowsocksr-libev)
Package/shadowsocksr-libev-alt = $(Package/shadowsocksr-libev)
Package/shadowsocksr-libev-ssr-local = $(Package/shadowsocksr-libev)
Package/shadowsocksr-libev-server = $(Package/shadowsocksr-libev/Default)
Package/shadowsocksr-libev-alt = $(Package/shadowsocksr-libev/Default)
Package/shadowsocksr-libev-ssr-local = $(Package/shadowsocksr-libev/Default)
CONFIGURE_ARGS += --disable-documentation --disable-ssp --disable-assert \
--enable-system-shared-lib
@ -42,15 +43,6 @@ CONFIGURE_ARGS += --disable-documentation --disable-ssp --disable-assert \
TARGET_CFLAGS += -flto
TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
define Package/shadowsocksr-libev/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-redir $(1)/usr/bin/ssr-redir
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-local $(1)/usr/bin/ssr-local
$(LN) ssr-local $(1)/usr/bin/ssr-tunnel
$(INSTALL_BIN) $(PKG_BUILD_DIR)/server/ss-check $(1)/usr/bin/ssr-check
$(INSTALL_BIN) $(PKG_BUILD_DIR)/server/ss-server $(1)/usr/bin/ssr-server
endef
define Package/shadowsocksr-libev-alt/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-redir $(1)/usr/bin/ssr-redir