How to use the is-ip.v6 function in is-ip

To help you get started, we’ve selected a few is-ip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ZencashOfficial / arizen / app / zcommon.js View on Github external
function pingSecureNode() {
    if (isValidDomainName(settings.secureNodeFQDN)) {
        let ping = require('ping');
        const isIp = require('is-ip');

        let fqdnIsV6 = isIp.v6(settings.secureNodeFQDN);

        let cfg = {
            v6: fqdnIsV6,
        };

        let hosts = [settings.secureNodeFQDN];
        hosts.forEach(function (host) {
            ping.sys.probe(host, function (isAlive) {
                toggleLedHTML();
                if (ledWrapperExists()){
                    if (isAlive) {
                        document.getElementById("dotSNstatus").style.backgroundColor = "#34A853"; // green #34A853
                    } else {
                        document.getElementById("dotSNstatus").style.backgroundColor = "#EA4335"; // red #EA4335
                        document.getElementById("dotSNstatusRPC").style.backgroundColor = "#EA4335"; // red #EA4335
                    }
github hashicorp / nomad / ui / app / serializers / network.js View on Github external
normalize(typeHash, hash) {
    const ip = hash.IP;

    if (isIp.v6(ip)) {
      hash.IP = `[${ip}]`;
    }

    const reservedPorts = (hash.ReservedPorts || []).map(port => ({
      name: port.Label,
      port: port.Value,
      to: port.To,
      isDynamic: false,
    }));

    const dynamicPorts = (hash.DynamicPorts || []).map(port => ({
      name: port.Label,
      port: port.Value,
      to: port.To,
      isDynamic: true,
    }));
github berty / berty / client / react-native / tools / dashboard / node-geoip / lib / geoip.js View on Github external
function isIP (string) {
  if (isIpLib.v4(string)) return 4
  else if (isIpLib.v6(string)) return 6
  else return 0
}
github hashicorp / levant / vendor / github.com / hashicorp / nomad / ui / app / serializers / network.js View on Github external
normalize(typeHash, hash) {
    const ip = hash.IP;

    if (isIp.v6(ip)) {
      hash.IP = `[${ip}]`;
    }

    return this._super(...arguments);
  },
});

is-ip

Check if a string is an IP address

MIT
Latest version published 9 months ago

Package Health Score

71 / 100
Full package analysis

Popular is-ip functions