You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.d.ts 1.2KB

123456789101112131415161718192021222324252627282930313233
  1. /// <reference types="node" />
  2. import { SocksProxy } from 'socks';
  3. import { Agent, ClientRequest, RequestOptions } from 'agent-base';
  4. import { AgentOptions } from 'agent-base';
  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>;
  32. }
  33. export {};