lib: ip: add 'isValidIp4'

This commit is contained in:
Bruno BELANYI 2021-04-24 23:16:30 +00:00
parent 5a06ab74bb
commit 0112dd87ac

View file

@ -124,4 +124,7 @@ rec {
(zipListsWith (lhs: rhs: lhs - rhs) to from);
in
map (nthInRange4 arg) (range 0 numAddresses);
isValidIp4 = ip:
(builtins.all (n: n >= 0 && n < 256) ip) && (builtins.length ip == 4);
}