|
@@ -62,11 +62,7 @@ Recursive function to get all of the IPv4 addresses for each IPv4 network that t
|
|
|
:param max: This is safety feature to prevent stack overflows, so you can manually set the depth to
|
|
|
call the function
|
|
|
*/
|
|
|
-func addressRecurse(ipmap *IpSubnetMapper, max int) {
|
|
|
-
|
|
|
- if len(ipmap.Ipv4s) > max {
|
|
|
- return
|
|
|
- }
|
|
|
+func addressRecurse(ipmap *IpSubnetMapper) {
|
|
|
|
|
|
next := getNextAddr(ipmap.Current.String())
|
|
|
|
|
@@ -79,7 +75,7 @@ func addressRecurse(ipmap *IpSubnetMapper, max int) {
|
|
|
ipmap.Current = net.ParseIP(next)
|
|
|
|
|
|
ipmap.Ipv4s = append(ipmap.Ipv4s, net.ParseIP(next))
|
|
|
- addressRecurse(ipmap, max)
|
|
|
+ addressRecurse(ipmap)
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -102,7 +98,7 @@ func GetNetworkAddresses(addr string) (*IpSubnetMapper, error) {
|
|
|
ipmap.NetworkAddr = ip.Mask(net.Mask)
|
|
|
ipmap.Mask = mask
|
|
|
ipmap.Current = ip.Mask(net.Mask)
|
|
|
- addressRecurse(ipmap, 65535)
|
|
|
+ addressRecurse(ipmap)
|
|
|
|
|
|
return ipmap, nil
|
|
|
|