v3.1.0 Update the method of upgrading Teams and Warp Api.

This commit is contained in:
fs carmen
2024-07-20 16:55:40 +00:00
parent 70cd6660a3
commit c92d6404e6
3 changed files with 361 additions and 317 deletions
+234 -264
View File
@@ -10,19 +10,18 @@
- [warp 运行脚本](README.md#warp-运行脚本)
- [warp-go 运行脚本](README.md#warp-go-运行脚本)
- [Cloudflare api](README.md#cloudflare-api)
- [通过 warp 解锁 chatGPT 的方法](README.md#通过-warp-解锁-chatgpt-的方法)
- [刷 Netflix 解锁 WARP IP 的方法](README.md#刷-Netflix-解锁-WARP-IP-的方法)
- [指定网站分流到 "socks5" 的 xray 配置模板 (适用于 WARP Client Proxy 和 WireProxy)](README.md#指定网站分流到-socks5-的-xray-配置模板-适用于-warp-client-proxy-和-wireproxy)
- [指定网站分流到 "interface" 的 xray 配置模板 (适用于 WARP Client Warp 和 warp / warp-go 非全局)](README.md#指定网站分流到-interface-的-xray-配置模板适用于-warp-client-warp-和-warp--warp-go-非全局)
- [WARP socks5 或 interface 分流模板及解锁 chatGPT 的方法](README.md#warp-socks5-或-interface-分流模板及解锁-chatgpt-的方法)
- [WARP+ License 及 ID 获取](README.md#warp-license-及-id-获取)
- [WARP Teams 获取并用于 Linux 的方法](README.md#WARP-Teams-获取并用于-Linux-的方法)
- [WARP 网络接口数据,临时、永久关闭和开启](README.md#warp-网络接口数据临时永久关闭和开启)
- [WARP原理](README.md#WARP原理)
- [鸣谢 WARP 贡献者和 CloudFlare WARP 全球站点服务状态列表](README.md#鸣谢下列作者的文章和项目)
* * *
## 更新信息
2024.7.18 menu.sh 3.1.0 / warp-go.sh v1.2.0 1. Use self-built warp api: https://warp.cloudflare.now.cc/ to upgrade to Teams account, no need to prepare Token in advance, only need to enter organization, email and verification code when the script is running to complete, the efficiency is greatly increased; 2. Because the Client's settings need to be set up in the Cloudflare dashboard, which can cause the vps to lose contact if not handled properly, the Client's is not upgraded to a Teams account, and the user can look up the information to set it up on their own; 1. 使用自建 warp api: https://warp.cloudflare.now.cc/ ,升级为 Teams 账户,不需要提前获取 Token,只须在脚本运行的时候输入组织名、邮箱和验证码即可完成,效率大增; 2. 由于 Client 的设置需要到 Cloudflare 控制后台设置,处理不好会导致 vps 失去联系,所以 Client 并没有升级为 Teams 账户的处理,用户可自行查资料设置
2024.7.8 menu.sh v3.0.10 / warp-go.sh v1.1.9 1. Publish warp api, you can register account, join Zero Trust, check account information and all other operations. Detailed instructions: https://warp.cloudflare.now.cc/ ; 2. Scripts to update the warp api; 1. 发布 warp api,可以注册账户,加入 Zero Trust,查账户信息等所有的操作。详细使用说明: https://warp.cloudflare.now.cc/; 2. 脚本更新 warp api
2024.6.30 menu.sh v3.0.9 1. By multithreading, parallel processing of optimal MTU, optimal endpoint, downloading wireguard-go and installing dependencies, the script runtime is reduced by more than half; 2. Reverse proxy http://ip-api.com/json and https://hits.seeyoufarm.com with cloudflare worker for better dual-stack support and faster fetching; 3. DNS Priority: Cloudflare 1.1.1.1 > Google 8.8.8.8; 1. 通过多线程,并行处理最优 MTU,最优 endpoint,下载 wireguard-go 和安装依赖, 脚本运行时间缩短一半以上; 2. 用 Cloudflare worker 反向代理 http://ip-api.com/json 和 https://hits.seeyoufarm.com,以更好支持双栈及提升获取速度; 3. DNS 优先级: Cloudflare 1.1.1.1 > Google 8.8.8.8
@@ -66,7 +65,7 @@
>2023.5.15 Cloudflare api
>Thanks to badafans open source project and patient guidance. Now released in linux using the Cloudflare WARP api. [badafans open source project](https://github.com/badafans/warp-reg)
>Use method
>感谢大神 badafans的开源项目及耐心指导,现发布在linux下使用的Cloudflare WARP api[badafans的开源项目](https://github.com/badafans/warp-reg)
>感谢大神 badafans的开源项目及耐心指导,现发布在linux下使用的Cloudflare WARP api[badafans的开源项目](https://github.com/badafans/warp-reg)
>使用方法
>```
>wget -N https://gitlab.com/fscarmen/warp/-/raw/main/api.sh && bash api.sh [option]
@@ -82,7 +81,7 @@
>
>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`
>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 系统
>
@@ -94,7 +93,7 @@
>
>2022.10.6 menu V2.45 1. Further improve the conversion function between accounts. You can even switch from one WARP+ to another; 2. Rebuild the account registration module; 1. 进一步完善账户间转换功能,你甚至可以从一个 WARP+ 换到另一个; 2. 重构账户注册模块
>
>2022.9.10 Over 2,000 users star. Thank you to every solution creator. I'm just passing these on more widely to serve more players. Thank you to each user for your continued support. I wish you all good health and Happy Mid-Autumn Festival!
>2022.9.10 Over 2,000 users star. Thank you to every solution creator. I'm just passing these on more widely to serve more players. Thank you to each user for your continued support. I wish you all good health and Happy Mid-Autumn Festival!
>项目 star 达 2000。感谢每位解决方案创造者。我只是把这些作更广泛的传递,服务更多玩家。感谢各用户一如既往的支持。祝大家身体健康,中秋节快乐!
>
>2022.8.29 warp-go V1.0.6 1.Fixed the bug that routing rules failed after restart in non-global mode; 2.Fixed the bug of not changing IP; 1.解决了非全局模式重启后,路由规则失效的bug; 2.解决了更换不了IP的bug
@@ -136,7 +135,7 @@
>2022.4.21 WARP one-click script on macOS. A VPN that fast,modern,secure by WireGuard tunnel and WARP service 全网首发: macOS 一键脚本, 一个为免费、快速、安全的>基于 WireGuard 隧道,WARP 服务的 VPN。你可以理解为白嫖 CloudFlare 的科学服务了,也不需要服务器。
>
>项目地址: https://github.com/fscarmen/warp/tree/main/pc
>
>
>2022.4.8 2.37 1. First publication on a global scale: After WirePorxy, another major technological breakthrough -- WARP-Cli's WARP mode solution. Thanks >to the original creator -- Teacher LUBAN. It solves two major pain points: 1) The instability of the traditional proxy model; 2) Currently HK does not >have a WARP service; 1. 全网首发: 继 WirePorxy 之后,又一重大技术突破,WARP-Cli 的 WARP 模式方案,感谢原创者 LUBAN 老师,引用大神的思路,解决两大通点: 1) 传统 proxy 模式的>断流和慢; 2) 解决 HK 没有 WARP 服务
>
>2022.3.27 2.36 1. First publication on a global scale. By WireProxy, Wireguard client that exposes itself as a socks5 proxy; Ths Fangliding for the >information:[#113](https://github.com/fscarmen/warp/issues/113); 2. WARP+ and Teams can be used in WireProxy; 3. Systemd and change Netflix IP for >WireProxy. 1. 全网首发: 通过 wireproxy,让 WARP 在本地建议一个 socks5 代理。感谢风扇滑翔翼 提供的资讯:[#113](https://github.com/fscarmen/warp/issues/113); 2. WARP+ >和 Teams 账户可用于 WireProxy 安装或者升级; 3. WireProxy systemd 进程守护,同时支持更换 Netflix IP
@@ -151,7 +150,7 @@
>
>2022.2.25 2.32: 1.Change the WARP endpoint; 2. Sync the Netflix title with lmc999; 1.更换 WARP 的 endpoint; 2. 同步 lmc999 的 Netflix 检测 title
>
>2022.2.15 Happy Lantern Festival. Bring you a new experience of docker unlock, another way to unlock Netflix. Project based on alpine, content wgcf and >unblocking Netflix scripts. Change unlock warp ip automatically. 元宵节快乐。为大家带来个 docker 解锁的全新体验,换个姿势解锁 Netflix。项目以 alpine 为基础系统,内含 >wgcf 和解锁 Netflix 脚本,自动切换解锁 WARP IP
>2022.2.15 Happy Lantern Festival. Bring you a new experience of docker unlock, another way to unlock Netflix. Project based on alpine, content wgcf and >unblocking Netflix scripts. Change unlock warp ip automatically. 元宵节快乐。为大家带来个 docker 解锁的全新体验,换个姿势解锁 Netflix。项目以 alpine 为基础系统,内含 >wgcf 和解锁 Netflix 脚本,自动切换解锁 WARP IP
>https://github.com/fscarmen/unlock_warp
>
>2022.2.11 2.31: 1.iptables + dnsmasq + ipset to unlock stream media. (Not available for IPv6 only VPS). It is better than setting the outbound in >xray/v2ray. 1.iptables + dnsmasq + ipset 最小化解锁流媒体,warp 只接管流媒体流量 (不适合 IPv6 only VPS),比在 xray/v2ray 设置分流的方案要更好
@@ -186,14 +185,14 @@
>wg-quick up wgcf; exit #运行 WGCF 并退出容器。
>
>```
>
>
>![image](https://user-images.githubusercontent.com/62703343/148343358-67d0089a-591e-4af2-915c-e725422a5b0e.png)
>
>
>2022.1.1 1.Happy new year bros. I wish everyone good health and lots of money. Thanks for your support to this project. This project belongs to bros, I >just summarized your fragmented information; 2.Add timestamp and running time while brushing Netflix IP. 1.元旦快乐,祝各位身体健康,赚钱多多。本项目是属于网友们的,我只是把大家碎片化的信息汇总而已; 2.新年第一更刷奈飞IP时加入时间戳和运行时长
>
>2021.12 29 大家可以试试另两位 WARP 作者脚本:
>1.甬哥 ```wget -N https://cdn.jsdelivr.net/gh/kkkyg/CFwarp/CFwarp.sh && bash CFwarp.sh```
>2021.12 29 大家可以试试另两位 WARP 作者脚本:
>1.甬哥 ```wget -N https://cdn.jsdelivr.net/gh/kkkyg/CFwarp/CFwarp.sh && bash CFwarp.sh```
>2.P3terx ```bash <(curl -fsSL git.io/warp.sh) menu```
>
>2021.12.28 2.25: IMPORTANT: 1.First publication on a global scale. Support architecture s390x for IBM Linux One(Choose WARP ipv6 single stack),thx Brother Big B and Misaka; 2.Support Alpine Linux, thx Dong gua; 3.add whitelist. support Debian bookworm; 重要更新: 1. 全网首发,支持 IBM Linux One 的 s390x 架构 CPU (请选用 WARP ipv6单栈),感谢Misaka和大B哥借机器测试 2.支持 Alpine Linux 系统,感谢 Dong gua 借机器测试 3.支持 Debian bookworm系统,增加白名单,遇到没有大版本号的系统可以往里面放
@@ -233,9 +232,9 @@
* 支持 WARP+ 账户,附带第三方刷 WARP+ 流量和升级内核 BBR 脚本
* 普通用户友好的菜单,进阶者通过后缀选项快速搭建
* 智能判断vps操作系统:Ubuntu 16.04、18.04、20.04; Debian 9、10、11CentOS 7、8; Alpine 和 Arch Linux,请务必选择 LTS 系统
* 智能判断vps操作系统:Ubuntu 16.04、18.04、20.04; Debian 9、10、11CentOS 7、8; Alpine 和 Arch Linux,请务必选择 LTS 系统
智能判断硬件结构类型:AMD、ARM 和 s390x
* 结合 Linux 版本和虚拟化方式,自动优选三个 WireGuard 方案。
* 结合 Linux 版本和虚拟化方式,自动优选三个 WireGuard 方案。
网络性能方面:内核集成 WireGuard>安装内核模块>BoringTunwireguard-go
* 智能判断 WGCF 作者 github库的最新版本 Latest release
* 智能分析内网和公网IP生成 WGCF 配置文件
@@ -277,7 +276,7 @@ warp [option] [lisence]
| a lisence | 在上面基础上把 WARP+ Lisence 添加进去,如 ```bash menu.sh a N5670ljg-sS9jD334-6o6g4M9F``` |
| p | 刷 Warp+ 流量 |
| c | 安装 WARP Linux Client,开启 Socks5 代理模式 |
| l | 安装 WARP Linux Client,开启 WARP 模式 |
| l | 安装 WARP Linux Client,开启 WARP 模式 |
| c lisence | 在上面基础上把 WARP+ Lisence 添加进去,如 ```bash menu.sh c N5670ljg-sS9jD334-6o6g4M9F``` |
| r | WARP Linux Client 开关 |
| v | 同步脚本至最新版本 |
@@ -299,10 +298,220 @@ wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh d
warp i jp
```
## 通过 warp 解锁 chatGPT 的方法
方法原创,转引用请标明本项目出处。<br>
适合范围: 除大陆、香港和美国 LA 外的所有 VPS,因为这些地方没有 wgcf 的 warp 服务<br>
## warp-go 运行脚本
首次运行
```
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/warp-go.sh && bash warp-go.sh [option] [lisence]
```
再次运行
```bash
warp-go [option] [lisence]
```
| [option] 变量1 变量2 | 具体动作说明 |
| ----------------- | --------------- |
| h | 帮助 |
| 4 | 原无论任何状态 -> WARP IPv4 |
| 4 lisence name | 把 WARP+ Lisence 和设备名添加进去,如 ```bash wire-go 4 N5670ljg-sS9jD334-6o6g4M9F Goodluck``` |
| 6 | 原无论任何状态 -> WARP IPv6 |
| d | 原无论任何状态 -> WARP 双栈 |
| o | warp-go 开关,脚本主动判断当前状态,自动开或关 |
| u | 卸载 warp-go |
| a | 免费 WARP 账户升级 WARP+ |
| a lisence name| 在上面基础上把 WARP+ Lisence 和设备名添加进去,如 ```bash menu.sh a N5670ljg-sS9jD334-6o6g4M9F Goodluck``` |
| v | 同步脚本至最新版本 |
| 其他或空值| 菜单界面 |
## Cloudflare api
### Cli-API 使用指南,浏览器带参数访问,或者使用 `curl` 命令可以执行 Warp API 请求,
| run 参数 | 作用描述 | 参数 | 示例 |
|---|---|---|---|
| | 使用指南 | | `https://warp.cloudflare.now.cc/` |
| `register` | 注册新设备 | `team_token(可选)`, `format(可选)` | `https://warp.cloudflare.now.cc/?run=register&team_token=<Your-Team-Token>&format=<json\|yaml\|client\|wireguard\|warp-go\|\|clash\|xray\|sing-box\|qrencode>` |
| `device` | 获取特定设备的详细信息 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=device&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `app` | 获取客户端配置 | `token` | `https://warp.cloudflare.now.cc/?run=app&token=<Your-Token>` |
| `bind` | 将设备绑定到帐户 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=bind&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `name` | 设置设备名称 | `device_id`, `token`, `device_name` | `https://warp.cloudflare.now.cc/?run=name&device_id=<Your-Device-ID>&token=<Your-Token>&device_name=<Your-Device-Name>` |
| `license` | 设置设备许可证 | `device_id`, `token`, `license` | `https://warp.cloudflare.now.cc/?run=license&device_id=<Your-Device-ID>&token=<Your-Token>&license=<Your-License>` |
| `unbind` | 从帐户中取消绑定设备 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=unbind&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `cancel` | 取消设备注册 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=cancel&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `id` | Client ID 与 Reserved 转换 | `convert` | `https://warp.cloudflare.now.cc/?run=id&convert=<4-char-string\|Numbers1,Numbers2,Numbers3>` |
| `key` | 生成一对 WireGuard 公私钥 | `format(可选)` | `https://warp.cloudflare.now.cc/?run=key&format=<json\|yaml>` |
| `token` | 获取 Zero Trust token | `organization`, `email`, `code` | step1: `https://warp.cloudflare.now.cc/?organization=<Your-Organization>&email=<Your-Email>` </br> step2: `https://warp.cloudflare.now.cc/?organization=<Your-Organization>&A=<A-Value>&S=<S-Value>&N=<N-Value>&code=<Your-Code>` |
| `sum` | 获取总计和 24 小时运行计数 | | `https://warp.cloudflare.now.cc/?run=sum` |
### Shell-API 运行脚本
```
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/api.sh && bash api.sh [option]
```
| [option] 变量 | 具体动作说明 |
| ------------- | ------------- |
| -h/--help | 帮助 |
| -f/--file | 保存账户注册信息的文件,支持官方api,clientwgcf 和 warp-go ,不填则手动输入 device id 和 api token |
| -r/--register | 注册账户 |
| -t/--token | -r 注册时,使用 team token 注册,快速获取: https://web--public--warp-team-api--coia-mfs4.code.run |
| -d/--device | 获取账户注册信息,包括 plus 流量等 |
| -a/--app | 获取 app 信息 |
| -b/--bind | 获取绑定设备信息,包括子设备 |
| -n/--name | 修改设备名称 |
| -l/--license | 修改 license |
| -u/--unbind | 解绑设备 |
| -c/--cancle | 注销账户 |
| -i/--id | 显示 cliend id 与 reserved |
## 刷 Netflix 解锁 WARP IP 的方法
* 可以用另一个通过 WARP 解锁流媒体的一键脚本: [【刷 WARP IP】 - 为 WARP 解锁流媒体而生](https://github.com/fscarmen/unlock_warp)
* 以刷 香港 hk 为例, 运行 `warp i`。建议在 screen nohup 下后台运行
* 如果长时间仍然未刷出解锁IP,可以查查 CloudFlare 当地是否在维护调路由:https://www.cloudflarestatus.com/
## WARP socks5 或 interface 分流模板及解锁 chatGPT 的方法
<details>
<summary> 指定网站分流到 socks5 的 xray 配置模板 (适用于 WARP Client Proxy 和 WireProxy)(点击即可展开或收起)</summary>
<br>
本地 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":[
{
"protocol":"freedom"
},
{
"tag":"warp",
"protocol":"socks",
"settings":{
"servers":[
{
"address":"127.0.0.1",
"port":40000 // 填写你的 socks5 端口
}
]
}
},
{
"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":{
"rules":[
{
"type":"field",
"domain":[
"geosite:openai",
"ip.gs"
],
"outboundTag":"WARP-socks5-v4"
},
{
"type":"field",
"domain":[
"geosite:google",
"geosite:netflix",
"p3terx.com"
],
"outboundTag":"WARP-socks5-v6"
}
]
}
}
```
</details>
<details>
<summary> 指定网站分流到 "interface" 的 xray 配置模板(适用于 WARP Client Warp 和 warp / warp-go 非全局)(点击即可展开或收起)</summary>
<br>
```
{
"outbounds":[
{
"protocol":"freedom"
},
{
"tag":"WARP-interface-v4",
"protocol":"freedom",
"settings":{
"domainStrategy":"UseIPv4"
},
"streamSettings":{
"sockopt":{
"interface":"CloudflareWARP", // warp 非全局模式填 warp; Client 的 Proxy 模式填 CloudflareWARP; warp-go 填 WARP
"tcpFastOpen":true
}
}
},
{
"tag":"WARP-interface-v6",
"protocol":"freedom",
"settings":{
"domainStrategy":"UseIPv6"
},
"streamSettings":{
"sockopt":{
"interface":"CloudflareWARP",
"tcpFastOpen":true
}
}
}
],
"routing":{
"domainStrategy":"AsIs",
"rules":[
{
"type":"field",
"domain":[
"geosite:google",
"geosite:openai",
"ip.gs"
],
"outboundTag":"WARP-interface-v4"
},
{
"type":"field",
"domain":[
"geosite:netflix",
"p3terx.com"
],
"outboundTag":"WARP-interface-v6"
}
]
}
}
```
</details>
<details>
<summary> 通过 WARP 解锁 chatGPT 的方法(点击即可展开或收起)</summary>
<br>
思路是使用已经注册的 warp 做链式代理的设置,此解决方法是最轻便的,用户只要有 xray 即可。具体做法是修改 xray 配置文件的 outbound 和 routing,模板如下
```
{
@@ -378,230 +587,8 @@ warp i jp
}
}
```
## 刷 Netflix 解锁 WARP IP 的方法
</details>
也可以用另一个通过 WARP 解锁流媒体的一键脚本: [【刷 WARP IP】 - 为 WARP 解锁流媒体而生](https://github.com/fscarmen/unlock_warp)
以刷 香港 hk 为例
* screen 多会话方式运行,会话任务名为 n
```
screen -USdm n warp i hk ##创建名为 n 的会话
screen -Udr n ##进入会话 n 看运行情况
## 按 Ctrl+a 再按 d 退出话 n,返回主界面
screen -ls ##查看会话窗口列表
screen -SX n quit ##关闭会议 n,结束运行
```
* nohup & 后台运行方式,把结果输出到 log 文件
```
nohup warp i hk > logs 2>&1 & ##放进后台运行
jobs -l | grep warp ##看后台任务
cat logs ##查看运行日志文件
kill -9 $(jobs -l | grep warp | awk '{print $2}') ##结束进程
```
* crobtab 计划任务
```
echo '@reboot root warp i hk' >>/etc/crobtab ##在计划任务里加入一条新任务
sed -i '/warp i/d' /etc/crontab ##删掉计划任务
kill -9 $(pgrep -f warp) ##杀掉正在运行的进程
```
* 另外遇到问题仍然需要用户有一定的处理能力,如结束时没有网络,可以用 ```warp o``` 开关来获取,因此并没有写死在脚本里了。
* 如果长时间仍然未刷出解锁IP,可以查查 CloudFlare 当地是否在维护调路由:https://www.cloudflarestatus.com/
## 指定网站分流到 socks5 的 xray 配置模板 (适用于 WARP Client Proxy 和 WireProxy)
本地 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":[
{
"protocol":"freedom"
},
{
"tag":"warp",
"protocol":"socks",
"settings":{
"servers":[
{
"address":"127.0.0.1",
"port":40000 // 填写你的 socks5 端口
}
]
}
},
{
"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":{
"rules":[
{
"type":"field",
"domain":[
"geosite:openai",
"ip.gs"
],
"outboundTag":"WARP-socks5-v4"
},
{
"type":"field",
"domain":[
"geosite:google",
"geosite:netflix",
"p3terx.com"
],
"outboundTag":"WARP-socks5-v6"
}
]
}
}
```
## 指定网站分流到 "interface" 的 xray 配置模板(适用于 WARP Client Warp 和 warp / warp-go 非全局)
```
{
"outbounds":[
{
"protocol":"freedom"
},
{
"tag":"WARP-interface-v4",
"protocol":"freedom",
"settings":{
"domainStrategy":"UseIPv4"
},
"streamSettings":{
"sockopt":{
"interface":"CloudflareWARP", // warp 非全局模式填 warp; Client 的 Proxy 模式填 CloudflareWARP; warp-go 填 WARP
"tcpFastOpen":true
}
}
},
{
"tag":"WARP-interface-v6",
"protocol":"freedom",
"settings":{
"domainStrategy":"UseIPv6"
},
"streamSettings":{
"sockopt":{
"interface":"CloudflareWARP",
"tcpFastOpen":true
}
}
}
],
"routing":{
"domainStrategy":"AsIs",
"rules":[
{
"type":"field",
"domain":[
"geosite:google",
"geosite:openai",
"ip.gs"
],
"outboundTag":"WARP-interface-v4"
},
{
"type":"field",
"domain":[
"geosite:netflix",
"p3terx.com"
],
"outboundTag":"WARP-interface-v6"
}
]
}
}
```
## warp-go 运行脚本
首次运行
```
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/warp-go.sh && bash warp-go.sh [option] [lisence]
```
再次运行
```bash
warp-go [option] [lisence]
```
| [option] 变量1 变量2 | 具体动作说明 |
| ----------------- | --------------- |
| h | 帮助 |
| 4 | 原无论任何状态 -> WARP IPv4 |
| 4 lisence name | 把 WARP+ Lisence 和设备名添加进去,如 ```bash wire-go 4 N5670ljg-sS9jD334-6o6g4M9F Goodluck``` |
| 6 | 原无论任何状态 -> WARP IPv6 |
| d | 原无论任何状态 -> WARP 双栈 |
| o | warp-go 开关,脚本主动判断当前状态,自动开或关 |
| u | 卸载 warp-go |
| a | 免费 WARP 账户升级 WARP+ |
| a lisence name| 在上面基础上把 WARP+ Lisence 和设备名添加进去,如 ```bash menu.sh a N5670ljg-sS9jD334-6o6g4M9F Goodluck``` |
| v | 同步脚本至最新版本 |
| 其他或空值| 菜单界面 |
## Cloudflare api
### Warp 使用指南,使用 `curl` 命令可以执行 Warp API 请求。
| run 参数 | 作用描述 | 参数 | 示例 |
|---|---|---|---|
| | 使用指南 | | `https://warp.cloudflare.now.cc/` |
| `register` | 注册新设备 | `team_token(可选)`, `format(可选)` | `https://warp.cloudflare.now.cc/?run=register&team_token=<Your-Team-Token>&format=<json\|yaml\|wireguard\|qrencode>` |
| `device` | 获取特定设备的详细信息 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=device&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `app` | 获取客户端配置 | `token` | `https://warp.cloudflare.now.cc/?run=app&token=<Your-Token>` |
| `bind` | 将设备绑定到帐户 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=bind&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `name` | 设置设备名称 | `device_id`, `token`, `device_name` | `https://warp.cloudflare.now.cc/?run=name&device_id=<Your-Device-ID>&token=<Your-Token>&device_name=<Your-Device-Name>` |
| `license` | 设置设备许可证 | `device_id`, `token`, `license` | `https://warp.cloudflare.now.cc/?run=license&device_id=<Your-Device-ID>&token=<Your-Token>&license=<Your-License>` |
| `unbind` | 从帐户中取消绑定设备 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=unbind&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `cancel` | 取消设备注册 | `device_id`, `token` | `https://warp.cloudflare.now.cc/?run=cancel&device_id=<Your-Device-ID>&token=<Your-Token>` |
| `id` | Client ID 与 Reserved 转换 | `convert` | `https://warp.cloudflare.now.cc/?run=id&convert=<4-char-string\|Numbers1,Numbers2,Numbers3>` |
| `key` | 生成一对 WireGuard 公私钥 | `format(可选)` | `https://warp.cloudflare.now.cc/?run=key&format=<json\|yaml>` |
| `sum` | 获取总计和 24 小时运行计数 | | `https://warp.cloudflare.now.cc/?run=sum` |
### 运行脚本
```
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/api.sh && bash api.sh [option]
```
| [option] 变量 | 具体动作说明 |
| ------------- | ------------- |
| -h/--help | 帮助 |
| -f/--file | 保存账户注册信息的文件,支持官方api,clientwgcf 和 warp-go ,不填则手动输入 device id 和 api token |
| -r/--register | 注册账户 |
| -t/--token | -r 注册时,使用 team token 注册,快速获取: https://web--public--warp-team-api--coia-mfs4.code.run |
| -d/--device | 获取账户注册信息,包括 plus 流量等 |
| -a/--app | 获取 app 信息 |
| -b/--bind | 获取绑定设备信息,包括子设备 |
| -n/--name | 修改设备名称 |
| -l/--license | 修改 license |
| -u/--unbind | 解绑设备 |
| -c/--cancle | 注销账户 |
| -i/--id | 显示 cliend id 与 reserved |
## WARP+ License 及 ID 获取
@@ -611,24 +598,12 @@ wget -N https://gitlab.com/fscarmen/warp/-/raw/main/api.sh && bash api.sh [optio
<img src="https://user-images.githubusercontent.com/62703343/136070323-47f2600a-13e4-4eb0-a64d-d7eb805c28e2.png" width="70%" />
## WARP 网络接口数据,临时、永久关闭和开启
WireGuard 网络接口数据,查看 ```wg```
临时关闭和开启 WARP(reboot重启后恢复开启) ```warp o```
官方原始指令 ```wg-quick down wgcf``` ,恢复启动 ```wg-quick up wgcf```
禁止开机启动 ```systemctl disable --now wg-quick@wgcf```,恢复开机启动 ```systemctl enable --now wg-quick@wgcf```
## WARP Teams 获取并用于 Linux 的方法
* 通过 Coia 的网站,填入 teams 的组织名、邮箱和验证码获取 token: `https://web--public--warp-team-api--coia-mfs4.code.run/`
* https://token.cloudflare.now.cc/ , 通过 fscarmen 的网站
* 在 vps 里运行以下指令获取 teams 配置的全部信息,保存在文件 `warp-account.conf`
```
bash <(wget -qO- https://gitlab.com/fscarmen/warp/-/raw/main/api.sh) -r -t <TOKEN>
```
* https://web--public--warp-team-api--coia-mfs4.code.run/, 通过 Coia 的网站
## WARP原理
@@ -653,12 +628,6 @@ WARP是CloudFlare提供的一项基于WireGuard的网络流量安全及加速服
* 网络性能方面:内核集成>内核模块>wireguard-go
Linux 5.6 及以上内核则已经集成了 WireGuard ,可以用 ```hostnamectl```或```uname -r```查看版本。
甲骨文是 KVM 完整虚拟化的 VPS 主机,而官方系统由于版本较低,在不更换内核的前提下选择 "内核模块" 方案。如已升级内核在5.6及以上,将会自动选择 “内核集成” 方案。
EUserv是 LXC 非完整虚拟化 VPS 主机,共享宿主机内核,不能更换内核,只能选择 "wireguard-go" 方案。
## 鸣谢下列作者的文章和项目
@@ -670,7 +639,7 @@ EUserv是 LXC 非完整虚拟化 VPS 主机,共享宿主机内核,不能更
* 猫大: https://github.com/Oreomeow
* Luminous: https://luotianyi.vc/5252.html
* Hiram: https://hiram.wang/cloudflare-wrap-vps
* Cloudflare: https://pkg.cloudflareclient.com/
* Cloudflare: https://pkg.cloudflareclient.com/
https://blog.cloudflare.com/announcing-warp-for-linux-and-proxy-mode/
https://blog.cloudflare.com/argo-v2/
* WireGuard: https://lists.zx2c4.com/pipermail/wireguard/2017-December/002201.html
@@ -685,7 +654,8 @@ https://github.com/acacia233/Project-WARP-Unlock
* 所有的热心网友们
服务提供(排名不分先后):
* fscarmen 的 Warp Api: https://warp.cloudflare.now.cc/
* fscarmen 的 Warp API: https://warp.cloudflare.now.cc/
* fscarmen 的 Zero Trust Token API: https://token.cloudflare.now.cc/
* CloudFlare Warp(+): https://1.1.1.1/
* WGCF 项目原作者: https://github.com/ViRb3/wgcf/
* Coia 和 warp-go 团队: https://gitlab.com/ProjectWARP/warp-go
@@ -699,7 +669,7 @@ https://github.com/acacia233/Project-WARP-Unlock
* WireProxy 作者: https://github.com/pufferffish/wireproxy
* 获取公网 IP 及归属地查询: https://ifconfig.co/ , https://ip.gs/ , https://ip.sb/ , https://ip-api.com
* 统计PV网: https://hits.seeyoufarm.com/
* Coia 的网页版提 Teams Token: https://web--public--warp-team-api--coia-mfs4.code.run
* Coia 的网页版提 Teams Token: https://web--public--warp-team-api--coia-mfs4.code.run
CloudFlare WARP 全球站点和服务状态:
* Operational = 正常。Re-routed = 检修状态: https://www.cloudflarestatus.com/
+59 -29
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# 当前脚本版本号
VERSION='3.0.10'
VERSION='3.1.0'
# 环境变量用于在Debian或Ubuntu操作系统中设置非交互式(noninteractive)安装模式
export DEBIAN_FRONTEND=noninteractive
@@ -13,8 +13,8 @@ trap "rm -f /tmp/{wireguard-go-*,best_mtu,best_endpoint,endpoint,ip}; exit" INT
E[0]="\n Language:\n 1. English (default) \n 2. 简体中文"
C[0]="${E[0]}"
E[1]="Publish warp api, you can register account, join Zero Trust, check account information and all other operations. Detailed instructions: https://warp.cloudflare.now.cc/; 2. Scripts to update the warp api."
C[1]="发布 warp api,可以注册账户,加入 Zero Trust,查账户信息等所有的操作。详细使用说明: https://warp.cloudflare.now.cc/; 2. 脚本更新 warp api"
E[1]="1. Use self-built warp api: https://warp.cloudflare.now.cc/ to upgrade to Teams account, no need to prepare Token in advance, only need to enter organization, email and verification code when the script is running to complete, the efficiency is greatly increased; 2. Because the Client's settings need to be set up in the Cloudflare dashboard, which can cause the vps to lose contact if not handled properly, the Client's is not upgraded to a Teams account, and the user can look up the information to set it up on their own. Website to get a Zero Trust token: https://token.cloudflare.now.cc/"
C[1]="1. 使用自建 warp api: https://warp.cloudflare.now.cc/ ,升级为 Teams 账户,不需要提前获取 Token,只须在脚本运行的时候输入组织名、邮箱和验证码即可完成,效率大增; 2. 由于 Client 的设置需要到 Cloudflare 控制后台设置,处理不好会导致 vps 失去联系,所以 Client 并没有升级为 Teams 账户的处理,用户可自行查资料设置。获取 Zero Trust token 的网站: https://token.cloudflare.now.cc/"
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-sh/issues]"
C[2]="必须以root方式运行脚本,可以输入 sudo -i 后重新下载运行,问题反馈:[https://github.com/fscarmen/warp-sh/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-sh/issues]"
@@ -265,10 +265,10 @@ E[125]="\$(date +'%F %T') Region: \$REGION Done. IPv\$NF: \$WAN \$COUNTRY \$AS
C[125]="\$(date +'%F %T') 区域 \$REGION 解锁成功,IPv\$NF: \$WAN \$COUNTRY \$ASNORG1 小时后重新测试,刷 IP 运行时长: \$DAY 天 \$HOUR 时 \$MIN 分 \$SEC 秒"
E[126]="\$(date +'%F %T') Try \${i}. Failed. IPv\$NF: \$WAN \$COUNTRY \$ASNORG. Retry after \${j} seconds. Brush ip runing time:\$DAY days \$HOUR hours \$MIN minutes \$SEC seconds"
C[126]="\$(date +'%F %T') 尝试第\${i}次,解锁失败,IPv\$NF: \$WAN \$COUNTRY \$ASNORG\${j}秒后重新测试,刷 IP 运行时长: \$DAY 天 \$HOUR 时 \$MIN 分 \$SEC 秒"
E[127]="1. with URL file\n 2. with token (Easily available at https://web--public--warp-team-api--coia-mfs4.code.run)\n 3. manual input private key, IPv6 and Client id\n 4. share teams account (default)"
C[127]="1. 通过在线文件\n 2. 使用 token (可通过 https://web--public--warp-team-api--coia-mfs4.code.run 轻松获取)\n 3. 手动输入 private key IPv6 和 Client id\n 4. 共享 teams 账户 (默认)"
E[128]="Token has expired, please re-enter:"
C[128]="Token 已超时失效,请重新输入:"
E[127]="1. with URL file\n 2. input the organization and email verification code\n 3. manual input private key, IPv6 and Client id\n 4. share teams account (default)"
C[127]="1. 通过在线文件\n 2. 输入组织名和邮箱验证码获取\n 3. 手动输入 private key IPv6 和 Client id\n 4. 共享 teams 账户 (默认)"
E[128]="Organization does not exist, please re-enter:"
C[128]="组织名不存在,请重新输入:"
E[129]="The current Teams account is unavailable, automatically switch back to the free account"
C[129]="当前 Teams 账户不可用,自动切换回免费账户"
E[130]="Please confirm\\\n Private key\\\t: \$PRIVATEKEY \${MATCH[0]}\\\n Address IPv6\\\t: \$ADDRESS6/128 \${MATCH[1]}\\\n Client id\\\t: \$CLIENT_ID \${MATCH[2]}"
@@ -335,8 +335,8 @@ E[160]="WireProxy is not installed."
C[160]="WireProxy 未安装"
E[161]="WireProxy is installed and disconnected"
C[161]="WireProxy 已安装,状态为断开连接"
E[162]="Token is invalid, please re-enter:"
C[162]="Token 无效,请重新输入:"
E[162]="The verification code is wrong, please re-enter:"
C[162]="验证码错误,请重新输入:"
E[163]="Connect the Wireproxy (warp y)"
C[163]="连接 Wireproxy (warp y)"
E[164]="Disconnect the Wireproxy (warp y)"
@@ -395,6 +395,12 @@ E[190]="The configuration file warp.conf cannot be found. The script is aborted.
C[190]="找不到配置文件 warp.conf,脚本中止,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[191]="Current operating system is: \$SYSTEM, Linux Client only supports Ubuntu, Debian and CentOS. The script is aborted. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
C[191]="当前操作系统是: \$SYSTEM。 Linux Client 只支持 Ubuntu, Debian 和 CentOS,脚本中止,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[192]="Your organization"
C[192]="组织名:"
E[193]="E-mail address to receive the verification code:"
C[193]="接收验证码的邮箱:"
E[194]="Verification code:"
C[194]="验证码:"
# 自定义字体彩色,read 函数
warning() { echo -e "\033[31m\033[01m$*\033[0m"; } # 红色
@@ -524,6 +530,7 @@ check_dependencies() {
# 获取 warp 账户信息
warp_api(){
local WARP_API_URL="warp.cloudflare.now.cc"
local RUN=$1
local FILE_PATH=$2
local WARP_LICENSE=$3
@@ -531,7 +538,10 @@ warp_api(){
local WARP_TEAM_TOKEN=$5
local WARP_CONVERT=$6
local WARP_CONVERT_MODE=$7
local WARP_API_URL="warp.cloudflare.now.cc"
local TEAM_AUTH=$8
local TEAM_ORGANIZATION=$9
local TEAM_EMAIL=${10}
local TEAM_CODE=${11}
if [ -s "$FILE_PATH" ]; then
# Teams 账户文件
@@ -562,10 +572,10 @@ warp_api(){
token=$(awk -F' *= *' '/^Token/{print $2}' "$FILE_PATH")
fi
fi
case "$RUN" in
register )
curl -m5 -sL "https://${WARP_API_URL}/?run=register&team_token=${WARP_TEAM_TOKE}"
curl -m5 -sL "https://${WARP_API_URL}/?run=register&team_token=${WARP_TEAM_TOKEN}"
;;
device )
curl -m5 -sL "https://${WARP_API_URL}/?run=device&device_id=${WARP_DEVICE_ID}&token=${WARP_TOKEN}"
@@ -594,6 +604,17 @@ warp_api(){
fi
fi
;;
token-step1 )
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&email=${TEAM_EMAIL}"
;;
token-step2 )
local TEAM_ORGANIZATION=$(sed "s/.*organization=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
local A=$(sed "s/.*A=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
local S=$(sed "s/.*S=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
local N=$(sed "s/.*N=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&A=${A}&S=${S}&N=${N}&code=${TEAM_CODE}"
;;
esac
}
@@ -1663,28 +1684,39 @@ input_url_token() {
fi
elif [ "$1" = 'token' ]; then
[ -z "$TEAM_TOKEN" ] && reading " token: " TEAM_TOKEN
[ -z "$TEAM_TOKEN" ] && return
local ERROR_TIMES=0
while [ "$ERROR_TIMES" -le 3 ]; do
until grep -sq 'organization=' <<< "$TEAM_AUTH"; do
unset TEAM_ORGANIZATION TEAM_AUTH
(( ERROR_TIMES++ ))
if grep -q 'token is expired' <<< "$TEAMS"; then
reading " $(text 128) " TEAM_TOKEN
elif grep -q 'error' <<< "$TEAMS"; then
reading " $(text 162) " TEAM_TOKEN
elif grep -q 'organization' <<< "$TEAMS"; then
break
if [[ "$ERROR_TIMES" > 5 ]]; then
error "\n $(text 29) \n"
else
[ "$ERROR_TIMES" = 1 ] && reading "\n $(text 192) " TEAM_ORGANIZATION || reading "\n $(text 128) " TEAM_ORGANIZATION
[[ -n "$TEAM_ORGANIZATION" && -z "$TEAM_EMAIL" ]] && reading " $(text 193) " TEAM_EMAIL
[ -n "$TEAM_EMAIL" ] && local TEAM_AUTH=$(warp_api "token-step1" "" "" "" "" "" "" "" "$TEAM_ORGANIZATION" "$TEAM_EMAIL")
fi
[ -z "$TEAM_TOKEN" ] && return
done
if grep -sq 'organization=' <<< "$TEAM_AUTH"; then
local ERROR_TIMES=0
until grep -sq '^com.cloudflare.warp:' <<< "$TEAM_TOKEN"; do
unset TEAM_CODE TEAM_TOKEN
(( ERROR_TIMES++ ))
if [[ "$ERROR_TIMES" > 5 ]]; then
error "\n $(text 29) \n"
else
[ "$ERROR_TIMES" = 1 ] && reading " $(text 194) " TEAM_CODE || reading " $(text 162) " TEAM_CODE
[[ "$TEAM_CODE" =~ ^[0-9]{6}$ ]] && local TEAM_TOKEN=$(warp_api "token-step2" "" "" "" "" "" "" "$TEAM_AUTH" "" "" "$TEAM_CODE")
fi
done
unset TEAMS ADDRESS6 PRIVATEKEY CLIENT_ID
TEAMS=$(warp_api "register" "" "" "" "$TEAM_TOKEN" 2>&1)
TEAMS=$(warp_api "register" "" "" "" "${TEAM_TOKEN#*=}" 2>&1)
ADDRESS6=$(expr "$TEAMS" : '.*"v6":[ ]*"\([^"]*\).*')
PRIVATEKEY=$(expr "$TEAMS" : '.*"private_key":[ ]*"\([^"]*\).*')
RESERVED=$(expr "$TEAMS" : '.*"client_id":[ ]*"\([^"]*\).*')
CLIENT_ID="$(warp_api "convert" "" "" "" "" "$RESERVED" "decode")"
done
fi
elif [ "$1" = 'input' ]; then
reading " private key: " PRIVATEKEY
@@ -2013,7 +2045,7 @@ install() {
input_url_token url
;;
2 )
:
input_url_token token
;;
3 )
input_url_token input
@@ -2321,9 +2353,8 @@ WantedBy=multi-user.target
EOF
fi
# 保存好配置文件, 如有 Teams,改为 Teams 账户信息
# 保存好配置文件
mv -f $0 /etc/wireguard/menu.sh >/dev/null 2>&1
[ "$CHOOSE_TEAMS" = '2' ] && input_url_token token
if [ "${CONFIRM_TEAMS_INFO,,}" = 'y' ]; then
backup_restore_delete backup wireproxy
sed -i "s#\(PrivateKey[ ]\+=[ ]\+\).*#\1$PRIVATEKEY#g; s#\(Address[ ]\+=[ ]\+\).*\(/128$\)#\1$ADDRESS6\2#g; s#\(.*Reserved[ ]\+=[ ]\+\).*#\1$CLIENT_ID#g" /etc/wireguard/warp.conf
@@ -2364,7 +2395,6 @@ EOF
[ "$IS_ANEMONE" = 'is_anemone' ] && ( iptables_solution; systemctl restart dnsmasq >/dev/null 2>&1 )
# 经过确认的 teams private key 和 address6,改为 Teams 账户信息,不确认则不升级
[ "$CHOOSE_TEAMS" = '2' ] && input_url_token token
if [ "${CONFIRM_TEAMS_INFO,,}" = 'y' ]; then
backup_restore_delete backup warp
sed -i "s#\(PrivateKey[ ]\+=[ ]\+\).*#\1$PRIVATEKEY#g; s#\(Address[ ]\+=[ ]\+\).*\(/128$\)#\1$ADDRESS6\2#g; s#\(.*Reserved[ ]\+=[ ]\+\).*#\1$CLIENT_ID#g" /etc/wireguard/warp.conf
+68 -24
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# 当前脚本版本号和新增功能
VERSION='1.1.9'
VERSION='1.2.0'
# 判断 Teams token 最少字符数
TOKEN_LENGTH=800
@@ -16,8 +16,8 @@ trap "rm -f /tmp/warp-go*; exit" INT
E[0]="Language:\n 1.English (default) \n 2.简体中文"
C[0]="${E[0]}"
E[1]="1. Publish warp api, you can register account, join Zero Trust, check account information and all other operations. Detailed instructions: https://warp.cloudflare.now.cc/ ; 2. Scripts to update the warp api."
C[1]="1. 发布 warp api,可以注册账户,加入 Zero Trust,查账户信息等所有的操作。详细使用说明: https://warp.cloudflare.now.cc/; 2. 脚本更新 warp api"
E[1]="1. Use self-built warp api: https://warp.cloudflare.now.cc/ to upgrade to Teams account, no need to prepare Token in advance, only need to enter organization, email and verification code when the script is running to complete, the efficiency is greatly increased; 2. Because the Client's settings need to be set up in the Cloudflare dashboard, which can cause the vps to lose contact if not handled properly, the Client's is not upgraded to a Teams account, and the user can look up the information to set it up on their own. Website to get a Zero Trust token: https://token.cloudflare.now.cc/"
C[1]="1. 使用自建 warp api: https://warp.cloudflare.now.cc/ ,升级为 Teams 账户,不需要提前获取 Token,只须在脚本运行的时候输入组织名、邮箱和验证码即可完成,效率大增; 2. 由于 Client 的设置需要到 Cloudflare 控制后台设置,处理不好会导致 vps 失去联系,所以 Client 并没有升级为 Teams 账户的处理,用户可自行查资料设置。获取 Zero Trust token 的网站: https://token.cloudflare.now.cc/"
E[2]="warp-go h (help)\n warp-go o (temporary warp-go switch)\n warp-go u (uninstall WARP web interface and warp-go)\n warp-go v (sync script to latest version)\n warp-go i (replace IP with Netflix support)\n warp-go 4/6 ( WARP IPv4/IPv6 single-stack)\n warp-go d (WARP dual-stack)\n warp-go n (WARP IPv4 non-global)\n warp-go g (WARP global/non-global switching)\n warp-go e (output wireguard and sing-box configuration file)\n warp-go a (Change to Free, WARP+ or Teams account)"
C[2]="warp-go h (帮助)\n warp-go o (临时 warp-go 开关)\n warp-go u (卸载 WARP 网络接口和 warp-go)\n warp-go v (同步脚本至最新版本)\n warp-go i (更换支持 Netflix 的IP)\n warp-go 4/6 (WARP IPv4/IPv6 单栈)\n warp-go d (WARP 双栈)\n warp-go n (WARP IPv4 非全局)\n warp-go g (WARP 全局 / 非全局相互切换)\n warp-go e (输出 wireguard 和 sing-box 配置文件)\n warp-go a (更换到 FreeWARP+ 或 Teams 账户)"
E[3]="This project is designed to add WARP network interface for VPS, using warp-go core, using various interfaces of CloudFlare-WARP, integrated wireguard-go, can completely replace WGCF. Save Hong Kong, Toronto and other VPS, can also get WARP IP. Thanks again @CoiaPrant and his team. Project address: https://gitlab.com/ProjectWARP/warp-go/-/tree/master/"
@@ -102,18 +102,18 @@ E[42]="Please Input WARP+ license:"
C[42]="请输入WARP+ License:"
E[43]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\): "
C[43]="License 应为26位字符,请重新输入 WARP+ License \(剩余\${i}次\): "
E[44]="Please enter the Teams Token (You can easily available at https://web--public--warp-team-api--coia-mfs4.code.run. Or use the one provided by the script if left blank):"
C[44]="请输入 Teams Token (可通过 https://web--public--warp-team-api--coia-mfs4.code.run 轻松获取,如果留空,则使用脚本提供的):"
E[44]="Your organization"
C[44]="组织名:"
E[45]="Token error, please re-enter Teams token \(remaining \${i} times\):"
C[45]="Token 错误,请重新输入 Teams token \(剩余\${i}次\):"
E[46]="Current account type is: \$ACCOUNT_TYPE\\\t \$PLUS_QUOTA\\\n \$CHANGE_TYPE"
C[46]="当前账户类型是: \$ACCOUNT_TYPE\\\t \$PLUS_QUOTA\\\n \$CHANGE_TYPE"
E[47]="1. Continue using the free account without changing.\n 2. Change to WARP+ account.\n 3. Change to Teams account. (You can easily available at https://web--public--warp-team-api--coia-mfs4.code.run. Or use the one provided by the script if left blank)\n 0. Return to the main menu."
C[47]="1. 继续使用 free 账户,不变更\n 2. 变更为 WARP+ 账户\n 3. 变更为 Teams 账户 (可通过 https://web--public--warp-team-api--coia-mfs4.code.run 轻松获取,如果留空,则使用脚本提供的)\n 0. 返回主菜单"
E[48]="1. Change to free account.\n 2. Change to WARP+ account.\n 3. Change to another WARP Teams account. (You can easily available at https://web--public--warp-team-api--coia-mfs4.code.run. Or use the one provided by the script if left blank)\n 0. Return to the main menu."
C[48]="1. 变更为 free 账户\n 2. 变更为 WARP+ 账户\n 3. 更换为另一个 Teams 账户 (可通过 https://web--public--warp-team-api--coia-mfs4.code.run 轻松获取,如果留空,则使用脚本提供的)\n 0. 返回主菜单"
E[49]="1. Change to free account.\n 2. Change to another WARP+ account.\n 3. Change to Teams account. (You can easily available at https://web--public--warp-team-api--coia-mfs4.code.run. Or use the one provided by the script if left blank)\n 0. Return to the main menu."
C[49]="1. 变更为 free 账户\n 2. 变更为另一个 WARP+ 账户\n 3. 变更为 Teams 账户 (可通过 https://web--public--warp-team-api--coia-mfs4.code.run 轻松获取,如果留空,则使用脚本提供的)\n 0. 返回主菜单"
E[47]="1. Continue using the free account without changing.\n 2. Change to WARP+ account.\n 3. Change to Teams account. (Enter the organization name and email verification code to get it. Or use the one provided by the script if left blank)\n 0. Return to the main menu."
C[47]="1. 继续使用 free 账户,不变更\n 2. 变更为 WARP+ 账户\n 3. 变更为 Teams 账户 (输入组织名和邮箱验证码获取,如果留空,则使用脚本提供的)\n 0. 返回主菜单"
E[48]="1. Change to free account.\n 2. Change to WARP+ account.\n 3. Change to another WARP Teams account. (Enter the organization name and email verification code to get it. Or use the one provided by the script if left blank)\n 0. Return to the main menu."
C[48]="1. 变更为 free 账户\n 2. 变更为 WARP+ 账户\n 3. 更换为另一个 Teams 账户 (输入组织名和邮箱验证码获取,如果留空,则使用脚本提供的)\n 0. 返回主菜单"
E[49]="1. Change to free account.\n 2. Change to another WARP+ account.\n 3. Change to Teams account. (Enter the organization name and email verification code to get it. Or use the one provided by the script if left blank)\n 0. Return to the main menu."
C[49]="1. 变更为 free 账户\n 2. 变更为另一个 WARP+ 账户\n 3. 变更为 Teams 账户 (输入组织名和邮箱验证码获取,如果留空,则使用脚本提供的)\n 0. 返回主菜单"
E[50]="Registration of WARP\${k} account failed, script aborted. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
C[50]="注册 WARP\${k} 账户失败,脚本中止,问题反馈: [https://github.com/fscarmen/warp-sh/issues]"
E[51]="Warp-go not yet installed. No account registered. Script aborted. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
@@ -232,6 +232,14 @@ E[107]="All endpoints of WARP cannot be connected. Ask the supplier for more hel
C[107]="WARP 的所有的 endpoint 均不能连通,有可能 UDP 被限制了,可联系供应商了解如何开启,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[108]="Cannot detect any IPv4 or IPv6. The script is aborted. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
C[108]="检测不到任何 IPv4 或 IPv6。脚本中止,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
E[109]="E-mail address to receive the verification code:"
C[109]="接收验证码的邮箱:"
E[110]="Verification code:"
C[110]="验证码:"
E[111]="Organization does not exist, please re-enter:"
C[111]="组织名不存在,请重新输入:"
E[112]="The verification code is wrong, please re-enter:"
C[112]="验证码错误,请重新输入:"
# 自定义字体彩色,read 函数
warning() { echo -e "\033[31m\033[01m$*\033[0m"; } # 红色
@@ -393,6 +401,7 @@ check_dependencies() {
# 获取 warp 账户信息
warp_api(){
local WARP_API_URL="warp.cloudflare.now.cc"
local RUN=$1
local FILE_PATH=$2
local WARP_LICENSE=$3
@@ -400,7 +409,10 @@ warp_api(){
local WARP_TEAM_TOKEN=$5
local WARP_CONVERT=$6
local WARP_CONVERT_MODE=$7
local WARP_API_URL="warp.cloudflare.now.cc"
local TEAM_AUTH=$8
local TEAM_ORGANIZATION=$9
local TEAM_EMAIL=${10}
local TEAM_CODE=${11}
if [ -s "$FILE_PATH" ]; then
# Teams 账户文件
@@ -434,7 +446,7 @@ warp_api(){
case "$RUN" in
register )
curl -m5 -sL "https://${WARP_API_URL}/?run=register&team_token=${WARP_TEAM_TOKE}"
curl -m5 -sL "https://${WARP_API_URL}/?run=register&team_token=${WARP_TEAM_TOKEN}"
;;
device )
curl -m5 -sL "https://${WARP_API_URL}/?run=device&device_id=${WARP_DEVICE_ID}&token=${WARP_TOKEN}"
@@ -463,6 +475,17 @@ warp_api(){
fi
fi
;;
token-step1 )
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&email=${TEAM_EMAIL}"
;;
token-step2 )
local TEAM_ORGANIZATION=$(sed "s/.*organization=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
local A=$(sed "s/.*A=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
local S=$(sed "s/.*S=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
local N=$(sed "s/.*N=\([^&]\+\)&.*/\1/" <<< "$TEAM_AUTH")
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&A=${A}&S=${S}&N=${N}&code=${TEAM_CODE}"
;;
esac
}
@@ -1047,16 +1070,37 @@ update_license() {
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME="${NAME:-warp-go}"
}
# 输入 Teams 账户 token(如有),如果 TOKEN 以 com.cloudflare.warp 开头,将自动删除多余部分
input_token() {
[ -z "$TOKEN" ] && reading " $(text 44) " TOKEN
i=5
until [[ -z "$TOKEN" || "${#TOKEN}" -ge "$TOKEN_LENGTH" ]]; do
(( i-- )) || true
[ "$i" = 0 ] && error "$(text 39)" || reading " $(text_eval 45) " TOKEN
# 通过组织名和邮箱获取 Teams Token, 如果 Token 以 com.cloudflare.warp 开头,将自动删除多余部分
get_token() {
local ERROR_TIMES=0
until grep -sq 'organization=' <<< "$TEAM_AUTH"; do
unset TEAM_ORGANIZATION TEAM_AUTH
(( ERROR_TIMES++ ))
if [[ "$ERROR_TIMES" > 5 ]]; then
error "\n $(text 39) \n"
else
[ "$ERROR_TIMES" = 1 ] && reading "\n $(text 44) " TEAM_ORGANIZATION || reading "\n $(text 111) " TEAM_ORGANIZATION
[[ -n "$TEAM_ORGANIZATION" && -z "$TEAM_EMAIL" ]] && reading " $(text 109) " TEAM_EMAIL
[ -n "$TEAM_EMAIL" ] && local TEAM_AUTH=$(warp_api "token-step1" "" "" "" "" "" "" "" "$TEAM_ORGANIZATION" "$TEAM_EMAIL")
fi
done
[[ -n "$TOKEN" && -z "$NAME" ]] && reading " $(text 41) " NAME
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME="${NAME:-warp-go}"
if grep -sq 'organization=' <<< "$TEAM_AUTH"; then
local ERROR_TIMES=0
until grep -sq '^com.cloudflare.warp:' <<< "$TEAM_TOKEN"; do
unset TEAM_CODE TOKEN
(( ERROR_TIMES++ ))
if [[ "$ERROR_TIMES" > 5 ]]; then
error "\n $(text 39) \n"
else
[ "$ERROR_TIMES" = 1 ] && reading " $(text 110) " TEAM_CODE || reading " $(text 112) " TEAM_CODE
[[ "$TEAM_CODE" =~ ^[0-9]{6}$ ]] && local TEAM_TOKEN=$(warp_api "token-step2" "" "" "" "" "" "" "$TEAM_AUTH" "" "" "$TEAM_CODE")
fi
done
grep -sq '^com.cloudflare.warp:' <<< "$TEAM_TOKEN" && [ -z "$NAME" ] && TOKEN=${TEAM_TOKEN#*=} && reading " $(text 41) " NAME
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME="${NAME:-warp-go}"
fi
}
# 免费 WARP 账户升级 WARP+ 或 Teams 账户
@@ -1108,7 +1152,7 @@ update() {
;;
3 )
unset QUOTA
input_token
get_token
if [ -n "$TOKEN" ]; then
k=' teams'
register_api warp.conf.tmp 58 59
@@ -1171,7 +1215,7 @@ install() {
input_license
;;
2 )
input_token
get_token
esac
# 选择优先使用 IPv4 /IPv6 网络