luci-app-ssr-plus: add SOCKS5 node support (more fun!~)

This commit is contained in:
LEAN-ESX 2020-03-02 08:48:06 -08:00
parent 7d05eea87d
commit 9ac3c990f4
4 changed files with 18 additions and 5 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=155
PKG_VERSION:=156
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@ -39,7 +39,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks
bool "Include Socks Sever"
default n
default y if x86_64
endef
define Package/$(PKG_NAME)
@ -48,13 +48,12 @@ define Package/$(PKG_NAME)
SUBMENU:=3. Applications
TITLE:=SS/SSR/V2Ray/Trojan LuCI interface
PKGARCH:=all
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua \
DEPENDS:=+shadowsocksr-libev-alt +ipset +ip-full +iptables-mod-tproxy +dnsmasq-full +coreutils +coreutils-base64 +pdnsd-alt +wget +lua +ipt2socks \
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks:shadowsocks-libev-ss-redir \
+PACKAGE_$(PKG_NAME)_INCLUDE_Simple_obfs: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_Kcptun:kcptun-client \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Socks:srelay

View File

@ -131,6 +131,9 @@ end
if nixio.fs.access("/usr/sbin/trojan") then
o:value("trojan", translate("Trojan"))
end
if nixio.fs.access("/usr/bin/ipt2socks") then
o:value("socks5", translate("Socks5"))
end
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
o = s:option(Value, "alias", translate("Alias(optional)"))

View File

@ -398,7 +398,7 @@ msgid "GFW List"
msgstr "GFW列表"
msgid "ShadowSocksR Plus+ Settings"
msgstr "ShadowSocksR Plus+ 设置支持SS/SSR/V2RAY/TROJAN"
msgstr "ShadowSocksR Plus+ 设置支持SS/SSR/V2RAY/TROJAN/SOCKS5"
msgid "Main Server"
msgstr "主服务器"

View File

@ -286,6 +286,8 @@ start_redir() {
[ ! -f "$sscmd" ] && sscmd="/usr/bin/v2ray"
elif [ "$stype" == "trojan" ]; then
sscmd="/usr/sbin/trojan"
elif [ "$stype" == "socks5" ]; then
sscmd="/usr/bin/ipt2socks"
fi
local utype=$(uci_get_by_name $UDP_RELAY_SERVER type)
if [ "$utype" == "ss" ]; then
@ -297,6 +299,8 @@ start_redir() {
[ ! -f "$ucmd" ] && ucmd="/usr/bin/v2ray"
elif [ "$utype" == "trojan" ]; then
ucmd="/usr/sbin/trojan"
elif [ "$stype" == "socks5" ]; then
ucmd="/usr/bin/ipt2socks"
fi
if [ "$(uci_get_by_type global threads 0)" == "0" ]; then
threads=$(cat /proc/cpuinfo | grep 'processor' | wc -l)
@ -319,6 +323,11 @@ start_redir() {
$sscmd --config /var/etc/trojan-ssr-retcp.json >/dev/null 2>&1 &
done
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd --version 2>&1 | head -1) , $threads Threads Started!" >>/tmp/ssrplus.log
elif [ "$stype" == "socks5" ]; then
for i in $(seq 1 $threads); do
$sscmd -T -4 -b 0.0.0.0 -s $(uci_get_by_name $GLOBAL_SERVER server) -p $(uci_get_by_name $GLOBAL_SERVER server_port) -l $(uci_get_by_name $GLOBAL_SERVER local_port) -R ssr-retcp >/dev/null 2>&1 &
done
echo "$(date "+%Y-%m-%d %H:%M:%S") Socks5 REDIRECT/TPROXY, $threads Threads Started!" >>/tmp/ssrplus.log
fi
if [ -n "$UDP_RELAY_SERVER" ]; then
redir_udp=1
@ -340,6 +349,8 @@ start_redir() {
sed -i 's/\\//g' /var/etc/trojan-ssr-reudp.json
$ucmd --config /var/etc/trojan-ssr-reudp.json >/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 &
elif [ "$utype" == "socks5" ]; then
$sscmd -U -4 -b 0.0.0.0 -s $(uci_get_by_name $UDP_RELAY_SERVER server) -p $(uci_get_by_name $UDP_RELAY_SERVER server_port) -l $(uci_get_by_name $UDP_RELAY_SERVER local_port) -R ssr-reudp >/dev/null 2>&1 &
fi
fi
#deal with dns