DoHAnswer.fromJson constructor
Create DNS answer record from JSON
Implementation
factory DoHAnswer.fromJson(Map<String, dynamic> json) {
final ttl = (json['TTL'] as int?) ?? 0;
final currentTime = DateTime.now().millisecondsSinceEpoch;
return DoHAnswer(
name: (json['name'] as String?) ?? '',
ttl: ttl,
type: (json['type'] as int?) ?? 0,
dnsClass: (json['class'] as int?) ?? 1,
data: (json['data'] as String?) ?? '',
dataLength: json['rdlength'] as int?,
validUntil: currentTime + (ttl * 1000),
);
}