dns.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package option
  2. import (
  3. "net/netip"
  4. "github.com/sagernet/sing/common/json/badoption"
  5. )
  6. type DNSOptions struct {
  7. Servers []DNSServerOptions `json:"servers,omitempty"`
  8. Rules []DNSRule `json:"rules,omitempty"`
  9. Final string `json:"final,omitempty"`
  10. ReverseMapping bool `json:"reverse_mapping,omitempty"`
  11. FakeIP *DNSFakeIPOptions `json:"fakeip,omitempty"`
  12. DNSClientOptions
  13. }
  14. type DNSServerOptions struct {
  15. Tag string `json:"tag,omitempty"`
  16. Address string `json:"address"`
  17. AddressResolver string `json:"address_resolver,omitempty"`
  18. AddressStrategy DomainStrategy `json:"address_strategy,omitempty"`
  19. AddressFallbackDelay badoption.Duration `json:"address_fallback_delay,omitempty"`
  20. Strategy DomainStrategy `json:"strategy,omitempty"`
  21. Detour string `json:"detour,omitempty"`
  22. ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
  23. }
  24. type DNSClientOptions struct {
  25. Strategy DomainStrategy `json:"strategy,omitempty"`
  26. DisableCache bool `json:"disable_cache,omitempty"`
  27. DisableExpire bool `json:"disable_expire,omitempty"`
  28. IndependentCache bool `json:"independent_cache,omitempty"`
  29. CacheCapacity uint32 `json:"cache_capacity,omitempty"`
  30. ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
  31. }
  32. type DNSFakeIPOptions struct {
  33. Enabled bool `json:"enabled,omitempty"`
  34. Inet4Range *netip.Prefix `json:"inet4_range,omitempty"`
  35. Inet6Range *netip.Prefix `json:"inet6_range,omitempty"`
  36. }