netUtils.d.ts 929 B

1234567891011121314151617181920212223
  1. /// <reference types="node" />
  2. /// <reference types="node" />
  3. import { Socket } from "net";
  4. import { ConnectionOptions, TLSSocket } from "tls";
  5. /**
  6. * Returns a string describing the encryption on a given socket instance.
  7. */
  8. export declare function describeTLS(socket: Socket | TLSSocket): string;
  9. /**
  10. * Returns a string describing the remote address of a socket.
  11. */
  12. export declare function describeAddress(socket: Socket): string;
  13. /**
  14. * Upgrade a socket connection with TLS.
  15. */
  16. export declare function upgradeSocket(socket: Socket, options: ConnectionOptions): Promise<TLSSocket>;
  17. /**
  18. * Returns true if an IP is a private address according to https://tools.ietf.org/html/rfc1918#section-3.
  19. * This will handle IPv4-mapped IPv6 addresses correctly but return false for all other IPv6 addresses.
  20. *
  21. * @param ip The IP as a string, e.g. "192.168.0.1"
  22. */
  23. export declare function ipIsPrivateV4Address(ip?: string): boolean;