2022-07-06 23:11:48 +08:00
|
|
|
package option
|
|
|
|
|
2024-11-07 21:44:04 +08:00
|
|
|
import (
|
|
|
|
"net/netip"
|
|
|
|
|
|
|
|
"github.com/sagernet/sing/common/json/badoption"
|
|
|
|
)
|
2023-10-21 12:00:00 +08:00
|
|
|
|
2022-07-06 23:11:48 +08:00
|
|
|
type DNSOptions struct {
|
2023-03-23 19:08:48 +08:00
|
|
|
Servers []DNSServerOptions `json:"servers,omitempty"`
|
|
|
|
Rules []DNSRule `json:"rules,omitempty"`
|
|
|
|
Final string `json:"final,omitempty"`
|
|
|
|
ReverseMapping bool `json:"reverse_mapping,omitempty"`
|
2023-03-25 12:03:23 +08:00
|
|
|
FakeIP *DNSFakeIPOptions `json:"fakeip,omitempty"`
|
2022-07-06 23:39:17 +08:00
|
|
|
DNSClientOptions
|
|
|
|
}
|
|
|
|
|
2022-07-06 23:11:48 +08:00
|
|
|
type DNSServerOptions struct {
|
2024-11-07 21:44:04 +08:00
|
|
|
Tag string `json:"tag,omitempty"`
|
|
|
|
Address string `json:"address"`
|
|
|
|
AddressResolver string `json:"address_resolver,omitempty"`
|
|
|
|
AddressStrategy DomainStrategy `json:"address_strategy,omitempty"`
|
|
|
|
AddressFallbackDelay badoption.Duration `json:"address_fallback_delay,omitempty"`
|
|
|
|
Strategy DomainStrategy `json:"strategy,omitempty"`
|
|
|
|
Detour string `json:"detour,omitempty"`
|
|
|
|
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
2022-07-06 23:11:48 +08:00
|
|
|
}
|
2023-03-25 12:03:23 +08:00
|
|
|
|
|
|
|
type DNSClientOptions struct {
|
2024-11-07 21:44:04 +08:00
|
|
|
Strategy DomainStrategy `json:"strategy,omitempty"`
|
|
|
|
DisableCache bool `json:"disable_cache,omitempty"`
|
|
|
|
DisableExpire bool `json:"disable_expire,omitempty"`
|
|
|
|
IndependentCache bool `json:"independent_cache,omitempty"`
|
2024-11-14 12:42:42 +08:00
|
|
|
CacheCapacity uint32 `json:"cache_capacity,omitempty"`
|
2024-11-07 21:44:04 +08:00
|
|
|
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
2023-03-25 12:03:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type DNSFakeIPOptions struct {
|
|
|
|
Enabled bool `json:"enabled,omitempty"`
|
2023-10-21 12:00:00 +08:00
|
|
|
Inet4Range *netip.Prefix `json:"inet4_range,omitempty"`
|
|
|
|
Inet6Range *netip.Prefix `json:"inet6_range,omitempty"`
|
2023-03-25 12:03:23 +08:00
|
|
|
}
|