adguard-home-manager/lib/models/dns_info.dart

116 lines
4.4 KiB
Dart
Raw Normal View History

2022-10-19 20:26:40 +02:00
class DnsInfo {
List<String> upstreamDns;
2023-06-15 14:27:08 +02:00
String? upstreamDnsFile;
2022-10-19 20:26:40 +02:00
List<String> bootstrapDns;
2023-12-11 22:03:36 +01:00
List<String>? fallbackDns;
2022-10-19 20:26:40 +02:00
bool protectionEnabled;
int ratelimit;
String blockingMode;
bool ednsCsEnabled;
2023-12-11 15:48:01 +01:00
bool? ednsCsUseCustom;
String? ednsCsCustomIp;
2022-10-19 20:26:40 +02:00
bool dnssecEnabled;
bool disableIpv6;
2023-06-16 14:38:19 +02:00
String? upstreamMode;
2023-07-26 18:49:48 +02:00
int? cacheSize;
2023-08-28 20:19:49 +02:00
int? cacheTtlMin;
int? cacheTtlMax;
2023-10-04 19:20:43 +02:00
bool? cacheOptimistic;
2023-10-08 14:22:03 +02:00
bool? resolveClients;
2023-10-21 19:04:58 +02:00
bool? usePrivatePtrResolvers;
2022-10-19 20:26:40 +02:00
List<String> localPtrUpstreams;
String blockingIpv4;
String blockingIpv6;
List<String> defaultLocalPtrUpstreams;
2023-12-11 22:24:24 +01:00
int? blockedResponseTtl;
int? ratelimitSubnetLenIpv4;
int? ratelimitSubnetLenIpv6;
2023-05-24 20:40:45 +02:00
DnsInfo({
2022-10-19 20:26:40 +02:00
required this.upstreamDns,
required this.upstreamDnsFile,
required this.bootstrapDns,
2023-12-11 22:03:36 +01:00
required this.fallbackDns,
2022-10-19 20:26:40 +02:00
required this.protectionEnabled,
required this.ratelimit,
required this.blockingMode,
required this.ednsCsEnabled,
2023-12-11 15:48:01 +01:00
required this.ednsCsUseCustom,
required this.ednsCsCustomIp,
2022-10-19 20:26:40 +02:00
required this.dnssecEnabled,
required this.disableIpv6,
required this.upstreamMode,
required this.cacheSize,
required this.cacheTtlMin,
required this.cacheTtlMax,
required this.cacheOptimistic,
required this.resolveClients,
required this.usePrivatePtrResolvers,
required this.localPtrUpstreams,
required this.blockingIpv4,
required this.blockingIpv6,
required this.defaultLocalPtrUpstreams,
2023-12-11 22:24:24 +01:00
required this.blockedResponseTtl,
required this.ratelimitSubnetLenIpv4,
required this.ratelimitSubnetLenIpv6,
2022-10-19 20:26:40 +02:00
});
2023-05-24 20:40:45 +02:00
factory DnsInfo.fromJson(Map<String, dynamic> json) => DnsInfo(
2022-10-19 20:26:40 +02:00
upstreamDns: json["upstream_dns"] != null ? List<String>.from(json["upstream_dns"].map((x) => x)) : [],
upstreamDnsFile: json["upstream_dns_file"],
2023-07-09 22:29:41 +02:00
bootstrapDns: json["bootstrap_dns"] != null ? List<String>.from(json["bootstrap_dns"].map((x) => x)) : [],
2023-12-11 22:03:36 +01:00
fallbackDns: json["fallback_dns"] != null ? List<String>.from(json["fallback_dns"].map((x) => x)) : [],
2022-10-19 20:26:40 +02:00
protectionEnabled: json["protection_enabled"],
ratelimit: json["ratelimit"],
blockingMode: json["blocking_mode"],
ednsCsEnabled: json["edns_cs_enabled"],
2023-12-11 15:48:01 +01:00
ednsCsUseCustom: json["edns_cs_use_custom"],
ednsCsCustomIp: json["edns_cs_custom_ip"],
2022-10-19 20:26:40 +02:00
dnssecEnabled: json["dnssec_enabled"],
disableIpv6: json["disable_ipv6"],
upstreamMode: json["upstream_mode"],
cacheSize: json["cache_size"],
cacheTtlMin: json["cache_ttl_min"],
cacheTtlMax: json["cache_ttl_max"],
cacheOptimistic: json["cache_optimistic"],
resolveClients: json["resolve_clients"],
usePrivatePtrResolvers: json["use_private_ptr_resolvers"],
localPtrUpstreams: json["local_ptr_upstreams"] != null ? List<String>.from(json["local_ptr_upstreams"].map((x) => x)) : [],
blockingIpv4: json["blocking_ipv4"],
blockingIpv6: json["blocking_ipv6"],
defaultLocalPtrUpstreams: json["default_local_ptr_upstreams"] != null ? List<String>.from(json["default_local_ptr_upstreams"].map((x) => x)) : [],
blockedResponseTtl: json["blocked_response_ttl"],
ratelimitSubnetLenIpv4: json["ratelimit_subnet_len_ipv4"],
ratelimitSubnetLenIpv6: json["ratelimit_subnet_len_ipv6"],
2022-10-19 20:26:40 +02:00
);
Map<String, dynamic> toJson() => {
"upstream_dns": List<dynamic>.from(upstreamDns.map((x) => x)),
"upstream_dns_file": upstreamDnsFile,
"bootstrap_dns": List<dynamic>.from(bootstrapDns.map((x) => x)),
2023-12-11 22:03:36 +01:00
"fallback_dns": List<dynamic>.from(bootstrapDns.map((x) => x)),
2022-10-19 20:26:40 +02:00
"protection_enabled": protectionEnabled,
"ratelimit": ratelimit,
"blocking_mode": blockingMode,
"edns_cs_enabled": ednsCsEnabled,
2023-12-11 15:48:01 +01:00
"edns_cs_use_custom": ednsCsUseCustom,
"edns_cs_custom_ip": ednsCsCustomIp,
2022-10-19 20:26:40 +02:00
"dnssec_enabled": dnssecEnabled,
"disable_ipv6": disableIpv6,
"upstream_mode": upstreamMode,
"cache_size": cacheSize,
"cache_ttl_min": cacheTtlMin,
"cache_ttl_max": cacheTtlMax,
"cache_optimistic": cacheOptimistic,
"resolve_clients": resolveClients,
"use_private_ptr_resolvers": usePrivatePtrResolvers,
"local_ptr_upstreams": List<dynamic>.from(localPtrUpstreams.map((x) => x)),
"blocking_ipv4": blockingIpv4,
"blocking_ipv6": blockingIpv6,
"default_local_ptr_upstreams": List<dynamic>.from(defaultLocalPtrUpstreams.map((x) => x)),
"blocked_response_ttl": blockedResponseTtl,
"ratelimit_subnet_len_ipv4": ratelimitSubnetLenIpv4,
"ratelimit_subnet_len_ipv6": ratelimitSubnetLenIpv6,
2022-10-19 20:26:40 +02:00
};
}