mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-19 03:43:29 +00:00
luci ssr plus: script optimization
This commit is contained in:
parent
78986783c1
commit
8816df5e44
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=45
|
||||
PKG_RELEASE:=46
|
||||
|
||||
PO2LMO:=$(BUILD_DIR)/luci-base/po2lmo
|
||||
|
||||
|
@ -121,7 +121,7 @@ EOF
|
||||
}
|
||||
EOF
|
||||
elif [ "$stype" == "v2ray" ] ;then
|
||||
lua /usr/share/shadowsocksr/genv2config.lua $GLOBAL_SERVER tcp > /var/etc/v2-ssr-retcp.json
|
||||
lua /usr/share/shadowsocksr/genv2config.lua $GLOBAL_SERVER tcp $(uci_get_by_name $1 local_port) > /var/etc/v2-ssr-retcp.json
|
||||
fi
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ start_redir() {
|
||||
kcp_enable_flag=1
|
||||
fi
|
||||
|
||||
gen_config_file $GLOBAL_SERVER 0
|
||||
gen_config_file $GLOBAL_SERVER 0
|
||||
local stype=$(uci_get_by_name $GLOBAL_SERVER type)
|
||||
if [ "$stype" == "ss" ] ;then
|
||||
sscmd="/usr/bin/ss-redir"
|
||||
@ -302,7 +302,7 @@ start_redir() {
|
||||
local pid_file="/var/run/ssr-retcp.pid"
|
||||
$sscmd \
|
||||
-c $CONFIG_FILE $ARG_OTA \
|
||||
-f /var/run/ssr-retcp.pid
|
||||
-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
|
||||
@ -318,13 +318,14 @@ start_redir() {
|
||||
redir_udp=1
|
||||
$ucmd \
|
||||
-c $last_config_file $ARG_OTA -U \
|
||||
-f $pid_file
|
||||
-f $pid_file >/dev/null 2>&1
|
||||
elif [ "$utype" == "v2ray" ] ; then
|
||||
lua /usr/share/shadowsocksr/genv2config.lua $UDP_RELAY_SERVER udp > /var/etc/v2-ssr-reudp.json
|
||||
$ucmd -config /var/etc/v2-ssr-reudp.json >/dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#deal with dns
|
||||
|
||||
if [ "$(uci_get_by_type global pdnsd_enable)" = "1" ] ;then
|
||||
@ -459,7 +460,7 @@ start() {
|
||||
cat > /tmp/dnsmasq.d/dnsmasq-ssr.conf <<EOF
|
||||
conf-dir=/etc/dnsmasq.ssr
|
||||
EOF
|
||||
/etc/init.d/dnsmasq restart
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
fi
|
||||
@ -491,11 +492,15 @@ stop() {
|
||||
killall -q -9 ssr-server
|
||||
killall -q -9 ssr-kcptun
|
||||
killall -q -9 ssr-local
|
||||
kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1 || kill -9 $(ps | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
if [ -f /var/run/pdnsd.pid ] ;then
|
||||
kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
|
||||
else
|
||||
kill -9 $(ps | grep pdnsd | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
|
||||
rm -f /tmp/dnsmasq.d/dnsmasq-ssr.conf
|
||||
/etc/init.d/dnsmasq restart
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
fi
|
||||
del_cron
|
||||
}
|
||||
|
@ -2,13 +2,14 @@ local ucursor = require "luci.model.uci"
|
||||
local json = require "luci.jsonc"
|
||||
local server_section = arg[1]
|
||||
local proto = arg[2]
|
||||
local local_port = arg[3]
|
||||
|
||||
local server = ucursor:get_all("shadowsocksr", server_section)
|
||||
|
||||
local v2ray = {
|
||||
-- 传入连接
|
||||
inbound = {
|
||||
port = 1234,
|
||||
port = local_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {
|
||||
network = proto,
|
||||
|
Loading…
Reference in New Issue
Block a user