From ae187b6d75c8079da0be1dc288613bad8466fe61 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Tue, 24 Oct 2023 17:43:37 +0200 Subject: Initial commit --- .../global-agent/src/classes/HttpProxyAgent.js | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 desktop/node_modules/global-agent/src/classes/HttpProxyAgent.js (limited to 'desktop/node_modules/global-agent/src/classes/HttpProxyAgent.js') diff --git a/desktop/node_modules/global-agent/src/classes/HttpProxyAgent.js b/desktop/node_modules/global-agent/src/classes/HttpProxyAgent.js new file mode 100644 index 0000000..8b9b471 --- /dev/null +++ b/desktop/node_modules/global-agent/src/classes/HttpProxyAgent.js @@ -0,0 +1,30 @@ +// @flow + +import net from 'net'; +import type { + ConnectionCallbackType, + ConnectionConfigurationType, +} from '../types'; +import Agent from './Agent'; + +class HttpProxyAgent extends Agent { + // @see https://github.com/sindresorhus/eslint-plugin-unicorn/issues/169#issuecomment-486980290 + // eslint-disable-next-line unicorn/prevent-abbreviations + constructor (...args: *) { + super(...args); + + this.protocol = 'http:'; + this.defaultPort = 80; + } + + createConnection (configuration: ConnectionConfigurationType, callback: ConnectionCallbackType) { + const socket = net.connect( + configuration.proxy.port, + configuration.proxy.hostname, + ); + + callback(null, socket); + } +} + +export default HttpProxyAgent; -- cgit