selfDNSTest method

Future<bool> selfDNSTest(
  1. DnsDcvData data, {
  2. int maxAttempts = 15,
})

A test whether the DNS record is placed or not. Uses the Google DNS JSON API to check the corresponding zone file.

Implementation

Future<bool> selfDNSTest(DnsDcvData data, {int maxAttempts = 15}) async {
  for (var i = 0; i < maxAttempts; i++) {
    var records = await DnsUtils.lookupRecord(
        data.rRecord.name, RRecordType.TXT,
        provider: DnsApiProvider.GOOGLE);
    if (records!.first.data == data.rRecord.data) {
      print('Found record at Google DNS');
      return true;
    } else {
      print('Record not found yet at Google DNS');
    }
    await Future.delayed(Duration(seconds: 4));
  }
  return false;
}