Added proxy support (#1260)

This commit is contained in:
Tomas Della Vedova
2020-08-03 11:39:24 +02:00
committed by GitHub
parent 629894adba
commit 26238634a7
15 changed files with 344 additions and 6 deletions

5
lib/Connection.d.ts vendored
View File

@ -24,6 +24,8 @@ import { inspect, InspectOptions } from 'util'
import { Readable as ReadableStream } from 'stream';
import { ApiKeyAuth, BasicAuth } from './pool'
import * as http from 'http'
import * as https from 'https'
import * as hpagent from 'hpagent'
import { ConnectionOptions as TlsConnectionOptions } from 'tls'
export declare type agentFn = () => any;
@ -37,6 +39,7 @@ interface ConnectionOptions {
status?: string;
roles?: ConnectionRoles;
auth?: BasicAuth | ApiKeyAuth;
proxy?: string | URL;
}
interface ConnectionRoles {
@ -81,7 +84,7 @@ export default class Connection {
makeRequest: any
_openRequests: number
_status: string
_agent: http.Agent
_agent: http.Agent | https.Agent | hpagent.HttpProxyAgent | hpagent.HttpsProxyAgent
constructor(opts?: ConnectionOptions)
request(params: RequestOptions, callback: (err: Error | null, response: http.IncomingMessage | null) => void): http.ClientRequest
close(): Connection