Skip to main content

Crate towershield_cloudflare

Crate towershield_cloudflare 

Source
Expand description

Offline Cloudflare Ruleset Engine exporter for portable shield rules.

Turns a towershield_core::RuleSet into Cloudflare expression text, a Rulesets API-shaped JSON payload, and a human-readable ExportReport. Export is pure CPU: no network, credentials, zone IDs, Terraform, or live deploy side effects. The Tower middleware remains the authoritative in-process denylist; edge rules are a coarse first filter.

§Domain map

ConceptTypes
Entry pointCloudflareExporter
Run configurationCloudflareExportOptions, HostScope, options::CloudflareAction
Plan budgetsCloudflarePlan, CloudflareCapabilities
Success artifactsCloudflareOutput, ExportReport, output::ExportDiagnostic
Hard failureexporter::ExportError
Matcher loweringexpression
Known Tower↔edge gapsparity

§Pipeline

  1. Filter enabled deny rules (allow rules are Tower-only exclusions).
  2. Lower each matcher to a Cloudflare fragment (expression).
  3. Emit soft diagnostics for unsupported or approximated operators.
  4. Pack fragments into plan-sized or groups with optional host scope.
  5. Return CloudflareOutput for review or hand-off to your deploy tooling.

Hard failures (exporter::ExportError) abort export: missing host scope, nothing exportable, or plan budget overflow. Soft gaps appear as output::ExportDiagnostic entries inside a successful output.

§Parity

Edge matching and the Tower path denylist are not byte-identical. See parity for field normalisation, segment/wildcard gaps, and how the exporter reports them.

§Features

FeatureEffect
serde (default)JSON pretty-print of Rulesets API payloads
regex (default)Export regex matchers and include the broader rule tier
rayonForwarded to towershield-core (compile-side only)

Re-exports§

pub use exporter::CloudflareExporter;
pub use options::CloudflareExportOptions;
pub use options::HostScope;
pub use output::CloudflareOutput;
pub use output::ExportReport;
pub use plan::CloudflareCapabilities;
pub use plan::CloudflarePlan;

Modules§

exporter
Offline compile of a portable RuleSet into Cloudflare Ruleset output.
expression
Lower portable PathMatcher values into Cloudflare expression fragments.
options
Host scope, action, and plan knobs for a Cloudflare export run.
output
Artifacts produced by a successful offline Cloudflare export.
parity
Known semantic gaps between the Tower path denylist and Cloudflare edge rules.
plan
Plan-tier limits that constrain expression packing and regex export.