NameServerConfig.fromJson constructor
NameServerConfig.fromJson(
- Object? json
Implementation
factory NameServerConfig.fromJson(Object? json) {
if (json is String) {
return NameServerConfig.simple(json);
}
final map = asJsonMap(json, 'name server');
return NameServerConfig(
address: XrayAddress.fromJson(map['address']),
clientIp: map['clientIp'] == null
? null
: XrayAddress.fromJson(map['clientIp']),
port: map['port'] as int?,
skipFallback: map['skipFallback'] as bool?,
domains: map['domains'] == null
? null
: XrayStringList.fromJson(map['domains']),
expectedIPs: map['expectedIPs'] == null
? null
: XrayStringList.fromJson(map['expectedIPs']),
expectIPs: map['expectIPs'] == null
? null
: XrayStringList.fromJson(map['expectIPs']),
queryStrategy: map['queryStrategy'] == null
? null
: DnsQueryStrategy.fromJson(map['queryStrategy']),
tag: map['tag'] as String?,
timeoutMs: map['timeoutMs'] as int?,
disableCache: map['disableCache'] as bool?,
serveStale: map['serveStale'] as bool?,
serveExpiredTTL: map['serveExpiredTTL'] as int?,
finalQuery: map['finalQuery'] as bool?,
unexpectedIPs: map['unexpectedIPs'] == null
? null
: XrayStringList.fromJson(map['unexpectedIPs']),
);
}