MCPcopy
hub / github.com/axios/axios / isIPv4Loopback

Function isIPv4Loopback

lib/helpers/shouldBypassProxy.js:3–8  ·  view source on GitHub ↗
(host)

Source from the content-addressed store, hash-verified

1const LOOPBACK_HOSTNAMES = new Set(['localhost', '0.0.0.0']);
2
3const isIPv4Loopback = (host) => {
4 const parts = host.split('.');
5 if (parts.length !== 4) return false;
6 if (parts[0] !== '127') return false;
7 return parts.every((p) => /^\d+$/.test(p) && Number(p) >= 0 && Number(p) <= 255);
8};
9
10const isIPv6ZeroGroup = (group) => /^0{1,4}$/.test(group);
11

Callers 2

isIPv6LoopbackFunction · 0.85
isLoopbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected