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

View File

@ -35,6 +35,7 @@ class BaseConnectionPool {
this.auth = opts.auth || null
this._ssl = opts.ssl
this._agent = opts.agent
this._proxy = opts.proxy || null
}
getConnection () {
@ -69,6 +70,8 @@ class BaseConnectionPool {
if (opts.ssl == null) opts.ssl = this._ssl
/* istanbul ignore else */
if (opts.agent == null) opts.agent = this._agent
/* istanbul ignore else */
if (opts.proxy == null) opts.proxy = this._proxy
const connection = new this.Connection(opts)

2
lib/pool/index.d.ts vendored
View File

@ -27,6 +27,7 @@ import { nodeFilterFn, nodeSelectorFn } from '../Transport';
interface BaseConnectionPoolOptions {
ssl?: SecureContextOptions;
agent?: AgentOptions;
proxy?: string | URL;
auth?: BasicAuth | ApiKeyAuth;
emit: (event: string | symbol, ...args: any[]) => boolean;
Connection: typeof Connection;
@ -83,6 +84,7 @@ declare class BaseConnectionPool {
emit: (event: string | symbol, ...args: any[]) => boolean;
_ssl: SecureContextOptions | null;
_agent: AgentOptions | null;
_proxy: string | URL;
auth: BasicAuth | ApiKeyAuth;
Connection: typeof Connection;
constructor(opts?: BaseConnectionPoolOptions);