socks-proxy-agent
TypeScript icon, indicating that this package has built-in type declarations

8.0.5 • Public • Published

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();
});

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
8.0.515,110,455latest
6.2.0-beta.14beta

Version History

VersionDownloads (Last 7 Days)Published
8.0.515,110,455
8.0.42,435,538
8.0.3944,856
8.0.21,133,970
8.0.1148,542
8.0.031
7.0.04,959,066
6.2.12,724,316
6.2.051,092
6.2.0-beta.14
6.2.0-beta.013
6.1.1486,218
6.1.092,886
6.0.017,386
5.0.11,341,267
5.0.0173,574
4.0.2709,365
4.0.149,206
4.0.081
3.0.185,730
3.0.01,365
2.1.132,745
2.1.068
2.0.01,524
1.0.25,997
1.0.16
1.0.09
0.1.2723
0.1.110
0.1.07
0.0.28
0.0.18

Package Sidebar

Install

npm i socks-proxy-agent

Weekly Downloads

30,506,066

Version

8.0.5

License

MIT

Unpacked Size

25.5 kB

Total Files

8

Last publish

Collaborators

  • tootallnate
  • kikobeats