You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
864 B
39 lines
864 B
/// Represents a Nostr relay connection.
|
|
class NostrRelay {
|
|
/// Relay URL (e.g., 'wss://relay.example.com').
|
|
final String url;
|
|
|
|
/// Whether the relay is currently connected.
|
|
bool isConnected;
|
|
|
|
/// Whether the relay is enabled (should be used).
|
|
bool isEnabled;
|
|
|
|
/// Creates a [NostrRelay] instance.
|
|
NostrRelay({
|
|
required this.url,
|
|
this.isConnected = false,
|
|
this.isEnabled = true,
|
|
});
|
|
|
|
/// Creates a [NostrRelay] from a URL string.
|
|
factory NostrRelay.fromUrl(String url) {
|
|
return NostrRelay(url: url);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'NostrRelay(url: $url, connected: $isConnected, enabled: $isEnabled)';
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
return other is NostrRelay && other.url == url;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => url.hashCode;
|
|
}
|
|
|