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
| Concept | Types |
|---|---|
| Entry point | CloudflareExporter |
| Run configuration | CloudflareExportOptions, HostScope, options::CloudflareAction |
| Plan budgets | CloudflarePlan, CloudflareCapabilities |
| Success artifacts | CloudflareOutput, ExportReport, output::ExportDiagnostic |
| Hard failure | exporter::ExportError |
| Matcher lowering | expression |
| Known Tower↔edge gaps | parity |
§Pipeline
- Filter enabled deny rules (allow rules are Tower-only exclusions).
- Lower each matcher to a Cloudflare fragment (
expression). - Emit soft diagnostics for unsupported or approximated operators.
- Pack fragments into plan-sized
orgroups with optional host scope. - Return
CloudflareOutputfor 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
| Feature | Effect |
|---|---|
serde (default) | JSON pretty-print of Rulesets API payloads |
regex (default) | Export regex matchers and include the broader rule tier |
rayon | Forwarded 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
RuleSetinto Cloudflare Ruleset output. - expression
- Lower portable
PathMatchervalues 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.