pub struct ClashDNSConfigDef {
    pub enable: bool,
    pub ipv6: bool,
    pub user_hosts: bool,
    pub nameserver: Vec<String, Global>,
    pub fallback: Vec<String, Global>,
    pub fallback_filter: FallbackFilter,
    pub listen: Option<DNSListen>,
    pub enhanced_mode: DNSMode,
    pub fake_ip_range: String,
    pub fake_ip_filter: Vec<String, Global>,
    pub default_nameserver: Vec<String, Global>,
    pub nameserver_policy: HashMap<String, String, RandomState>,
}
Expand description

DNS client/server settings This section is optional. When not present, the DNS server will be disabled and system DNS config will be used

Example

dns:
  enable: true
  ipv6: false # when the false, response to AAAA questions will be empty
  listen:
    udp: 127.0.0.1:5353
    tcp: 127.0.0.1:5353
    doh: 127.0.0.1:5354
    dot: 127.0.0.1:5355

Fields§

§enable: bool

When disabled, system DNS config will be used All other DNS related options will only be used when this is enabled

§ipv6: bool

When false, response to AAAA questions will be empty

§user_hosts: bool

Whether to Config::hosts as when resolving hostnames

§nameserver: Vec<String, Global>

DNS servers

§fallback: Vec<String, Global>

Fallback DNS servers

§fallback_filter: FallbackFilter

Fallback DNS filter

§listen: Option<DNSListen>

DNS server listening address. If not present, the DNS server will be disabled.

§enhanced_mode: DNSMode

Whether to use fake IP addresses

§fake_ip_range: String

Fake IP addresses pool CIDR

§fake_ip_filter: Vec<String, Global>

Fake IP addresses filter

§default_nameserver: Vec<String, Global>

Default nameservers, used to resolve DoH hostnames

§nameserver_policy: HashMap<String, String, RandomState>

Lookup domains via specific nameservers

Trait Implementations§

§

impl Default for DNS

§

fn default() -> DNS

Returns the “default value” for a type. Read more
§

impl<'de> Deserialize<'de> for DNSwhere DNS: Default,

§

fn deserialize<__D>( __deserializer: __D ) -> Result<DNS, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Serialize for DNS

§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for DNS

§

impl Send for DNS

§

impl Sync for DNS

§

impl Unpin for DNS

§

impl UnwindSafe for DNS

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> Serialize for Twhere T: Serialize + ?Sized,

source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,