XiaO

Warp+ 与 WireGuard

XiaO / 2023-04-19


获取 Cloudflare Warp+ 24 PB 流量

通过 wgcf 获取 Cloudflare Warp+ 配置

使用 homebrew 安装 wgcf

brew install wgcf

wgcf 的操作说明

wgcf --help
wgcf is a utility for Cloudflare Warp that allows you to create and manage accounts, assign license keys, and generate WireGuard profiles. Made by Victor (@ViRb3). Project website: https://github.com/ViRb3/wgcf

Usage:
  wgcf [flags]
  wgcf [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  generate    Generates a WireGuard profile from the current Cloudflare Warp account
  help        Help about any command
  register    Registers a new Cloudflare Warp device and creates a new account, preparing it for connection
  status      Prints the status of the current Cloudflare Warp device
  trace       Prints trace information about the current internet connection
  update      Updates the current Cloudflare Warp account, preparing it for connection

Flags:
      --config string   Configuration file (default "wgcf-account.toml")
  -h, --help            help for wgcf

Use "wgcf [command] --help" for more information about a command.

注册 Cloudflare Warp 帐号:

wgcf register

此时,在终端的当前文件夹中会生成一个 wgcf-account.toml 文件

access_token = 'ab629343-ac46-abdc-78di-6f7e3a332caf'
device_id = 'cea7b53f-bd00-40vd-aiod-3e950bf24wer'
license_key = '2e5sT91G-2I0njiKj-4UE23458'
private_key = 'GBIsrwccea7b53ffnyawbR3/Mr37PW8MPINaRuSxGc='

修改该 license_key 的值为前面获取的 Warp+ key,然后更新配置

wgcf update

生成配置文件:

wgcf generate

此时,在终端的当前文件夹中会生成一个 wgcf-profile.conf 文件,该文件含有所有魔法口诀。

对机器使用魔法

下载不同平台的支持 wireguard 协议的软件,导入上述文件即可进入魔法世界。

本老旧破机器无法使用现成的软件,只能配置 wireguard-tools

brew install wireguard-tools

将前述 wgcf-profile.conf 文件复制到 /usr/local/etc/wireguard/ 文件夹中。

sudo wg-quick up /usr/local/etc/wireguard/wgcf-profile.conf #启用
sudo wg #查看
sudo wg-quick down /usr/local/etc/wireguard/wgcf-profile.conf #停止