isInNet.d.ts 986 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Module dependencies.
  3. */
  4. /**
  5. * True iff the IP address of the host matches the specified IP address pattern.
  6. *
  7. * Pattern and mask specification is done the same way as for SOCKS configuration.
  8. *
  9. * Examples:
  10. *
  11. * ``` js
  12. * isInNet(host, "198.95.249.79", "255.255.255.255")
  13. * // is true iff the IP address of host matches exactly 198.95.249.79.
  14. *
  15. * isInNet(host, "198.95.0.0", "255.255.0.0")
  16. * // is true iff the IP address of the host matches 198.95.*.*.
  17. * ```
  18. *
  19. * @param {String} host a DNS hostname, or IP address. If a hostname is passed,
  20. * it will be resoved into an IP address by this function.
  21. * @param {String} pattern an IP address pattern in the dot-separated format mask.
  22. * @param {String} mask for the IP address pattern informing which parts of the
  23. * IP address should be matched against. 0 means ignore, 255 means match.
  24. * @return {Boolean}
  25. */
  26. export default function isInNet(host: string, pattern: string, mask: string): Promise<boolean>;