|
|
|
|
@ -425,7 +425,7 @@ check_operating_system(){ |
|
|
|
|
check_dependencies(){ |
|
|
|
|
type -p curl >/dev/null 2>&1 || (yellow " ${T[${L}7]} " && ${PACKAGE_INSTALL[int]} curl 2>/dev/null) || (yellow " ${T[${L}8]} " && ${PACKAGE_UPDATE[int]} && ${PACKAGE_INSTALL[int]} curl 2>/dev/null) |
|
|
|
|
! type -p curl >/dev/null 2>&1 && red " ${T[${L}9]} " && exit 1 |
|
|
|
|
[[ $SYSTEM = Alpine ]] && ! type -P curl >/dev/null 2>&1 && ${PACKAGE_UPDATE[int]} && ${PACKAGE_INSTALL[int]} curl wget grep |
|
|
|
|
[[ $SYSTEM = Alpine ]] && ! type -p curl >/dev/null 2>&1 && ${PACKAGE_UPDATE[int]} && ${PACKAGE_INSTALL[int]} curl wget grep |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 检测 IPv4 IPv6 信息,WARP Ineterface 开启,普通还是 Plus账户 和 IP 信息 |
|
|
|
|
@ -459,7 +459,7 @@ ip6_info(){ |
|
|
|
|
proxy_info(){ |
|
|
|
|
unset PROXYSOCKS5 PROXYPORT PROXYJASON PROXYIP PROXYCOUNTR PROXYASNORG ACCOUNT QUOTA AC PROXYSOCKS52 PROXYPORT2 PROXYJASON2 PROXYIP2 PROXYCOUNTR2 PROXYASNORG2 ACCOUNT2 AC2 TRACE42 |
|
|
|
|
|
|
|
|
|
if type -P warp-cli >/dev/null 2>&1; then |
|
|
|
|
if type -p warp-cli >/dev/null 2>&1; then |
|
|
|
|
PROXYSOCKS5=$(ss -nltp | grep 'warp' | grep -oP '127.0*\S+') |
|
|
|
|
PROXYPORT=$(echo $PROXYSOCKS5 | cut -d: -f2) |
|
|
|
|
PROXYJASON=$(curl -sx socks5h://localhost:$PROXYPORT https://ip.gs/json) |
|
|
|
|
@ -471,7 +471,7 @@ proxy_info(){ |
|
|
|
|
[[ $ACCOUNT =~ 'Limited' ]] && AC='+' && check_quota |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if type -P wireproxy >/dev/null 2>&1; then |
|
|
|
|
if type -p wireproxy >/dev/null 2>&1; then |
|
|
|
|
PROXYSOCKS52=$(ss -nltp | grep 'wireproxy' | grep -oP '127.0*\S+') |
|
|
|
|
PROXYPORT2=$(echo $PROXYSOCKS52 | cut -d: -f2) |
|
|
|
|
PROXYJASON2=$(curl -sx socks5h://localhost:$PROXYPORT2 https://ip.gs/json) |
|
|
|
|
@ -509,8 +509,8 @@ plus(){ |
|
|
|
|
reading " ${T[${L}50]} " CHOOSEPLUS |
|
|
|
|
case "$CHOOSEPLUS" in |
|
|
|
|
1 ) input |
|
|
|
|
[[ $(type -P git) ]] || ${PACKAGE_INSTALL[int]} git 2>/dev/null |
|
|
|
|
[[ $(type -P python3) ]] || ${PACKAGE_INSTALL[int]} python3 2>/dev/null |
|
|
|
|
[[ $(type -p git) ]] || ${PACKAGE_INSTALL[int]} git 2>/dev/null |
|
|
|
|
[[ $(type -p python3) ]] || ${PACKAGE_INSTALL[int]} python3 2>/dev/null |
|
|
|
|
[[ -d ~/warp-plus-cloudflare ]] || git clone https://github.com/aliilapro/warp-plus-cloudflare.git |
|
|
|
|
echo "$ID" | python3 ~/warp-plus-cloudflare/wp-plus.py;; |
|
|
|
|
2 ) input |
|
|
|
|
@ -672,7 +672,7 @@ change_ip(){ |
|
|
|
|
CHANGE_IP3=("" "" "" "" "" "" "" "change_wireproxy") |
|
|
|
|
|
|
|
|
|
for ((a=0; a<${#INSTALL_CHECK[@]}; a++)); do |
|
|
|
|
type -P ${INSTALL_CHECK[a]} >/dev/null 2>&1 && INSTALL_RESULT[a]=1 || INSTALL_RESULT[a]=0 |
|
|
|
|
type -p ${INSTALL_CHECK[a]} >/dev/null 2>&1 && INSTALL_RESULT[a]=1 || INSTALL_RESULT[a]=0 |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
for ((b=0; b<${#CASE_RESAULT[@]}; b++)); do |
|
|
|
|
@ -752,7 +752,7 @@ uninstall(){ |
|
|
|
|
UNINSTALL_DO=("uninstall_wgcf" "uninstall_proxy" "uninstall_wireproxy") |
|
|
|
|
UNINSTALL_RESULT=("${T[${L}117]}" "${T[${L}119]}" "${T[${L}98]}") |
|
|
|
|
for ((i=0; i<${#UNINSTALL_CHECK}; i++)); do |
|
|
|
|
type -P ${UNINSTALL_CHECK[i]} >/dev/null 2>&1 && (${UNINSTALL_DO[i]}; green " ${UNINSTALL_RESULT[i]} ") |
|
|
|
|
type -p ${UNINSTALL_CHECK[i]} >/dev/null 2>&1 && (${UNINSTALL_DO[i]}; green " ${UNINSTALL_RESULT[i]} ") |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
# 显示卸载结果 |
|
|
|
|
@ -773,7 +773,7 @@ ver(){ |
|
|
|
|
# 由于warp bug,有时候获取不了ip地址,加入刷网络脚本手动运行,并在定时任务加设置 VPS 重启后自动运行,i=当前尝试次数,j=要尝试的次数 |
|
|
|
|
net(){ |
|
|
|
|
unset IP4 IP6 WAN4 WAN6 COUNTRY4 COUNTRY6 ASNORG4 ASNORG6 WARPSTATUS4 WARPSTATUS6 |
|
|
|
|
[[ ! $(type -P wg-quick) || ! -e /etc/wireguard/wgcf.conf ]] && red " ${T[${L}10]} " && exit 1 |
|
|
|
|
[[ ! $(type -p wg-quick) || ! -e /etc/wireguard/wgcf.conf ]] && red " ${T[${L}10]} " && exit 1 |
|
|
|
|
i=1;j=5 |
|
|
|
|
yellow " $(eval echo "${T[${L}11]}")\n $(eval echo "${T[${L}12]}") " |
|
|
|
|
[[ $SYSTEM != Alpine ]] && [[ $(systemctl is-active wg-quick@wgcf) != 'active' ]] && wg-quick down wgcf >/dev/null 2>&1 |
|
|
|
|
@ -805,13 +805,13 @@ net(){ |
|
|
|
|
|
|
|
|
|
# WARP 开关,先检查是否已安装,再根据当前状态转向相反状态 |
|
|
|
|
onoff(){ |
|
|
|
|
! type -P wg-quick >/dev/null 2>&1 && red " ${T[${L}155]} " && exit 1 |
|
|
|
|
! type -p wg-quick >/dev/null 2>&1 && red " ${T[${L}155]} " && exit 1 |
|
|
|
|
[[ -n $(wg 2>/dev/null) ]] && (wg-quick down wgcf >/dev/null 2>&1; green " ${T[${L}15]} ") || net |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Proxy 开关,先检查是否已安装,再根据当前状态转向相反状态 |
|
|
|
|
proxy_onoff(){ |
|
|
|
|
! type -P warp-cli >/dev/null 2>&1 && red " ${T[${L}93]} " && exit 1 |
|
|
|
|
! type -p warp-cli >/dev/null 2>&1 && red " ${T[${L}93]} " && exit 1 |
|
|
|
|
if systemctl is-active warp-svc >/dev/null 2>&1; then |
|
|
|
|
[[ ! $(warp-cli --accept-tos settings) =~ WarpProxy ]] && ( ip -4 rule delete from 172.16.0.2/32 lookup 51820; ip -4 rule delete table main suppress_prefixlength 0 ) |
|
|
|
|
systemctl stop warp-svc |
|
|
|
|
@ -841,7 +841,7 @@ proxy_onoff(){ |
|
|
|
|
|
|
|
|
|
# WireProxy 开关,先检查是否已安装,再根据当前状态转向相反状态 |
|
|
|
|
wireproxy_onoff(){ |
|
|
|
|
! type -P wireproxy >/dev/null 2>&1 && red " ${T[${L}157]} " && exit 1 || OCTEEP=1 |
|
|
|
|
! type -p wireproxy >/dev/null 2>&1 && red " ${T[${L}157]} " && exit 1 || OCTEEP=1 |
|
|
|
|
if ss -nltp | grep wireproxy >/dev/null 2>&1; then |
|
|
|
|
systemctl stop wireproxy |
|
|
|
|
[[ ! $(ss -nltp) =~ 'wireproxy' ]] && green " ${T[${L}158]} " |
|
|
|
|
@ -965,7 +965,7 @@ EOF |
|
|
|
|
|
|
|
|
|
# 判断当前 Linux Client 状态,决定变量 CLIENT,变量 CLIENT 含义:0=未安装 1=已安装未激活 2=状态激活 3=Clinet proxy 已开启 5=Clinet warp 已开启 |
|
|
|
|
CLIENT=0 |
|
|
|
|
if type -P warp-cli >/dev/null 2>&1; then |
|
|
|
|
if type -p warp-cli >/dev/null 2>&1; then |
|
|
|
|
ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) |
|
|
|
|
[[ $ACCOUNT =~ 'Limited' ]] && CHECK_TYPE=1 && AC='+' && check_quota |
|
|
|
|
CLIENT=1 && CLIENT_INSTALLED="${T[${L}92]}" |
|
|
|
|
@ -979,7 +979,7 @@ EOF |
|
|
|
|
|
|
|
|
|
# 判断当前 WireProxy 状态,决定变量 WIREPROXY,变量 WIREPROXY 含义:0=未安装 1=已安装未激活 2=状态激活 3=Clinet 已开启 |
|
|
|
|
WIREPROXY=0 |
|
|
|
|
if type -P wireproxy >/dev/null 2>&1; then |
|
|
|
|
if type -p wireproxy >/dev/null 2>&1; then |
|
|
|
|
WIREPROXY=1 |
|
|
|
|
[[ $WIREPROXY = 1 ]] && WIREPROXY_INSTALLED="${T[${L}92]}" && [[ $(ss -nltp) =~ 'wireproxy' ]] && WIREPROXY=3 && proxy_info || WIREPROXY=2 |
|
|
|
|
fi |
|
|
|
|
@ -1331,10 +1331,10 @@ install(){ |
|
|
|
|
${PACKAGE_UPDATE[int]} |
|
|
|
|
|
|
|
|
|
# s390x wireguard-tools 安装 |
|
|
|
|
[[ $ARCHITECTURE = s390x ]] && ! type -P wg >/etc/null 2>&1 && rpm -i https://mirrors.cloud.tencent.com/epel/8/Everything/s390x/Packages/w/wireguard-tools-1.0.20210914-1.el8.s390x.rpm |
|
|
|
|
[[ $ARCHITECTURE = s390x ]] && ! type -p wg >/etc/null 2>&1 && rpm -i https://mirrors.cloud.tencent.com/epel/8/Everything/s390x/Packages/w/wireguard-tools-1.0.20210914-1.el8.s390x.rpm |
|
|
|
|
|
|
|
|
|
# CentOS Stream 9 需要安装 resolvconf |
|
|
|
|
[[ $SYSTEM = CentOS && "$(expr "$SYS" : '.*\s\([0-9]\{1,\}\)\.*')" = 9 ]] && ! type -P resolvconf >/dev/null 2>&1 && |
|
|
|
|
[[ $SYSTEM = CentOS && "$(expr "$SYS" : '.*\s\([0-9]\{1,\}\)\.*')" = 9 ]] && ! type -p resolvconf >/dev/null 2>&1 && |
|
|
|
|
wget $CDN -P /usr/sbin https://github.com/fscarmen/warp/releases/download/resolvconf/resolvconf && chmod +x /usr/sbin/resolvconf |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1470,7 +1470,7 @@ EOF |
|
|
|
|
|
|
|
|
|
# 设置开机启动 |
|
|
|
|
${SYSTEMCTL_ENABLE[int]}>/dev/null 2>&1 |
|
|
|
|
type -P dnsmasq >/dev/null 2>&1 && systemctl restart dnsmasq >/dev/null 2>&1 |
|
|
|
|
type -p dnsmasq >/dev/null 2>&1 && systemctl restart dnsmasq >/dev/null 2>&1 |
|
|
|
|
|
|
|
|
|
# Linux 内核低于5.6的,安装 Wireguard-GO。部分较低内核版本的KVM,即使安装了wireguard-dkms, 仍不能正常工作,兜底使用 wireguard-go |
|
|
|
|
([[ $WG = 1 ]] || [[ $(systemctl is-active wg-quick@wgcf) != active ]] || [[ $(systemctl is-enabled wg-quick@wgcf) != enabled ]]) && |
|
|
|
|
@ -1792,7 +1792,7 @@ update(){ |
|
|
|
|
ACCOUNT3=("" "" "" "" "" "" "" "wireproxy_account") |
|
|
|
|
|
|
|
|
|
for ((c=0; c<${#INSTALL_CHECK[@]}; c++)); do |
|
|
|
|
type -P ${INSTALL_CHECK[c]} >/dev/null 2>&1 && INSTALL_RESULT[c]=1 || INSTALL_RESULT[c]=0 |
|
|
|
|
type -p ${INSTALL_CHECK[c]} >/dev/null 2>&1 && INSTALL_RESULT[c]=1 || INSTALL_RESULT[c]=0 |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
for ((d=0; d<${#CASE_RESAULT[@]}; d++)); do |
|
|
|
|
|