diff --git a/.github/workflows/sync_wireguard-go.yml b/.github/workflows/sync_wireguard-go.yml index d8ae5aa..58995d2 100644 --- a/.github/workflows/sync_wireguard-go.yml +++ b/.github/workflows/sync_wireguard-go.yml @@ -42,7 +42,7 @@ jobs: go-version: "1.20" - name: Cross compile WireGuard-go - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v4.3.0 if: ${{ env.VERSION != '' }} with: distribution: goreleaser diff --git a/.github/workflows/wireguard-go.yml b/.github/workflows/wireguard-go.yml index 3b6e56b..896b957 100644 --- a/.github/workflows/wireguard-go.yml +++ b/.github/workflows/wireguard-go.yml @@ -30,7 +30,7 @@ jobs: go-version: "1.20" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v4.3.0 with: distribution: goreleaser workdir: ${{ env.workdir }} diff --git a/.github/workflows/wireguard-go_version.yml b/.github/workflows/wireguard-go_version.yml index feced78..3271a00 100644 --- a/.github/workflows/wireguard-go_version.yml +++ b/.github/workflows/wireguard-go_version.yml @@ -35,7 +35,7 @@ jobs: go-version: "1.18" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v4.3.0 with: distribution: goreleaser workdir: ${{ env.workdir }} diff --git a/.github/workflows/wireproxy.yml b/.github/workflows/wireproxy.yml index c0e0e93..1911861 100644 --- a/.github/workflows/wireproxy.yml +++ b/.github/workflows/wireproxy.yml @@ -33,7 +33,7 @@ jobs: go-version: "1.18" - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4.2.0 + uses: goreleaser/goreleaser-action@v4.3.0 with: distribution: goreleaser workdir: ${{ env.workdir }} diff --git a/README.md b/README.md index c0be119..de47b21 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ - [Cloudflare api 运行脚本](README.md#cloudflare-api-运行脚本) - [通过 warp 解锁 chatGPT 的方法](README.md#通过-warp-解锁-chatgpt-的方法) - [刷 Netflix 解锁 WARP IP 的方法](README.md#刷-Netflix-解锁-WARP-IP-的方法) -- [Netflix 分流到 WARP Client Proxy、WireProxy 的方法](README.md#Netflix-分流到-WARP-Client-ProxyWireProxy-的方法) -- [Netflix,Google 分流到 Client WARP 网络接口的方法](README.md#netflixgoogle-分流到-client-warp-网络接口的方法) +- [指定网站分流到 "socks5" 的 xray 配置模板 (适用于 WARP Client Proxy 和 WireProxy)](README.md#指定网站分流到-socks5-的-xray-配置模板-适用于-warp-client-proxy-和-wireproxy) +- [指定网站分流到 "interface" 的 xray 配置模板 (适用于 WARP Client Warp 和 warp-go 非全局)](README.md#指定网站分流到-interface-的-xray-配置模板适用于-warp-client-warp-和-warp-go-非全局) - [WARP+ License 及 ID 获取](README.md#warp-license-及-id-获取) - [WARP Teams 获取并用于 Linux 的方法](README.md#WARP-Teams-获取并用于-Linux-的方法) - [WARP 网络接口数据,临时、永久关闭和开启](README.md#warp-网络接口数据临时永久关闭和开启) @@ -23,6 +23,9 @@ * * * ## 更新信息 +2023.6.21 menu.sh V2.52 1. Client proxy mode supports warp dualstack; 2. Client warp mode supports warp dualstack; 3. Speed up script startup; Thanks to Bro ⑥, WordsWorthLess, us254 and chika0801 for the guidace on the xray template; 1. Client Proxy 模式支持 warp 双栈; 2. Client warp 模式支持 warp 双栈; 3. 加快脚本启动速度; 感谢网友 ⑥哥, WordsWorthLess, us254 and chika0801 关于 xray 模板的指导 + + 2023.6.18 menu.sh V2.51 Client supports Debian 12 (bookworm); Client 支持 Debian 12 (bookworm) 2023.5.20 menu.sh V2.50 1. Client supports IPv6 only VPS; 2. Support 4 ways to upgrade to teams account including token (Easily available at https://web--public--warp-team-api--coia-mfs4.code.run); 3. Use api to delete warp account while uninstalling; 1. Client 支持 IPv6 only VPS 安装; 2. 支持包括 token 等4种方式升级为 teams 账户 (可通过 https://web--public--warp-team-api--coia-mfs4.code.run 轻松获取); 3. 卸载的同时使用 api 删除 warp 账户 @@ -40,20 +43,20 @@ wget -N https://raw.githubusercontent.com/fscarmen/warp/main/api.sh && bash api. 2023.3.26 warp-go V1.1.3 / menu.sh 2.49 1. Change the best Warp endpoint to standard ports [500,1701,2408,4500]; 2. Upgrade the Netflix unlocking section; 1. warp endpoint 优选改为标准端口 [500,1701,2408,4500]; 2. 升级奈飞解锁部分 -2023.3.14 warp-go V1.1.2 / menu.sh 2.48 To speed up WARP, automatically find the most suitable endpoint for local use and apply it to wgcf, warp-go and client. Thanks to an anonymous and enthusiastic user for the tool; 为了提速 WARP,自动寻找最适合本机使用的 endpoint,应用在 wgcf, warp-go 和 client,感谢匿名的热心网友提供的工具 - -2023.3.2 warp-go V1.1.1 1. warp-go v1.0.8 is supported. Allowing custom MTU values in the configuration file /opt/warp-go/warp.conf; 2. Singbox configuration exports reseved using 3-numeric-array instead of a string; 1. 支持 warp-go v1.0.8 , 允许在配置文件 /opt/warp-go/warp.conf 自定义 MTU 值; 2. Singbox配置导出 reseved 使用三个数字的数组代替字符串 - -2023.2.22 [Unlock chatGPT without installing warp; 不安装 warp 就能解锁 chatGPT 的方法](README.md#通过-warp-解锁-chatgpt-的方法) - -2023.2.7 menu.sh V2.47 Iptables + dnsmasq + ipset solution supports chatGPT. Install via the 12 option in the menu or `bash menu.sh e`; Iptables + dnsmasq + ipset 方案支持 chatGPT. 安装方式: 菜单 12 选项或者 `bash menu.sh e` - -2022.12.17 warp-go V1.1.0 Support OpenWrt system; 支持 OpenWrt 系统 -
历史更新 history(点击即可展开或收起)
+>2023.3.14 warp-go V1.1.2 / menu.sh 2.48 To speed up WARP, automatically find the most suitable endpoint for local use and apply it to wgcf, warp-go and client. Thanks to an anonymous and enthusiastic user for the tool; 为了提速 WARP,自动寻找最适合本机使用的 endpoint,应用在 wgcf, warp-go 和 client,感谢匿名的热心网友提供的工具 +> +>2023.3.2 warp-go V1.1.1 1. warp-go v1.0.8 is supported. Allowing custom MTU values in the configuration file /opt/warp-go/warp.conf; 2. Singbox configuration exports reseved using 3-numeric-array instead of a string; 1. 支持 warp-go v1.0.8 , 允许在配置文件 /opt/warp-go/warp.conf 自定义 MTU 值; 2. Singbox配置导出 reseved 使用三个数字的数组代替字符串 +> +>2023.2.22 [Unlock chatGPT without installing warp; 不安装 warp 就能解锁 chatGPT 的方法](README.md#通过-warp-解锁-chatgpt-的方法) +> +>2023.2.7 menu.sh V2.47 Iptables + dnsmasq + ipset solution supports chatGPT. Install via the 12 option in the menu or `bash menu.sh e`; Iptables + dnsmasq + ipset 方案支持 chatGPT. 安装方式: 菜单 12 选项或者 `bash menu.sh e` +> +>2022.12.17 warp-go V1.1.0 Support OpenWrt system; 支持 OpenWrt 系统 +> >2022.12.10 warp-go V1.0.9 1.Export wireguard and sing-box config file with [warp-go e]; 2.Teams token website change to https://web--public--warp-team-api--coia-mfs4.code.run 1. 使用 [warp-go e] 导出 wireguard 和 sing-box 配置文件; 2.获取 teams token 网站更换为: https://web--public--warp-team-api--coia-mfs4.code.run > >2022.10.19 menu V2.46 / warp-go V1.0.8 Switch the IPv4 / IPv6 priority by [warp s 4/6/d] or [warp-go s 4/6/d]; 通过 [warp s 4/6/d] 或者 [warp-go 4/6/d]来切换 IPv4 / IPv6 的优先级别 @@ -273,10 +276,6 @@ warp i jp { "outbounds":[ { - "protocol":"freedom" - }, - { - "tag":"WARP", "protocol":"wireguard", "settings":{ "secretKey":"YFYOAdbw1bKTHlNNi+aEjBM3BO7unuFC5rOkMRAz9XY=", @@ -291,12 +290,37 @@ warp i jp "0.0.0.0/0", "::/0" ], - "endpoint":"engage.cloudflareclient.com:2408" + "endpoint":"162.159.192.1:2408" } ], "reserved":[78, 135, 76], "mtu":1280 - } + }, + "tag":"wireguard" + }, + { + "protocol":"freedom", + "tag":"direct" + }, + { + "protocol":"freedom", + "settings":{ + "domainStrategy":"UseIPv4" + }, + "proxySettings":{ + "tag":"wireguard" + }, + "tag":"warp-IPv4" + }, + { + "protocol":"freedom", + "settings":{ + "domainStrategy":"UseIPv6" + }, + "proxySettings":{ + "tag":"wireguard" + }, + "tag":"warp-IPv6" } ], "routing":{ @@ -305,10 +329,9 @@ warp i jp { "type":"field", "domain":[ - "domain:openai.com", - "domain:ai.com" + "geosite:openai" ], - "outboundTag":"WARP" + "outboundTag":"warp-IPv4" // 若需使用 Cloudflare 的 IPv6,改为 "warp-IPv6" } ] } @@ -354,50 +377,72 @@ kill -9 $(pgrep -f warp) ##杀掉正在运行的进程 * 如果长时间仍然未刷出解锁IP,可以查查 CloudFlare 当地是否在维护调路由:https://www.cloudflarestatus.com/ -## Netflix 分流到 WARP Client Proxy、WireProxy 的方法 +## 指定网站分流到 socks5 的 xray 配置模板 (适用于 WARP Client Proxy 和 WireProxy) -感谢 vpsxb admin 原创教程: [继续解锁奈飞(七)-WARP socks5 client分流](https://vpsxb.net/1069/) - -先安装 WARP Client,假设使用默认的 40000 端口 +本地 socks5://127.0.0.1:40000 并安装 [mack-a 八合一脚本](https://github.com/mack-a/v2ray-agent) 为例。编辑 ```/etc/v2ray-agent/xray/conf/10_ipv4_outbounds.json``` ``` { - "outbounds": [ + "outbounds":[ { - "protocol": "freedom" - }, - { - "tag": "media-unlock", - "protocol": "socks", - "settings": { - "servers": [ + "tag":"warp", + "protocol":"socks", + "settings":{ + "servers":[ { - "address": "127.0.0.1", - "port": 40000, - "users": [] + "address":"127.0.0.1", + "port":40000 } ] } + }, + { + "tag":"WARP-socks5-v4", + "protocol":"freedom", + "settings":{ + "domainStrategy":"UseIPv4" + }, + "proxySettings":{ + "tag":"warp" + } + }, + { + "tag":"WARP-socks5-v6", + "protocol":"freedom", + "settings":{ + "domainStrategy":"UseIPv6" + }, + "proxySettings":{ + "tag":"warp" + } } ], - "routing": { - "domainStrategy": "AsIs", - "rules": [ + "routing":{ + "rules":[ { - "type": "field", - "domain": [ - "geosite:netflix", - "domain:ip.gs" + "type":"field", + "domain":[ + "openai", + "ai.com", + "ip.gs" ], - "outboundTag": "media-unlock" + "outboundTag":"WARP-socks5-v4" + }, + { + "type":"field", + "domain":[ + "p3terx.com", + "netflix" + ], + "outboundTag":"WARP-socks5-v6" } ] } } ``` -## Netflix,Google 分流到 Client WARP 网络接口的方法 +## 指定网站分流到 "interface" 的 xray 配置模板(适用于 WARP Client Warp 和 warp-go 非全局) 感谢 LUDAN 老师提供的网络接口分流配置模板,注意:172.16.0.2 为 CloudFlareWARP 网络接口的 IP @@ -405,47 +450,59 @@ kill -9 $(pgrep -f warp) ##杀掉正在运行的进程 { "outbounds":[ { - "tag":"INTERNET_OUT", - "protocol":"freedom", - "settings":{ - "domainStrategy":"UseIP" - } + "protocol":"freedom" }, { - "tag":"CLI_OUT", + "tag":"CloudflareWARP-v4", "protocol":"freedom", "settings":{ "domainStrategy":"UseIPv4" }, - "sendThrough":"172.16.0.2" + "streamSettings":{ + "sockopt":{ + "interface":"CloudflareWARP", + "tcpFastOpen":true + } + } + }, + { + "tag":"CloudflareWARP-v6", + "protocol":"freedom", + "settings":{ + "domainStrategy":"UseIPv6" + }, + "streamSettings":{ + "sockopt":{ + "interface":"CloudflareWARP", + "tcpFastOpen":true + } + } } ], "routing":{ + "domainStrategy":"AsIs", "rules":[ { "type":"field", - "outboundTag":"CLI_OUT", "domain":[ "geosite:google", - "geosite:netflix", - "domain:ip.gs" - ] + "domain:ip.gs", + "domain:openai.com", + "domain:ai.com" + ], + "outboundTag":"CloudflareWARP-v4" }, { "type":"field", - "outboundTag":"INTERNET_OUT", - "network":"udp,tcp" + "domain":[ + "geosite:netflix", + "domain:p3terx.com" + ], + "outboundTag":"CloudflareWARP-v6" } ] - }, - "dns":{ - "servers":[ - "1.1.1.1", - "1.0.0.1" - ] } } - ``` ## warp-go 运行脚本 @@ -568,7 +625,8 @@ https://github.com/acacia233/Project-WARP-Unlock * wangying202: https://blog.csdn.net/wangying202/article/details/113178159 * LUBAN: https://github.com/HXHGTS/Cloudflare_WARP_Connect * valetzx: https://gitlab.com/valetzx/pubfile -* badafans cf api: https://github.com/badafans/warp-reg +* badafans cf api: https://github.com/badafans/warp-reg +* chika0801: https://github.com/chika0801/Xray-examples/ * 所有的热心网友们 服务提供(排名不分先后): diff --git a/api.sh b/api.sh index fcdf434..54a312a 100644 --- a/api.sh +++ b/api.sh @@ -5,7 +5,7 @@ # 帮助 help() { - echo -ne " Usage:\n\tbash $(basename $0)\t-h/--help\t\thelp\n\t\t\t-f/--file string\tConfiguration file (default "warp-account.conf")\n\t\t\t-r/--registe\t\tRegiste an account\n\t\t\t-t/--token\t\tRegiste with a team token\n\t\t\t-d/--device\t\tGet the devices information and plus traffic quota\n\t\t\t-a/--app\t\tFetch App information\n\t\t\t-b/--bind\t\tGet the account blinding devices\n\t\t\t-n/--name\t\tChange the device name\n\t\t\t-l/--license\t\tChange the license\n\t\t\t-u/--unbind\t\tUnbine a device from the account\n\t\t\t-c/--cancle\t\tCancle the account (There will be no display back for successful cancel)\n\t\t\t-i/--id\t\t\tShow the client id and reserved\n\n" + echo -ne " Usage:\n\tbash api.sh\t-h/--help\t\thelp\n\t\t\t-f/--file string\tConfiguration file (default "warp-account.conf")\n\t\t\t-r/--registe\t\tRegiste an account\n\t\t\t-t/--token\t\tRegiste with a team token\n\t\t\t-d/--device\t\tGet the devices information and plus traffic quota\n\t\t\t-a/--app\t\tFetch App information\n\t\t\t-b/--bind\t\tGet the account blinding devices\n\t\t\t-n/--name\t\tChange the device name\n\t\t\t-l/--license\t\tChange the license\n\t\t\t-u/--unbind\t\tUnbine a device from the account\n\t\t\t-c/--cancle\t\tCancle the account (There will be no display back for successful cancel)\n\t\t\t-i/--id\t\t\tShow the client id and reserved\n\n" } # 获取账户信息 diff --git a/menu.sh b/menu.sh index 5c488ce..7238239 100644 --- a/menu.sh +++ b/menu.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # 当前脚本版本号 -VERSION=2.51 +VERSION=2.52 # IP API 服务商 IP_API=("http://ip-api.com/json/" "https://api.ip.sb/geoip" "https://ifconfig.co/json" "https://www.cloudflare.com/cdn-cgi/trace") @@ -13,8 +13,8 @@ export DEBIAN_FRONTEND=noninteractive E[0]="\n Language:\n 1. English (default) \n 2. 简体中文\n" C[0]="${E[0]}" -E[1]="Client supports Debian 12 (bookworm)" -C[1]="Client 支持 Debian 12 (bookworm)" +E[1]="1. Client proxy mode supports warp dualstack; 2. Client warp mode supports warp dualstack; 3. Speed up script startup; Thanks to Bro ⑥, WordsWorthLess, us254 and chika0801 for the guidace on the xray template." +C[1]="1. Client Proxy 模式支持 warp 双栈; 2. Client warp 模式支持 warp 双栈; 3. 加快脚本启动速度; 感谢网友 ⑥哥, WordsWorthLess, us254 and chika0801 关于 xray 模板的指导" E[2]="The script must be run as root, you can enter sudo -i and then download and run again. Feedback: [https://github.com/fscarmen/warp/issues]" C[2]="必须以root方式运行脚本,可以输入 sudo -i 后重新下载运行,问题反馈:[https://github.com/fscarmen/warp/issues]" E[3]="The TUN module is not loaded. You should turn it on in the control panel. Ask the supplier for more help. Feedback: [https://github.com/fscarmen/warp/issues]" @@ -127,8 +127,8 @@ E[56]="The current Netflix region is \$REGION. Confirm press [y] . If you want a C[56]="当前 Netflix 地区是:\$REGION,需要解锁当前地区请按 [y], 如需其他地址请输入两位地区简写 \(如 hk ,sg,默认:\$REGION\):" E[57]="The target quota you want to get. The unit is GB, the default value is 10:" C[57]="你希望获取的目标流量值,单位为 GB,输入数字即可,默认值为10:" -E[58]="" -C[58]="" +E[58]="Local network interface: CloudflareWARP" +C[58]="本地网络接口: CloudflareWARP" E[59]="Cannot find the account file: /etc/wireguard/wgcf-account.toml, you can reinstall with the WARP+ License" C[59]="找不到账户文件:/etc/wireguard/wgcf-account.toml,可以卸载后重装,输入 WARP+ License" E[60]="Cannot find the configuration file: /etc/wireguard/wgcf.conf, you can reinstall with the WARP+ License" @@ -469,7 +469,7 @@ check_dependencies() { ip_info() { local CHECK_46="$1" if [[ "$2" =~ ^[0-9]+$ ]]; then - local INTERFACE_SOCK5="-x socks5h://localhost:$2" + local INTERFACE_SOCK5="-x socks5://127.0.0.1:$2" elif [[ "$2" =~ ^[[:alnum:]]+$ ]]; then local INTERFACE_SOCK5="--interface $2" fi @@ -514,40 +514,125 @@ ip_case() { WIREPROXY_ACCOUNT=' free' && [ "$WIREPROXY_TRACE4" = plus ] && [ -e /etc/wireguard/info.log ] && WIREPROXY_ACCOUNT=' Teams' && grep -sq 'Device name' /etc/wireguard/info.log && WIREPROXY_ACCOUNT='+' && check_quota warp elif [ "$CHECK_TYPE" = "client" ]; then - unset IP_RESULT CLIENT_SOCKS5 CLIENT_PORT CLIENT_TRACE4 CLIENT_WAN4 CLIENT_COUNTRY4 CLIENT_ASNORG4 CLIENT_ACCOUNT QUOTA AC + unset CLIENT_SOCKS5 CLIENT_PORT CLIENT_SOCKS5=$(ss -nltp | grep 'warp' | awk '{print $(NF-2)}') CLIENT_PORT=$(cut -d: -f2 <<< "$CLIENT_SOCKS5") - local IP_RESULT=$(ip_info "$CHECK_46" "$CLIENT_PORT") - CLIENT_TRACE4=$(expr "$IP_RESULT" : '.*trace=\([^@]*\).*') - CLIENT_WAN4=$(expr "$IP_RESULT" : '.*ip=\([^@]*\).*') - CLIENT_COUNTRY4=$(expr "$IP_RESULT" : '.*country=\([^@]*\).*') - [ "$L" = C ] && CLIENT_COUNTRY4_ZH=$(translate "$CLIENT_COUNTRY4") - [ -n "$CLIENT_COUNTRY4_ZH" ] && CLIENT_COUNTRY4="$CLIENT_COUNTRY4_ZH" - CLIENT_ASNORG4=$(expr "$IP_RESULT" : '.*asnorg=\([^@]*\).*') - CLIENT_ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) - [[ "$CLIENT_ACCOUNT" =~ Limited ]] && CLIENT_AC='+' && check_quota client - - elif [ "$CHECK_46" = 4 ]; then - unset IP_RESULT COUNTRY4 ASNORG4 TRACE4 PLUS4 WARPSTATUS4 - [ "$CHECK_TYPE" = luban ] && local INTERFACE=CloudflareWARP - local IP_RESULT=$(ip_info "$CHECK_46" "$INTERFACE") - TRACE4=$(expr "$IP_RESULT" : '.*trace=\([^@]*\).*') - WAN4=$(expr "$IP_RESULT" : '.*ip=\([^@]*\).*') - COUNTRY4=$(expr "$IP_RESULT" : '.*country=\([^@]*\).*') - [ "$L" = C ] && COUNTRY4_ZH=$(translate "$COUNTRY4") - [ -n "$COUNTRY4_ZH" ] && COUNTRY4="$COUNTRY4_ZH" - ASNORG4=$(expr "$IP_RESULT" : '.*asnorg=\([^@]*\).*') - - elif [ "$CHECK_46" = 6 ]; then - unset IP_RESULT COUNTRY6 ASNORG6 TRACE6 PLUS6 WARPSTATUS6 - [ "$CHECK_TYPE" = luban ] && local INTERFACE=CloudflareWARP - local IP_RESULT=$(ip_info "$CHECK_46" "$INTERFACE") - TRACE6=$(expr "$IP_RESULT" : '.*trace=\([^@]*\).*') - WAN6=$(expr "$IP_RESULT" : '.*ip=\([^@]*\).*') - COUNTRY6=$(expr "$IP_RESULT" : '.*country=\([^@]*\).*') - [ "$L" = C ] && COUNTRY6_ZH=$(translate "$COUNTRY6") - [ -n "$COUNTRY6_ZH" ] && COUNTRY6="$COUNTRY6_ZH" - ASNORG6=$(expr "$IP_RESULT" : '.*asnorg=\([^@]*\).*') + case "$CHECK_46" in + 4 ) unset IP_RESULT4 CLIENT_TRACE4 CLIENT_WAN4 CLIENT_COUNTRY4 CLIENT_ASNORG4 CLIENT_ACCOUNT QUOTA AC + local IP_RESULT4=$(ip_info 4 "$CLIENT_PORT") + CLIENT_TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*') + CLIENT_WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*') + CLIENT_COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CLIENT_COUNTRY4_ZH=$(translate "$CLIENT_COUNTRY4") + [ -n "$CLIENT_COUNTRY4_ZH" ] && CLIENT_COUNTRY4="$CLIENT_COUNTRY4_ZH" + CLIENT_ASNORG4=$(expr "$IP_RESULT4" : '.*asnorg=\([^@]*\).*') + CLIENT_ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) + [[ "$CLIENT_ACCOUNT" =~ Limited ]] && CLIENT_AC='+' && check_quota client + ;; + 6 ) unset IP_RESULT6 CLIENT_TRACE6 CLIENT_WAN6 CLIENT_COUNTRY6 CLIENT_ASNORG6 CLIENT_ACCOUNT QUOTA AC + local IP_RESULT6=$(ip_info 6 "$CLIENT_PORT") + CLIENT_TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*') + CLIENT_WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*') + CLIENT_COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CLIENT_COUNTRY6_ZH=$(translate "$CLIENT_COUNTRY6") + [ -n "$CLIENT_COUNTRY6_ZH" ] && CLIENT_COUNTRY6="$CLIENT_COUNTRY6_ZH" + CLIENT_ASNORG6=$(expr "$IP_RESULT6" : '.*asnorg=\([^@]*\).*') + CLIENT_ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) + [[ "$CLIENT_ACCOUNT" =~ Limited ]] && CLIENT_AC='+' && check_quota client + ;; + d ) unset IP_RESULT4 CLIENT_TRACE4 CLIENT_WAN4 CLIENT_COUNTRY4 CLIENT_ASNORG4 IP_RESULT6 CLIENT_TRACE6 CLIENT_WAN6 CLIENT_COUNTRY6 CLIENT_ASNORG6 CLIENT_ACCOUNT QUOTA AC + local IP_RESULT4=$(ip_info 4 "$CLIENT_PORT") + CLIENT_TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*') + CLIENT_WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*') + CLIENT_COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CLIENT_COUNTRY4_ZH=$(translate "$CLIENT_COUNTRY4") + [ -n "$CLIENT_COUNTRY4_ZH" ] && CLIENT_COUNTRY4="$CLIENT_COUNTRY4_ZH" + CLIENT_ASNORG4=$(expr "$IP_RESULT4" : '.*asnorg=\([^@]*\).*') + local IP_RESULT6=$(ip_info 6 "$CLIENT_PORT") + CLIENT_TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*') + CLIENT_WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*') + CLIENT_COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CLIENT_COUNTRY6_ZH=$(translate "$CLIENT_COUNTRY6") + [ -n "$CLIENT_COUNTRY6_ZH" ] && CLIENT_COUNTRY6="$CLIENT_COUNTRY6_ZH" + CLIENT_ASNORG6=$(expr "$IP_RESULT6" : '.*asnorg=\([^@]*\).*') + CLIENT_ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) + [[ "$CLIENT_ACCOUNT" =~ Limited ]] && CLIENT_AC='+' && check_quota client + ;; + esac + elif [ "$CHECK_TYPE" = "luban" ]; then + case "$CHECK_46" in + 4 ) unset IP_RESULT4 CFWARP_COUNTRY4 CFWARP_ASNORG4 CFWARP_TRACE4 CFWARP_WAN4 + local IP_RESULT4=$(ip_info 4 CloudflareWARP) + CFWARP_TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*') + CFWARP_WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*') + CFWARP_COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CFWARP_COUNTRY4_ZH=$(translate "$CFWARP_COUNTRY4") + [ -n "$CFWARP_COUNTRY4_ZH" ] && CFWARP_COUNTRY4="$CFWARP_COUNTRY4_ZH" + CFWARP_ASNORG4=$(expr "$IP_RESULT4" : '.*asnorg=\([^@]*\).*') + ;; + 6 ) unset IP_RESULT6 CFWARP_COUNTRY6 CFWARP_ASNORG6 CFWARP_TRACE6 CFWARP_WAN6 + local IP_RESULT6=$(ip_info 6 CloudflareWARP) + CFWARP_TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*') + CFWARP_WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*') + CFWARP_COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CFWARP_COUNTRY6_ZH=$(translate "$CFWARP_COUNTRY6") + [ -n "$CFWARP_COUNTRY6_ZH" ] && CFWARP_COUNTRY6="$CFWARP_COUNTRY6_ZH" + CFWARP_ASNORG6=$(expr "$IP_RESULT6" : '.*asnorg=\([^@]*\).*') + ;; + d ) unset IP_RESULT4 CFWARP_COUNTRY4 CFWARP_ASNORG4 CFWARP_TRACE4 CFWARP_WAN4 IP_RESULT6 CFWARP_COUNTRY6 CFWARP_ASNORG6 CFWARP_TRACE6 CFWARP_WAN6 + local IP_RESULT4=$(ip_info 4 CloudflareWARP) + CFWARP_TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*') + CFWARP_WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*') + CFWARP_COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CFWARP_COUNTRY4_ZH=$(translate "$CFWARP_COUNTRY4") + [ -n "$CFWARP_COUNTRY4_ZH" ] && CFWARP_COUNTRY4="$CFWARP_COUNTRY4_ZH" + CFWARP_ASNORG4=$(expr "$IP_RESULT4" : '.*asnorg=\([^@]*\).*') + local IP_RESULT6=$(ip_info 6 CloudflareWARP) + CFWARP_TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*') + CFWARP_WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*') + CFWARP_COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*') + [ "$L" = C ] && CFWARP_COUNTRY6_ZH=$(translate "$CFWARP_COUNTRY6") + [ -n "$CFWARP_COUNTRY6_ZH" ] && CFWARP_COUNTRY6="$CFWARP_COUNTRY6_ZH" + CFWARP_ASNORG6=$(expr "$IP_RESULT6" : '.*asnorg=\([^@]*\).*') + ;; + esac + elif [ -z "$CHECK_TYPE" ]; then + case "$CHECK_46" in + 4 ) unset IP_RESULT4 COUNTRY4 ASNORG4 TRACE4 + local IP_RESULT4=$(ip_info 4) + TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*') + WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*') + COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*') + [ "$L" = C ] && COUNTRY4_ZH=$(translate "$COUNTRY4") + [ -n "$COUNTRY4_ZH" ] && COUNTRY4="$COUNTRY4_ZH" + ASNORG4=$(expr "$IP_RESULT4" : '.*asnorg=\([^@]*\).*') + ;; + 6 ) unset IP_RESULT6 COUNTRY6 ASNORG6 TRACE6 + local IP_RESULT6=$(ip_info 6) + TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*') + WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*') + COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*') + [ "$L" = C ] && COUNTRY6_ZH=$(translate "$COUNTRY6") + [ -n "$COUNTRY6_ZH" ] && COUNTRY6="$COUNTRY6_ZH" + ASNORG6=$(expr "$IP_RESULT6" : '.*asnorg=\([^@]*\).*') + ;; + d ) unset IP_RESULT4 COUNTRY4 ASNORG4 TRACE4 IP_RESULT6 COUNTRY6 ASNORG6 TRACE6 + local IP_RESULT4=$(ip_info 4) + TRACE4=$(expr "$IP_RESULT4" : '.*trace=\([^@]*\).*') + WAN4=$(expr "$IP_RESULT4" : '.*ip=\([^@]*\).*') + COUNTRY4=$(expr "$IP_RESULT4" : '.*country=\([^@]*\).*') + [ "$L" = C ] && COUNTRY4_ZH=$(translate "$COUNTRY4") + [ -n "$COUNTRY4_ZH" ] && COUNTRY4="$COUNTRY4_ZH" + ASNORG4=$(expr "$IP_RESULT4" : '.*asnorg=\([^@]*\).*') + local IP_RESULT6=$(ip_info 6) + TRACE6=$(expr "$IP_RESULT6" : '.*trace=\([^@]*\).*') + WAN6=$(expr "$IP_RESULT6" : '.*ip=\([^@]*\).*') + COUNTRY6=$(expr "$IP_RESULT6" : '.*country=\([^@]*\).*') + [ "$L" = C ] && COUNTRY6_ZH=$(translate "$COUNTRY6") + [ -n "$COUNTRY6_ZH" ] && COUNTRY6="$COUNTRY6_ZH" + ASNORG6=$(expr "$IP_RESULT6" : '.*asnorg=\([^@]*\).*') + ;; + esac fi } @@ -627,7 +712,7 @@ result_priority() { # 更换 Netflix IP 时确认期望区域 input_region() { [ -n "$NF" ] && REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -$NF -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") - [ -n "$WIREPROXY_PORT" ] && REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -sx socks5h://localhost:$WIREPROXY_PORT -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") + [ -n "$WIREPROXY_PORT" ] && REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -sx socks5://127.0.0.1:$WIREPROXY_PORT -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") [ -n "$INTERFACE" ] && REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" $INTERFACE -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") REGION=${REGION:-'US'} reading " $(text_eval 56) " EXPECT @@ -639,6 +724,11 @@ input_region() { # 更换支持 Netflix WARP IP 改编自 [luoxue-bot] 的成熟作品,地址[https://github.com/luoxue-bot/warp_auto_change_ip] change_ip() { + change_stack() { + hint "\n $(text 124) \n" && reading " $(text 50) " NETFLIX + NF='4' && [ "$NETFLIX" = 2 ] && NF='6' + } + change_wgcf() { wgcf_restart() { warning " $(text_eval 126) " && ${SYSTEMCTL_RESTART[int]}; ss -nltp | grep dnsmasq >/dev/null 2>&1 && systemctl restart dnsmasq >/dev/null 2>&1; sleep $j; } unset T4 T6 @@ -647,8 +737,7 @@ change_ip() { case "$T4$T6" in 01 ) NF='6' ;; 10 ) NF='4' ;; - 11 ) hint "\n $(text 124) \n" && reading " $(text 50) " NETFLIX - NF='4' && [ "$NETFLIX" = 2 ] && NF='6' ;; + 11 ) change_stack ;; esac [ -z "$EXPECT" ] && input_region @@ -657,8 +746,7 @@ change_ip() { (( i++ )) || true ip_now=$(date +%s); RUNTIME=$((ip_now - ip_start)); DAY=$(( RUNTIME / 86400 )); HOUR=$(( (RUNTIME % 86400 ) / 3600 )); MIN=$(( (RUNTIME % 86400 % 3600) / 60 )); SEC=$(( RUNTIME % 86400 % 3600 % 60 )) ip_case "$NF" - WAN=$(eval echo \$WAN$NF) && ASNORG=$(eval echo \$ASNORG$NF) - [ "$L" = C ] && COUNTRY=$(translate "$(eval echo \$COUNTRY$NF)") || COUNTRY=$(eval echo \$COUNTRY$NF) + WAN=$(eval echo \$WAN$NF) && COUNTRY=$(eval echo \$COUNTRY$NF) && ASNORG=$(eval echo \$ASNORG$NF) unset RESULT REGION for ((l=0; l<${#RESULT_TITLE[@]}; l++)); do RESULT[l]=$(curl --user-agent "${UA_Browser}" -$NF -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/${RESULT_TITLE[l]}") @@ -684,22 +772,24 @@ change_ip() { sleep $j [ "$CLIENT_PROXY" != 1 ] && rule_add >/dev/null 2>&1 } - + + change_stack + if [[ $(warp-cli --accept-tos settings) =~ WarpProxy ]]; then [ -z "$EXPECT" ] && input_region i=0; j=10 while true; do (( i++ )) || true ip_now=$(date +%s); RUNTIME=$((ip_now - ip_start)); DAY=$(( RUNTIME / 86400 )); HOUR=$(( (RUNTIME % 86400 ) / 3600 )); MIN=$(( (RUNTIME % 86400 % 3600) / 60 )); SEC=$(( RUNTIME %86400 % 3600 % 60 )) - ip_case 4 client - WAN=$CLIENT_WAN4 && ASNORG=$CLIENT_ASNORG4 && NF=4 && COUNTRY=$CLIENT_COUNTRY4 + ip_case "$NF" client + WAN=$(eval echo "\$CLIENT_WAN$NF") && ASNORG=$(eval echo "\$CLIENT_ASNORG$NF") && COUNTRY=$(eval echo "\$CLIENT_COUNTRY$NF") unset RESULT REGION for ((l=0; l<${#RESULT_TITLE[@]}; l++)); do - RESULT[l]=$(curl --user-agent "${UA_Browser}" -sx socks5h://localhost:$CLIENT_PORT -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/${RESULT_TITLE[l]}") + RESULT[l]=$(curl --user-agent "${UA_Browser}" -"$NF" -sx socks5://127.0.0.1:$CLIENT_PORT -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/${RESULT_TITLE[l]}") [ "${RESULT[l]}" = 200 ] && break done if [[ "${RESULT[@]}" =~ 200 ]]; then - REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -sx socks5h://localhost:$CLIENT_PORT -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") + REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -"$NF" -sx socks5://127.0.0.1:$CLIENT_PORT -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") REGION=${REGION:-'US'} echo "$REGION" | grep -qi "$EXPECT" && info " $(text_eval 125) " && i=0 && sleep 1h || client_restart else @@ -708,15 +798,13 @@ change_ip() { done else - INTERFACE='--interface CloudflareWARP' [ -z "$EXPECT" ] && input_region i=0; j=10 while true; do (( i++ )) || true ip_now=$(date +%s); RUNTIME=$((ip_now - ip_start)); DAY=$(( RUNTIME / 86400 )); HOUR=$(( (RUNTIME % 86400 ) / 3600 )); MIN=$(( (RUNTIME % 86400 % 3600) / 60 )); SEC=$(( RUNTIME % 86400 % 3600 % 60 )) - ip_case 4 luban - WAN=$WAN4 && ASNORG=$ASNORG4 && NF=4 - [ "$L" = C ] && COUNTRY=$(translate "$COUNTRY4") || COUNTRY=$COUNTRY4 + ip_case "$NF" luban + WAN=$(eval echo "\$CFWARP_WAN$NF") && COUNTRY=$(eval echo "\$CFWARP_COUNTRY$NF") && ASNORG=$(eval echo "\$CFWARP_ASNORG$NF") unset RESULT REGION for ((l=0; l<${#RESULT_TITLE[@]}; l++)); do RESULT[l]=$(curl --user-agent "${UA_Browser}" $INTERFACE -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/${RESULT_TITLE[l]}") @@ -746,11 +834,11 @@ change_ip() { WAN=$CLIENT_WAN4 && ASNORG=$CLIENT_COUNTRY4 && COUNTRY=$CLIENT_COUNTRY4 unset RESULT REGION for ((l=0; l<${#RESULT_TITLE[@]}; l++)); do - RESULT[l]=$(curl --user-agent "${UA_Browser}" -sx socks5h://localhost:$WIREPROXY_PORT -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/${RESULT_TITLE[l]}") + RESULT[l]=$(curl --user-agent "${UA_Browser}" -sx socks5://127.0.0.1:$WIREPROXY_PORT -fsL --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/${RESULT_TITLE[l]}") [ "${RESULT[l]}" = 200 ] && break done if [[ "${RESULT[@]}" =~ 200 ]]; then - REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -sx socks5h://localhost:$WIREPROXY_PORT -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") + REGION=$(tr 'a-z' 'A-Z' <<< "$(curl --user-agent "${UA_Browser}" -sx socks5://127.0.0.1:$WIREPROXY_PORT -fs --max-time 10 --write-out "%{redirect_url}" --output /dev/null "https://www.netflix.com/title/$REGION_TITLE" | sed 's/.*com\/\([^-/]\{1,\}\).*/\1/g')") REGION=${REGION:-'US'} echo "$REGION" | grep -qi "$EXPECT" && info " $(text_eval 125) " && i=0 && sleep 1h || wireproxy_restart else @@ -895,7 +983,7 @@ uninstall() { # 显示卸载结果 systemctl restart systemd-resolved >/dev/null 2>&1; sleep 3 - ip_case 4; ip_case 6 + ip_case d info " $(text 45)\n IPv4: $WAN4 $COUNTRY4 $ASNORG4\n IPv6: $WAN6 $COUNTRY6 $ASNORG6 " } @@ -924,13 +1012,13 @@ net() { ${SYSTEMCTL_START[int]} >/dev/null 2>&1 wg-quick up wgcf >/dev/null 2>&1 ss -nltp | grep dnsmasq >/dev/null 2>&1 && systemctl restart dnsmasq >/dev/null 2>&1 - ip_case 4; ip_case 6 + ip_case d until [[ "$TRACE4$TRACE6" =~ on|plus && -z "$CONFIRM_TEAMS_INFO" ]]; do (( i++ )) || true hint " $(text_eval 12) " ${SYSTEMCTL_RESTART[int]} >/dev/null 2>&1 ss -nltp | grep dnsmasq >/dev/null 2>&1 && systemctl restart dnsmasq >/dev/null 2>&1 - ip_case 4; ip_case 6 + ip_case d # 如果 teams 升级状态,但多次未成功获取 warp IP ,将换回普通账户,如果成功,删除临时文件 if [[ "$CONFIRM_TEAMS_INFO" = [Yy] ]]; then if [[ "$TRACE4$TRACE6" =~ plus ]]; then @@ -951,7 +1039,7 @@ net() { [ -e /etc/wireguard/wgcf.conf.bak ] && rm -f /etc/wireguard/wgcf.conf.bak [[ "$TRACE4$TRACE6" =~ on|plus ]] && [ -e /etc/wireguard/info.log ] && TYPE=' Teams' && grep -sq 'Device name' /etc/wireguard/info.log && TYPE='+' && check_quota warp info " $(text_eval 14) " - [[ $OPTION = [on] ]] && info " IPv4:$WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4\n IPv6:$WAN6 $WARPSTATUS6 $COUNTRY6 $ASNORG6 " + [[ $OPTION = [on] ]] && info " IPv4:$WAN4 $COUNTRY4 $ASNORG4\n IPv6:$WAN6 $COUNTRY6 $ASNORG6 " } # WARP 开关,先检查是否已安装,再根据当前状态转向相反状态 @@ -970,20 +1058,19 @@ client_onoff() { else systemctl start warp-svc; sleep 2 if [[ $(warp-cli --accept-tos settings) =~ WarpProxy ]]; then - ip_case 4 client + ip_case d client CLIENT_ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) [[ $CLIENT_ACCOUNT =~ Limited ]] && CLIENT_AC='+' && check_quota client - [[ $(ss -nltp | awk '{print $NF}' | awk -F \" '{print $2}') =~ warp-svc ]] && info " $(text 90)\n $(text 27): $CLIENT_SOCKS5\n WARP$CLIENT_AC IPv4: $CLIENT_WAN4 $CLIENT_COUNTRY4 $CLIENT_ASNORG4 " + [[ $(ss -nltp | awk '{print $NF}' | awk -F \" '{print $2}') =~ warp-svc ]] && info " $(text 90)\n $(text 27): $CLIENT_SOCKS5\n WARP$CLIENT_AC IPv4: $CLIENT_WAN4 $CLIENT_COUNTRY4 $CLIENT_ASNORG4\n WARP$CLIENT_AC IPv6: $CLIENT_WAN6 $CLIENT_COUNTRY6 $CLIENT_ASNORG6 " [ -n "$QUOTA" ] && info " $(text 63): $QUOTA " exit 0 else rule_add >/dev/null 2>&1 - ip_case 4 luban - [[ "$L" = C && -n "$COUNTRY4" ]] && COUNTRY4=$(translate "$COUNTRY4") + ip_case d luban CLIENT_ACCOUNT=$(warp-cli --accept-tos account 2>/dev/null) [[ $CLIENT_ACCOUNT =~ Limited ]] && CLIENT_AC='+' && check_quota client - [[ $(ip link show | awk -F': ' '{print $2}') =~ CloudflareWARP ]] && info " $(text 90)\n WARP$CLIENT_AC IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4 " + [[ $(ip link show | awk -F': ' '{print $2}') =~ CloudflareWARP ]] && info " $(text 90)\n WARP$CLIENT_AC IPv4: $CFWARP_WAN4 $CFWARP_COUNTRY4 $CFWARP_ASNORG4\n WARP$CLIENT_AC IPv6: $CFWARP_WAN6 $CFWARP_COUNTRY6 $CFWARP_ASNORG6 " [ -n "$QUOTA" ] && info " $(text 63): $QUOTA " exit 0 fi @@ -1000,7 +1087,7 @@ wireproxy_onoff() { else systemctl start wireproxy sleep 1 && ip_case 4 wireproxy - [[ $(ss -nltp | awk '{print $NF}' | awk -F \" '{print $2}') =~ wireproxy ]] && info " $(text 99)\n $(text 27): $WIREPROXY_SOCKS5\n WARP$WIREPROXY_ACCOUNT IPv4: $WIREPROXY_WAN4 $WIREPROXY_COUNTRY4 " + [[ $(ss -nltp | awk '{print $NF}' | awk -F \" '{print $2}') =~ wireproxy ]] && info " $(text 99)\n $(text 27): $WIREPROXY_SOCKS5\n WARP$WIREPROXY_ACCOUNT IPv4: $WIREPROXY_WAN4 $WIREPROXY_COUNTRY4 $WIREPROXY_ASNORG4" [ -n "$QUOTA" ] && info " $(text 25): $(grep 'Device name' /etc/wireguard/info.log | awk '{ print $NF }')\n $(text 63): $QUOTA " fi } @@ -1111,9 +1198,9 @@ EOF CLIENT=1 && CLIENT_INSTALLED="$(text 92)" [[ $(systemctl is-active warp-svc 2>/dev/null) = active || $(systemctl is-enabled warp-svc 2>/dev/null) = enabled ]] && CLIENT=2 if [[ $(warp-cli --accept-tos settings) =~ WarpProxy ]]; then - [ "$CLIENT" = 2 ] && CLIENT_MODE='Proxy' && [[ $(ss -nltp | awk '{print $NF}' | awk -F \" '{print $2}') =~ warp-svc ]] && CLIENT=3 && ip_case 4 client + [ "$CLIENT" = 2 ] && CLIENT_MODE='Proxy' && [[ $(ss -nltp | awk '{print $NF}' | awk -F \" '{print $2}') =~ warp-svc ]] && CLIENT=3 && ip_case d client else - [ "$CLIENT" = 2 ] && CLIENT_MODE='WARP' && [[ $(ip link show | awk -F': ' '{print $2}') =~ CloudflareWARP ]] && CLIENT=5 && ip_case 4 luban + [ "$CLIENT" = 2 ] && CLIENT_MODE='WARP' && [[ $(ip link show | awk -F': ' '{print $2}') =~ CloudflareWARP ]] && CLIENT=5 && ip_case d luban fi fi @@ -1129,11 +1216,16 @@ rule_add() { ip -4 rule add from 172.16.0.2 lookup 51820 ip -4 route add default dev CloudflareWARP table 51820 ip -4 rule add table main suppress_prefixlength 0 + ip -6 rule add oif CloudflareWARP lookup 51820 + ip -6 route add default dev CloudflareWARP table 51820 + ip -6 rule add table main suppress_prefixlength 0 } rule_del() { ip -4 rule delete from 172.16.0.2 lookup 51820 ip -4 rule delete table main suppress_prefixlength 0 + ip -6 rule delete oif CloudflareWARP lookup 51820 + ip -6 rule delete table main suppress_prefixlength 0 } # 替换为 Teams 账户信息, 升级为 teams 的标志为 CONFIRM_TEAMS_INFO = [Yy] @@ -1815,8 +1907,8 @@ EOF # 结果提示,脚本运行时间,次数统计 end=$(date +%s) echo -e "\n==============================================================\n" - info " IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4 " - info " IPv6: $WAN6 $WARPSTATUS6 $COUNTRY6 $ASNORG6 " + info " IPv4: $WAN4 $COUNTRY4 $ASNORG4 " + info " IPv6: $WAN6 $COUNTRY6 $ASNORG6 " info " $(text_eval 41) " && [ -n "$QUOTA" ] && info " $(text_eval 133) " info " $PRIORITY_NOW " echo -e "\n==============================================================\n" @@ -1837,7 +1929,7 @@ client_install() { [[ "$CLIENT_ACCOUNT" =~ Limited ]] && TYPE='+' && echo "$LICENSE" > /etc/wireguard/license && info " $(text_eval 62) " || warning " $(text_eval 36) " ) if [ "$LUBAN" = 1 ]; then - i=1; j=5; INTERFACE='--interface CloudflareWARP' + i=1; j=5 hint " $(text_eval 11)\n $(text_eval 12) " warp-cli --accept-tos add-excluded-route 0.0.0.0/0 >/dev/null 2>&1 warp-cli --accept-tos add-excluded-route ::0/0 >/dev/null 2>&1 @@ -1847,8 +1939,8 @@ client_install() { warp-cli --accept-tos enable-always-on >/dev/null 2>&1 sleep 5 rule_add >/dev/null 2>&1 - ip_case 4 luban - until [ -n "$WAN4" ]; do + ip_case d luban + until [[ -n "$CFWARP_WAN4" && -n "$CFWARP_WAN6" ]]; do (( i++ )) || true hint " $(text_eval 12) " warp-cli --accept-tos disconnect >/dev/null 2>&1 @@ -1859,7 +1951,7 @@ client_install() { warp-cli --accept-tos enable-always-on >/dev/null 2>&1 sleep 5 rule_add >/dev/null 2>&1 - ip_case 4 luban + ip_case d luban if [ "$i" = "$j" ]; then warp-cli --accept-tos disconnect >/dev/null 2>&1 warp-cli --accept-tos disable-always-on >/dev/null 2>&1 @@ -1881,7 +1973,6 @@ client_install() { # 禁止安装的情况。重复安装,非 AMD64 CPU 架构 [ "$CLIENT" -ge 2 ] && error " $(text 85) " [ "$ARCHITECTURE" != amd64 ] && error " $(text_eval 101) " -# [ "$TRACE4" != off ] && error " $(text 95) " # 安装 WARP Linux Client [[ "$SYSTEM" = 'CentOS' && "$(expr "$SYS" : '.*\s\([0-9]\{1,\}\)\.*')" -le 7 ]] && error " $(text_eval 145) " @@ -1924,13 +2015,13 @@ client_install() { if [ "$LUBAN" = 1 ]; then end=$(date +%s) echo -e "\n==============================================================\n" - info " $(text_eval 94)\n WARP$CLIENT_AC IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4 " + info " $(text_eval 94)\n WARP$CLIENT_AC IPv4: $CFWARP_WAN4 $CFWARP_COUNTRY4 $CFWARP_ASNORG4\n WARP$CLIENT_AC IPv6: $CFWARP_WAN6 $CFWARP_COUNTRY6 $CFWARP_ASNORG6 " else - ip_case 4 client + ip_case d client end=$(date +%s) echo -e "\n==============================================================\n" - info " $(text_eval 94)\n $(text 27): $CLIENT_SOCKS5\n WARP$CLIENT_AC IPv4: $CLIENT_WAN4 $CLIENT_COUNTRY4 $CLIENT_ASNORG4 " + info " $(text_eval 94)\n $(text 27): $CLIENT_SOCKS5\n WARP$CLIENT_AC IPv4: $CLIENT_WAN4 $CLIENT_COUNTRY4 $CLIENT_ASNORG4\n WARP$CLIENT_AC IPv6: $CLIENT_WAN6 $CLIENT_COUNTRY6 $CLIENT_ASNORG6 " fi [[ "$CLIENT_ACCOUNT" =~ Limited ]] && info " $(text 63): $QUOTA " @@ -2010,9 +2101,8 @@ change_to_free() { sleep 2 if [ "$CLIENT_PROXY" != 1 ]; then rule_add >/dev/null 2>&1 - ip_case 4 luban - [ "$L" = C ] && COUNTRY4=$(translate "$COUNTRY4") - info " WARP$CLIENT_AC IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4\n $(text_eval 62) " + ip_case d luban + info " WARP$CLIENT_AC IPv4: $CFWARP_WAN4 $CFWARP_COUNTRY4 $CFWARP_ASNORG4\nWARP$CLIENT_AC IPv6: $CFWARP_WAN6 $CFWARP_COUNTRY6 $CFWARP_ASNORG6\n $(text_eval 62) " else ip_case 4 wireproxy info " $(text 27): $WIREPROXY_SOCKS5\n WARP$CLIENT_AC IPv4: $WIREPROXY_WAN4 $WIREPROXY_COUNTRY4 $WIREPROXY_ASNORG4\n $(text_eval 62) " @@ -2070,10 +2160,9 @@ change_to_plus() { unset AC && TYPE=' free' && [[ "$CLIENT_ACCOUNT" =~ Limited ]] && CLIENT_AC='+' && TYPE='+' && echo "$LICENSE" > /etc/wireguard/license && check_quota client if [ "$CLIENT_PROXY" != 1 ]; then rule_add >/dev/null 2>&1 - ip_case 4 luban - [ "$L" = C ] && COUNTRY4=$(translate "$COUNTRY4") + ip_case d luban [ "$TYPE" = '+' ] && CLIENT_PLUS="$(text 63): $QUOTA" - info " WARP$CLIENT_AC IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4\n $(text_eval 62)\n $CLIENT_PLUS \n" + info " WARP$CLIENT_AC IPv4: $CFWARP_WAN4 $CFWARP_COUNTRY4 $CFWARP_ASNORG4\n WARP$CLIENT_AC IPv6: $CFWARP_WAN6 $CFWARP_COUNTRY6 $CFWARP_ASNORG6\n $(text_eval 62)\n $CLIENT_PLUS \n" else ip_case 4 wireproxy [ "$TYPE" = '+' ] && CLIENT_PLUS="$(text 63): $QUOTA" @@ -2160,7 +2249,7 @@ change_to_teams() { sed -i "s#PrivateKey.*#PrivateKey = $PRIVATEKEY#g" /etc/wireguard/proxy.conf [ -e /etc/wireguard/info-temp.log ] && mv -f /etc/wireguard/info-temp.log /etc/wireguard/info.log wireproxy_onoff - [[ $(eval echo "\$(curl -sx socks5h://localhost:$(ss -nltp | grep wireproxy | awk '{print $(NF-2)}' | cut -d: -f2) https://www.cloudflare.com/cdn-cgi/trace)") =~ plus ]] && rm -f /etc/wireguard/wgcf.conf.bak && TYPE=' teams' && info " $(text_eval 62) " + [[ $(eval echo "\$(curl -sx socks5://127.0.0.1:$(ss -nltp | grep wireproxy | awk '{print $(NF-2)}' | cut -d: -f2) https://www.cloudflare.com/cdn-cgi/trace)") =~ plus ]] && rm -f /etc/wireguard/wgcf.conf.bak && TYPE=' teams' && info " $(text_eval 62) " fi fi } @@ -2327,8 +2416,8 @@ menu() { hint " $(text 16) " echo -e "======================================================================================================================\n" info " $(text 17):$VERSION\n $(text 18):$(text 1)\n $(text 19):\n\t $(text 20):$SYS\n\t $(text 21):$(uname -r)\n\t $(text 22):$ARCHITECTURE\n\t $(text 23):$VIRT " - info "\t IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4 " - info "\t IPv6: $WAN6 $WARPSTATUS6 $COUNTRY6 $ASNORG6 " + info "\t IPv4: $WAN4 $COUNTRY4 $ASNORG4 " + info "\t IPv6: $WAN6 $COUNTRY6 $ASNORG6 " case "$TRACE4$TRACE6" in *plus* ) info "\t $(text_eval 114)\t $PLUSINFO " ;; *on* ) info "\t $(text 115) " ;; @@ -2337,13 +2426,13 @@ menu() { case "$CLIENT" in 0 ) info "\t $(text 112) " ;; 1 ) info "\t $(text_eval 113) " ;; - 3 ) info "\t WARP$CLIENT_AC $(text 24)\t $(text 27): $CLIENT_SOCKS5\n\t WARP$CLIENT_AC IPv4: $CLIENT_WAN4 $CLIENT_COUNTRY4 $CLIENT_ASNORG4 " ;; - 5 ) info "\t WARP$CLIENT_AC $(text 24)\t WARP$CLIENT_AC IPv4: $WAN4 $WARPSTATUS4 $COUNTRY4 $ASNORG4 " ;; + 3 ) info "\t WARP$CLIENT_AC $(text 24)\t $(text 27): $CLIENT_SOCKS5\n\t WARP$CLIENT_AC IPv4: $CLIENT_WAN4 $CLIENT_COUNTRY4 $CLIENT_ASNORG4\n\t WARP$CLIENT_AC IPv6: $CLIENT_WAN6 $CLIENT_COUNTRY6 $CLIENT_ASNORG6 " ;; + 5 ) info "\t WARP$CLIENT_AC $(text 24)\t $(text 58)\n\t WARP$CLIENT_AC IPv4: $CFWARP_WAN4 $CFWARP_COUNTRY4 $CFWARP_ASNORG4\n\t WARP$CLIENT_AC IPv6: $CFWARP_WAN6 $CFWARP_COUNTRY6 $CFWARP_ASNORG6 " ;; esac case "$WIREPROXY" in 0 ) info "\t $(text 160) " ;; 1 ) info "\t $(text 161) " ;; - 2 ) info "\t WARP$WIREPROXY_ACCOUNT $(text 159)\t $(text 27): $WIREPROXY_SOCKS5\n\t WARP$WIREPROXY_ACCOUNT IPv4: $WIREPROXY_WAN4 $WIREPROXY_COUNTRY4 $WIREPROXY_COUNTRY4 " ;; + 2 ) info "\t WARP$WIREPROXY_ACCOUNT $(text 159)\t $(text 27): $WIREPROXY_SOCKS5\n\t WARP$WIREPROXY_ACCOUNT IPv4: $WIREPROXY_WAN4 $WIREPROXY_COUNTRY4 $WIREPROXY_ASNORG4 " ;; esac grep -q '+' <<< $AC$WIREPROXY_ACCOUNT && info "\t $(text 63): $QUOTA " echo -e "\n======================================================================================================================\n"