← ClaudeAtlas

rust-network-modulelisted

Scaffold new Rust async networking modules for the nat464-sidecar project. Use when adding TCP/UDP listeners, protocol handlers, proxies, or translation modules. Triggers: 'scaffold module', 'add new module', 'create listener', 'create proxy', 'add protocol handler', 'new networking module', 'scaffold UDP', 'add ICMP translation'.
fakoli/fakoli-plugins · ★ 4 · AI & Automation · score 74
Install: claude install-skill fakoli/fakoli-plugins
# Rust Network Module Scaffolding Scaffold new async networking modules following nat464-sidecar's established patterns. ## Workflow ### 1. Determine Module Type | Type | Pattern | Example | |------|---------|---------| | **Listener** | Accept connections, spawn handler tasks | `proxy/inbound.rs` | | **Protocol handler** | Parse/serialize protocol messages | `socks5/handshake.rs` | | **Relay/proxy** | Bidirectional byte forwarding between streams | `proxy/copy.rs`, `socks5/relay.rs` | | **Resolver/racer** | DNS resolution, connection racing | `happy_eyeballs/resolver.rs`, `racer.rs` | | **HTTP server** | Hyper-based HTTP endpoint | `health.rs` | ### 2. Create Module Files Every module is a directory under `src/` with `mod.rs` + implementation files. ``` src/<module_name>/ ├── mod.rs # Re-exports, shared types/constants ├── <primary>.rs # Main logic └── (optional).rs # Additional files as needed ``` Register in parent: add `pub mod <module_name>;` to `src/main.rs` or parent `mod.rs`. ### 3. Apply Project Conventions See [references/patterns.md](references/patterns.md) for the full pattern catalog with code templates. **Key conventions:** - `pub async fn run_<name>(port: u16, ...) -> anyhow::Result<()>` for server entry points - `tokio::spawn` per connection, errors logged inside spawn (never crash the server) - `tracing` structured fields: `debug!` per-connection, `info!` lifecycle, `error!` failures - `anyhow::Result` everywhere, `anyhow::bail!` fo