index.d.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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;