You've already forked codtracker-js
chore: add pkg dependencies
This commit is contained in:
30
node_modules/https-proxy-agent/dist/agent.d.ts
generated
vendored
Normal file
30
node_modules/https-proxy-agent/dist/agent.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
/// <reference types="node" />
|
||||
import net from 'net';
|
||||
import { Agent, ClientRequest, RequestOptions } from 'agent-base';
|
||||
import { HttpsProxyAgentOptions } from '.';
|
||||
/**
|
||||
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
|
||||
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
|
||||
*
|
||||
* Outgoing HTTP requests are first tunneled through the proxy server using the
|
||||
* `CONNECT` HTTP request method to establish a connection to the proxy server,
|
||||
* and then the proxy server connects to the destination target and issues the
|
||||
* HTTP request from the proxy server.
|
||||
*
|
||||
* `https:` requests have their socket connection upgraded to TLS once
|
||||
* the connection to the proxy server has been established.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
export default class HttpsProxyAgent extends Agent {
|
||||
private secureProxy;
|
||||
private proxy;
|
||||
constructor(_opts: string | HttpsProxyAgentOptions);
|
||||
/**
|
||||
* Called when the node-core HTTP client library is creating a
|
||||
* new HTTP request.
|
||||
*
|
||||
* @api protected
|
||||
*/
|
||||
callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket>;
|
||||
}
|
177
node_modules/https-proxy-agent/dist/agent.js
generated
vendored
Normal file
177
node_modules/https-proxy-agent/dist/agent.js
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const net_1 = __importDefault(require("net"));
|
||||
const tls_1 = __importDefault(require("tls"));
|
||||
const url_1 = __importDefault(require("url"));
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const agent_base_1 = require("agent-base");
|
||||
const parse_proxy_response_1 = __importDefault(require("./parse-proxy-response"));
|
||||
const debug = debug_1.default('https-proxy-agent:agent');
|
||||
/**
|
||||
* The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to
|
||||
* the specified "HTTP(s) proxy server" in order to proxy HTTPS requests.
|
||||
*
|
||||
* Outgoing HTTP requests are first tunneled through the proxy server using the
|
||||
* `CONNECT` HTTP request method to establish a connection to the proxy server,
|
||||
* and then the proxy server connects to the destination target and issues the
|
||||
* HTTP request from the proxy server.
|
||||
*
|
||||
* `https:` requests have their socket connection upgraded to TLS once
|
||||
* the connection to the proxy server has been established.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
class HttpsProxyAgent extends agent_base_1.Agent {
|
||||
constructor(_opts) {
|
||||
let opts;
|
||||
if (typeof _opts === 'string') {
|
||||
opts = url_1.default.parse(_opts);
|
||||
}
|
||||
else {
|
||||
opts = _opts;
|
||||
}
|
||||
if (!opts) {
|
||||
throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!');
|
||||
}
|
||||
debug('creating new HttpsProxyAgent instance: %o', opts);
|
||||
super(opts);
|
||||
const proxy = Object.assign({}, opts);
|
||||
// If `true`, then connect to the proxy server over TLS.
|
||||
// Defaults to `false`.
|
||||
this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol);
|
||||
// Prefer `hostname` over `host`, and set the `port` if needed.
|
||||
proxy.host = proxy.hostname || proxy.host;
|
||||
if (typeof proxy.port === 'string') {
|
||||
proxy.port = parseInt(proxy.port, 10);
|
||||
}
|
||||
if (!proxy.port && proxy.host) {
|
||||
proxy.port = this.secureProxy ? 443 : 80;
|
||||
}
|
||||
// ALPN is supported by Node.js >= v5.
|
||||
// attempt to negotiate http/1.1 for proxy servers that support http/2
|
||||
if (this.secureProxy && !('ALPNProtocols' in proxy)) {
|
||||
proxy.ALPNProtocols = ['http 1.1'];
|
||||
}
|
||||
if (proxy.host && proxy.path) {
|
||||
// If both a `host` and `path` are specified then it's most likely
|
||||
// the result of a `url.parse()` call... we need to remove the
|
||||
// `path` portion so that `net.connect()` doesn't attempt to open
|
||||
// that as a Unix socket file.
|
||||
delete proxy.path;
|
||||
delete proxy.pathname;
|
||||
}
|
||||
this.proxy = proxy;
|
||||
}
|
||||
/**
|
||||
* Called when the node-core HTTP client library is creating a
|
||||
* new HTTP request.
|
||||
*
|
||||
* @api protected
|
||||
*/
|
||||
callback(req, opts) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { proxy, secureProxy } = this;
|
||||
// Create a socket connection to the proxy server.
|
||||
let socket;
|
||||
if (secureProxy) {
|
||||
debug('Creating `tls.Socket`: %o', proxy);
|
||||
socket = tls_1.default.connect(proxy);
|
||||
}
|
||||
else {
|
||||
debug('Creating `net.Socket`: %o', proxy);
|
||||
socket = net_1.default.connect(proxy);
|
||||
}
|
||||
const headers = Object.assign({}, proxy.headers);
|
||||
const hostname = `${opts.host}:${opts.port}`;
|
||||
let payload = `CONNECT ${hostname} HTTP/1.1\r\n`;
|
||||
// Inject the `Proxy-Authorization` header if necessary.
|
||||
if (proxy.auth) {
|
||||
headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`;
|
||||
}
|
||||
// The `Host` header should only include the port
|
||||
// number when it is not the default port.
|
||||
let { host, port, secureEndpoint } = opts;
|
||||
if (!isDefaultPort(port, secureEndpoint)) {
|
||||
host += `:${port}`;
|
||||
}
|
||||
headers.Host = host;
|
||||
headers.Connection = 'close';
|
||||
for (const name of Object.keys(headers)) {
|
||||
payload += `${name}: ${headers[name]}\r\n`;
|
||||
}
|
||||
const proxyResponsePromise = parse_proxy_response_1.default(socket);
|
||||
socket.write(`${payload}\r\n`);
|
||||
const { statusCode, buffered } = yield proxyResponsePromise;
|
||||
if (statusCode === 200) {
|
||||
req.once('socket', resume);
|
||||
if (opts.secureEndpoint) {
|
||||
// The proxy is connecting to a TLS server, so upgrade
|
||||
// this socket connection to a TLS connection.
|
||||
debug('Upgrading socket connection to TLS');
|
||||
const servername = opts.servername || opts.host;
|
||||
return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket,
|
||||
servername }));
|
||||
}
|
||||
return socket;
|
||||
}
|
||||
// Some other status code that's not 200... need to re-play the HTTP
|
||||
// header "data" events onto the socket once the HTTP machinery is
|
||||
// attached so that the node core `http` can parse and handle the
|
||||
// error status code.
|
||||
// Close the original socket, and a new "fake" socket is returned
|
||||
// instead, so that the proxy doesn't get the HTTP request
|
||||
// written to it (which may contain `Authorization` headers or other
|
||||
// sensitive data).
|
||||
//
|
||||
// See: https://hackerone.com/reports/541502
|
||||
socket.destroy();
|
||||
const fakeSocket = new net_1.default.Socket({ writable: false });
|
||||
fakeSocket.readable = true;
|
||||
// Need to wait for the "socket" event to re-play the "data" events.
|
||||
req.once('socket', (s) => {
|
||||
debug('replaying proxy buffer for failed request');
|
||||
assert_1.default(s.listenerCount('data') > 0);
|
||||
// Replay the "buffered" Buffer onto the fake `socket`, since at
|
||||
// this point the HTTP module machinery has been hooked up for
|
||||
// the user.
|
||||
s.push(buffered);
|
||||
s.push(null);
|
||||
});
|
||||
return fakeSocket;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = HttpsProxyAgent;
|
||||
function resume(socket) {
|
||||
socket.resume();
|
||||
}
|
||||
function isDefaultPort(port, secure) {
|
||||
return Boolean((!secure && port === 80) || (secure && port === 443));
|
||||
}
|
||||
function isHTTPS(protocol) {
|
||||
return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false;
|
||||
}
|
||||
function omit(obj, ...keys) {
|
||||
const ret = {};
|
||||
let key;
|
||||
for (key in obj) {
|
||||
if (!keys.includes(key)) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
//# sourceMappingURL=agent.js.map
|
1
node_modules/https-proxy-agent/dist/agent.js.map
generated
vendored
Normal file
1
node_modules/https-proxy-agent/dist/agent.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,8CAAsB;AACtB,8CAAsB;AACtB,oDAA4B;AAC5B,kDAAgC;AAEhC,2CAAkE;AAElE,kFAAwD;AAExD,MAAM,KAAK,GAAG,eAAW,CAAC,yBAAyB,CAAC,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAqB,eAAgB,SAAQ,kBAAK;IAIjD,YAAY,KAAsC;QACjD,IAAI,IAA4B,CAAC;QACjC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC9B,IAAI,GAAG,aAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;aAAM;YACN,IAAI,GAAG,KAAK,CAAC;SACb;QACD,IAAI,CAAC,IAAI,EAAE;YACV,MAAM,IAAI,KAAK,CACd,8DAA8D,CAC9D,CAAC;SACF;QACD,KAAK,CAAC,2CAA2C,EAAE,IAAI,CAAC,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,MAAM,KAAK,qBAAgC,IAAI,CAAE,CAAC;QAElD,wDAAwD;QACxD,uBAAuB;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAE/D,+DAA+D;QAC/D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IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,OAAO,CAAC,QAAwB;IACxC,OAAO,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3E,CAAC;AAED,SAAS,IAAI,CACZ,GAAM,EACN,GAAG,IAAO;IAIV,MAAM,GAAG,GAAG,EAEX,CAAC;IACF,IAAI,GAAqB,CAAC;IAC1B,KAAK,GAAG,IAAI,GAAG,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACpB;KACD;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
23
node_modules/https-proxy-agent/dist/index.d.ts
generated
vendored
Normal file
23
node_modules/https-proxy-agent/dist/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/// <reference types="node" />
|
||||
import net from 'net';
|
||||
import tls from 'tls';
|
||||
import { Url } from 'url';
|
||||
import { AgentOptions } from 'agent-base';
|
||||
import { OutgoingHttpHeaders } from 'http';
|
||||
import _HttpsProxyAgent from './agent';
|
||||
declare function createHttpsProxyAgent(opts: string | createHttpsProxyAgent.HttpsProxyAgentOptions): _HttpsProxyAgent;
|
||||
declare namespace createHttpsProxyAgent {
|
||||
interface BaseHttpsProxyAgentOptions {
|
||||
headers?: OutgoingHttpHeaders;
|
||||
secureProxy?: boolean;
|
||||
host?: string | null;
|
||||
path?: string | null;
|
||||
port?: string | number | null;
|
||||
}
|
||||
export interface HttpsProxyAgentOptions extends AgentOptions, BaseHttpsProxyAgentOptions, Partial<Omit<Url & net.NetConnectOpts & tls.ConnectionOptions, keyof BaseHttpsProxyAgentOptions>> {
|
||||
}
|
||||
export type HttpsProxyAgent = _HttpsProxyAgent;
|
||||
export const HttpsProxyAgent: typeof _HttpsProxyAgent;
|
||||
export {};
|
||||
}
|
||||
export = createHttpsProxyAgent;
|
14
node_modules/https-proxy-agent/dist/index.js
generated
vendored
Normal file
14
node_modules/https-proxy-agent/dist/index.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const agent_1 = __importDefault(require("./agent"));
|
||||
function createHttpsProxyAgent(opts) {
|
||||
return new agent_1.default(opts);
|
||||
}
|
||||
(function (createHttpsProxyAgent) {
|
||||
createHttpsProxyAgent.HttpsProxyAgent = agent_1.default;
|
||||
createHttpsProxyAgent.prototype = agent_1.default.prototype;
|
||||
})(createHttpsProxyAgent || (createHttpsProxyAgent = {}));
|
||||
module.exports = createHttpsProxyAgent;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/https-proxy-agent/dist/index.js.map
generated
vendored
Normal file
1
node_modules/https-proxy-agent/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,oDAAuC;AAEvC,SAAS,qBAAqB,CAC7B,IAA2D;IAE3D,OAAO,IAAI,eAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,WAAU,qBAAqB;IAoBjB,qCAAe,GAAG,eAAgB,CAAC;IAEhD,qBAAqB,CAAC,SAAS,GAAG,eAAgB,CAAC,SAAS,CAAC;AAC9D,CAAC,EAvBS,qBAAqB,KAArB,qBAAqB,QAuB9B;AAED,iBAAS,qBAAqB,CAAC"}
|
7
node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts
generated
vendored
Normal file
7
node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
import { Readable } from 'stream';
|
||||
export interface ProxyResponse {
|
||||
statusCode: number;
|
||||
buffered: Buffer;
|
||||
}
|
||||
export default function parseProxyResponse(socket: Readable): Promise<ProxyResponse>;
|
66
node_modules/https-proxy-agent/dist/parse-proxy-response.js
generated
vendored
Normal file
66
node_modules/https-proxy-agent/dist/parse-proxy-response.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const debug = debug_1.default('https-proxy-agent:parse-proxy-response');
|
||||
function parseProxyResponse(socket) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// we need to buffer any HTTP traffic that happens with the proxy before we get
|
||||
// the CONNECT response, so that if the response is anything other than an "200"
|
||||
// response code, then we can re-play the "data" events on the socket once the
|
||||
// HTTP parser is hooked up...
|
||||
let buffersLength = 0;
|
||||
const buffers = [];
|
||||
function read() {
|
||||
const b = socket.read();
|
||||
if (b)
|
||||
ondata(b);
|
||||
else
|
||||
socket.once('readable', read);
|
||||
}
|
||||
function cleanup() {
|
||||
socket.removeListener('end', onend);
|
||||
socket.removeListener('error', onerror);
|
||||
socket.removeListener('close', onclose);
|
||||
socket.removeListener('readable', read);
|
||||
}
|
||||
function onclose(err) {
|
||||
debug('onclose had error %o', err);
|
||||
}
|
||||
function onend() {
|
||||
debug('onend');
|
||||
}
|
||||
function onerror(err) {
|
||||
cleanup();
|
||||
debug('onerror %o', err);
|
||||
reject(err);
|
||||
}
|
||||
function ondata(b) {
|
||||
buffers.push(b);
|
||||
buffersLength += b.length;
|
||||
const buffered = Buffer.concat(buffers, buffersLength);
|
||||
const endOfHeaders = buffered.indexOf('\r\n\r\n');
|
||||
if (endOfHeaders === -1) {
|
||||
// keep buffering
|
||||
debug('have not received end of HTTP headers yet...');
|
||||
read();
|
||||
return;
|
||||
}
|
||||
const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n'));
|
||||
const statusCode = +firstLine.split(' ')[1];
|
||||
debug('got proxy server response: %o', firstLine);
|
||||
resolve({
|
||||
statusCode,
|
||||
buffered
|
||||
});
|
||||
}
|
||||
socket.on('error', onerror);
|
||||
socket.on('close', onclose);
|
||||
socket.on('end', onend);
|
||||
read();
|
||||
});
|
||||
}
|
||||
exports.default = parseProxyResponse;
|
||||
//# sourceMappingURL=parse-proxy-response.js.map
|
1
node_modules/https-proxy-agent/dist/parse-proxy-response.js.map
generated
vendored
Normal file
1
node_modules/https-proxy-agent/dist/parse-proxy-response.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-proxy-response.js","sourceRoot":"","sources":["../src/parse-proxy-response.ts"],"names":[],"mappings":";;;;;AAAA,kDAAgC;AAGhC,MAAM,KAAK,GAAG,eAAW,CAAC,wCAAwC,CAAC,CAAC;AAOpE,SAAwB,kBAAkB,CACzC,MAAgB;IAEhB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,+EAA+E;QAC/E,gFAAgF;QAChF,8EAA8E;QAC9E,8BAA8B;QAC9B,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,SAAS,IAAI;YACZ,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBAAE,MAAM,CAAC,CAAC,CAAC,CAAC;;gBACZ,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QAED,SAAS,OAAO;YACf,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,MAAM,CAA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