fromBytes static method
Implementation
static AFSDBResponseRecord fromBytes({
required String name,
required int ttl,
required Uint8List bytes,
required int offset,
required int length }) {
// Length validation
if((length < 3) || ((offset + length) > bytes.length)) {
throw FormatException('Invalid AFSDB record: expected at least 3 bytes, got ${bytes.length}.');
}
late String hostname;
final int subtype = (bytes[offset + 0] << 8) | bytes[offset + 1]; // Uint8
(_, hostname) = DNSHelper.parseDomainName(bytes, offset + 2);
return AFSDBResponseRecord(
name: name,
ttl: ttl,
subtype: subtype,
hostname: hostname);
}