1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import * as net from 'net';
- import * as http from 'http';
- import { Readable } from 'stream';
- import { URL } from 'url';
- import { Agent, AgentConnectOpts } from 'agent-base';
- import { HttpProxyAgentOptions } from 'http-proxy-agent';
- import { HttpsProxyAgentOptions } from 'https-proxy-agent';
- import { SocksProxyAgentOptions } from 'socks-proxy-agent';
- import { protocols as gProtocols, ProtocolOpts as GetUriOptions } from 'get-uri';
- import { FindProxyForURL, PacResolverOptions } from 'pac-resolver';
- type Protocols = keyof typeof gProtocols;
- type Protocol<T> = T extends `pac+${infer P}:${infer _}` ? P : T extends `${infer P}:${infer _}` ? P : never;
- export type PacProxyAgentOptions<T> = http.AgentOptions & PacResolverOptions & GetUriOptions<`${Protocol<T>}:`> & HttpProxyAgentOptions<''> & HttpsProxyAgentOptions<''> & SocksProxyAgentOptions & {
- fallbackToDirect?: boolean;
- };
- export declare class PacProxyAgent<Uri extends string> extends Agent {
- static readonly protocols: `pac+${Protocols}`[];
- uri: URL;
- opts: PacProxyAgentOptions<Uri>;
- cache?: Readable;
- resolver?: FindProxyForURL;
- resolverHash: string;
- resolverPromise?: Promise<FindProxyForURL>;
- constructor(uri: Uri | URL, opts?: PacProxyAgentOptions<Uri>);
- private clearResolverPromise;
-
- private getResolver;
- private loadResolver;
-
- private loadPacFile;
-
- connect(req: http.ClientRequest, opts: AgentConnectOpts): Promise<http.Agent | net.Socket>;
- }
- export {};
|