Skip to content

Latest commit

 

History

History
37 lines (31 loc) · 2.8 KB

README.md

File metadata and controls

37 lines (31 loc) · 2.8 KB

chnroutes-cfworker

Generate chnroutes by fetching RIR stats and managing to compressing routes by merging consecutive CIDRs, deployed on Cloudflare Workers. Ported from my Python script.

📢 The CIDR aggregator is now available as a standalone app: https://github.com/Gowee/cidr-aggregator 📢

API

Base URL: https://chnroutes-worker.bamboo.workers.dev 🔗

Generate Routes

  • Endpoint: /generate
  • Parameters:
    • countries
      • Comma-separated list of countries represented by 2 letters Country Code.
      • A leading ! indicates excluding all following countries. For example, !CN will cover all countries/regions except mainland China in registries specified below. A single ! indicates all countries. And so on...
    • registries
      • Comma-separated list of registries: AFRINIC, APNIC, ARIN, LACNIC, RIPE. Or All for all the five.
      • Excluding is not supported.
  • Examples:
    • https://chnroutes-worker.bamboo.workers.dev/generate?countries=CN&registries=APNIC 🔗
      • Typical chnroutes, useful for spliting traffic when bypassing the GFW with VPN/Proxies
      • Becasuse almost all of mainland China IPs are delegated to APNIC currently (Sep 2019), so it might be sufficient to only cover APNIC.
    • https://chnroutes-worker.bamboo.workers.dev/generate6?countries=US&registries=All 🔗
      • All U.S. IPv6s delegated to any registries.
      • The /generate6 endpoint is experimental and subject to change.

Deployment

  1. Make sure Rust and Cargo is installed.
  2. Download the project with git clone https://github.com/Gowee/chnroutes-cfworker.
  3. Install the CLI tool wrangler for deploying to CloudFlare workers.
  4. Configure and publish the worker following the official quickstart.

Credits

This repo takes rustwasm-worker-template, which is a project by Ashley Williams, as the base skeleton.

The name chnroutes comes from https://github.com/fivesheep/chnroutes.git.