Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apple/swift-async-dns-resolver
A Swift library for asynchronous DNS requests, wrapping c-ares with Swift-friendly APIs and data structures.
https://github.com/apple/swift-async-dns-resolver
Last synced: 4 days ago
JSON representation
A Swift library for asynchronous DNS requests, wrapping c-ares with Swift-friendly APIs and data structures.
- Host: GitHub
- URL: https://github.com/apple/swift-async-dns-resolver
- Owner: apple
- License: apache-2.0
- Created: 2020-08-20T21:25:07.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-31T13:26:28.000Z (21 days ago)
- Last Synced: 2025-02-10T22:18:36.249Z (11 days ago)
- Language: Swift
- Homepage:
- Size: 125 KB
- Stars: 111
- Watchers: 22
- Forks: 22
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Swift Asynchronous DNS Resolver
A Swift library for asynchronous DNS queries.
## Overview
This library wraps around the [dnssd](https://developer.apple.com/documentation/dnssd) framework and
the [c-ares](https://github.com/c-ares/c-ares) C library with Swift-friendly APIs and data structures.## Usage
Add the package dependency in your `Package.swift`:
```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:
```swift
.target(name: "MyTarget", dependencies: [
.product(name: "AsyncDNSResolver", package: "swift-async-dns-resolver"),
],
```### Using the resolver
```swift
// import the package
import AsyncDNSResolver// Initialize a resolver
let resolver = try AsyncDNSResolver()// Run a query
let aRecords = try await resolver.queryA(name: "apple.com")// Process the `ARecord`s
...
```