CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
README.md50 linesDownload Raw Back to socks-proxy-agent
1socks-proxy-agent2================3### A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS4 5This module provides an `http.Agent` implementation that connects to a6specified SOCKS proxy server, and can be used with the built-in `http`7and `https` modules.8 9It can also be used in conjunction with the `ws` module to establish a WebSocket10connection over a SOCKS proxy. See the "Examples" section below.11 12Examples13--------14 15```ts16import https from 'https';17import { SocksProxyAgent } from 'socks-proxy-agent';18 19const agent = new SocksProxyAgent(20	'socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com'21);22 23https.get('https://ipinfo.io', { agent }, (res) => {24	console.log(res.headers);25	res.pipe(process.stdout);26});27```28 29#### `ws` WebSocket connection example30 31```ts32import WebSocket from 'ws';33import { SocksProxyAgent } from 'socks-proxy-agent';34 35const agent = new SocksProxyAgent(36	'socks://your-name%40gmail.com:abcdef12345124@br41.nordvpn.com'37);38 39var socket = new WebSocket('ws://echo.websocket.events', { agent });40 41socket.on('open', function () {42	console.log('"open" event!');43	socket.send('hello world');44});45 46socket.on('message', function (data, flags) {47	console.log('"message" event! %j %j', data, flags);48	socket.close();49});50```
basant307/AI_Governance_Project · CoolFace