@applitools/eg-socks5-proxy-server
Advanced tools
Comparing version 1.0.2 to 1.0.3-ondata
@@ -18,2 +18,3 @@ export declare const AUTHENTICATION = "authenticate"; | ||
export declare const ADDRESS_WAS_BLOCKED = "address-was-blocked"; | ||
export declare const REPLY = "reply"; | ||
//# sourceMappingURL=events.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ADDRESS_WAS_BLOCKED = 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.REPLY = exports.ADDRESS_WAS_BLOCKED = 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'; | ||
@@ -21,2 +21,3 @@ exports.AUTHENTICATION_ERROR = 'authenticateError'; | ||
exports.ADDRESS_WAS_BLOCKED = 'address-was-blocked'; | ||
exports.REPLY = 'reply'; | ||
//# sourceMappingURL=events.js.map |
/// <reference types="node" /> | ||
import net from 'net'; | ||
import { ExecuteRequestParameters } from '../types/execute-request'; | ||
export declare function executeRequest({ originalSocket, address, port, requestBuffer, addressType, end, onError, onConnect, }: ExecuteRequestParameters): net.Socket; | ||
export declare function executeRequest({ originalSocket, address, port, requestBuffer, addressType, end, onError, onConnect, onData, }: ExecuteRequestParameters): net.Socket; | ||
//# sourceMappingURL=execute-request.d.ts.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
const convert_socket_error_to_rpc_reply_1 = require("./utils/convert-socket-error-to-rpc-reply"); | ||
function executeRequest({ originalSocket, address, port, requestBuffer, addressType, end, onError, onConnect, }) { | ||
function executeRequest({ originalSocket, address, port, requestBuffer, addressType, end, onError, onConnect, onData, }) { | ||
const destination = net_1.default.createConnection(port, address, () => { | ||
@@ -39,2 +39,5 @@ // prepare a success response | ||
}); | ||
destination.on('data', (data) => { | ||
onData({ dst: { addr: address, port }, responseBuffer: data }); | ||
}); | ||
return destination; | ||
@@ -41,0 +44,0 @@ } |
@@ -285,2 +285,5 @@ "use strict"; | ||
}; | ||
const onData = (args) => { | ||
self.server.emit(EVENTS.REPLY, args); | ||
}; | ||
if (!shouldUseProxy) { | ||
@@ -296,2 +299,3 @@ destination = (0, execute_request_1.executeRequest)({ | ||
onError, | ||
onData, | ||
}); | ||
@@ -298,0 +302,0 @@ } |
{ | ||
"name": "@applitools/eg-socks5-proxy-server", | ||
"version": "1.0.2", | ||
"version": "1.0.3-ondata", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -19,1 +19,2 @@ export const AUTHENTICATION = 'authenticate' | ||
export const ADDRESS_WAS_BLOCKED = 'address-was-blocked' | ||
export const REPLY = 'reply' |
@@ -17,2 +17,3 @@ import net from 'net' | ||
onConnect, | ||
onData, | ||
}: ExecuteRequestParameters) { | ||
@@ -53,3 +54,7 @@ const destination = net.createConnection(port, address, () => { | ||
destination.on('data', (data) => { | ||
onData({dst: {addr: address, port}, responseBuffer: data}) | ||
}) | ||
return destination | ||
} |
@@ -29,2 +29,3 @@ import { | ||
import {AddressInfo} from '../types/utils' | ||
import {ExecuteResponseArgs} from '../types/execute-request' | ||
@@ -308,2 +309,6 @@ const _alwaysTrue = (data: { | ||
const onData = (args: ExecuteResponseArgs) => { | ||
self.server.emit(EVENTS.REPLY, args) | ||
} | ||
if (!shouldUseProxy) { | ||
@@ -319,2 +324,3 @@ destination = executeRequest({ | ||
onError, | ||
onData, | ||
}) | ||
@@ -321,0 +327,0 @@ } else { |
@@ -19,2 +19,10 @@ import {Socket} from 'net' | ||
export interface ExecuteResponseArgs { | ||
responseBuffer: Buffer | ||
dst: { | ||
addr: string | ||
port: number | ||
} | ||
} | ||
export interface ExecuteRequestParameters { | ||
@@ -29,2 +37,3 @@ originalSocket: Socket | ||
onConnect: (destination: Socket) => void | ||
onData: (args: ExecuteResponseArgs) => void | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
109684
2007
2