ssray variable save / remove / upgrade

pull/149/head
BOYPT 6 years ago committed by cutelua
parent ba530f28a2
commit 87780fe95f
  1. 9
      src/download-ssray.sh
  2. 8
      src/ss-info.sh
  3. 114
      v2ray.sh

@ -54,7 +54,7 @@ _update_ssray_version() {
_download_ssray_file
do_service restart ssray
echo
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${cyan}$ssray_latest_ver$none"
echo -e " $green 更新成功啦...当前 V2Ray plugin 版本: ${cyan}$ssray_latest_ver$none"
echo
echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题...V2Ray 客户端的版本最好和服务器的版本保持一致$none"
echo
@ -65,3 +65,10 @@ _update_ssray_version() {
fi
}
_uninstall_ssray() {
if [[ $systemd ]]; then
systemctl disable ssray
rm -f "/lib/systemd/system/ssray.service" /etc/v2ray/ssray.conf
fi
rm -f /usr/local/bin/v2ray-plugin
}

@ -22,7 +22,13 @@ if [[ $shadowsocks ]]; then
echo -e "$yellow SS 链接 = ${cyan}$ss$none"
echo
if [[ $ssray ]]; then
echo -e "$yellow SS + V2ray - Plugin 链接 = ${cyan}$ssplugin$none"
echo -e "$yellow SS + V2ray - Plugin 地址 = ${cyan}${ssray_domain}$none"
echo
echo -e "$yellow SS + V2ray - Plugin 端口 = ${cyan}${ssrayport}$none"
echo
echo -e "$yellow SS + V2ray - Plugin 参数 = ${cyan}${clientopt}$none"
echo
echo -e "$yellow SS + V2ray - Plugin 链接 = ${cyan}${ssplugin}$none"
echo
fi
echo -e "提示: 输入$cyan v2ray ssqr $none可生成 Shadowsocks 二维码链接"

@ -33,6 +33,7 @@ if [[ -f /usr/bin/yum ]]; then
fi
backup="/etc/v2ray/233blog_v2ray_backup.conf"
ssraybackup="/etc/v2ray/233blog_ssray_backup.conf"
if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then
@ -57,6 +58,8 @@ if [[ $path_status ]]; then
is_path=true
fi
[[ -f $ssraybackup ]] && source $ssraybackup
uuid=$(cat /proc/sys/kernel/random/uuid)
old_id="e55c8d17-2cf3-b21a-bcf1-eeacb011ed79"
v2ray_server_config="/etc/v2ray/config.json"
@ -89,6 +92,12 @@ else
caddy_run_status="$red未在运行$none"
fi
ssray_transports=(
"HTTP (Websocket)"
"HTTPS (Websocket TLS)"
"QUIC (udp)"
)
_load transport.sh
ciphers=(
aes-128-cfb
@ -627,8 +636,6 @@ ssray_config() {
echo -e " $red大佬...你没有配置 Shadowsocks - V2ray - Plugin $none...不过现在想要配置的话也是可以的 ^_^"
echo
echo
echo -e " $yellow 唉唉 现在不管有没有配置过都要重新配置的,脚本还没完善好这部分,想改就接着重新配置吧~$none..."
echo
while :; do
echo -e "是否配置 ${yellow}Shadowsocks - V2ray Plugin ${none} [${magenta}Y/N$none]"
@ -645,6 +652,7 @@ ssray_config() {
echo
ssray=true
ssray_port_config
ssray_proto_config
break
elif [[ "$install_ssray" == [Nn] ]]; then
break
@ -653,6 +661,11 @@ ssray_config() {
fi
done
_download_ssray_file
ssray_apply_config
ssray_save_config
_load ss-info.sh
}
ssray_port_config() {
@ -673,9 +686,6 @@ ssray_port_config() {
error
;;
[1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $v2ray_transport == [45] ]]; then
local tls=ture
fi
if [[ $tls && $ssrayport == "80" ]] || [[ $tls && $ssrayport == "443" ]]; then
echo
echo -e "由于你已选择了 "$green"WebSocket + TLS $none或$green HTTP/2"$none" 传输协议."
@ -707,17 +717,10 @@ ssray_port_config() {
esac
done
ssray_proto_config
}
ssray_proto_config() {
ssray_transports=(
"HTTP (Websocket)"
"HTTPS (Websocket TLS)"
"QUIC (udp)"
)
echo
while :; do
echo -e "请选择 "$yellow"V2Ray-Plugin"$none" 传输协议 [${magenta}1-${#transport[*]}$none]"
@ -788,6 +791,10 @@ ssray_proto_config() {
echo -e "$yellow 噫!好像已经有证书了! 皮皮虾咋们走! $none"
else
echo -e "$yellow 开始安装acme.sh $none"
if ! command -v socat; then
echo -e "$red 需要安装socat $none"
exit 1
fi
curl https://get.acme.sh | bash
echo -e "$yellow 开始申请 $ssray_domain 的证书,如果有正在使用80端口的程序先让它们退下~... $none"
@ -807,19 +814,87 @@ ssray_proto_config() {
}
change_ssray_config() {
_load download-ssray.sh
if [[ $ssray ]]; then
while :; do
echo
echo -e "$yellow 1. $none修改 Shadowsocks - V2ray插件 端口"
echo
echo -e "$yellow 2. $none修改 Shadowsocks - V2ray插件 协议"
echo
echo -e "$yellow 3. $none升级 Shadowsocks - V2ray插件"
echo
echo -e "$yellow 4. $none关闭 Shadowsocks - V2ray"
echo
read -p "$(echo -e "请选择 [${magenta}1-3$none]:")" _opt
if [[ -z $_opt ]]; then
error
else
ssray_config
_load download-ssray.sh
_download_ssray_file
_install_ssray_service
case $_opt in
1)
local oldssrayport=$ssrayport
ssray_port_config
ssray_save_config
ssray_apply_config
del_port $oldssrayport
open_port $ssrayport
do_service restart ssray
_load ss-info.sh
break
;;
2)
ssray_proto_config
ssray_save_config
ssray_apply_config
_load ss-info.sh
break
;;
3)
_update_ssray_version
ssray_save_config
break
;;
4)
del_port $ssrayport
_uninstall_ssray
ssray=
install_ssray=n
rm -f $ssraybackup
break
;;
*)
error
;;
esac
fi
done
else
ssray_config
fi
}
ssray_save_config() {
cat > $ssraybackup << EOF
install_ssray=${install_ssray}
ssray_ver="$ssray_latest_ver"
ssray=${ssray}
ssray_transport=${ssray_transport}
ssrayport=${ssrayport}
ssray_domain="${ssray_domain}"
ssrayopt="${ssrayopt}"
EOF
}
ssray_apply_config() {
_install_ssray_service
open_port $ssrayport
do_service restart ssray
}
change_v2ray_config() {
local _menu=(
@ -2616,6 +2691,11 @@ update() {
update_v2ray() {
_load download-v2ray.sh
_update_v2ray_version
if [[ $ssray ]]; then
_update_ssray_version
ssray_save_config
fi
}
update_v2ray.sh() {
if [[ $_test ]]; then

Loading…
Cancel
Save