DNSConfig.fromJson constructor

DNSConfig.fromJson(
  1. Object? json
)

Implementation

factory DNSConfig.fromJson(Object? json) {
  final map = asJsonMap(json, 'dns');
  return DNSConfig(
    servers: map['servers'] == null
        ? null
        : asJsonList(map['servers'], NameServerConfig.fromJson),
    hosts: map['hosts'] == null ? null : HostsWrapper.fromJson(map['hosts']),
    clientIp: map['clientIp'] == null
        ? null
        : XrayAddress.fromJson(map['clientIp']),
    tag: map['tag'] as String?,
    queryStrategy: map['queryStrategy'] == null
        ? null
        : DnsQueryStrategy.fromJson(map['queryStrategy']),
    disableCache: map['disableCache'] as bool?,
    serveStale: map['serveStale'] as bool?,
    serveExpiredTTL: map['serveExpiredTTL'] as int?,
    disableFallback: map['disableFallback'] as bool?,
    disableFallbackIfMatch: map['disableFallbackIfMatch'] as bool?,
    enableParallelQuery: map['enableParallelQuery'] as bool?,
    useSystemHosts: map['useSystemHosts'] as bool?,
  );
}