How to use the isLoopback function from ip
Find comprehensive JavaScript ip.isLoopback code examples handpicked from public code repositorys.
GitHub: Xcopyco/orc
97 98 99 100 101 102 103 104 105 106 107
const [, info] = contact; const isValidAddr = ip.isV4Format(info.hostname) || ip.isV6Format(info.hostname) || ip.isPublic(info.hostname); const isValidPort = info.port > 0; const isAllowedAddr = ip.isLoopback(info.hostname) ? !!loopback : true; return isValidPort && isValidAddr && isAllowedAddr; };
20
1
0
+ 2 other calls in file
GitHub: jianxcao/ftl-node
22 23 24 25 26 27 28 29 30 31
var getIps = function() { var interfaces = os.networkInterfaces(); var all = Object.keys(interfaces).map(function (nic) { var addresses = interfaces[nic].filter(function (details) { details.family = details.family.toLowerCase(); if (details.family !== 'ipv4' || ip.isLoopback(details.address)) { return false; } return true; });
4
21
0
62 63 64 65 66 67 68 69 70 71 72
* Tests if input is an IP address is a loopback ip address. * @param {string} ip * @returns {boolean} */ ipDash.isLoopbackIP = function (ip) { return nodeIp.isLoopback(ip); }; /** * Returns the private ip address of the current running process.
0
1
0
65 66 67 68 69 70 71 72 73 74
* when this is called. */ const addresses = interfaces[nic].filter(function(details) { details.family = details.family.toLowerCase(); details.ifname = nic; if (details.family !== family || ip.isLoopback(details.address)) { return false; } else if (!name) { return true; }
0
0
0
GitHub: dagardom92/core
190 191 192 193 194 195 196 197 198 199 200 201
var isValidAddr = ip.isV4Format(contact.address) || ip.isV6Format(contact.address) || ip.isPublic(contact.address); var isValidPort = contact.port > 0; var isAllowedAddr = ip.isLoopback(contact.address) ? !!loopback : true; return isValidPort && isValidAddr && isAllowedAddr; };
0
0
0
GitHub: Bismyth/CaptionLog
79 80 81 82 83 84 85 86 87 88 89
router.get('/local', (req, res) => { res.json({ local: process.env.SUBNET.split(',').some((v) => { return ip.cidrSubnet(v).contains(req.clientIp); }) || ip.isLoopback(req.clientIp), }); }); router.get('/roles', auth.block(auth.roles.admin), (req, res) => {
0
0
0
ip.address is the most popular function in ip (635 examples)