Skip to content

Commit e313bdc

Browse files
committed
add: custom residential port
1 parent 1f7e3d5 commit e313bdc

8 files changed

Lines changed: 278 additions & 133 deletions

File tree

README.md

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Instantly install, configure, and manage authenticated proxies on your VPS. Prox
1616
- **Zero-Overhead Analytics:** Uses kernel `iptables` to track proxy traffic (Sent/Received GB) with zero CPU strain on Node.js.
1717
- **Create Your Own Residential Network:** Link home computers to your VPS and route consumer traffic strictly through designated geographic locations.
1818
- **Hot-Reloading:** Change passwords and add new proxies without disconnecting currently active users.
19+
- **Provider Management:** Blacklist, whitelist, and auto-penalize misbehaving residential providers.
20+
- **Dual-Protocol Consumers:** Residential proxies accept both SOCKS5 and HTTP CONNECT on the same port.
1921
- **Instant Output:** Formats proxies beautifully into `user:pass@ip:port` for immediate copy-pasting.
2022

2123
---
@@ -105,7 +107,13 @@ npx proxyfoxy add res_user res_pass 8003 residential --country=US --limit=2GB
105107
🏠 Home PC string: npx proxyfoxy provider 203.0.113.50:9000
106108
```
107109

108-
You can specify a required country code (`--country=XX`) and a strict data limit (`--limit=XGB`). If the data limit is hit, connections are instantly severed.
110+
You can specify a required country code (`--country=XX`), a strict data limit (`--limit=XGB`), and a custom gateway port (`--gateway=PORT`, default 9000). If the data limit is hit, connections are instantly severed.
111+
112+
```bash
113+
# Custom gateway port (providers connect here instead of 9000)
114+
npx proxyfoxy add res_user res_pass 8003 residential --gateway=5000
115+
# → Provider string: npx proxyfoxy provider 203.0.113.50:5000
116+
```
109117

110118
<p align="center"><img src="https://raw.githubusercontent.com/maxylev/proxyfoxy/refs/heads/main/assets/proxyfoxy-residential.svg" alt="Residential Proxy Architecture"></p>
111119

@@ -120,7 +128,7 @@ ProxyFoxy allows you to create your own distributed residential proxy pool (simi
120128
Anyone can run this locally to inject themselves into the proxy pool. ProxyFoxy will auto-detect the Home PC's country using IP APIs. No credentials needed — just point it at your VPS.
121129

122130
```bash
123-
npx proxyfoxy provider <VPS_IP>:9000
131+
npx proxyfoxy provider <VPS_IP>:<GATEWAY_PORT>
124132
```
125133

126134
```
@@ -129,16 +137,30 @@ npx proxyfoxy provider <VPS_IP>:9000
129137

130138
```bash
131139
# Suppress reconnect messages (useful for Docker / PM2 / systemd)
132-
npx proxyfoxy provider <VPS_IP>:9000 --quiet
140+
npx proxyfoxy provider <VPS_IP>:<GATEWAY_PORT> --quiet
133141

134142
# Run it in the background / on boot
135143
npm install -g pm2 && \
136-
pm2 start "npx proxyfoxy provider <VPS_IP>:9000" --name "proxy-exit-node" --quiet && \
144+
pm2 start "npx proxyfoxy provider <VPS_IP>:<GATEWAY_PORT>" --name "proxy-exit-node" --quiet && \
137145
pm2 startup
138146
```
139147

140148
Providers that gracefully stop (SIGTERM/SIGINT) are disconnected without penalty. Providers that abruptly disconnect too often (>5 times in 10 minutes) are automatically blacklisted.
141149

150+
### Consume the Proxy
151+
152+
Residential proxies accept both **SOCKS5** and **HTTP CONNECT** on the same consumer port:
153+
154+
```bash
155+
# SOCKS5
156+
curl --socks5-hostname res_user:res_pass@<VPS_IP>:8003 https://icanhazip.com
157+
158+
# HTTP CONNECT
159+
curl -x http://res_user:res_pass@<VPS_IP>:8003 https://icanhazip.com
160+
```
161+
162+
The proxy is a fully transparent TCP tunnel — cookies, sessions, TLS, and all headers pass through untouched.
163+
142164
### Manage Providers (on VPS)
143165

144166
Control which providers can join your network with blacklists and whitelists.
@@ -153,7 +175,7 @@ npx proxyfoxy providers unwhitelist <ip> # Remove IP from whitelist
153175

154176
```
155177
🏠 PROVIDER MANAGEMENT
156-
════════════════════════════════════════════
178+
════════════════════════════════════════════
157179
158180
🟢 Connected (2):
159181
├─ 198.51.100.22 [US] since 2026-04-28T14:30:00.000Z
@@ -175,12 +197,12 @@ npx proxyfoxy list
175197

176198
```
177199
🦊 ProxyFoxy - Proxies
178-
════════════════════════════════════════════════════════
179-
🟢 HTTP -> myuser:mypass@203.0.113.50:8000
180-
🟢 SOCKS5 -> myuser:mypass@203.0.113.50:8001
181-
🟢 MTPROTO -> tg://proxy?server=203.0.113.50&port=8002&secret=ee...bHM
200+
════════════════════════════════════════════════════════
201+
🟢 HTTP -> myuser:mypass@203.0.113.50:8000
202+
🟢 SOCKS5 -> myuser:mypass@203.0.113.50:8001
203+
🟢 MTPROTO -> tg://proxy?server=203.0.113.50&port=8002&secret=ee...bHM
182204
🟢 RESIDENTIAL [US] -> res_user:res_pass@203.0.113.50:8003
183-
════════════════════════════════════════════════════════
205+
════════════════════════════════════════════════════════
184206
```
185207

186208
### `status` — Analytics Dashboard
@@ -191,11 +213,12 @@ npx proxyfoxy status
191213

192214
```
193215
📊 PROXYFOXY STATUS & ANALYTICS
194-
════════════════════════════════════════════════════════
216+
════════════════════════════════════════════════════════
195217
🛠️ CORE SERVICES:
196218
├─ HTTP (Squid): 🟢 RUNNING
197219
├─ SOCKS5 (Dante): 🟢 RUNNING
198-
└─ Master Gateway: 🟢 RUNNING
220+
├─ Master Gateway: 🟢 RUNNING
221+
└─ MTProto :8002 🟢 RUNNING
199222
200223
📈 TRAFFIC BY PORT:
201224
├─ Port 8000 [HTTP]
@@ -215,7 +238,7 @@ npx proxyfoxy status
215238
└─ Subtotal: 42.0 MB IN / 31.2 MB OUT
216239
217240
📊 Total: 3 Nodes — 170.5 MB IN / 115.4 MB OUT
218-
════════════════════════════════════════════════════════
241+
════════════════════════════════════════════════════════
219242
```
220243

221244
### `change` — Hot-Reload Password
@@ -247,13 +270,16 @@ Safely deletes the user, closes the firewall port, and removes the service.
247270
```bash
248271
npx proxyfoxy stop 8000 # Stop a specific port
249272
npx proxyfoxy start http # Start all HTTP proxies
273+
npx proxyfoxy stop residential # Stop the master gateway (disconnects all providers)
250274
npx proxyfoxy stop # Stop everything
251275
```
252276

253277
```
254278
✅ Successfully executed 'stop' on requested services.
255279
```
256280

281+
Note: `stop residential` stops the master gateway daemon (all providers disconnect). `stop <port>` stops a specific consumer proxy but keeps the gateway running (providers stay connected).
282+
257283
### `uninstall` — Nuclear Option
258284

259285
```bash
@@ -301,30 +327,44 @@ The generated `tg://proxy?...` link appears in the container logs: `docker logs
301327

302328
Residential mode runs **two ports** inside one container:
303329

304-
- **Port 9000** (Gateway) — where Home PC providers connect
305-
- **Port 8003** (Consumer) — a SOCKS5 proxy that relays traffic through providers
330+
- **Gateway port** (default 9000) — where Home PC providers connect
331+
- **Consumer port** (e.g., 8003) — accepts both SOCKS5 and HTTP CONNECT, relays through providers
306332

307-
Both ports must be published, and you can pass `--country=` / `--limit=` flags:
333+
Both ports must be published. You can pass `--country=`, `--limit=`, and `--gateway=` flags:
308334

309335
```bash
336+
# Default gateway (9000)
310337
docker run -d \
311338
-p 8003:8003 \
312339
-p 9000:9000 \
313340
--name residential-proxy \
314341
ghcr.io/maxylev/proxyfoxy:latest \
315342
res_user res_pass 8003 residential --country=US --limit=2GB
343+
344+
# Custom gateway port (5000)
345+
docker run -d \
346+
-p 8003:8003 \
347+
-p 5000:5000 \
348+
--name residential-proxy \
349+
ghcr.io/maxylev/proxyfoxy:latest \
350+
res_user res_pass 8003 residential --country=US --gateway=5000
316351
```
317352

318353
Then on a **Home PC**, run the provider to donate your IP:
319354

320355
```bash
356+
# Use the gateway port from the --gateway flag (or 9000 by default)
321357
npx proxyfoxy provider <VPS_IP>:9000
322358
```
323359

324-
Consumers connect via **SOCKS5**:
360+
Consumers connect via **SOCKS5** or **HTTP CONNECT**:
325361

326362
```bash
363+
# SOCKS5
327364
curl --socks5-hostname res_user:res_pass@<VPS_IP>:8003 https://icanhazip.com
365+
366+
# HTTP CONNECT
367+
curl -x http://res_user:res_pass@<VPS_IP>:8003 https://icanhazip.com
328368
```
329369

330370
Manage providers from inside the container:

assets/proxyfoxy-http.svg

Lines changed: 3 additions & 3 deletions
Loading

assets/proxyfoxy-mtproto.svg

Lines changed: 5 additions & 5 deletions
Loading

assets/proxyfoxy-residential.svg

Lines changed: 5 additions & 5 deletions
Loading

assets/proxyfoxy-socks5.svg

Lines changed: 4 additions & 4 deletions
Loading

e2e/tests/04-residential.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,26 @@ if [ "$PROVIDER_READY" = true ]; then
2929
CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 \
3030
--socks5-hostname res_user:res_pass@127.0.0.1:8083 https://icanhazip.com) || CODE="000"
3131
if [ "$CODE" = "200" ]; then
32-
pass "residential proxy forwards request"
32+
pass "SOCKS5 residential proxy forwards request"
3333
else
34-
fail "residential proxy forwards request (HTTP $CODE)"
34+
fail "SOCKS5 residential proxy forwards request (HTTP $CODE)"
3535
fi
36+
37+
CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 \
38+
-x http://res_user:res_pass@127.0.0.1:8083 https://icanhazip.com) || CODE="000"
39+
if [ "$CODE" = "200" ]; then
40+
pass "HTTP CONNECT residential proxy forwards request"
41+
else
42+
fail "HTTP CONNECT residential proxy forwards request (HTTP $CODE)"
43+
fi
44+
45+
assert_fail "HTTP CONNECT rejects bad credentials" \
46+
curl -s -o /dev/null --max-time 10 \
47+
-x http://res_user:wrong@127.0.0.1:8083 https://icanhazip.com
3648
else
3749
fail "provider connected to gateway (timeout waiting for state)"
38-
skip "residential proxy forwards request (no provider)"
50+
skip "SOCKS5 residential proxy forwards request (no provider)"
51+
skip "HTTP CONNECT residential proxy forwards request (no provider)"
3952
fi
4053

4154
assert_output "status shows residential provider pool" "RESIDENTIAL" proxyfoxy status

0 commit comments

Comments
 (0)