chore: netip.Prefix should not using pointer

This commit is contained in:
wwqgtxx
2023-10-26 10:39:54 +08:00
parent 4314b37d04
commit bffe47a974
9 changed files with 40 additions and 40 deletions

View File

@ -36,7 +36,7 @@ type Pool struct {
cycle bool
mux sync.Mutex
host *trie.DomainTrie[struct{}]
ipnet *netip.Prefix
ipnet netip.Prefix
store store
}
@ -91,7 +91,7 @@ func (p *Pool) Broadcast() netip.Addr {
}
// IPNet return raw ipnet
func (p *Pool) IPNet() *netip.Prefix {
func (p *Pool) IPNet() netip.Prefix {
return p.ipnet
}
@ -153,7 +153,7 @@ func (p *Pool) restoreState() {
}
type Options struct {
IPNet *netip.Prefix
IPNet netip.Prefix
Host *trie.DomainTrie[struct{}]
// Size sets the maximum number of entries in memory
@ -171,7 +171,7 @@ func New(options Options) (*Pool, error) {
hostAddr = options.IPNet.Masked().Addr()
gateway = hostAddr.Next()
first = gateway.Next().Next().Next() // default start with 198.18.0.4
last = nnip.UnMasked(*options.IPNet)
last = nnip.UnMasked(options.IPNet)
)
if !options.IPNet.IsValid() || !first.IsValid() || !first.Less(last) {