dnsolve 2.0.0 copy "dnsolve: ^2.0.0" to clipboard
dnsolve: ^2.0.0 copied to clipboard

Pure Dart library that provides an easy way to perform DNS lookups

example/main.dart

import 'dart:developer';

import 'package:dnsolve/dnsolve.dart';

Future<void> main() async {
  final dnsolve = DNSolve();

  try {
    final response = await dnsolve.lookup(
      '_xmpp._tcp.vsevex.me',
      dnsSec: true,
      type: RecordType.srv,
      timeout: const Duration(seconds: 10),
    );

    if (response.answer?.records != null) {
      for (final record in response.answer!.records!) {
        log(record.toBind);
      }
    }

    // Access parsed SRV records
    if (response.answer?.srvs != null) {
      log('Parsed SRV Records:');
      for (final srv in response.answer!.srvs!) {
        log('  Priority: ${srv.priority}, Weight: ${srv.weight}, '
            'Port: ${srv.port}, Target: ${srv.target}');
      }
    }
  } on DNSolveException catch (e) {
    log('DNS error: $e');
  } finally {
    dnsolve.dispose();
  }
}
2
likes
160
points
1.93k
downloads

Publisher

verified publishervsevex.me

Weekly Downloads

Pure Dart library that provides an easy way to perform DNS lookups

Repository (GitHub)
View/report issues

Topics

#network #http #dns

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on dnsolve