@applitools/eg-socks5-proxy-server
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@applitools/eg-socks5-proxy-server", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -15,6 +15,6 @@ const net = require('net') | ||
function createRequestExecuter({originalSocket, proxyServer, args, clientHandshakeBuffer}) { | ||
const host = proxyServer ? proxyServer.host : args.dst.addr | ||
const address = proxyServer ? proxyServer.host : args.dst.addr | ||
const port = proxyServer ? proxyServer.port : args.dst.port | ||
const destination = net.createConnection(port, host, () => { | ||
const destination = net.createConnection(port, address, () => { | ||
// prepare a success response | ||
@@ -32,2 +32,3 @@ let responseBuffer = Buffer.alloc(args.requestBuffer.length) | ||
}) | ||
proxyServer.onHandShakeCompleted && proxyServer.onHandShakeCompleted() | ||
}) | ||
@@ -66,5 +67,2 @@ }) | ||
destination.on('error', (err) => { | ||
// exit the connection filter domain | ||
//connectionFilterDomain.exit() | ||
// notify of connection error | ||
@@ -71,0 +69,0 @@ err.addr = args.dst.addr |
@@ -32,6 +32,7 @@ const { | ||
CONNECTED_TO_REMOTE_PROXY: 'connected-to-remote-proxy', | ||
REMOTE_PROXY_HANDSHAKE_COMPLETED: 'remote-proxy-handshake-completed', | ||
ORIGINAL_SOCKET_ERROR: 'orginal-socket-error', | ||
DESTINATION_SOCKET_ERROR: 'destination-socket-error', | ||
DESTINATION_TIMEOUT_CONNECTION_ERROR: 'destination-timeout-connection-error', | ||
REMOTE_SOCKET_ERROR: 'remote-socket-error', | ||
REMOTE_CONNECTION_TIMEOUT_ERROR: 'remote-connection-timeout-error', | ||
}, | ||
@@ -263,2 +264,8 @@ LENGTH_RFC_1928_ATYP = 4 | ||
if (proxyServer){ | ||
proxyServer.onHandShakeCompleted = () => { | ||
self.server.emit(EVENTS.REMOTE_PROXY_HANDSHAKE_COMPLETED, {originInfo, destinationInfo, proxyServer}) | ||
} | ||
} | ||
self.server.emit(EVENTS.ACCEPT_NEW_REQUEST, { | ||
@@ -272,3 +279,3 @@ originInfo, | ||
() => | ||
self.server.emit(EVENTS.DESTINATION_TIMEOUT_CONNECTION_ERROR, { | ||
self.server.emit(EVENTS.REMOTE_CONNECTION_TIMEOUT_ERROR, { | ||
originInfo, | ||
@@ -304,2 +311,3 @@ destinationInfo, | ||
}) | ||
const event = proxyServer | ||
@@ -321,3 +329,3 @@ ? EVENTS.CONNECTED_TO_REMOTE_PROXY | ||
self.server.emit(EVENTS.DESTINATION_SOCKET_ERROR, { | ||
self.server.emit(EVENTS.REMOTE_SOCKET_ERROR, { | ||
err, | ||
@@ -324,0 +332,0 @@ destination, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21042
531