Skip to content

Latest commit

 

History

History
70 lines (47 loc) · 2.59 KB

CONTRIBUTING.md

File metadata and controls

70 lines (47 loc) · 2.59 KB

Contributing

Repository layout

Path Contents
crates/libcfd Public tunnel, edge and origin APIs, examples, and tests
crates/libcfd-rpc Cap'n Proto schemas, pregenerated bindings, and the registration RPC client
research/ Protocol notes and a read-only cloudflared reference checkout (git submodule)

AGENTS.md lists the design constraints that every change must follow.

Development environment

The Nix flake provides the Rust toolchain, the Cap'n Proto compiler, and the native dependencies for both QUIC backends:

nix develop

Without Nix you need a stable Rust toolchain and a C compiler. You also need cmake and libclang for quic-edge-quiche. The capnp compiler is optional: without it, libcfd-rpc uses the committed bindings in pregenerated/. After changing a schema, regenerate them with:

LIBCFD_UPDATE_PREGENERATED=1 cargo build -p libcfd-rpc

Validation

CI runs exactly this:

nix flake check -L

It runs a secret-hygiene scan, the checks below, and a default-features cargo check. To iterate locally inside nix develop, run:

cargo fmt --all --check
cargo check --workspace --all-targets --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features

The offline suite needs no network or credentials. Note that --all-features selects the quiche QUIC backend; the default-features check covers quinn.

Live tests

The live test target (crates/libcfd/tests/live) runs against the real Cloudflare edge and creates tunnels. Its tests are #[ignore]d, so you have to run them explicitly, one thread at a time:

# Quick tunnels (HTTP, WebSocket over quinn; HTTP over HTTP/2)
cargo test -p libcfd --test live quick:: -- --ignored --test-threads=1

# Named tunnels; requires NAMED_TUNNEL_TOKEN in the environment
cargo test -p libcfd --test live named:: -- --ignored --test-threads=1

# quiche backend
cargo test -p libcfd --test live --features quic-edge-quiche \
  quick::live_quick_quic_quiche_serves_http -- --ignored --exact --test-threads=1

Named tests require a remotely managed tunnel with routed ingress hostnames. The WebSocket and TCP tests also need matching ingress rules. Missing prerequisites make a test fail; it is not skipped.

Live tests cache credentials under tests/state/ at the workspace root. That directory is gitignored and contains real secrets, so never commit or share its contents. Set RUST_LOG to control test log output.

API documentation

cargo doc --workspace --all-features --no-deps --open