Refactor: DomainTrie use generics
This commit is contained in:
@ -28,7 +28,7 @@ type Pool struct {
|
||||
broadcast uint32
|
||||
offset uint32
|
||||
mux sync.Mutex
|
||||
host *trie.DomainTrie
|
||||
host *trie.DomainTrie[bool]
|
||||
ipnet *net.IPNet
|
||||
store store
|
||||
}
|
||||
@ -138,7 +138,7 @@ func uintToIP(v uint32) net.IP {
|
||||
|
||||
type Options struct {
|
||||
IPNet *net.IPNet
|
||||
Host *trie.DomainTrie
|
||||
Host *trie.DomainTrie[bool]
|
||||
|
||||
// Size sets the maximum number of entries in memory
|
||||
// and does not work if Persistence is true
|
||||
|
@ -100,8 +100,8 @@ func TestPool_CycleUsed(t *testing.T) {
|
||||
|
||||
func TestPool_Skip(t *testing.T) {
|
||||
_, ipnet, _ := net.ParseCIDR("192.168.0.1/29")
|
||||
tree := trie.New()
|
||||
tree.Insert("example.com", tree)
|
||||
tree := trie.New[bool]()
|
||||
tree.Insert("example.com", true)
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
|
Reference in New Issue
Block a user