luci ssr plus: splite tcp and udp to 2 instance

This commit is contained in:
coolsnowwolf 2018-11-12 15:44:25 +08:00
parent 59a6964da8
commit 9b3b5c8cce
2 changed files with 18 additions and 32 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=1
PKG_RELEASE:=48
PKG_RELEASE:=49
PO2LMO:=$(BUILD_DIR)/luci-base/po2lmo

View File

@ -278,50 +278,37 @@ start_redir() {
gen_config_file $GLOBAL_SERVER 0
local stype=$(uci_get_by_name $GLOBAL_SERVER type)
if [ "$stype" == "ss" ] ;then
if [ "$stype" == "ss" ] ;then
sscmd="/usr/bin/ss-redir"
elif [ "$stype" == "ssr" ] ;then
sscmd="/usr/bin/ssr-redir"
elif [ "$stype" == "v2ray" ] ;then
sscmd="/usr/bin/v2ray/v2ray"
fi
fi
redir_tcp=1
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
if [ "$utype" == "ss" ] ;then
if [ "$utype" == "ss" ] ;then
ucmd="/usr/bin/ss-redir"
elif [ "$utype" == "ssr" ] ;then
ucmd="/usr/bin/ssr-redir"
elif [ "$utype" == "v2ray" ] ;then
ucmd="/usr/bin/v2ray/v2ray"
fi
redir_tcp=1
if [ "$stype" == "ss" -o "$stype" == "ssr" ] ;then
local last_config_file=$CONFIG_FILE
local pid_file="/var/run/ssr-retcp.pid"
$sscmd \
-c $CONFIG_FILE $ARG_OTA \
-f /var/run/ssr-retcp.pid >/dev/null 2>&1
elif [ "$stype" == "v2ray" ] ;then
$sscmd -config /var/etc/v2-ssr-retcp.json >/dev/null 2>&1 &
fi
if [ "$ARG_UDP" = "-u" ]; then
if [ -n $UDP_RELAY_SERVER ] ;then
redir_udp=1
if [ "$stype" == "ss" -o "$stype" == "ssr" ] ;then
local last_config_file=$CONFIG_FILE
$sscmd \
-c $CONFIG_FILE $ARG_OTA -u \
-f /var/run/ssr-retcp-ssr-reudp.pid >/dev/null 2>&1
elif [ "$utype" == "v2ray" ] ; then
lua /usr/share/shadowsocksr/genv2config.lua $GLOBAL_SERVER 'tcp,udp' $(uci_get_by_name $GLOBAL_SERVER local_port) > /var/etc/v2-ssr-retcp-ssr-reudp.json
$ucmd -config /var/etc/v2-ssr-retcp-ssr-reudp.json >/dev/null 2>&1 &
fi
else
if [ "$stype" == "ss" -o "$stype" == "ssr" ] ;then
local last_config_file=$CONFIG_FILE
local pid_file="/var/run/ssr-retcp.pid"
$sscmd \
-c $CONFIG_FILE $ARG_OTA \
-f /var/run/ssr-retcp.pid >/dev/null 2>&1
elif [ "$stype" == "v2ray" ] ;then
$sscmd -config /var/etc/v2-ssr-retcp.json >/dev/null 2>&1 &
fi
if [ "$ARG_UDP" = "-U" ]; then
redir_udp=1
if [ "$utype" == "ss" -o "$utype" == "ssr" ] ;then
if [ "$utype" == "ss" -o "$utype" == "ssr" ] ;then
case "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable)" in
1|on|true|yes|enabled) ARG_OTA="-A";;
*) ARG_OTA="";;
@ -334,10 +321,9 @@ start_redir() {
-f $pid_file >/dev/null 2>&1
elif [ "$utype" == "v2ray" ] ; then
lua /usr/share/shadowsocksr/genv2config.lua $UDP_RELAY_SERVER udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) > /var/etc/v2-ssr-reudp.json
$ucmd -config /var/etc/v2-ssr-reudp.json >/dev/null 2>&1 &
$ucmd -config /var/etc/v2-ssr-reudp.json >/dev/null 2>&1 &
fi
fi
fi