|
1 | 1 | /// <reference types="node" />
|
2 |
| -import { Url } from 'url'; |
3 | 2 | import { SocksProxy } from 'socks';
|
4 |
| -import tls from 'tls'; |
| 3 | +import { Agent, ClientRequest, RequestOptions } from 'agent-base'; |
5 | 4 | import { AgentOptions } from 'agent-base';
|
6 |
| -import _SocksProxyAgent from './agent'; |
7 |
| -declare function createSocksProxyAgent(opts: string | createSocksProxyAgent.SocksProxyAgentOptions): _SocksProxyAgent; |
8 |
| -declare namespace createSocksProxyAgent { |
9 |
| - interface BaseSocksProxyAgentOptions { |
10 |
| - host?: string | null; |
11 |
| - port?: string | number | null; |
12 |
| - username?: string | null; |
13 |
| - tls?: tls.ConnectionOptions | null; |
14 |
| - } |
15 |
| - export interface SocksProxyAgentOptions extends AgentOptions, BaseSocksProxyAgentOptions, Partial<Omit<Url & SocksProxy, keyof BaseSocksProxyAgentOptions>> { |
16 |
| - } |
17 |
| - export type SocksProxyAgent = _SocksProxyAgent; |
18 |
| - export const SocksProxyAgent: typeof _SocksProxyAgent; |
19 |
| - export {}; |
| 5 | +import { Url } from 'url'; |
| 6 | +import net from 'net'; |
| 7 | +import tls from 'tls'; |
| 8 | +interface BaseSocksProxyAgentOptions { |
| 9 | + host?: string | null; |
| 10 | + port?: string | number | null; |
| 11 | + username?: string | null; |
| 12 | + tls?: tls.ConnectionOptions | null; |
| 13 | +} |
| 14 | +interface SocksProxyAgentOptionsExtra { |
| 15 | + timeout?: number; |
| 16 | +} |
| 17 | +export interface SocksProxyAgentOptions extends AgentOptions, BaseSocksProxyAgentOptions, Partial<Omit<Url & SocksProxy, keyof BaseSocksProxyAgentOptions>> { |
| 18 | +} |
| 19 | +export declare class SocksProxyAgent extends Agent { |
| 20 | + private readonly shouldLookup; |
| 21 | + private readonly proxy; |
| 22 | + private readonly tlsConnectionOptions; |
| 23 | + timeout: number | null; |
| 24 | + constructor(input: string | SocksProxyAgentOptions, options?: SocksProxyAgentOptionsExtra); |
| 25 | + /** |
| 26 | + * Initiates a SOCKS connection to the specified SOCKS proxy server, |
| 27 | + * which in turn connects to the specified remote host and port. |
| 28 | + * |
| 29 | + * @api protected |
| 30 | + */ |
| 31 | + callback(req: ClientRequest, opts: RequestOptions): Promise<net.Socket>; |
20 | 32 | }
|
21 |
| -export = createSocksProxyAgent; |
| 33 | +export {}; |
0 commit comments