github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/adapter/fakeip.go (about)

     1  package adapter
     2  
     3  import (
     4  	"net/netip"
     5  
     6  	"github.com/sagernet/sing-dns"
     7  	"github.com/sagernet/sing/common/logger"
     8  )
     9  
    10  type FakeIPStore interface {
    11  	Service
    12  	Contains(address netip.Addr) bool
    13  	Create(domain string, isIPv6 bool) (netip.Addr, error)
    14  	Lookup(address netip.Addr) (string, bool)
    15  	Reset() error
    16  }
    17  
    18  type FakeIPStorage interface {
    19  	FakeIPMetadata() *FakeIPMetadata
    20  	FakeIPSaveMetadata(metadata *FakeIPMetadata) error
    21  	FakeIPSaveMetadataAsync(metadata *FakeIPMetadata)
    22  	FakeIPStore(address netip.Addr, domain string) error
    23  	FakeIPStoreAsync(address netip.Addr, domain string, logger logger.Logger)
    24  	FakeIPLoad(address netip.Addr) (string, bool)
    25  	FakeIPLoadDomain(domain string, isIPv6 bool) (netip.Addr, bool)
    26  	FakeIPReset() error
    27  }
    28  
    29  type FakeIPTransport interface {
    30  	dns.Transport
    31  	Store() FakeIPStore
    32  }