mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
feat: support ARC for DNS cache
This commit is contained in:
@@ -3,12 +3,12 @@ package fakeip
|
||||
import (
|
||||
"net/netip"
|
||||
|
||||
"github.com/metacubex/mihomo/common/cache"
|
||||
"github.com/metacubex/mihomo/common/lru"
|
||||
)
|
||||
|
||||
type memoryStore struct {
|
||||
cacheIP *cache.LruCache[string, netip.Addr]
|
||||
cacheHost *cache.LruCache[netip.Addr, string]
|
||||
cacheIP *lru.LruCache[string, netip.Addr]
|
||||
cacheHost *lru.LruCache[netip.Addr, string]
|
||||
}
|
||||
|
||||
// GetByHost implements store.GetByHost
|
||||
@@ -73,7 +73,7 @@ func (m *memoryStore) FlushFakeIP() error {
|
||||
|
||||
func newMemoryStore(size int) *memoryStore {
|
||||
return &memoryStore{
|
||||
cacheIP: cache.New[string, netip.Addr](cache.WithSize[string, netip.Addr](size)),
|
||||
cacheHost: cache.New[netip.Addr, string](cache.WithSize[netip.Addr, string](size)),
|
||||
cacheIP: lru.New[string, netip.Addr](lru.WithSize[string, netip.Addr](size)),
|
||||
cacheHost: lru.New[netip.Addr, string](lru.WithSize[netip.Addr, string](size)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user