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: 27 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 (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-26T16:05:54.000Z (3 months ago)
- Last Synced: 2024-09-29T21:41:22.505Z (about 1 month ago)
- Language: Swift
- Homepage:
- Size: 94.7 KB
- Stars: 91
- Watchers: 14
- Forks: 16
- Open Issues: 13
-
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
...
```