socks-proxy-agent (8.0.5)

Published 2026-02-24 14:05:15 +00:00 by atheaadmin

Installation

registry=
npm install socks-proxy-agent@8.0.5
"socks-proxy-agent": "8.0.5"

About this package

socks-proxy-agent

A SOCKS proxy http.Agent implementation for HTTP and HTTPS

This module provides an http.Agent implementation that connects to a specified SOCKS proxy server, and can be used with the built-in http and https modules.

It can also be used in conjunction with the ws module to establish a WebSocket connection over a SOCKS proxy. See the "Examples" section below.

Examples

import https from 'https';
import { SocksProxyAgent } from 'socks-proxy-agent';

const agent = new SocksProxyAgent(
	'socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com'
);

https.get('https://ipinfo.io', { agent }, (res) => {
	console.log(res.headers);
	res.pipe(process.stdout);
});

ws WebSocket connection example

import WebSocket from 'ws';
import { SocksProxyAgent } from 'socks-proxy-agent';

const agent = new SocksProxyAgent(
	'socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com'
);

var socket = new WebSocket('ws://echo.websocket.events', { agent });

socket.on('open', function () {
	console.log('"open" event!');
	socket.send('hello world');
});

socket.on('message', function (data, flags) {
	console.log('"message" event! %j %j', data, flags);
	socket.close();
});

Dependencies

Dependencies

ID Version
agent-base ^7.1.2
debug ^4.3.4
socks ^2.8.3

Development Dependencies

ID Version
@types/async-retry ^1.4.5
@types/debug ^4.1.7
@types/dns2 ^2.0.3
@types/jest ^29.5.1
@types/node ^14.18.45
async-listen ^3.0.0
async-retry ^1.3.3
cacheable-lookup ^6.1.0
dns2 ^2.1.0
jest ^29.5.0
proxy 2.2.0
socksv5 github:TooTallNate/socksv5#fix/dstSock-close-event
ts-jest ^29.1.0
tsconfig 0.0.0
typescript ^5.0.4

Keywords

agent http https proxy socks socks4 socks4a socks5 socks5h
Details
npm
2026-02-24 14:05:15 +00:00
0
Nathan Rajlich
MIT
latest
6.7 KiB
Assets (1)
Versions (2) View all
5.0.1 2026-02-24
8.0.5 2026-02-24