Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/eg-socks5-proxy-server

Package Overview
Dependencies
Maintainers
34
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/eg-socks5-proxy-server - npm Package Compare versions

Comparing version 0.4.6 to 0.5.0

5

lib/events.d.ts

@@ -5,7 +5,3 @@ export declare const AUTHENTICATION = "authenticate";

export declare const HANDSHAKE = "handshake";
export declare const PROXY_CONNECT = "proxyConnect";
export declare const PROXY_DATA = "proxyData";
export declare const PROXY_DISCONNECT = "proxyDisconnect";
export declare const PROXY_END = "proxyEnd";
export declare const PROXY_ERROR = "proxyError";
export declare const ACCEPT_NEW_REQUEST = "accept-new-request";

@@ -21,2 +17,3 @@ export declare const CONNECTED_TO_REMOTE_ADDRESS = "connected-to-remote-address";

export declare const REMOTE_CONNECTION_TIMEOUT_ERROR = "remote-connection-timeout-error";
export declare const PRIVATE_ADDRESS_WAS_BLOCKED = "private-address-was-blocked";
//# sourceMappingURL=events.d.ts.map

7

lib/events.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.REMOTE_CONNECTION_TIMEOUT_ERROR = exports.REMOTE_SOCKET_ERROR = exports.ORIGIN_SOCKET_ERROR = exports.REMOTE_PROXY_RFC_1928_REPLY = exports.REMOTE_PROXY_RFC_1928_REPLY_TIMEOUT = exports.REMOTE_PROXY_HANDSHAKE_TIMEOUT = exports.REMOTE_PROXY_HANDSHAKE_COMPLETED = exports.CONNECTED_TO_REMOTE_PROXY = exports.CONNECTED_TO_REMOTE_ADDRESS = exports.ACCEPT_NEW_REQUEST = exports.PROXY_ERROR = exports.PROXY_END = exports.PROXY_DISCONNECT = exports.PROXY_DATA = exports.PROXY_CONNECT = exports.HANDSHAKE = exports.CONNECTION_FILTER = exports.AUTHENTICATION_ERROR = exports.AUTHENTICATION = void 0;
exports.PRIVATE_ADDRESS_WAS_BLOCKED = exports.REMOTE_CONNECTION_TIMEOUT_ERROR = exports.REMOTE_SOCKET_ERROR = exports.ORIGIN_SOCKET_ERROR = exports.REMOTE_PROXY_RFC_1928_REPLY = exports.REMOTE_PROXY_RFC_1928_REPLY_TIMEOUT = exports.REMOTE_PROXY_HANDSHAKE_TIMEOUT = exports.REMOTE_PROXY_HANDSHAKE_COMPLETED = exports.CONNECTED_TO_REMOTE_PROXY = exports.CONNECTED_TO_REMOTE_ADDRESS = exports.ACCEPT_NEW_REQUEST = exports.PROXY_END = exports.HANDSHAKE = exports.CONNECTION_FILTER = exports.AUTHENTICATION_ERROR = exports.AUTHENTICATION = void 0;
exports.AUTHENTICATION = 'authenticate';

@@ -8,7 +8,3 @@ exports.AUTHENTICATION_ERROR = 'authenticateError';

exports.HANDSHAKE = 'handshake';
exports.PROXY_CONNECT = 'proxyConnect';
exports.PROXY_DATA = 'proxyData';
exports.PROXY_DISCONNECT = 'proxyDisconnect';
exports.PROXY_END = 'proxyEnd';
exports.PROXY_ERROR = 'proxyError';
exports.ACCEPT_NEW_REQUEST = 'accept-new-request';

@@ -24,2 +20,3 @@ exports.CONNECTED_TO_REMOTE_ADDRESS = 'connected-to-remote-address';

exports.REMOTE_CONNECTION_TIMEOUT_ERROR = 'remote-connection-timeout-error';
exports.PRIVATE_ADDRESS_WAS_BLOCKED = 'private-address-was-blocked';
//# sourceMappingURL=events.js.map

@@ -25,2 +25,4 @@ /// <reference types="node" />

getProxyServers: () => import("../types/utils").ProxyPoolOptions | undefined;
set shouldBlockPrivateAddresses(value: boolean);
get shouldBlockPrivateAddresses(): boolean;
}

@@ -27,0 +29,0 @@ export declare function createSocks5ProxyServer(options?: Socks5ProxyOptions): SocksServer;

@@ -40,2 +40,3 @@ "use strict";

const net_1 = __importDefault(require("net"));
const private_ip_1 = __importDefault(require("private-ip"));
const _alwaysTrue = (data) => true;

@@ -151,2 +152,10 @@ /**

};
if (self.options.shouldBlockPrivateAddresses &&
(0, private_ip_1.default)(destinationInfo.address)) {
self.server.emit(EVENTS.PRIVATE_ADDRESS_WAS_BLOCKED, {
destinationInfo,
originInfo,
});
return end(constants_1.RFC_1928_REPLIES.CONNECTION_NOT_ALLOWED, args);
}
let createExecuterAndRegisterToEvents = null;

@@ -334,2 +343,8 @@ let proxyServer = undefined;

}
set shouldBlockPrivateAddresses(value) {
this.options.shouldBlockPrivateAddresses = value;
}
get shouldBlockPrivateAddresses() {
return !!this.options.shouldBlockPrivateAddresses;
}
}

@@ -336,0 +351,0 @@ exports.SocksServer = SocksServer;

{
"name": "@applitools/eg-socks5-proxy-server",
"version": "0.4.6",
"version": "0.5.0",
"description": "",

@@ -34,3 +34,4 @@ "main": "lib/index.js",

"dependencies": {
"binary": "^0.3.0"
"binary": "^0.3.0",
"private-ip": "^2.3.4"
},

@@ -37,0 +38,0 @@ "devDependencies": {

@@ -5,7 +5,3 @@ export const AUTHENTICATION = 'authenticate'

export const HANDSHAKE = 'handshake'
export const PROXY_CONNECT = 'proxyConnect'
export const PROXY_DATA = 'proxyData'
export const PROXY_DISCONNECT = 'proxyDisconnect'
export const PROXY_END = 'proxyEnd'
export const PROXY_ERROR = 'proxyError'

@@ -22,1 +18,2 @@ export const ACCEPT_NEW_REQUEST = 'accept-new-request'

export const REMOTE_CONNECTION_TIMEOUT_ERROR = 'remote-connection-timeout-error'
export const PRIVATE_ADDRESS_WAS_BLOCKED = 'private-address-was-blocked'

@@ -22,2 +22,3 @@ import {

import net, {Socket} from 'net'
import isIpPrivate from 'private-ip'

@@ -144,3 +145,3 @@ import {ISocksServer, ProxyServers, SetProxyServerOptions, Socks5ProxyOptions} from '../types'

const originInfo = {
const originInfo: AddressInfo = {
address: socket.remoteAddress,

@@ -150,2 +151,13 @@ port: socket.remotePort,

if (
self.options.shouldBlockPrivateAddresses &&
isIpPrivate(destinationInfo.address!)
) {
self.server.emit(EVENTS.PRIVATE_ADDRESS_WAS_BLOCKED, {
destinationInfo,
originInfo,
})
return end(RFC_1928_REPLIES.CONNECTION_NOT_ALLOWED, args)
}
let createExecuterAndRegisterToEvents: any = null

@@ -393,2 +405,10 @@

public getProxyServers = () => this.options.proxyServers
public set shouldBlockPrivateAddresses(value: boolean) {
this.options.shouldBlockPrivateAddresses = value
}
public get shouldBlockPrivateAddresses() {
return !!this.options.shouldBlockPrivateAddresses
}
}

@@ -395,0 +415,0 @@

@@ -26,2 +26,3 @@ import {Socket} from 'net'

export interface FullSocks5ProxyOptions {
shouldBlockPrivateAddresses: boolean
proxyServer: SingleProxyOptions

@@ -28,0 +29,0 @@ proxyServers: ProxyPoolOptions

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc