checking in- working on fix for numhost subnetting

This commit is contained in:
brent saner
2025-04-06 14:37:57 -04:00
parent 3c239a4d09
commit fd344f3b8e
3 changed files with 50 additions and 26 deletions

View File

@@ -1,21 +1,22 @@
package netsplit
import (
`math/big`
`net`
"fmt"
"math/big"
"net"
"net/netip"
`github.com/projectdiscovery/mapcidr`
"github.com/projectdiscovery/mapcidr"
"go4.org/netipx"
)
/*
Split splits the network defined in a HostSplitter alongside its configuration and performs the subnetting.
This strategy attempts to split the network into subnets of equal number of hosts.
Split splits the network defined in a HostSplitter alongside its configuration and performs the subnetting.
This strategy attempts to split the network into subnets of equal number of hosts.
remaining may or may not be nil depending on if the number of hosts can fit cleanly within equal network sizes on boundaries.
remaining may or may not be nil depending on if the number of hosts can fit cleanly within equal network sizes on boundaries.
An ErrBadNumHosts will be returned if the number of hosts does not match the *addressable* range in a prefix.
An ErrBadNumHosts will be returned if the number of hosts does not match the *addressable* range in a prefix.
*/
func (h *HostSplitter) Split() (nets []*netip.Prefix, remaining *netipx.IPSet, err error) {
@@ -34,6 +35,8 @@ func (h *HostSplitter) Split() (nets []*netip.Prefix, remaining *netipx.IPSet, e
return
}
fmt.Println(split)
tgt = big.NewInt(0)
tgt.SetUint64(uint64(h.NumberHosts))