Browse Source

Add xray-plugin support

Mattraks 4 years ago
parent
commit
0d10169dfc

+ 4 - 0
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua

@@ -271,6 +271,9 @@ end
 if is_finded("v2ray-plugin") then
 	o:value("v2ray-plugin", translate("v2ray-plugin"))
 end
+if is_finded("xray-plugin") then
+	o:value("xray-plugin", translate("xray-plugin"))
+end
 o.rmempty = true
 o:depends("type", "ss")
 
@@ -278,6 +281,7 @@ o = s:option(Value, "plugin_opts", translate("Plugin Opts"))
 o.rmempty = true
 o:depends({type = "ss", plugin = "obfs-local"})
 o:depends({type = "ss", plugin = "v2ray-plugin"})
+o:depends({type = "ss", plugin = "xray-plugin"})
 
 o = s:option(ListValue, "protocol", translate("Protocol"))
 for _, v in ipairs(protocol) do

+ 3 - 2
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -27,6 +27,7 @@ shunt_dns_config_file=
 tmp_local_port=
 ARG_UDP=
 ARG_OTA=
+dns_port="5335"            #dns port
 tmp_dns_port="300"         #dns2socks temporary port
 tmp_udp_port="301"         #udp temporary port
 tmp_udp_local_port="302"   #udp socks temporary port
@@ -182,7 +183,7 @@ start_dns() {
 			pid_file="/var/run/pdnsd.pid";
 			run_as="nobody";
 			server_ip=127.0.0.1;
-			server_port=5335;
+			server_port=$dns_port;
 			status_ctl=on;
 			query_method=tcp_only;
 			min_ttl=1h;
@@ -219,7 +220,7 @@ start_dns() {
 			;;
 		2)
 			ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_dns_port ssrplus-dns
-			ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:5335 -q
+			ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
 			pdnsd_enable_flag=2
 			;;
 		esac

+ 0 - 2
luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus

@@ -28,7 +28,5 @@ if [ ! -s "/etc/config/shadowsocksr" ]; then
 fi
 sed -i "s/option type 'vmess'"/"option type 'v2ray'\n\toption v2ray_protocol 'vmess'/g" /etc/config/shadowsocksr
 sed -i "s/option type 'vless'"/"option type 'v2ray'\n\toption v2ray_protocol 'vless'/g" /etc/config/shadowsocksr
-sed -i "s/option type 'trojan'"/"option type 'v2ray'\n\toption v2ray_protocol 'trojan'/g" /etc/config/shadowsocksr
-sed -i "s/option type 'socks5'"/"option type 'v2ray'\n\toption v2ray_protocol 'socks'/g" /etc/config/shadowsocksr
 rm -rf /tmp/luci-modulecache /tmp/luci-indexcache
 exit 0

+ 1 - 1
luci-app-ssr-plus/root/usr/bin/ssr-monitor

@@ -108,7 +108,7 @@ while [ "1" == "1" ]; do #死循环
 			kill -9 $(busybox ps -w | grep ssrplus-dns | grep -v grep | awk '{print $1}') >/dev/null 2>&1
 			kill -9 $(busybox ps -w | grep "dns2socks 127.0.0.1 $tmp_dns_port" | grep -v grep | awk '{print $1}') >/dev/null 2>&1
 			ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_dns_port ssrplus-dns
-			ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:5335 -q
+			ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
 		fi
 	fi
 done

+ 2 - 2
luci-app-ssr-plus/root/usr/share/shadowsocksr/gfw2ipset.sh

@@ -19,7 +19,7 @@ nil)
 	rm -f $TMP_DNSMASQ_PATH/netflix_forward.conf
 	;;
 $(uci_get_by_type global global_server nil) | same)
-	netflix 5335
+	netflix $dns_port
 	;;
 *)
 	netflix $tmp_shunt_dns_port
@@ -31,7 +31,7 @@ for line in $(cat /etc/ssrplus/white.list); do sed -i "/$line/d" $TMP_DNSMASQ_PA
 for line in $(cat /etc/ssrplus/white.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done
 for line in $(cat /etc/ssrplus/deny.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_list.conf; done
 for line in $(cat /etc/ssrplus/deny.list); do sed -i "/$line/d" $TMP_DNSMASQ_PATH/gfw_base.conf; done
-cat /etc/ssrplus/black.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#5335\nipset=\/&\/blacklist/" >$TMP_DNSMASQ_PATH/blacklist_forward.conf
+cat /etc/ssrplus/black.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1#$dns_port\nipset=\/&\/blacklist/" >$TMP_DNSMASQ_PATH/blacklist_forward.conf
 cat /etc/ssrplus/white.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/server=\/&\/127.0.0.1\nipset=\/&\/whitelist/" >$TMP_DNSMASQ_PATH/whitelist_forward.conf
 cat /etc/ssrplus/deny.list | sed '/^$/d' | sed '/#/d' | sed "/.*/s/.*/address=\/&\//" >$TMP_DNSMASQ_PATH/denylist.conf
 if [ "$(uci_get_by_type global adblock 0)" == "1" ]; then