Skip to content

A Swift library for asynchronous DNS requests, wrapping c-ares with Swift-friendly APIs and data structures.

License

Notifications You must be signed in to change notification settings

tadasr/swift-async-dns-resolver

 
 

Repository files navigation

Swift Asynchronous DNS Resolver

A Swift library for asynchronous DNS queries.

Overview

This library wraps around the dnssd framework and the c-ares C library with Swift-friendly APIs and data structures.

Usage

Add the package dependency in your Package.swift:

.package(
    url: "https://github.com/apple/swift-async-dns-resolver", 
    .upToNextMajor(from: "0.1.0")
),

Next, in your target, add AsyncDNSResolver to your dependencies:

.target(name: "MyTarget", dependencies: [
    .product(name: "AsyncDNSResolver", package: "swift-async-dns-resolver"),
],

Using the resolver

// import the package
import AsyncDNSResolver

// Initialize a resolver
let resolver = AsyncDNSResolver()

// Run a query
let aRecords = try await resolver.queryA(name: "apple.com")

// Process the `ARecord`s
...

About

A Swift library for asynchronous DNS requests, wrapping c-ares with Swift-friendly APIs and data structures.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 81.5%
  • C 12.0%
  • Shell 5.7%
  • Dockerfile 0.8%