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.
107 lines
2.6 KiB
Markdown
107 lines
2.6 KiB
Markdown
# s5p -- Cheatsheet
|
|
|
|
## CLI
|
|
|
|
```
|
|
s5p # direct, listen :1080
|
|
s5p -C socks5://127.0.0.1:9050 # through Tor
|
|
s5p -C socks5://tor:9050,http://px:8080 # Tor + HTTP proxy
|
|
s5p -c config/s5p.yaml # from config file
|
|
s5p -l 0.0.0.0:9999 # custom listen address
|
|
s5p -t 30 # 30s per-hop timeout
|
|
s5p -v # debug logging
|
|
s5p -q # errors only
|
|
s5p -S http://api:8081/proxies # proxy source API
|
|
s5p -r 5 # retry up to 5 proxies
|
|
s5p --cprofile # profile to s5p.prof
|
|
s5p --cprofile out.prof # profile to custom file
|
|
```
|
|
|
|
## Container
|
|
|
|
```
|
|
make build # podman-compose build
|
|
make up # podman-compose up -d
|
|
make logs # podman-compose logs -f
|
|
make down # podman-compose down
|
|
```
|
|
|
|
## Config
|
|
|
|
```bash
|
|
cp config/example.yaml config/s5p.yaml # create live config (gitignored)
|
|
```
|
|
|
|
## Proxy Pool (config)
|
|
|
|
```yaml
|
|
proxy_pool:
|
|
sources:
|
|
- url: http://10.200.1.250:8081/proxies
|
|
proto: socks5
|
|
limit: 1000
|
|
- file: /etc/s5p/proxies.txt
|
|
refresh: 300 # re-fetch interval
|
|
test_interval: 120 # health test cycle
|
|
max_fails: 3 # evict after N fails
|
|
```
|
|
|
|
## Proxy File Format
|
|
|
|
```
|
|
# one proxy URL per line
|
|
socks5://1.2.3.4:1080
|
|
socks5://user:pass@5.6.7.8:1080
|
|
http://proxy.example.com:8080
|
|
```
|
|
|
|
## Proxy URLs
|
|
|
|
```
|
|
socks5://host:port
|
|
socks5://user:pass@host:port
|
|
socks4://host:port
|
|
http://host:port
|
|
http://user:pass@host:port
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
# Check exit IP
|
|
curl -x socks5h://127.0.0.1:1080 https://httpbin.org/ip
|
|
|
|
# Tor check
|
|
curl -x socks5h://127.0.0.1:1080 https://check.torproject.org/api/ip
|
|
|
|
# Verbose curl
|
|
curl -v -x socks5h://127.0.0.1:1080 https://example.com
|
|
|
|
# With timeout
|
|
curl --max-time 30 -x socks5h://127.0.0.1:1080 https://example.com
|
|
```
|
|
|
|
## Profiling
|
|
|
|
```bash
|
|
python -m pstats s5p.prof # interactive stats viewer
|
|
```
|
|
|
|
## Metrics Log
|
|
|
|
```
|
|
metrics: conn=142 ok=98 fail=44 retries=88 active=3 in=1.2M out=4.5M up=0h05m12s pool=42/65
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
| Symptom | Check |
|
|
|---------|-------|
|
|
| Connection refused | Is Tor running? `ss -tlnp \| grep 9050` |
|
|
| Timeout | Increase `-t`, check proxy reachability |
|
|
| DNS leak | Use `socks5h://` (not `socks5://`) in client |
|
|
| Auth failed | Verify credentials in proxy URL |
|
|
| Port in use | `fuser -k 1080/tcp` to free the port |
|
|
| Container slow stop | Rebuild image after SIGTERM fix |
|
|
| Proxy keeps failing | Backoff penalizes for 60s; check `pool=` in metrics |
|