diff --git a/component/fakeip/pool.go b/component/fakeip/pool.go index 925882bb..43b9cee1 100644 --- a/component/fakeip/pool.go +++ b/component/fakeip/pool.go @@ -22,14 +22,15 @@ type store interface { // Pool is a implementation about fake ip generator without storage type Pool struct { - max uint32 - min uint32 - gateway uint32 - offset uint32 - mux sync.Mutex - host *trie.DomainTrie - ipnet *net.IPNet - store store + max uint32 + min uint32 + gateway uint32 + broadcast uint32 + offset uint32 + mux sync.Mutex + host *trie.DomainTrie + ipnet *net.IPNet + store store } // Lookup return a fake ip with host @@ -82,6 +83,11 @@ func (p *Pool) Gateway() net.IP { return uintToIP(p.gateway) } +// Broadcast return broadcast ip +func (p *Pool) Broadcast() net.IP { + return uintToIP(p.broadcast) +} + // IPNet return raw ipnet func (p *Pool) IPNet() *net.IPNet { return p.ipnet @@ -144,7 +150,7 @@ func New(options Options) (*Pool, error) { min := ipToUint(options.IPNet.IP) + 2 ones, bits := options.IPNet.Mask.Size() - total := 1<