///
///
///
import * as net from 'net';
import * as tls from 'tls';
import { OutgoingHttpHeaders } from 'http';
import { Agent, AgentOptions, ClientRequest, RequestOptions } from 'agent-base';
import { SocksProxy } from 'socks';
interface BaseSocksProxyAgentOptions {
hostname?: string;
port?: string | number;
protocol?: string;
type?: number;
tls?: tls.ConnectionOptions | null;
timeout?: number;
auth?: string | null;
username?: string | null;
password?: string | null;
}
interface BaseHttpsProxyAgentOptions {
hostname?: string;
port?: string | number;
protocol?: string;
tls?: tls.SecureContextOptions | null;
headers?: OutgoingHttpHeaders;
secureEndpoint?: boolean;
timeout?: number;
auth?: string | null;
username?: string | null;
password?: string | null;
}
export interface HttpsProxyAgentOptions extends AgentOptions, BaseHttpsProxyAgentOptions, Partial> {
}
export interface SocksProxyAgentOptions extends AgentOptions, BaseSocksProxyAgentOptions, Partial> {
}
/**
* 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
*/
declare class HttpsProxyAgent extends Agent {
private readonly tlsSecureContext;
readonly proxy: HttpsProxyAgentOptions;
private readonly secureEndpoint;
private readonly ca;
timeout: number | null;
constructor(input: string | HttpsProxyAgentOptions, options?: HttpsProxyAgentOptions);
private static _parseHttpsProxy;
/**
* Called when the node-core HTTP client library is creating a
* new HTTP request.
*
* @api protected
*/
callback(req: ClientRequest, opts: RequestOptions): Promise;
}
/**
* The `SocksProxyAgent` implements an HTTP Agent subclass that connects to
* the specified "SOCKS proxy server" in order to proxy HTTPS requests.
*
* @api public
*/
declare class SocksProxyAgent extends Agent {
private readonly tlsConnectionOptions;
readonly proxy: SocksProxy;
timeout: number | null;
constructor(input: string | SocksProxyAgentOptions, options?: SocksProxyAgentOptions);
private static _parseSocksProxy;
/**
* Initiates a SOCKS connection to the specified SOCKS proxy server,
* which in turn connects to the specified remote host and port.
*
* @api protected
*/
callback(req: ClientRequest, opts: RequestOptions): Promise;
}
export { HttpsProxyAgent, SocksProxyAgent };