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.

53 lines
1.3 KiB

4 years ago
  1. interface v6 {
  2. /**
  3. * @returns The IPv6 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
  4. *
  5. * @example
  6. *
  7. * console.log(await internalIp.v6());
  8. * //=> 'fe80::1'
  9. */
  10. (): Promise<string>;
  11. /**
  12. * @returns The IPv6 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
  13. *
  14. * @example
  15. *
  16. * console.log(internalIp.v6.sync());
  17. * //=> 'fe80::1'
  18. */
  19. sync(): string;
  20. }
  21. interface v4 {
  22. /**
  23. * @returns The IPv4 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
  24. *
  25. * @example
  26. *
  27. * console.log(await internalIp.v4())
  28. * //=> '10.0.0.79'
  29. */
  30. (): Promise<string>;
  31. /**
  32. * @returns The IPv4 address of the internet-facing interface, as determined from the default gateway. When the address cannot be determined for any reason, `null` will be returned.
  33. *
  34. * @example
  35. *
  36. * console.log(internalIp.v4.sync())
  37. * //=> '10.0.0.79'
  38. */
  39. sync(): string;
  40. }
  41. declare const internalIp: {
  42. v6: v6;
  43. v4: v4;
  44. // TODO: Remove this for the next major release
  45. default: typeof internalIp;
  46. };
  47. export = internalIp;