Skip to content

Commit a55855e

Browse files
committed
chore: deduplicate README — consolidate docs links, remove inline examples
- Remove duplicated 'Writing Wasm Modules' code examples (moved to docs/DEVELOPMENT.md) - Remove duplicated 'Host Functions' list (canonical in docs/COMPATIBILITY.md) - Merge 'Getting Started', 'Architecture', 'Documentation' into single section - README: 199 → 137 lines (31% reduction)
1 parent 6f2db5d commit a55855e

1 file changed

Lines changed: 7 additions & 69 deletions

File tree

README.md

Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -85,71 +85,14 @@ sub vcl_deliver {
8585
| `wasm.get_metrics_json()` | Return Proxy-Wasm metrics as JSON |
8686
| `wasm.get_stats_json()` | Return execution statistics as JSON |
8787

88-
## Host Functions
89-
90-
**`env` namespace** (for non-proxy-wasm modules):
91-
92-
`get_request_header`, `get_request_url`, `get_request_method`, `get_client_ip`, `set_response_header`, `log_msg`
93-
94-
**`wasi_snapshot_preview1` namespace** (WASI stubs for wasm32-wasi modules):
95-
96-
`fd_write`, `clock_time_get`, `random_get`, `environ_sizes_get`, `environ_get`, `args_sizes_get`, `args_get`, `proc_exit`
97-
98-
For the full Proxy-Wasm ABI compatibility matrix, see [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
99-
10088
## Writing Wasm Modules
10189

102-
### Rust (wasm32-unknown-unknown)
103-
104-
```rust
105-
extern "C" {
106-
fn get_request_header(name_ptr: *const u8, name_len: i32,
107-
buf_ptr: *mut u8, buf_len: i32) -> i32;
108-
}
109-
110-
#[no_mangle]
111-
pub extern "C" fn on_request() -> i32 {
112-
// Return 0 to allow, 403 to block
113-
0
114-
}
115-
```
116-
117-
### Proxy-Wasm SDK (Rust)
118-
119-
```rust
120-
use proxy_wasm::traits::*;
121-
use proxy_wasm::types::*;
122-
123-
proxy_wasm::main! {{
124-
proxy_wasm::set_http_context(|_, _| -> Box<dyn HttpContext> {
125-
Box::new(MyFilter)
126-
});
127-
}}
128-
129-
struct MyFilter;
130-
impl HttpContext for MyFilter {
131-
fn on_http_request_headers(&mut self, _: usize, _: bool) -> Action {
132-
if self.get_http_request_header("x-block").is_some() {
133-
self.send_http_response(403, vec![], Some(b"Blocked"));
134-
return Action::Pause;
135-
}
136-
Action::Continue
137-
}
138-
}
139-
impl Context for MyFilter {}
140-
```
141-
142-
See [`examples/`](examples/) for complete examples, including the
143-
[edge-security-filter](examples/edge-security-filter/) — a production-grade
144-
module demonstrating rate limiting, bot detection, HTTP callouts, and metrics.
145-
146-
## Getting Started
147-
148-
New to vmod-wasm? Start here:
90+
See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for a complete guide and the
91+
[`examples/`](examples/) directory for working modules including the
92+
[edge-security-filter](examples/edge-security-filter/).
14993

150-
1. [Development Guide](docs/DEVELOPMENT.md) — Write, build, test, and deploy your first Proxy-Wasm module
151-
2. [Configuration Reference](docs/CONFIGURATION.md) — All VCL functions and recommended settings
152-
3. [Architecture](docs/ARCHITECTURE.md) — How vmod-wasm works internally
94+
For host function signatures and Proxy-Wasm ABI coverage, see
95+
[docs/COMPATIBILITY.md](docs/COMPATIBILITY.md).
15396

15497
## Building
15598

@@ -176,16 +119,11 @@ docker build -t vmod-wasm-dev .
176119
docker run --rm vmod-wasm-dev make check
177120
```
178121

179-
## Architecture
180-
181-
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the up-to-date component
182-
diagram and request lifecycle.
183-
184122
## Documentation
185123

186-
- [Architecture](docs/ARCHITECTURE.md) — Detailed component design and request lifecycle
187-
- [Development Guide](docs/DEVELOPMENT.md) — Writing your first Proxy-Wasm module
124+
- [Development Guide](docs/DEVELOPMENT.md) — Writing, building, and testing Proxy-Wasm modules
188125
- [Configuration Reference](docs/CONFIGURATION.md) — All VCL functions with parameters
126+
- [Architecture](docs/ARCHITECTURE.md) — Component design and request lifecycle
189127
- [Proxy-Wasm Compatibility](docs/COMPATIBILITY.md) — ABI coverage matrix
190128
- [Security Model](docs/SECURITY.md) — Isolation, threat model, supply chain security
191129
- [Production Guide](docs/PRODUCTION.md) — Deployment, hot-reload, monitoring, capacity planning

0 commit comments

Comments
 (0)