Commit Graph

24 Commits

Author SHA1 Message Date
user
818169758b feat: add SIGHUP hot config reload
On SIGHUP, re-read the YAML config file and update mutable runtime
settings: timeout, retries, log_level, and pool config (sources,
intervals, thresholds). Pool triggers an immediate source re-fetch.
Listen address and chain require restart.
2026-02-15 16:02:57 +01:00
user
fc1dea70f4 docs: update project docs for warm start and chain health check
Add warm start and chain pre-flight sections to USAGE. Mark both
features complete in ROADMAP and TASKS. Remove implemented items
from TODO. Update README, PROJECT, and CHEATSHEET.
2026-02-15 16:00:23 +01:00
user
0816a7f0cb feat: add static chain health check before pool tests
Test the static chain (without pool proxy) before running pool health
tests. If the chain itself is unreachable, skip proxy testing and log a
clear warning. Prevents false mass-failure when the issue is upstream
(e.g., Tor is down), not the exit proxies.
2026-02-15 15:59:26 +01:00
user
8e2d6a654a feat: add fast warm start with deferred full health test
On warm start (state has alive proxies), only quick-test the
previously-alive subset before serving. Full health test runs in
background. Cold start behavior unchanged (test all before serving).
Reduces startup blocking from minutes to seconds on warm restarts.
2026-02-15 15:58:22 +01:00
user
eddcc5f615 docs: update project docs for backoff, stale expiry, pool metrics
Add failure backoff and stale expiry sections to USAGE. Document pool=
field in metrics output. Update ROADMAP, TASKS, TODO with completed
items and remaining suggestions. Add metrics example to CHEATSHEET.
2026-02-15 15:56:06 +01:00
user
8aa384a80b feat: add pool stats to periodic metrics log
Append pool=alive/total to the 60-second metrics summary and shutdown
log. Pool health is now visible without waiting for health test cycles.
2026-02-15 15:54:52 +01:00
user
e1403a67fc feat: add stale proxy expiry based on last_seen TTL
Evict proxies not returned by sources for >3 refresh cycles and not
currently alive. Cleans up proxies removed upstream faster than waiting
for max_fails consecutive health test failures.
2026-02-15 15:54:17 +01:00
user
4801e70b93 feat: add per-proxy backoff after connection failure
Track last_fail timestamp on ProxyEntry. When a connection attempt fails
in server.py, report_failure() records the time. The selection weight
multiplies by min(fail_age/60, 1.0), ramping back from floor over 60s.
Prevents wasting retries on proxies that just failed.
2026-02-15 15:53:39 +01:00
user
0ed9142b1a docs: update project docs for weighted proxy selection
Add selection weight section to USAGE.md with decay formula and
reference table. Mark feature complete in ROADMAP and TASKS.
Update README and PROJECT descriptions.
2026-02-15 15:49:54 +01:00
user
b60264b865 feat: add weighted proxy selection based on recency
Replace uniform random.choice with random.choices weighted by last_ok
recency. Proxies tested successfully more recently get higher selection
probability (weight = 1/(1 + age/300)), decaying over ~5 minutes.
2026-02-15 15:48:40 +01:00
user
b11071e7f7 docs: add proxy pool documentation
Update all docs for managed proxy pool: README, USAGE, CHEATSHEET,
PROJECT, TASKS, and example config. Document multi-source config,
proxy file format, health testing, persistence, and legacy compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:18:20 +01:00
user
72adf2f658 feat: add managed proxy pool with health testing
ProxyPool replaces ProxySource with:
- Multiple sources: HTTP APIs and text files (one proxy URL per line)
- Deduplication by proto://host:port
- Health testing: full chain test with configurable concurrency
- Mass-failure guard: skip eviction when >90% fail
- Background loops for periodic refresh and health checks
- JSON state persistence with atomic writes (warm starts)
- Backward compat: ProxySource still works for legacy configs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:11:19 +01:00
user
1780c3a8cd feat: add proxy pool config dataclasses
Add PoolSourceConfig and ProxyPoolConfig for multi-source proxy pool
with health testing. Config supports both HTTP API and file sources.

Backward compat: legacy proxy_source YAML key auto-converts to
proxy_pool. CLI -S flag creates ProxyPoolConfig with single source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:08:39 +01:00
user
4463adf08b refactor: extract build_chain into proto module
Moves _negotiate_hop() and build_chain() from server.py to proto.py
to break circular import between server and the upcoming pool module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 06:07:31 +01:00
user
b07ea49965 feat: add connection retry and metrics
Retry failed proxy connections with a fresh random proxy on each
attempt (configurable via retries setting, proxy_source only).
Track connection metrics and log summary every 60s and on shutdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 04:54:13 +01:00
user
9b18a59df9 docs: add proxy source API documentation 2026-02-15 04:20:17 +01:00
user
ddad839fca feat: add dynamic proxy source API integration
Fetches proxies from an HTTP API, caches them in memory, and appends
a random proxy to the chain on each connection. Supports proto/country
filters and configurable refresh interval.

Config: proxy_source.url, proto, country, limit, refresh
CLI: -S/--proxy-source URL
2026-02-15 04:19:29 +01:00
user
20c7597ef9 docs: update all docs for container, cprofile, and config split 2026-02-15 03:51:16 +01:00
user
a40c35cc0b fix: add STOPSIGNAL SIGTERM to Containerfile 2026-02-15 03:46:51 +01:00
user
c016844a33 fix: handle SIGTERM gracefully for clean container shutdown
Register signal handler on the event loop to stop the server
on SIGTERM/SIGINT instead of relying on serve_forever().
2026-02-15 03:46:18 +01:00
user
61c580a555 feat: add Containerfile and compose.yaml for podman
Alpine-based image (59MB), source and config bind-mounted via
compose.yaml. Host networking for access to local Tor nodes.
2026-02-15 03:42:59 +01:00
user
57d2d87424 feat: add --cprofile flag for performance profiling
Dumps cProfile stats to a file (default: s5p.prof) on exit.
View with: python -m pstats s5p.prof
2026-02-15 03:39:36 +01:00
user
57c78f5563 feat: split config into tracked example and gitignored live config
config/example.yaml is the repo-safe sample.
config/s5p.yaml holds real proxy addresses and is gitignored.
2026-02-15 03:38:04 +01:00
user
0710dda8da feat: initial SOCKS5 proxy with chain support
Asyncio-based SOCKS5 server that tunnels connections through
configurable chains of SOCKS5, SOCKS4/4a, and HTTP CONNECT proxies.
Tor integration via standard SOCKS5 hop.
2026-02-15 03:10:25 +01:00