Simplified the catching of URLError.cancelled in probeHTTPS.
Provides a way to scan a specific network or the local networks for hosts which satisfy an arbitrary condition.
The API and implementation use Swift Structured Concurrency (await/async, Task, etc).
For example, to find all HTTPS servers on the local network that respond successfully to a request for their main page:
import Foundation import NetworkScanner let scanner = NetworkScanner(concurrencyLimit: 250) { address in guard let URL = URL(string: "https://\(address)") else { throw Errors.unableToConstructURL(address: address) } do { _ = try await session.data(from: URL) return .hit } catch { return .miss } } for try await result in scanner { print(result) // e.g. "192.168.0.10: Hit" } enum Errors: Error { case unableToConstructURL(address: String) }
See the documentation for more details, as well as the included demo application for more probe examples.
NetworkScanner
Provides a way to scan a specific network or the local networks for hosts which satisfy an arbitrary condition.
The API and implementation use Swift Structured Concurrency (await/async, Task, etc).
For example, to find all HTTPS servers on the local network that respond successfully to a request for their main page:
See the documentation for more details, as well as the included demo application for more probe examples.