socks
- Version 2.8.3
- Published
- 156 kB
- 2 dependencies
- MIT license
Install
npm i socks
yarn add socks
pnpm add socks
Overview
Fully featured SOCKS proxy client supporting SOCKSv4, SOCKSv4a, and SOCKSv5. Includes Bind and Associate functionality.
Index
Classes
Interfaces
Classes
class SocksClient
class SocksClient extends EventEmitter implements SocksClient {}
constructor
constructor(options: SocksClientOptions);
property socksClientOptions
readonly socksClientOptions: SocksClientOptions;
method connect
connect: (existingSocket?: Duplex) => void;
Starts the connection establishment to the proxy and destination.
Parameter existingSocket
Connected socket to use instead of creating a new one (internal use).
method createConnection
static createConnection: ( options: SocksClientOptions, callback?: (error: Error | null, info?: SocksClientEstablishedEvent) => void) => Promise<SocksClientEstablishedEvent>;
Creates a new SOCKS connection.
Note: Supports callbacks and promises. Only supports the connect command.
Parameter options
Options.
Parameter callback
An optional callback function.
Returns
{ Promise }
method createConnectionChain
static createConnectionChain: ( options: SocksClientChainOptions, callback?: ( error: Error | null, socket?: SocksClientEstablishedEvent ) => void) => Promise<SocksClientEstablishedEvent>;
Creates a new SOCKS connection chain to a destination host through 2 or more SOCKS proxies.
Note: Supports callbacks and promises. Only supports the connect method. Note: Implemented via createConnection() factory function.
Parameter options
Options
Parameter callback
An optional callback function.
Returns
{ Promise }
method createUDPFrame
static createUDPFrame: (options: SocksUDPFrameDetails) => Buffer;
Creates a SOCKS UDP Frame.
Parameter options
method parseUDPFrame
static parseUDPFrame: (data: Buffer) => SocksUDPFrameDetails;
Parses a SOCKS UDP frame.
Parameter data
class SocksClientError
class SocksClientError extends Error {}
Error wrapper for SocksClient
constructor
constructor( message: string, options: SocksClientOptions | SocksClientChainOptions);
property options
options: SocksClientOptions | SocksClientChainOptions;
Interfaces
interface SocksClient
interface SocksClient {}
method emit
emit: { (event: string | symbol, ...args: unknown[]): boolean; (event: 'error', err: SocksClientError): boolean; (event: 'bound', info: SocksClientEstablishedEvent): boolean; (event: 'established', info: SocksClientEstablishedEvent): boolean;};
method on
on: { (event: 'error', listener: (err: SocksClientError) => void): this; ( event: 'bound', listener: (info: SocksClientEstablishedEvent) => void ): this; ( event: 'established', listener: (info: SocksClientEstablishedEvent) => void ): this;};
method once
once: { (event: string, listener: (...args: unknown[]) => void): this; (event: 'error', listener: (err: SocksClientError) => void): this; ( event: 'bound', listener: (info: SocksClientEstablishedEvent) => void ): this; ( event: 'established', listener: (info: SocksClientEstablishedEvent) => void ): this;};
interface SocksClientChainOptions
interface SocksClientChainOptions {}
SocksClient chain connection options.
property command
command: 'connect';
property destination
destination: SocksRemoteHost;
property proxies
proxies: SocksProxy[];
property randomizeChain
randomizeChain?: false;
property timeout
timeout?: number;
interface SocksClientOptions
interface SocksClientOptions {}
SocksClient connection options.
property command
command: SocksCommandOption;
property destination
destination: SocksRemoteHost;
property existing_socket
existing_socket?: Duplex;
property proxy
proxy: SocksProxy;
property set_tcp_nodelay
set_tcp_nodelay?: boolean;
property socket_options
socket_options?: SocketConnectOpts;
property timeout
timeout?: number;
interface SocksProxy
interface SocksProxy {}
Represents a SocksProxy
property custom_auth_method
custom_auth_method?: number;
property custom_auth_request_handler
custom_auth_request_handler?: () => Promise<Buffer>;
property custom_auth_response_handler
custom_auth_response_handler?: (data: Buffer) => Promise<boolean>;
property custom_auth_response_size
custom_auth_response_size?: number;
property host
host?: string;
property ipaddress
ipaddress?: string;
property password
password?: string;
property port
port: number;
property type
type: SocksProxyType;
property userId
userId?: string;
interface SocksRemoteHost
interface SocksRemoteHost {}
Represents a remote host
interface SocksUDPFrameDetails
interface SocksUDPFrameDetails {}
property data
data: Buffer;
property frameNumber
frameNumber?: number;
property remoteHost
remoteHost: SocksRemoteHost;
Package Files (4)
Dependencies (2)
Dev Dependencies (9)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/socks
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/socks)
- HTML<a href="https://www.jsdocs.io/package/socks"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3793 ms. - Missing or incorrect documentation? Open an issue for this package.