DNSAddr Protocol Address / Name Resolution
dnsaddr is a protocol that instructs the resolver to lookup multiaddr(s) in DNS TXT records for the domain name in it's value section.
This package add the ability to resolves multiaddr's of the form
Multiaddr("/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa")
- This package uses the
dnssd
library and doesn't work on Linux at the moment.
Include the following dependency in your Package.swift file
let package = Package(
...
dependencies: [
...
.package(url: "https://github.com/swift-libp2p/swift-libp2p-dnsaddr.git", .upToNextMajor(from: "0.0.1"))
],
...
.target(
...
dependencies: [
...
.product(name: "LibP2PDNSAddr", package: "swift-libp2p-dnsaddr"),
]),
...
)
import LibP2PDNSAddr
/// Add the resolver to the applications resolver list.
app.resolvers.use(.dnsaddr)
/// From here on, when the application encounters a dnsaddr address it will use this package to attempt to resolve it.
N/A
N/A
Contributions are welcomed! This code is very much a proof of concept. I can guarantee you there's a better / safer way to accomplish the same results. Any suggestions, improvements, or even just critques, are welcome!
Let's make this code better together! 🤝
MIT © 2022 Breth Inc.