super_dns_client 0.3.3
super_dns_client: ^0.3.3 copied to clipboard
A modern and lightweight Dart library for performing DNS-over-HTTPS (DoH) lookups. Supports multiple resolvers and easy integration for Flutter and server-side apps.
π§ super_dns_client #
A modern and lightweight Dart library for performing DNS lookups via
πΉ DNS-over-HTTPS (DoH) and
πΉ traditional UDP/TCP resolvers β including System and Public SRV discovery.
Built for Flutter, Dart CLI, and backend apps.
π Features #
- π Query
A,AAAA,CNAME,SRV,TXTrecords - π Supports both DoH and traditional UDP/TCP DNS
- βοΈ Auto-detects System-configured DNS (macOS, Linux, Android, iOS)
- π§© Public resolver support: Quad9, AdGuard, Yandex, OpenDNS, Cloudflare, Google, Mullvad, etc.
- πΎ Built-in TTL-based SRV cache for performance
- π§± Built with
universal_io,super_raw, andsuper_ip - β Null-safe, well-tested, CI-integrated
π¦ Installation #
dependencies:
super_dns_client: ^0.3.0
Then run:
dart pub get
π‘ Example #
import 'package:super_dns_client/super_dns_client.dart';
import 'package:super_dns_client/src/udp_tcp/system_udp_srv_client.dart';
import 'package:super_dns_client/src/udp_tcp/public_udp_srv_client.dart';
void main() async {
// Example 1: DNS-over-HTTPS (Cloudflare)
final doh = DnsOverHttps.cloudflare();
final records = await doh.lookup('google.com');
for (var ip in records) {
print('DoH β ${ip.address}');
}
// Example 2: SRV lookup via System-configured DNS
final systemClient = SystemUdpSrvClient();
final systemRecords = await systemClient.lookupSrv('_jmap._tcp.linagora.com');
for (var r in systemRecords) {
print('SystemDNS β ${r.target}:${r.port}');
}
// Example 3: SRV lookup via Public DNS resolvers
final publicClient = PublicUdpSrvClient();
final publicRecords = await publicClient.lookupSrv('_jmap._tcp.linagora.com');
for (var r in publicRecords) {
print('PublicDNS(${r.resolverName}) β ${r.target}:${r.port}');
}
}
βοΈ Available DNS Resolvers #
πΈ DNS-over-HTTPS (DoH) #
| Provider | Endpoint URL |
|---|---|
https://dns.google/dns-query |
|
| Cloudflare | https://cloudflare-dns.com/dns-query |
| Quad9 | https://dns.quad9.net/dns-query |
| AdGuard | https://dns.adguard-dns.com/dns-query |
| Mullvad | https://doh.mullvad.net/dns-query |
| Yandex | https://dns.yandex.com/dns-query |
| OpenDNS | https://doh.opendns.com/dns-query |
πΈ Traditional (UDP/TCP) #
- System-configured resolvers (
/etc/resolv.conf, Androidgetprop, iOS fallback) - Public resolvers (Quad9, AdGuard, Yandex, OpenDNS)
- TCP fallback if UDP is truncated or timed out
π§ͺ Run Tests #
dart test
πͺͺ License #
Licensed under the MIT License.
See LICENSE for details.
β€οΈ Contributing #
Pull requests and ideas are welcome!
Open an issue or PR at GitHub Issues.
π Example Output #
DnsOverHttps.cloudflare::SRV β _jmap._tcp.linagora.com β jmap.linagora.com:443
SystemUdpSrvClient::SRV β linagora.com:443
PublicUdpSrvClient(quad9)::SRV β jmap.linagora.com:443
π§ Summary #
| Feature | Status |
|---|---|
| DoH (Google/Cloudflare) | β |
| Binary DoH (Quad9, Mullvad) | β |
| UDP/TCP SRV resolver | β |
| System DNS detection | β |
| Public resolver list | β |
| TTL cache | β |
| IPv6 support | β |
β¨ Since v0.3.0:
super_dns_clientis now a hybrid DNS resolver supporting
both DoH and UDP/TCP SRV record lookups with automatic fallback.