sing-box/adapter/fakeip.go

33 lines
811 B
Go
Raw Normal View History

2023-03-25 04:03:23 +00:00
package adapter
import (
"net/netip"
"github.com/sagernet/sing-dns"
2023-07-08 08:08:46 +00:00
"github.com/sagernet/sing/common/logger"
2023-03-25 04:03:23 +00:00
)
type FakeIPStore interface {
Service
Contains(address netip.Addr) bool
2023-07-11 06:05:14 +00:00
Create(domain string, isIPv6 bool) (netip.Addr, error)
2023-03-25 04:03:23 +00:00
Lookup(address netip.Addr) (string, bool)
Reset() error
}
type FakeIPStorage interface {
FakeIPMetadata() *FakeIPMetadata
FakeIPSaveMetadata(metadata *FakeIPMetadata) error
2023-08-07 13:53:19 +00:00
FakeIPSaveMetadataAsync(metadata *FakeIPMetadata)
2023-03-25 04:03:23 +00:00
FakeIPStore(address netip.Addr, domain string) error
2023-07-08 08:08:46 +00:00
FakeIPStoreAsync(address netip.Addr, domain string, logger logger.Logger)
2023-03-25 04:03:23 +00:00
FakeIPLoad(address netip.Addr) (string, bool)
2023-07-11 06:05:14 +00:00
FakeIPLoadDomain(domain string, isIPv6 bool) (netip.Addr, bool)
2023-03-25 04:03:23 +00:00
FakeIPReset() error
}
2023-06-10 08:26:40 +00:00
type FakeIPTransport interface {
dns.Transport
Store() FakeIPStore
}