diff --git a/menu.sh b/menu.sh index 975cd69..fa14e27 100644 --- a/menu.sh +++ b/menu.sh @@ -19,8 +19,8 @@ T[E4]="The WARP server cannot be connected. It may be a China Mainland VPS. You T[C4]="与 WARP 的服务器不能连接,可能是大陆 VPS,可手动 ping 162.159.193.10 或 ping6 2606:4700:d0::a29f:c001,如能连通可再次运行脚本,问题反馈:[https://github.com/fscarmen/warp/issues]" T[E5]="The script supports Debian, Ubuntu, CentOS or Alpine systems only. Feedback: [https://github.com/fscarmen/warp/issues]" T[C5]="本脚本只支持 Debian、Ubuntu、CentOS 或 Alpine 系统,问题反馈:[https://github.com/fscarmen/warp/issues]" -T[E6]="warp h (help)\n warp o (Turn off WARP temporarily)\n warp u (Turn off and uninstall WARP interface and Socks5 Linux Client)\n warp b (Upgrade kernel, turn on BBR, change Linux system)\n warp a (Upgrade to WARP+ account)\n warp p (Getting WARP+ quota by scripts)\n warp v (Sync the latest version)\n warp r (Connect/Disconnect WARP Linux Client)\n warp 4/6 (Add WARP IPv4/IPv6 interface)\n warp d (Add WARP dualstack interface IPv4 + IPv6)\n warp c (Install WARP Linux Client)\n warp i (Change the WARP IP to support Netflix)\n warp s (WARP single and dual stacks switch echo other. Such as [warp s 4],[warp s 6],[warp s d])\n warp y (Connect/Disconnect WireProxy socks5)\n" -T[C6]="warp h (帮助菜单)\n warp o (临时warp开关)\n warp u (卸载 WARP 网络接口和 Socks5 Client)\n warp b (升级内核、开启BBR及DD)\n warp a (免费 WARP 账户升级 WARP+)\n warp p (刷WARP+流量)\n warp v (同步脚本至最新版本)\n warp r (WARP Linux Client 开关)\n warp 4/6 (WARP IPv4/IPv6 单栈)\n warp d (WARP 双栈)\n warp c (安装 WARP Linux Client,开启 Socks5 代理模式)\n warp i (更换支持 Netflix 的IP)\n warp s [OPTION](WARP 单双栈相互切换,如 [warp s 4]、[warp s 6]、[warp s d])\n warp y (WireProxy socks5 开关)\n" +T[E6]="warp h (help)\n warp o (Turn off WARP temporarily)\n warp u (Turn off and uninstall WARP interface and Socks5 Linux Client)\n warp b (Upgrade kernel, turn on BBR, change Linux system)\n warp a (Upgrade to WARP+ account)\n warp p (Getting WARP+ quota by scripts)\n warp v (Sync the latest version)\n warp r (Connect/Disconnect WARP Linux Client)\n warp 4/6 (Add WARP IPv4/IPv6 interface)\n warp d (Add WARP dualstack interface IPv4 + IPv6)\n warp c (Install WARP Linux Client)\n warp i (Change the WARP IP to support Netflix)\n warp s (WARP single and dual stacks switch echo other. Such as [warp s 4],[warp s 6],[warp s d])\n warp e (Install Iptables + dnsmasq + ipset solution)\n warp w (Install WireProxy solution)\n warp y (Connect/Disconnect WireProxy socks5)\n" +T[C6]="warp h (帮助菜单)\n warp o (临时warp开关)\n warp u (卸载 WARP 网络接口和 Socks5 Client)\n warp b (升级内核、开启BBR及DD)\n warp a (免费 WARP 账户升级 WARP+)\n warp p (刷WARP+流量)\n warp v (同步脚本至最新版本)\n warp r (WARP Linux Client 开关)\n warp 4/6 (WARP IPv4/IPv6 单栈)\n warp d (WARP 双栈)\n warp c (安装 WARP Linux Client,开启 Socks5 代理模式)\n warp i (更换支持 Netflix 的IP)\n warp s [OPTION](WARP 单双栈相互切换,如 [warp s 4]、[warp s 6]、[warp s d])\n warp e (安装 Iptables + dnsmasq + ipset 解决方案)\n warp w (安装 WireProxy 解决方案)\n warp y (WireProxy socks5 开关)\n" T[E7]="Installing curl..." T[C7]="安装curl中……" T[E8]="It is necessary to upgrade the latest package library before install curl.It will take a little time,please be patiently..." @@ -337,6 +337,8 @@ T[E163]="Connect the WirePorxy" T[C163]="连接 WirePorxy" T[E164]="Disconnect the WirePorxy" T[C164]="断开 WirePorxy" +T[E165]="WireProxy Solution. A wireguard client that exposes itself as a socks5 proxy or tunnels. Adapted from the mature works of [octeep],[https://github.com/octeep/wireproxy]" +T[C165]="WireProxy,让 WARP 在本地建议一个 socks5 代理。改编自 [octeep] 的成熟作品,地址[https://github.com/octeep/wireproxy],请熟知" # 自定义字体彩色,read 函数,友道翻译函数 red(){ echo -e "\033[31m\033[01m$1\033[0m"; } @@ -684,7 +686,7 @@ uninstall(){ ${PACKAGE_UNINSTALL[int]} wireguard-tools openresolv 2>/dev/null rpm -e wireguard-tools 2>/dev/null [[ $(systemctl is-active systemd-resolved) != active ]] && systemctl enable --now systemd-resolved >/dev/null 2>&1 - rm -rf /usr/local/bin/wgcf /etc/wireguard /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf /usr/bin/warp /etc/dnsmasq.d/warp.conf /usr/bin/wireproxy + rm -rf /usr/bin/wgcf /etc/wireguard /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf /usr/bin/warp /etc/dnsmasq.d/warp.conf /usr/bin/wireproxy [[ -e /etc/gai.conf ]] && sed -i '/^precedence \:\:ffff\:0\:0/d;/^label 2002\:\:\/16/d' /etc/gai.conf [[ -e /usr/bin/tun.sh ]] && rm -f /usr/bin/tun.sh && sed -i '/tun.sh/d' /etc/crontab sed -i "/250 warp/d" /etc/iproute2/rt_tables @@ -697,7 +699,7 @@ uninstall(){ warp-cli --accept-tos delete >/dev/null 2>&1 ${PACKAGE_UNINSTALL[int]} cloudflare-warp 2>/dev/null systemctl disable --now warp-svc >/dev/null 2>&1 - rm -rf /usr/local/bin/wgcf /etc/wireguard /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf /usr/bin/warp + rm -rf /usr/bin/wgcf /etc/wireguard /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf /usr/bin/warp } # 卸载 WirePorxy @@ -705,7 +707,7 @@ uninstall(){ systemctl disable --now wireproxy [[ $SYSTEM != "Arch" ]] && ${PACKAGE_UNINSTALL[int]} wireguard-dkms resolvconf 2>/dev/null ${PACKAGE_UNINSTALL[int]} openresolv 2>/dev/null - rm -rf /usr/local/bin/wgcf /etc/wireguard /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf /usr/bin/warp /etc/dnsmasq.d/warp.conf /usr/bin/wireproxy /usr/lib/systemd/system/wireproxy.service + rm -rf /usr/bin/wgcf /etc/wireguard /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf /usr/bin/warp /etc/dnsmasq.d/warp.conf /usr/bin/wireproxy /usr/lib/systemd/system/wireproxy.service [[ -e /etc/gai.conf ]] && sed -i '/^precedence \:\:ffff\:0\:0/d;/^label 2002\:\:\/16/d' /etc/gai.conf [[ -e /usr/bin/tun.sh ]] && rm -f /usr/bin/tun.sh && sed -i '/tun.sh/d' /etc/crontab } @@ -884,7 +886,7 @@ EOF # 判断处理器架构 case $(uname -m) in - aarch64 ) ARCHITECTURE=arm64;; x86_64 ) ARCHITECTURE=amd64;; s390x ) ARCHITECTURE=s390x && S390X='-s390x';; * ) red " $(eval echo "${T[${L}134]}") " && exit 1;; + aarch64 ) ARCHITECTURE=arm64;; x86_64 ) ARCHITECTURE=amd64;; s390x ) ARCHITECTURE=s390x;; * ) red " $(eval echo "${T[${L}134]}") " && exit 1;; esac # 判断当前 IPv4 与 IPv6 ,IP归属 及 WARP 方案, Linux Client 是否开启 @@ -1118,7 +1120,7 @@ EOF # WGCF 或 WireProxy 安装 install(){ # 先删除之前安装,可能导致失败的文件 - rm -rf /usr/local/bin/wgcf /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf + rm -rf /usr/bin/wgcf /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf # 如安装 WireProxy 方案,自定义 Port [[ $OCTEEP = 1 ]] && input_port @@ -1143,13 +1145,16 @@ install(){ latest=${latest:-'2.2.12'} # 安装 wgcf,尽量下载官方的最新版本,如官方 wgcf 下载不成功,将使用 jsDelivr 的 CDN,以更好的支持双栈。并添加执行权限 - wget --no-check-certificate -T1 -t1 $CDN -O /usr/local/bin/wgcf https://github.com/ViRb3/wgcf/releases/download/v"$latest"/wgcf_"$latest"_linux_$ARCHITECTURE || - wget --no-check-certificate $CDN -O /usr/local/bin/wgcf https://cdn.jsdelivr.net/gh/fscarmen/warp/wgcf_"$latest"_linux_$ARCHITECTURE - chmod +x /usr/local/bin/wgcf + wget --no-check-certificate -T1 -t1 $CDN -O /usr/bin/wgcf https://github.com/ViRb3/wgcf/releases/download/v"$latest"/wgcf_"$latest"_linux_$ARCHITECTURE || + wget --no-check-certificate $CDN -O /usr/bin/wgcf https://cdn.jsdelivr.net/gh/fscarmen/warp/wgcf_"$latest"_linux_$ARCHITECTURE + chmod +x /usr/bin/wgcf - # 如安装 WireProxy 方案时下载 + # 如安装 WireProxy ,尽量下载官方的最新版本,如官方 WireProxy 下载不成功,将使用 jsDelivr 的 CDN,以更好的支持双栈。并添加执行权限 if [[ $OCTEEP = 1 ]]; then - wget -N https://github.com/fscarmen/warp/releases/download/wireproxy/wireproxy_linux_$ARCHITECTURE.tar.gz + wireproxy_latest=$(wget --no-check-certificate -qO- -T1 -t1 $CDN "https://api.github.com/repos/octeep/wireproxy/releases/latest" | grep "tag_name" | head -n 1 | cut -d : -f2 | sed 's/[ \"v,]//g') + wireproxy_latest=${wireproxy_latest:-'1.0.1'} + wget --no-check-certificate -T1 -t1 $CDN -N https://github.com/octeep/wireproxy/releases/download/v"$wireproxy_latest"/wireproxy_linux_$ARCHITECTURE.tar.gz || + wget --no-check-certificate $CDN -N https://cdn.jsdelivr.net/gh/fscarmen/warp/wireproxy/wireproxy_linux_$ARCHITECTURE.tar.gz tar -xzf wireproxy_linux_$ARCHITECTURE.tar.gz -C /usr/bin/; rm -f wireproxy_linux* fi @@ -1228,7 +1233,7 @@ install(){ # 如 Linux 版本低于5.6并且是 kvm,则安装 wireguard 内核模块 [[ $WG = 1 ]] && ${PACKAGE_INSTALL[int]} --no-install-recommends linux-headers-"$(uname -r)" && ${PACKAGE_INSTALL[int]} --no-install-recommends wireguard-dkms } - + Ubuntu(){ # 更新源 ${PACKAGE_UPDATE[int]} @@ -1390,7 +1395,7 @@ EOF # 如是 LXC,安装 Wireguard-GO。部分较低内核版本的KVM,即使安装了wireguard-dkms, 仍不能正常工作,兜底使用 wireguard-go [[ $LXC = 1 ]] || ([[ $WG = 1 ]] && [[ $(systemctl is-active wg-quick@wgcf) != active || $(systemctl is-enabled wg-quick@wgcf) != enabled ]]) && - wget --no-check-certificate $CDN -O /usr/bin/wireguard-go https://cdn.jsdelivr.net/gh/fscarmen/warp/wireguard-go$S390X && chmod +x /usr/bin/wireguard-go + wget --no-check-certificate $CDN -O /usr/bin/wireguard-go https://cdn.jsdelivr.net/gh/fscarmen/warp/wireguard-go/wireguard-go_linux_$ARCHITECTURE # 保存好配置文件 mv -f wgcf-account.toml wgcf-profile.conf menu.sh /etc/wireguard >/dev/null 2>&1 @@ -1518,6 +1523,21 @@ stream(){ esac } +# wireproxy 方案 +wireproxy_solution(){ + red "\n==============================================================" + yellow " ${T[${L}165]}\n " + green " 1.${T[${L}48]} " + [[ $OPTION != w ]] && green " 2.${T[${L}49]} " || green " 2.${T[${L}76]} " + red "==============================================================" + reading " ${T[${L}50]} " WIREPROXY_CHOOSE + case "$WIREPROXY_CHOOSE" in + 1 ) OCTEEP=1; install;; + 2 ) [[ $OPTION != w ]] && menu || exit;; + * ) red " ${T[${L}51]} [1-2]"; sleep 1; wireproxy_solution;; + esac + } + # 免费 WARP 账户升级 WARP+ 账户 update(){ wgcf_account(){ @@ -1747,5 +1767,6 @@ case "$OPTION" in c ) [[ $CLIENT -ge 2 ]] && red " ${T[${L}92]} " && exit 1 || proxy;; a ) update;; e ) [[ $m = 0 ]] && red " ${T[${L}147]} " && exit 1 || stream;; +w ) wireproxy_solution;; * ) menu;; esac