• 欢迎访问VAVE乐园,专注VPS测评,推荐使用最新版火狐浏览器Chrome浏览器Edge浏览器访问本网站,欢迎加入VAVE乐园 TG频道
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏VAVE乐园吧

1.1.1.1免费的WARP+流量提升方法

学习记录 admin 5年前 (2019-10-26) 10696次浏览 已收录 0个评论 扫描二维码

下载之后,进入主界面。点击右上角的 按钮,进入More settings,找到Diagnostics里面的ID,复制ID

然后打开网站Repl.it,运行以下代码:

const referrer = "eca767ef-8512-4f26-b968-48981e79466f"; // 左侧引号内填你的ID
const timesToLoop = 1024; // 循环次数
const retryTimes = 5; // 重试次数

const https = require("https");
const zlib = require("zlib");

async function init() {
  for (let i = 0; i < timesToLoop; i++) {
    if (await run()) {
      console.log(i + 1, "OK");
    } else {
      console.log(i + 1, "Error");
      for (let r = 0; r < retryTimes; r++) { if (await run()) { console.log(i + 1, "Retry #" + (r + 1), "OK"); break; } else { console.log(i + 1, "Retry #" + (r + 1), "Error"); if (r === retryTimes - 1) { return; } } } } } } async function run() { return new Promise(resolve => {
    const install_id = genString(11);
    const postData = JSON.stringify({
      key: `${genString(43)}=`,
      install_id: install_id,
      fcm_token: `${install_id}:APA91b${genString(134)}`,
      referrer: referrer,
      warp_enabled: false,
      tos: new Date().toISOString().replace("Z", "+07:00"),
      type: "Android",
      locale: "zh_CN"
    });

    const options = {
      hostname: "api.cloudflareclient.com",
      port: 443,
      path: "/v0a745/reg",
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Host: "api.cloudflareclient.com",
        Connection: "Keep-Alive",
        "Accept-Encoding": "gzip",
        "User-Agent": "okhttp/3.12.1",
        "Content-Length": postData.length
      }
    };

    const req = https.request(options, res => {
      const gzip = zlib.createGunzip();
      // const buffer = [];
      res.pipe(gzip);
      gzip
        .on("data", function(data) {
          // buffer.push(data.toString());
        })
        .on("end", function() {
          // console.dir(JSON.parse(buffer.join("")));
          resolve(true);
        })
        .on("error", function(e) {
          // console.error(e);
          resolve(false);
        });
    });

    req.on("error", error => {
      // console.error(error);
      resolve(false);
    });

    req.write(postData);
    req.end();
  });
}

function genString(length) {
  // https://gist.github.com/6174/6062387#gistcomment-2651745
  return [...Array(length)]
    .map(i => (~~(Math.random() * 36)).toString(36))
    .join("");
}

init();

或者直接点击群友牛宝提供的链接,只需要修改ID即可。

1.1.1.1 有时会出现连上不能使用的情况;可能是WARP+模式或被国内阻断干扰或 Cloudflare WARP+ 自身服务不稳定造成;可点击右上角More settings按钮,找到Connection options选择Reset allReset keys后,重新开启连接。

WARP采用wireguard所以我们采用下面的脚本生成wireguard配置。可使用在线网站Repl.it来生成。因应用升级以下脚本已失效,请使用某位大佬的链接直接生成:点击这里

const publicKey = "Public Key复制到这里";
const privateKey = "Private Key复制到这里";
const referrer = "Referrer ID复制到这里获取1G流量直接启用Warp+";

if (!publicKey.endsWith("=") || !privateKey.endsWith("=")) {
  console.error("请正确填写密钥.");
  process.exit(1);
}

const https = require("https");
const zlib = require("zlib");
const fs = require("fs");
const util = require("util");

let warpConf = null;

async function run() {
  let userData = {};

  if (fs.existsSync("./warp-conf.json")) {
    warpConf = JSON.parse(fs.readFileSync("./warp-conf.json").toString());
  } else {
    warpConf = {
      id: null,
      publicKey: publicKey, // WireGuard pubic key
      token: null, // Cloudflare access token
      isWarpPlusEnabled: null
    };
  }

  if (!warpConf.id) {
    console.log("未读取到保存信息, 正在注册新帐号中...");
    userData = await reg();
    console.log("注册成功:");
    console.log(util.inspect(userData, false, null, true));
  } else {
    console.log("正在获取用户信息...");
    const res = await getInfo(warpConf.id, warpConf.token);
    userData = res.result;
    if (
      !warpConf.isWarpPlusEnablsed && // If saved record indicate using free version of Cloudflare Warp
      userData.account &&
      (userData.account.premium_data || data.account.warp_plus)
    ) {
      warpConf.isWarpPlusEnabled = true;
      fs.writeFileSync("./warp-conf.json", JSON.stringify(warpConf));
    }
    console.log("成功获取用户信息:");
    if (process.argv[2] && process.argv[2] === "q") {
      if (warpConf.isWarpPlusEnabled) {
        console.log(
          "\x1b[36m%s\x1b[0m",
          "WARP PLUS剩余流量:",
          userData.account.quota / 1000000000,
          "GB"
        );
      } else {
        console.log(
          "\x1b[36m%s\x1b[0m",
          "您正在使用Cloudflare免费版Warp, 没有流量限制, 您可用自己的ID分享1.1.1.1来获取流量以升级到Warp Plus."
        );
      }
      process.exit(0);
    }
    console.log(util.inspect(userData, false, null, true));
  }

  const wireGuardConf = `
[Interface]
PrivateKey = ${privateKey}
# PublicKey = ${publicKey}
Address = ${userData.config.interface.addresses.v4}
# Address = ${userData.config.interface.addresses.v6}
DNS = 1.1.1.1

[Peer]
PublicKey = ${userData.config.peers[0].public_key}
Endpoint = ${userData.config.peers[0].endpoint.v4}
# Endpoint = ${userData.config.peers[0].endpoint.v6}
# Endpoint = ${userData.config.peers[0].endpoint.host}
AllowedIPs = 0.0.0.0/0
`;

  console.log("Config: ");
  console.log(wireGuardConf);
  fs.writeFileSync("./wireguard-cloudflare-warp.conf", wireGuardConf);
  console.log(
    "Config saved, check wireguard-cloudflare-warp.conf in current dir."
  );

  if (warpConf.isWarpPlusEnabled) {
    console.log(
      "\x1b[36m%s\x1b[0m",
      "WARP PLUS剩余流量:",
      userData.account.quota / 1000000000,
      "GB"
    );
  } else {
    console.log(
      "\x1b[36m%s\x1b[0m",
      "您正在使用Cloudflare免费版Warp, 没有流量限制, 您可用自己的ID分享1.1.1.1来获取流量以升级到Warp Plus."
    );
  }
}

async function getInfo(id, token) {
  return new Promise(async resolve => {
    const result = await httpRequest({
      hostname: "api.cloudflareclient.com",
      port: 443,
      path: `/v0i1909221500/reg/${id}`,
      method: "GET",
      headers: {
        Accept: "*/*",
        Authorization: `Bearer ${token}`,
        Host: "api.cloudflareclient.com",
        "Accept-Encoding": "gzip",
        "Accept-Language": "Language",
        "User-Agent": "1.1.1.1/1909221500.1 CFNetwork/978.0.7 Darwin/18.7.0"
      }
    });

    if (result.success) {
      const data = result.payload;
      resolve(data);
    } else {
      console.error("获取用户信息失败.");
      process.exit(1);
    }
  });
}

async function reg() {
  return new Promise(async resolve => {
    const install_id = genString(11);
    const postData = {
      key: publicKey,
      install_id: install_id,
      fcm_token: `${install_id}:APA91b${genString(134)}`,
      referrer: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(
        referrer
      )
        ? referrer
        : "",
      warp_enabled: true,
      tos: new Date().toISOString().replace("Z", "+08:00"),
      type: "Android",
      locale: "en_US"
    };

    const result = await httpRequest(
      {
        hostname: "api.cloudflareclient.com",
        port: 443,
        path: "/v0a745/reg",
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Host: "api.cloudflareclient.com",
          Connection: "Keep-Alive",
          "Accept-Encoding": "gzip",
          "User-Agent": "okhttp/3.12.1"
        }
      },
      postData
    );

    if (result.success) {
      const data = result.payload;
      warpConf.id = data.id;
      warpConf.token = data.token;

      if (data.account && (data.account.premium_data || data.account.warp_plus))
        warpConf.isWarpPlusEnabled = true;

      fs.writeFileSync("./warp-conf.json", JSON.stringify(warpConf));

      resolve(data);
    } else {
      console.error("注册帐号失败.");
      process.exit(1);
    }
  });
}

function httpRequest(options, data = undefined) {
  return new Promise(resolve => {
    const bodyString = data ? JSON.stringify(data) : data;
    const req = https.request(options, res => {
      const gzip = zlib.createGunzip();
      const buffer = [];
      res.pipe(gzip);
      gzip
        .on("data", function(data) {
          buffer.push(data.toString());
        })
        .on("end", function() {
          const res = JSON.parse(buffer.join(""));
          resolve({ success: true, payload: res });
        })
        .on("error", function(e) {
          resolve({ success: false, payload: e });
        });
    });

    req.on("error", e => {
      resolve({ success: false, payload: e });
    });

    if (bodyString) req.write(bodyString);
    req.end();
  });
}

function genString(length) {
  // https://gist.github.com/6174/6062387#gistcomment-2651745
  return [...Array(length)]
    .map(i => (~~(Math.random() * 36)).toString(36))
    .join("");
}

run();

介绍一下微软的Chromium Edge:启用Chromium Edge翻译功能:edge://flags/#edge-translate
稳定版下载地址:点击这里


VAVE公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:1.1.1.1免费的WARP+流量提升方法
喜欢 (3)
[扫优惠]
分享 (0)
关于作者:
分享一些VPS商家信息

您必须 登录 才能发表评论!