Unlink scripts submodule and commit contents as normal directory
This commit is contained in:
1 parent
4f7dea111f
commit
6488b3ea85
48 files changed
+2876
-1
No files matched your search
@@ -0,0 +1,16 @@
|
||||
const ipaddr = require('ipaddr.js');
|
||||
|
||||
const LOCAL_RANGES = new Set([
|
||||
'unspecified', 'multicast', 'linkLocal', 'loopback', 'reserved', 'benchmarking', 'amt',
|
||||
'broadcast', 'carrierGradeNat', 'private', 'as112',
|
||||
'uniqueLocal', 'ipv4Mapped', 'rfc6145', '6to4', 'teredo', 'as112v6', 'orchid2', 'droneRemoteIdProtocolEntityTags',
|
||||
]);
|
||||
|
||||
module.exports = ip => {
|
||||
try {
|
||||
const range = ipaddr.parse(ip).range();
|
||||
return { is: LOCAL_RANGES.has(range), range };
|
||||
} catch {
|
||||
return { is: false, range: null };
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user