diff --git a/common/fakeip/pool.go b/common/fakeip/pool.go index 1427e80..430b0c6 100755 --- a/common/fakeip/pool.go +++ b/common/fakeip/pool.go @@ -86,11 +86,15 @@ func uintToIP(v uint32) net.IP { } // New return Pool instance -func New(ipnet *net.IPNet, size int) (*Pool, error) { - min := ipToUint(ipnet.IP) + 2 +func New(ipnet *net.IPNet, offset, size int) (*Pool, error) { + if offset < 2 { + return nil, errors.New("offset must not less than 2") + } + + min := ipToUint(ipnet.IP) + uint32(offset) ones, bits := ipnet.Mask.Size() - total := 1<