Add max_connections config (default 256) with -m/--max-connections CLI flag. Server wraps on_client in asyncio.Semaphore to prevent fd exhaustion under load. Value reloads on SIGHUP; active connections drain normally. Also adds pool_size/pool_max_idle config fields and first_hop_pool wiring in server.py (used by next commits), and fixes asyncio.TimeoutError -> TimeoutError lint warnings.
46 lines
1.9 KiB
YAML
46 lines
1.9 KiB
YAML
# s5p example configuration
|
|
# Copy to config/s5p.yaml and edit to taste.
|
|
|
|
listen: 127.0.0.1:1080
|
|
timeout: 10
|
|
retries: 3 # max attempts per connection (proxy_source only)
|
|
log_level: info
|
|
# max_connections: 256 # max concurrent client connections (backpressure)
|
|
# pool_size: 0 # pre-warmed TCP connections to first hop (0 = disabled)
|
|
# pool_max_idle: 30 # max idle time (seconds) for pooled connections
|
|
|
|
# Proxy chain -- connections tunnel through each hop in order.
|
|
# Supported protocols: socks5://, socks4://, http://
|
|
#
|
|
# Example: Tor first hop, then a public proxy
|
|
chain:
|
|
- socks5://127.0.0.1:9050 # Tor
|
|
# - socks5://user:pass@proxy:1080 # post-Tor SOCKS5 proxy
|
|
# - socks4://proxy:1080 # post-Tor SOCKS4/4a proxy
|
|
# - http://user:pass@proxy:8080 # post-Tor HTTP CONNECT proxy
|
|
|
|
# Managed proxy pool -- fetches from multiple sources, health-tests,
|
|
# and rotates alive proxies per-connection after the static chain.
|
|
# proxy_pool:
|
|
# sources:
|
|
# - url: http://10.200.1.250:8081/proxies
|
|
# proto: socks5 # optional: filter by protocol
|
|
# country: US # optional: filter by country
|
|
# limit: 1000 # optional: max proxies to fetch
|
|
# - file: /etc/s5p/proxies.txt # text file, one proxy URL per line
|
|
# refresh: 300 # re-fetch sources interval (seconds)
|
|
# test_interval: 120 # health test cycle interval (seconds)
|
|
# test_url: http://httpbin.org/ip # URL for health checks
|
|
# test_timeout: 15 # per-test timeout (seconds)
|
|
# test_concurrency: 5 # parallel health tests
|
|
# max_fails: 3 # consecutive fails before eviction
|
|
# state_file: "" # empty = ~/.cache/s5p/pool.json
|
|
# report_url: "" # POST dead proxies here (optional)
|
|
|
|
# Legacy proxy source (still supported, auto-converts to proxy_pool):
|
|
# proxy_source:
|
|
# url: http://10.200.1.250:8081/proxies
|
|
# proto: socks5
|
|
# limit: 1000
|
|
# refresh: 300
|