luci-app-ssr-plus: add ss/v2ray/trojan global socks5 ssr server support
This commit is contained in:
parent
53fa21f3d6
commit
a38b2cfda9
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-ssr-plus
|
PKG_NAME:=luci-app-ssr-plus
|
||||||
PKG_VERSION:=173
|
PKG_VERSION:=173
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
@ -578,9 +578,26 @@ start_local() {
|
|||||||
[ "$local_server" = "nil" ] && return 1
|
[ "$local_server" = "nil" ] && return 1
|
||||||
local local_type=$(uci_get_by_name $local_server type)
|
local local_type=$(uci_get_by_name $local_server type)
|
||||||
mkdir -p /var/run /var/etc
|
mkdir -p /var/run /var/etc
|
||||||
|
|
||||||
|
echo $local_type
|
||||||
|
if [ "$local_type" == "ssr" ]; then
|
||||||
gen_config_file $local_server 3 $(uci_get_by_type socks5_proxy local_port 1080)
|
gen_config_file $local_server 3 $(uci_get_by_type socks5_proxy local_port 1080)
|
||||||
/usr/bin/ssr-local -c $CONFIG_SOCK5_FILE -u \
|
/usr/bin/ssr-local -c $CONFIG_SOCK5_FILE -u -f /var/run/ssr-local.pid >/dev/null 2>&1
|
||||||
-f /var/run/ssr-local.pid >/dev/null 2>&1
|
elif [ "$local_type" == "ss" ]; then
|
||||||
|
gen_config_file $local_server 3 $(uci_get_by_type socks5_proxy local_port 1080)
|
||||||
|
/usr/bin/ss-local -c $CONFIG_SOCK5_FILE -u -f /var/run/ssr-local.pid >/dev/null 2>&1
|
||||||
|
elif [ "$local_type" == "v2ray" ]; then
|
||||||
|
lua /usr/share/shadowsocksr/genv2config.lua $local_server tcp 0 $(uci_get_by_type socks5_proxy local_port 1080) >/var/etc/v2-ssr-local.json
|
||||||
|
sed -i 's/\\//g' /var/etc/v2-ssr-local.json
|
||||||
|
/usr/bin/v2ray/v2ray -config /var/etc/v2-ssr-local.json >/dev/null 2>&1 &
|
||||||
|
elif [ "$local_type" == "trojan" ]; then
|
||||||
|
lua /usr/share/shadowsocksr/gentrojanconfig.lua $local_server client $(uci_get_by_type socks5_proxy local_port 1080) >/var/etc/trojan-ssr-local.json
|
||||||
|
sed -i 's/\\//g' /var/etc/trojan-ssr-local.json
|
||||||
|
/usr/sbin/trojan --config /var/etc/trojan-ssr-local.json >/dev/null 2>&1 &
|
||||||
|
else
|
||||||
|
microsocks -i :: -p $(uci_get_by_type socks5_proxy local_port 1080) ssr-local >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
|
||||||
local_enable=1
|
local_enable=1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,6 +717,7 @@ stop() {
|
|||||||
killall -q -9 trojan
|
killall -q -9 trojan
|
||||||
killall -q -9 ipt2socks
|
killall -q -9 ipt2socks
|
||||||
kill -9 $(busybox ps -w | grep ssr-server | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
kill -9 $(busybox ps -w | grep ssr-server | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
|
kill -9 $(busybox ps -w | grep ssr-local | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
killall -q -9 ssr-local
|
killall -q -9 ssr-local
|
||||||
killall -q -9 ss-local
|
killall -q -9 ss-local
|
||||||
killall -q -9 kcptun-client
|
killall -q -9 kcptun-client
|
||||||
|
@ -2,7 +2,7 @@ local ucursor = require "luci.model.uci".cursor()
|
|||||||
local json = require "luci.jsonc"
|
local json = require "luci.jsonc"
|
||||||
local server_section = arg[1]
|
local server_section = arg[1]
|
||||||
local proto = arg[2]
|
local proto = arg[2]
|
||||||
local local_port = arg[3]
|
local local_port = arg[3] or "0"
|
||||||
local socks_port = arg[4] or "0"
|
local socks_port = arg[4] or "0"
|
||||||
|
|
||||||
local server = ucursor:get_all("shadowsocksr", server_section)
|
local server = ucursor:get_all("shadowsocksr", server_section)
|
||||||
@ -13,7 +13,7 @@ log = {
|
|||||||
loglevel = "warning"
|
loglevel = "warning"
|
||||||
},
|
},
|
||||||
-- 传入连接
|
-- 传入连接
|
||||||
inbound = {
|
inbound = (local_port ~= "0") and {
|
||||||
port = local_port,
|
port = local_port,
|
||||||
protocol = "dokodemo-door",
|
protocol = "dokodemo-door",
|
||||||
settings = {
|
settings = {
|
||||||
@ -24,12 +24,12 @@ log = {
|
|||||||
enabled = true,
|
enabled = true,
|
||||||
destOverride = { "http", "tls" }
|
destOverride = { "http", "tls" }
|
||||||
}
|
}
|
||||||
},
|
} or nil,
|
||||||
-- 同时开启 socks 代理
|
-- 开启 socks 代理
|
||||||
inboundDetour = (proto == "tcp" and socks_port ~= "0") and {
|
inboundDetour = (proto == "tcp" and socks_port ~= "0") and {
|
||||||
{
|
{
|
||||||
protocol = "socks",
|
protocol = "socks",
|
||||||
port = 1088,
|
port = socks_port,
|
||||||
settings = {
|
settings = {
|
||||||
auth = "noauth",
|
auth = "noauth",
|
||||||
udp = true
|
udp = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user