Expand description
Cloudflare API client — publishes the QDP front-door DNS record (the easy-install path).
The front door is anchored by a single DNS TXT record at _qdp.<domain> (QDP §3.6): a domain owner
adds one record and needs no server. For the many domains already on Cloudflare, doing that by hand
is friction; this module drives Cloudflare’s v4 API to publish the same record turnkey.
This is a convenience path, not infrastructure: it holds only the user’s own Cloudflare API token
(supplied by the principal), talks only to api.cloudflare.com, and carries only the public front-door
record produced by crate::front_door::FrontDoorRecord::to_dns_txt — never a private key (QDP §5).
The network calls are host-only (#[cfg(not(target_arch = "wasm32"))]) and use reqwest::blocking
(already a dependency — no new crates). The pure helpers (payload shaping, response parsing) carry
the logic and are unit-tested without a network.
Structs§
- CfConfig
- Credentials for the user’s own Cloudflare account. Supplied by the principal; never persisted here.
Functions§
- dns_
record_ payload - Shape the Cloudflare
POST /zones/{zone}/dns_recordsbody for a front-door record. - list_
zones - List the zones (domains) the token can manage (
GET /zones) →(zone_id, zone_name)pairs. - parse_
verify_ token - Validate a Cloudflare
GET /user/tokens/verifyresponse. - parse_
zone_ list - Parse a Cloudflare
GET /zonesresponse into(zone_id, zone_name)pairs. - provision_
pages_ project - Provision a Cloudflare Pages Project linked to a GitHub repository (
POST /accounts/{account_id}/pages/projects). - provision_
r2_ bucket - Provision a Cloudflare R2 bucket (
POST /accounts/{account_id}/r2/buckets). - provision_
tunnel - Provision a Cloudflare Tunnel (
POST /accounts/{account_id}/cfd_tunnel). Returns the generated Tunnel ID. - provision_
worker - Provision a Cloudflare Worker script (
PUT /accounts/{account_id}/workers/scripts/{script_name}). - publish_
front_ door - Publish the front-door TXT record (
POST /zones/{zone}/dns_records) → the created record’s id. - route_
tunnel_ dns - Route DNS to a Cloudflare Tunnel (
POST /zones/{zone_id}/dns_records). - verify_
token - Verify a Cloudflare API token is valid and active (
GET /user/tokens/verify).