TypeScript hosted proxies with unique exit IPs
Integration · Sockets · Messages · Provider · Embed · Hosted proxies
unique-exit.ts is a complete backend program for Node 24. It:
- creates N hosted proxies with
proxy_;config. unique_ exit - prints each proxy's exit location and
exit_id; - sends one request through each proxy's HTTPS and SOCKS5 URLs to an IP echo, and shows that the exits are distinct;
- optionally rotates one proxy's exit;
- removes the proxies again unless
--keep.
See the hosted proxy guide for what unique exits are, the curl walkthrough, and errors.
Pro only. A Pro network holds up to 1,000 active hosted proxies and creates up to 20 a minute. The program paces its creates to that rate, so 1,000 proxies take about 50 minutes.
Install and run
npm install
export URNETWORK_ ROOT_ JWT= 'your-network-credential'
node unique-exit.ts --count 3
node unique-exit.ts --count 3 --country de --rotate
node unique-exit.ts --count 10 --replace manual --keepNode 24 runs the TypeScript directly.
| Option | Meaning |
|---|---|
--count N | proxies to create, at most 1,000 |
--country CC | a two-letter country for the exits; the default is best available |
--replace auto|manual | on exit failure, auto (the default) assigns a new unique exit, while manual keeps the proxy on its exit until you rotate it |
--rotate | rotate the first proxy to a new unique exit (a proxy may rotate once a minute and 60 times a day) |
--echo-url URL | the IP echo reached through each proxy (default https://) |
--keep | keep the proxies instead of removing them |
URNETWORK_ is the network credential, so only your backend holds it. URNETWORK_ overrides https://.
The program never prints a credential. It prints each proxy's client id, and its exit's location, exit_id, state (with state_reason while a failed exit waits) and replace_mode, plus the exit IP seen through an echo. The API itself never returns exit IPs.
Refusals
The program reads the server's flags on each refusal:
client_about the minute (the create rate): it waits a minute and tries once more.limit_ exceeded client_otherwise (the cap of 1,000): it stops creating.limit_ exceeded upgrade_(not on Pro) andrequired no_(no unused exit IP in that location): it stops creating.unique_ supply - A rotate refused with
rate_limitedorno_: it reports the refusal, and the proxy keeps its exit.unique_ supply
Either way, the proxies it created are still removed at the end.
How the proxies are reached
- HTTPS:
proxy_carries the proxy's token in its host name. undici'sconfig_ result. https_ proxy_ url ProxyAgentsends it in the TLS server name. - SOCKS5: the token is the username, with any password. The program uses
socks5h://through<token>: x@<proxy_ host>: <socks_ proxy_ port> socks-proxy-agent.
Tests
npm test
npm run self-testnpm test type-checks with tsc, then runs node --test against a loopback stand-in for the API, so it needs no credentials or network. It checks:
- the
auth-client,rotate-exitandremove-clientrequests; - result parsing, and the refusal flags
client_,limit_ exceeded upgrade_,required no_andunique_ supply rate_limited; - that a refused rotate still removes the proxies, and that
no_stops creating;unique_ supply - duplicate-exit detection;
- pacing at the Pro creation rate;
- that no credential is printed.