X Hamster.proxy |top|
# ------------------------------------------------- # 1️⃣ Set up SQLite audit DB (very lightweight) # ------------------------------------------------- conn = sqlite3.connect(":memory:") cur = conn.cursor() cur.execute( """ CREATE TABLE audit ( ts TEXT, client_ip TEXT, method TEXT, url TEXT, status INTEGER, duration_ms INTEGER ) """ ) conn.commit()
You should see a log line similar to:
You can combine and geo‑IP lookups to implement sophisticated traffic steering. x hamster.proxy
To use X Hamster Proxy safely, follow these best practices: | | --tls-ca <path> | Path to a
| Flag | Meaning | |------|---------| | -p, --port | Listening port (default: 8080 ). | | -b, --bind | Interface to bind (default: 0.0.0.0 ). | | --tls-ca <path> | Path to a custom CA for MITM (if omitted a self‑signed CA is generated). | | --log-level <lvl> | debug , info , warning , error . | | --metrics-port <port> | Expose Prometheus metrics (default: disabled). | | --config <yaml> | Load a routing/auth config file. | | | --config <yaml> | Load a routing/auth config file
# ------------------------------------------------- # 4️⃣ Middleware: audit + timing # ------------------------------------------------- @proxy.middleware async def audit_and_time(request: Request, call_next): start = datetime.utcnow() response = await call_next(request) duration = int((datetime.utcnow() - start).total_seconds() * 1000)