Files
networkcity/Sources/NetworkCityCore/ConnectionSource.swift
T

13 lines
573 B
Swift
Raw Normal View History

import Foundation
/// The seam between *where the bytes come from* and *the city that renders them*.
///
/// Phase 1 backs this with `NettopSource`. Phase 2 can swap in a libpcap-based
/// source anything that can emit `ConnectionSnapshot`s and the renderer is
/// none the wiser.
public protocol ConnectionSource: Sendable {
/// Emits a snapshot roughly every `interval` seconds until the stream is
/// cancelled (e.g. the consumer breaks out of its `for await` loop).
func snapshots(every interval: TimeInterval) -> AsyncStream<ConnectionSnapshot>
}