Swiftpack.co -  riley-williams/PiholeNetworking as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Networking library for interfacing with Pi-hole instances
.package(url: "https://github.com/riley-williams/PiholeNetworking.git", from: "2.0.0")


Swift codecov

Open source networking library for interacting with Pi-hole DNS blocker instances

If you'd rather use Combine, check out version 1.0.0

Getting Started

// Add PHInstance conformance to your existing Pi-hole model type

struct MyPiholeModel {
    var ip: String
    var port: Int
    var password: String?

extension MyPiholeModel: PHInstance { }
// Create a shared provider object and a model instance

let provider = PHProvider()

var pihole = MyPiholeModel(ip: "", port: 80, password: nil)
// Make a request

let summary = try await provider.getSummary(pihole)
print("Queries today: \(summary.queryCount)")
print("Queries blocked today: \(summary.blockedQueryCount)")

// Queries today: 49216
// Queries blocked today: 3872
// Many queries require authentication
pihole.password = "MyWebPassword"

// Disable the Pi-hole for 15 seconds
let state = try await provider.disable(pihole, for: 15)

print("Pi-hole is now \(state)")

// Pi-hole is now disabled


Stars: 0
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

4 weeks ago

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