luci-app-ssr-plus: add domain name support for socks5 node type

This commit is contained in:
lean 2020-03-18 12:54:16 +08:00
parent cedebaac37
commit 1db3f00f56
2 changed files with 10 additions and 8 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=169
PKG_RELEASE:=7
PKG_RELEASE:=8
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -384,7 +384,7 @@ start_redir() {
echo "$(date "+%Y-%m-%d %H:%M:%S") $($sscmd --version 2>&1 | head -1) , $threads Threads Started!" >>/tmp/ssrplus.log
elif [ "$stype" == "socks5" ]; then
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-retcp.conf" socks5 tcp $(uci_get_by_name $GLOBAL_SERVER local_port) \
$(uci_get_by_name $GLOBAL_SERVER server) $(uci_get_by_name $GLOBAL_SERVER server_port) \
$(check_host $(uci_get_by_name $GLOBAL_SERVER server)) $(uci_get_by_name $GLOBAL_SERVER server_port) \
$(uci_get_by_name $GLOBAL_SERVER auth_enable 0) $(uci_get_by_name $GLOBAL_SERVER username) $(uci_get_by_name $GLOBAL_SERVER password)
for i in $(seq 1 $threads); do
$sscmd -c /var/etc/redsocks-ssr-retcp.conf >/dev/null 2>&1
@ -419,7 +419,7 @@ start_redir() {
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
elif [ "$ntype" == "socks5" ]; then
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-netflix.conf" socks5 tcp 4321 \
$(uci_get_by_name $NETFLIX_SERVER server) $(uci_get_by_name $NETFLIX_SERVER server_port) \
$(check_host $(uci_get_by_name $NETFLIX_SERVER server)) $(uci_get_by_name $NETFLIX_SERVER server_port) \
$(uci_get_by_name $NETFLIX_SERVER auth_enable 0) $(uci_get_by_name $NETFLIX_SERVER username) $(uci_get_by_name $NETFLIX_SERVER password)
$ncmd -c /var/etc/redsocks-ssr-netflix.conf >/dev/null 2>&1
microsocks -i 127.0.0.1 -p 1088 ssr-socksdns >/dev/null 2>&1 &
@ -455,7 +455,7 @@ start_redir() {
ipt2socks -U -b 0.0.0.0 -4 -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
/usr/share/shadowsocksr/genred2config.sh "/var/etc/redsocks-ssr-reudp.conf" socks5 udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) \
$(uci_get_by_name $UDP_RELAY_SERVER server) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
$(check_host $(uci_get_by_name $UDP_RELAY_SERVER server)) $(uci_get_by_name $UDP_RELAY_SERVER server_port) \
$(uci_get_by_name $UDP_RELAY_SERVER auth_enable 0) $(uci_get_by_name $UDP_RELAY_SERVER username) $(uci_get_by_name $UDP_RELAY_SERVER password)
$ucmd -c /var/etc/redsocks-ssr-reudp.conf >/dev/null 2>&1
elif [ "$stype" == "tun" ]; then
@ -468,7 +468,7 @@ start_redir() {
local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
if [ "$ssr_dns" != "0" ]; then
if [ "$ssr_dns" != "0" ]; then # not use custom dns service
if [ "$run_mode" == "gfw" ]; then
ipset add gfwlist $dnsserver 2>/dev/null
elif [ "$run_mode" == "oversea" ]; then
@ -476,12 +476,14 @@ start_redir() {
else
ipset add ss_spec_wan_ac $dnsserver nomatch 2>/dev/null
fi
fi
if [ "$ssr_dns" == "1" ]; then
start_pdnsd $dnsserver $dnsport
pdnsd_enable_flag=1
elif [ "$ssr_dns" == "2" ]; then
microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 &
dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 &
pdnsd_enable_flag=2
microsocks -i 127.0.0.1 -p 10802 ssr-dns >/dev/null 2>&1 &
dns2socks 127.0.0.1:10802 $dnsserver:$dnsport 127.0.0.1:5335 -q >/dev/null 2>&1 &
pdnsd_enable_flag=2
fi
if [ "$(uci_get_by_type global enable_switch)" == "1" ]; then
if [ "$(uci_get_by_name $GLOBAL_SERVER switch_enable 1)" == "1" ]; then