Anonymous user
Module:IP: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
a subnet has getPrefix and so does not need its own copy of parts
(save progress on new implentation plan - an internal RawIP object used for bit operations on IP parts) |
(a subnet has getPrefix and so does not need its own copy of parts) |
||
Line 382:
local function makeSubnet(data, cidrStr)
-- If cidrStr is a valid IPv4 or IPv6 CIDR specification, store its
-- information in data and return
local lhs, rhs = cidrStr:match('^%s*(.-)/(%d+)%s*$')
if lhs then
Line 392:
local prefix = base:getPrefix(n)
if base == prefix then
data.bitLength = n
data.prefix = prefix
data.highestIP = base:getHighestIP(n)
return
end
end
end
return
end
Line 469 ⟶ 468:
-- Set initial values
checkType('Subnet.new', 1, cidr, 'string')
if not data.version then
error('invalid CIDR', 2)
end
return obj
|