tinyproxy-zig is a Zig implementation of the tinyproxy HTTP/HTTPS proxy daemon, built on top of the zio coroutine and async I/O framework.
This project is a rewrite of tinyproxy in Zig. When implementing features:
-
Maintain Functional Parity: Keep the same functionality as the original tinyproxy C implementation. Do not add, remove, or change behavior unless explicitly discussed.
-
Idiomatic Zig Implementation: While functionality must match, the implementation should be native Zig - use Zig idioms, error handling patterns, and standard library conventions rather than direct C-to-Zig translation.
-
Preserve Module Structure: Keep the same (or similar) module/file structure as the original tinyproxy. Each C source file should have a corresponding Zig module with equivalent responsibilities.
Reference: Always consult ../../tinyproxy/src/ for the original C implementation when implementing new features or debugging behavior differences.
- Language: Zig 0.15.2
- Async Runtime: zio (stackful coroutines + io_uring/kqueue/epoll)
- Reference: tinyproxy (C version) - functionality parity goal
- Follow Zig standard library conventions strictly
- Use
error unionandoptionalfor error handling - Avoid global mutable state (use dependency injection)
- Naming:
snake_casefor functions/variables,PascalCasefor types - Documentation: use
///doc comments for public APIs
- Do not create or use git worktrees
- Make all changes in the main workspace
- Single-threaded coroutine model: one coroutine per connection
- Modular design: each feature is a separate
.zigfile - Configuration-driven: all features controllable via config file
| Module | Purpose |
|---|---|
request.zig |
Main request handling logic |
conf.zig |
Configuration parsing |
acl.zig |
Access control lists |
upstream.zig |
Upstream proxy support |
filter.zig |
URL filtering |
| Phase | Focus | Status |
|---|---|---|
| Phase 1 | Configuration, Logging | 🚧 Partial (struct done, file parsing pending) |
| Phase 2 | HTTP Enhancement, Headers, Anonymous | ✅ Done (headers, anonymous integrated) |
| Phase 3 | ACL, Auth, Filter, Connect Ports | 🚧 Partial (connect ports done) |
| Phase 4 | Upstream, Reverse, Transparent Proxy | Not Started |
| Phase 5 | Stats, Signals, Daemon, Error Pages | Not Started |
See docs/plans/2026-01-11-implementation-roadmap.md for detailed plan.
- Minimal testing strategy: core functionality only
- Run tests:
zig build test - Manual testing:
curl -x http://127.0.0.1:9999 http://example.com
- Create
src/<feature>.zig - Add config options to
conf.zig - Integrate into
request.zigprocessing pipeline - Update README.md feature checklist
- Use
std.log.scopedfor module-specific logging - Enable debug allocator in
main.zig
- tinyproxy (C):
../../tinyproxy- functionality reference - zio:
../zio- async I/O library
These instructions are for AI assistants working in this project.
Always open @/openspec/AGENTS.md when the request:
- Mentions planning or proposals (words like proposal, spec, change, plan)
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
- Sounds ambiguous and you need the authoritative spec before coding
Use @/openspec/AGENTS.md to learn:
- How to create and apply change proposals
- Spec format and conventions
- Project structure and guidelines
Keep this managed block so 'openspec update' can refresh the instructions.