HTTP/HTTPS proxy library with allow/deny list and interactive permission prompt
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-23 13:24:12 +01:00
agents Bugfix B004: split the prune-time SessionGone tests into their own test binary to stay inside the 500-line file limit 2026-11-23 13:20:40 +01:00
docs Docs B004: call out that an undeliverable one-time answer retires the id with SessionGone, so integrators polling for staleness see the whole picture 2026-11-23 13:21:33 +01:00
lib Docs B004: call out that an undeliverable one-time answer retires the id with SessionGone, so integrators polling for staleness see the whole picture 2026-11-23 13:21:33 +01:00
src Bugfix B004: emit the terminal AskRetired event for every retired ask 2026-11-23 12:55:40 +01:00
temp Initial commit, agent scaffolding, initial plan 2026-11-12 21:54:23 +01:00
.gitignore Fix, Plan 001: gitignore temp/ scratch dir declared in AGENTS.md 2026-11-13 03:15:40 +01:00
AGENTS.md Update AGENTS.md 2026-11-23 02:59:36 +01:00
Cargo.lock Feature 001, T003: policy type and pure decision engine with auto-add and ask outcomes 2026-11-12 23:48:24 +01:00
Cargo.toml Feature 001, T001: workspace scaffolding for proxyd and http-proxy 2026-11-12 23:26:54 +01:00
Changelog.md Docs B004: call out that an undeliverable one-time answer retires the id with SessionGone, so integrators polling for staleness see the whole picture 2026-11-23 13:21:33 +01:00
README.md Docs, Plan 001: add repository README 2026-11-13 03:26:32 +01:00

proxy — HTTP/HTTPS proxy with domain allow/deny lists

An explicit HTTP proxy (standard proxy protocol only — CONNECT tunnelling and absolute-form HTTP, deliberately not SOCKS) with per-domain allow and deny lists, five access policies, and a terminal "ask" flow that lets you approve or deny unknown domains as connections arrive.

It is built as two crates:

  • http-proxy (library, in lib/) — the proxy protocol itself. It owns no listener: inbound connections are handed in as generic tokio streams (TCP sockets, or SSH forwarding channels from socket-ssh), and the library makes its own outbound TCP connections. Everything else lives on top of it.
  • proxyd (binary, workspace root) — TCP listener, TOML config with atomic write-back, logging, and the interactive ask prompt.

Full documentation lives in the mdbook under docs/ (mdbook build docs -d docs/book, then open docs/book/index.html).

Quickstart

cargo build
cat > proxyd.toml <<'EOF'
policy = "allow"

[server]
listen = "127.0.0.1:8080"

[allow_list]
"example.com"   = "main site"
"*.example.org" = "all subdomains"

[deny_list]
"ads.example"   = "tracker"
EOF

./target/debug/proxyd --check   # validate the config
./target/debug/proxyd           # run it
curl -x http://127.0.0.1:8080 http://example.com/

Policies

Policy allow-listed deny-listed unknown
unlocked allow allow allow, no side effect
allow allow deny allow, auto-added to allow list
deny allow deny deny, auto-added to deny list
ask allow deny hold the connection, prompt
locked deny deny deny

Auto-added entries are written back to the config file with an auto-added <timestamp> comment. Under ask, each unknown domain produces one queued question on the terminal with four answers: [a]llow, [d]eny (permanent, recorded in the list with an asked, allowed/denied <timestamp> comment), allow [o]nce and deny on[c]e (resolve only that one connection). Wildcards (*.example.com, subdomains only; bare * matches everything) and IP literals are valid list entries; deny wins over allow. See docs/src/matching.md and docs/src/policies-and-asking.md.

Library use

Embed http-proxy to drive the proxy from your own listener — for example connections forwarded through a socket-ssh channel:

use http_proxy::{Proxy, ProxyConfig, Policy};

let (proxy, mut events) = Proxy::new(ProxyConfig::default(), Policy::Ask);
// spawn one task per event: prompt, answer via allow_once/deny_once or
// add_allow/add_deny, and persist lists yourself
// for each accepted stream:
proxy.handle_connection(stream, peer).await?;

See docs/src/library.md for the embedding guide and docs/src/limitations.md for known trade-offs (denied-after-200 CONNECT shows the client a TLS error, config rewrite drops hand-written comments, HTTP/1.x only).

Project structure

lib/       http-proxy library crate
src/       proxyd binary (CLI, config, runtime, prompt)
docs/      mdbook user documentation (src/, built to docs/book/)
agents/    plans, rules and memory for agent workers

Development

cargo build
cargo test --workspace            # unit + integration tests
cargo clippy --workspace --all-targets
cargo fmt --check
mdbook build docs -d docs/book    # user documentation

License

MIT