Make RelayPool private to NostrNetworkManager and migrate usages

Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
Daniel D’Aquino
2025-08-15 17:01:26 -07:00
parent 719a0c8cb0
commit 578d47356d
45 changed files with 852 additions and 892 deletions

View File

@@ -19,6 +19,11 @@ struct QueuedRequest {
let skip_ephemeral: Bool
}
struct SeenEvent: Hashable {
let relay_id: RelayURL
let evid: NoteId
}
/// Establishes and manages connections and subscriptions to a list of relays.
class RelayPool {
private(set) var relays: [Relay] = []
@@ -31,6 +36,8 @@ class RelayPool {
var keypair: Keypair?
var message_received_function: (((String, RelayDescriptor)) -> Void)?
var message_sent_function: (((String, Relay)) -> Void)?
var delegate: Delegate?
private(set) var signal: SignalModel = SignalModel()
private let network_monitor = NWPathMonitor()
private let network_monitor_queue = DispatchQueue(label: "io.damus.network_monitor")
@@ -410,3 +417,10 @@ func add_rw_relay(_ pool: RelayPool, _ url: RelayURL) {
}
extension RelayPool {
protocol Delegate {
func latestRelayListChanged(_ newEvent: NdbNote)
}
}

View File

@@ -7,7 +7,7 @@
import Foundation
public struct RelayURL: Hashable, Equatable, Codable, CodingKeyRepresentable, Identifiable, Comparable, CustomStringConvertible {
public struct RelayURL: Hashable, Equatable, Codable, CodingKeyRepresentable, Identifiable, Comparable, CustomStringConvertible, Sendable {
private(set) var url: URL
public var id: URL {