xorevia-errors 0.0.1-alpha.2

Xorevia 组件:错误页定制(error_page / recursive_error_pages 的等价物)
Documentation
# Xorevia

[![Version](https://img.shields.io/badge/version-0.0.1--alpha.2-orange)](https://github.com/xorevia-dev)
[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

English | [简体中文]README_ZH.md

**Xorevia** is a high-performance Rust web framework with a **hand-rolled HTTP/1.1 protocol kernel**, self-built HTTP/2 (HPACK / Huffman) and HTTP/3 (QUIC / QPACK / Retry), and a **zero third-party HTTP dependency** protocol layer (no hyper / axum / http / httparse / tower). Capabilities are aligned with nginx item by item (proxy / ACL / rewrite / location / geo / map / SSI / proxy-cache / dav / mail / L4 stream ...).

> Status: `0.0.1-alpha.2`, APIs still evolving. The codebase has been through 9 security-audit rounds (trust boundaries, request smuggling, path traversal, DNS rebinding, ... closed class by class) — see the security baseline at the bottom.

Everything Xorevia ships from lives in this one repository: the framework crates, the shared business assembly, both distribution forms, the panel frontend, the client SDKs and the interop harnesses. The workspace root **is** the repository root, so `cargo` commands run from the checkout.

## Layout

```bash
cargo run                         # the standalone edition (default member), 127.0.0.1:8080
cargo test --workspace            # framework + both distributions
```

| Path | Contents |
|------|------|
| `crates/` | 59 component/capability crates: the `xorevia` facade, Lite/Standard/Full presets, the ops panel, MCP, ACME, CLI |
| `apps/app-shared/` | Business assembly layer — routes, middleware, state, models; the only copy |
| `apps/app-atlas/` | **Standalone edition** (default distribution, bin `xorevia`): one process started like nginx, tuned by one optional TOML |
| `apps/app-lyra/` | **Embeddable edition** (library): the host owns `main`, the runtime and the signals; `build.rs` can bake the frontend into the binary |
| `frontend/` | Panel frontend source (`web-src/xorevia-web`, Next.js) and the built artifacts (`web/`) that the server serves |
| `clients/` | Client SDKs — node / python / go / cpp, contract in `clients/CONTRACT.md` |
| `test/` | Interop harnesses (HTTP/1.1 + TLS, HTTP/3 vs aioquic); standalone Cargo projects, not workspace members |

The documentation site lives in its own repo, [xorevia-docs](https://github.com/xorevia-dev/xorevia-docs).

```text
crates/
├── xorevia-core/        Protocol kernel: HTTP/1.1 parser·encoder·headers·framing + error + util (no features)
├── xorevia-rt/          Runtime + accept + connection loop + graceful shutdown (reuseport / proxy_protocol live here)
├── xorevia-h2/ h3/      Fully self-built HTTP/2 and HTTP/3 (h2 in default; h3 behind the http3 feature)
├── xorevia-router/ handler/ multipart/ tls/ sse/ ws/ static/    Routing and endpoint layer
├── xorevia-proxy/       Reverse proxy (upstream pool / consistent hash / sticky cookie / Upgrade tunnel / TLS upstream)
├── xorevia-acl/ vars/ geo/ location/ rewrite/ vhost/ accesslog/ …   nginx directive families
├── xorevia-panel/       Ops panel /api/panel/** (loopback gate + first-run admin, SQLite sessions)
├── xorevia-mcp/         AI MCP server (the panel surface exposed to AI assistants)
├── xorevia-acme/        Self-built ACME (multiple CAs, four challenge types)
├── xorevia-cli/         Package manager for language packs / CAs / DNS adapters
└── xorevia/             ★ Facade: App assembly + prelude + 62 capability features + all e2e
apps/app-shared/         Business assembly layer (both distributions share one copy)
apps/app-atlas/          Standalone edition (bin xorevia, default member) · apps/app-lyra/  Embeddable edition (library)
frontend/                Panel frontend source (web-src) and built artifacts (web)
clients/                 node / python / go / cpp client SDKs + CONTRACT.md
test/                    interop harnesses (not workspace members)
```

## Quick start

```bash
cargo check --workspace           # fastest feedback
cargo test --workspace            # full test suite (3700+ cases, zero-warning standard)
cargo test --workspace --all-features  # run again with every capability compiled in
```

Hard constraints (pinned by workspace lints and tests):

- **`unsafe` is forbidden** in every crate (`unsafe_code = "forbid"`, inherited everywhere)
- **Zero third-party HTTP dependencies in the protocol layer**: beyond tokio / bytes / memchr / serde / serde_json, only `socket2` in `xorevia-rt` (the backlog must genuinely apply on every bind path)
- **Zero-warning standard**: `cargo test` / `cargo check` must be warning-free under both default and trimmed feature sets
- Library code reads no config files and no environment variables (the single exception is the atlas distribution reading one optional TOML whose keys map onto real knobs)

## Capability highlights

| Area | Notes |
|----|------|
| HTTP kernel | Incremental parsing, O(1) known-header index, anti-smuggling (CL+TE / duplicate CL / obfuscated variants), protocol-error responses readable before close |
| HTTP/2 · HTTP/3 | HPACK / Huffman / QPACK built from scratch, pinned by RFC golden vectors; h3 includes Retry (RFC 9001 App A.4 reproduced byte for byte) |
| Reverse proxy | round-robin / least_conn / hash (nginx-identical per key) / consistent hash / sticky cookie; `proxy_next_upstream` idempotency matched item by item |
| nginx alignment | rewrite / location / geo / map / referer / SSI / proxy-cache / dav / mail / stream / gateways … mapped as equivalent·partial·missing |
| Security | ACL (Windows platform folding), secure-link, auth_basic (constant-time), realip (rightmost untrusted hop), panel loopback gate + first-run admin with SQLite sessions |
| Observability | Structured logging, Prometheus exposition (field-by-field compliance assertions), `/api/_metrics`, `stub_status` |
| Business layer | `app-shared` assembled once, shared by both distributions; panel + MCP + ACME + i18n all trimmable |

## Links

- Documentation site: <https://docs.xorevia.net> (repo: [xorevia-docs]https://github.com/xorevia-dev/xorevia-docs)
- Releases: standalone binaries are attached to this repository's releases; the SDKs publish to npm / PyPI / the Go module proxy / vcpkg
- Client SDKs (node / python / go / cpp): [`clients/`]clients, contract in [`clients/CONTRACT.md`]clients/CONTRACT.md

## License

MIT