You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray/src/backup.sh

124 lines
4.9 KiB

6 years ago
## backup config
6 years ago
_backup() {
6 years ago
for keys in $*; do
case $keys in
v2ray_transport)
6 years ago
sed -i "s/v2ray_transport=$v2ray_transport/v2ray_transport=$new_v2ray_transport/" $backup
6 years ago
;;
v2ray_port)
6 years ago
sed -i "s/v2ray_port=$v2ray_port/v2ray_port=$new_v2ray_port/" $backup
6 years ago
;;
uuid)
6 years ago
sed -i "s/v2ray_id=$v2ray_id/v2ray_id=$uuid/" $backup
6 years ago
;;
alterId)
6 years ago
sed -i "s/alterId=$alterId/alterId=$new_alterId/" $backup
6 years ago
;;
v2ray_dynamicPort_start)
6 years ago
sed -i "s/v2ray_dynamicPort_start=$v2ray_dynamicPort_start/v2ray_dynamicPort_start=$v2ray_dynamic_port_start_input/" $backup
6 years ago
;;
v2ray_dynamicPort_end)
6 years ago
sed -i "s/v2ray_dynamicPort_end=$v2ray_dynamicPort_end/v2ray_dynamicPort_end=$v2ray_dynamic_port_end_input/" $backup
6 years ago
;;
domain)
6 years ago
sed -i "s/domain=$domain/domain=$new_domain/" $backup
6 years ago
;;
caddy)
6 years ago
sed -i "s/caddy=/caddy=true/" $backup
6 years ago
;;
+ss)
6 years ago
sed -i "s/shadowsocks=/shadowsocks=true/; s/ssport=$ssport/ssport=$new_ssport/; s/sspass=$sspass/sspass=$new_sspass/; s/ssciphers=$ssciphers/ssciphers=$new_ssciphers/" $backup
6 years ago
;;
-ss)
6 years ago
sed -i "s/shadowsocks=true/shadowsocks=/" $backup
6 years ago
;;
ssport)
6 years ago
sed -i "s/ssport=$ssport/ssport=$new_ssport/" $backup
6 years ago
;;
sspass)
6 years ago
sed -i "s/sspass=$sspass/sspass=$new_sspass/" $backup
6 years ago
;;
ssciphers)
6 years ago
sed -i "s/ssciphers=$ssciphers/ssciphers=$new_ssciphers/" $backup
6 years ago
;;
+ad)
6 years ago
sed -i "s/ban_ad=/ban_ad=true/" $backup
6 years ago
;;
-ad)
6 years ago
sed -i "s/ban_ad=true/ban_ad=/" $backup
6 years ago
;;
+path)
6 years ago
sed -i "s/path_status=/path_status=true/; s/path=$path/path=$new_path/; s#proxy_site=$proxy_site#proxy_site=$new_proxy_site#" $backup
6 years ago
;;
-path)
6 years ago
sed -i "s/path_status=true/path_status=/" $backup
6 years ago
;;
path)
6 years ago
sed -i "s/path=$path/path=$new_path/" $backup
6 years ago
;;
proxy_site)
6 years ago
sed -i "s#proxy_site=$proxy_site#proxy_site=$new_proxy_site#" $backup
6 years ago
;;
+socks)
6 years ago
sed -i "s/socks=/socks=true/; s/socks_port=$socks_port/socks_port=$new_socks_port/; s/socks_username=$socks_username/socks_username=$new_socks_username/; s/socks_userpass=$socks_userpass/socks_userpass=$new_socks_userpass/;" $backup
6 years ago
;;
-socks)
6 years ago
sed -i "s/socks=true/socks=/" $backup
6 years ago
;;
socks_port)
6 years ago
sed -i "s/socks_port=$socks_port/socks_port=$new_socks_port/" $backup
6 years ago
;;
socks_username)
6 years ago
sed -i "s/socks_username=$socks_username/socks_username=$new_socks_username/" $backup
6 years ago
;;
socks_userpass)
6 years ago
sed -i "s/socks_userpass=$socks_userpass/socks_userpass=$new_socks_userpass/" $backup
6 years ago
;;
+mtproto)
6 years ago
sed -i "s/mtproto=/mtproto=true/; s/mtproto_port=$mtproto_port/mtproto_port=$new_mtproto_port/; s/mtproto_secret=$mtproto_secret/mtproto_secret=$new_mtproto_secret/" $backup
6 years ago
;;
-mtproto)
6 years ago
sed -i "s/mtproto=true/mtproto=/" $backup
6 years ago
;;
mtproto_port)
6 years ago
sed -i "s/mtproto_port=$mtproto_port/mtproto_port=$new_mtproto_port/" $backup
6 years ago
;;
mtproto_secret)
6 years ago
sed -i "s/mtproto_secret=$mtproto_secret/mtproto_secret=$new_mtproto_secret/" $backup
6 years ago
;;
+bt)
6 years ago
sed -i "s/ban_bt=/ban_bt=true/" $backup
6 years ago
;;
-bt)
6 years ago
sed -i "s/ban_bt=true/ban_bt=/" $backup
6 years ago
;;
esac
done
}
6 years ago
_first_backup(){
for keys in $*; do
case $keys in
v2ray)
sed -i "s/v2ray_transport=1/v2ray_transport=$v2ray_transport/; s/v2ray_port=2333/v2ray_port=$v2ray_port/; s/v2ray_id=uuid/v2ray_id=$uuid/" $backup
;;
dynamicPort)
sed -i "s/v2ray_dynamicPort_start=10000/v2ray_dynamicPort_start=$v2ray_dynamic_port_start_input/; s/v2ray_dynamicPort_end=20000/v2ray_dynamicPort_end=$v2ray_dynamic_port_end_input/" $backup
;;
domain)
sed -i "s/domain=233blog.com/domain=$domain/" $backup
;;
caddy)
sed -i "s/caddy=/caddy=true/" $backup
;;
+ss)
sed -i "s/shadowsocks=/shadowsocks=true/; s/ssport=6666/ssport=$ssport/; s/sspass=233blog.com/sspass=$sspass/; s/ssciphers=chacha20-ietf/ssciphers=$ssciphers/" $backup
;;
+ad)
sed -i "s/ban_ad=/ban_ad=true/" $backup
;;
+path)
sed -i "s/path_status=/path_status=true/; s/path=233blog/path=$path/; s#proxy_site=https://liyafly.com#proxy_site=$proxy_site#" $backup
;;
esac
done
}