index.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /// <reference types="node" />
  2. /// <reference types="node" />
  3. /// <reference types="node" />
  4. /// <reference types="node" />
  5. import * as net from 'net';
  6. import * as tls from 'tls';
  7. import * as http from 'http';
  8. import type { Duplex } from 'stream';
  9. export * from './helpers';
  10. interface HttpConnectOpts extends net.TcpNetConnectOpts {
  11. secureEndpoint: false;
  12. protocol?: string;
  13. }
  14. interface HttpsConnectOpts extends tls.ConnectionOptions {
  15. secureEndpoint: true;
  16. protocol?: string;
  17. port: number;
  18. }
  19. export type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;
  20. declare const INTERNAL: unique symbol;
  21. export declare abstract class Agent extends http.Agent {
  22. private [INTERNAL];
  23. options: Partial<net.TcpNetConnectOpts & tls.ConnectionOptions>;
  24. keepAlive: boolean;
  25. constructor(opts?: http.AgentOptions);
  26. abstract connect(req: http.ClientRequest, options: AgentConnectOpts): Promise<Duplex | http.Agent> | Duplex | http.Agent;
  27. /**
  28. * Determine whether this is an `http` or `https` request.
  29. */
  30. isSecureEndpoint(options?: AgentConnectOpts): boolean;
  31. private incrementSockets;
  32. private decrementSockets;
  33. getName(options: AgentConnectOpts): string;
  34. createSocket(req: http.ClientRequest, options: AgentConnectOpts, cb: (err: Error | null, s?: Duplex) => void): void;
  35. createConnection(): Duplex;
  36. get defaultPort(): number;
  37. set defaultPort(v: number);
  38. get protocol(): string;
  39. set protocol(v: string);
  40. }
  41. //# sourceMappingURL=index.d.ts.map