Swiftpack.co - swift-libp2p/swift-libp2p-dnsaddr as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by swift-libp2p.
swift-libp2p/swift-libp2p-dnsaddr 0.0.2
DNSAddr Name Resolution
⭐️ 0
🕓 1 week ago
iOS macOS
.package(url: "https://github.com/swift-libp2p/swift-libp2p-dnsaddr.git", from: "0.0.2")

LibP2PDNSAddr

Swift Package Manager compatible Build & Test (macos)

DNSAddr Protocol Address / Name Resolution

Table of Contents

Overview

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")

Heads up ‼️

  • This package uses the dnssd library and doesn't work on Linux at the moment.

For more details see

Install

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"),
            ]),
    ...
)

Usage

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.

Example


N/A

API


N/A

Contributing

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! 🤝

Credits

License

MIT © 2022 Breth Inc.

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics