Add the ability to mark relays as broken
not currently used Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -19,10 +19,31 @@ struct RelayDescriptor: Codable {
|
||||
let info: RelayInfo
|
||||
}
|
||||
|
||||
struct Relay: Identifiable {
|
||||
enum RelayFlags: Int {
|
||||
case none = 0
|
||||
case broken = 1
|
||||
}
|
||||
|
||||
class Relay: Identifiable {
|
||||
let descriptor: RelayDescriptor
|
||||
let connection: RelayConnection
|
||||
|
||||
|
||||
var flags: Int
|
||||
|
||||
init(descriptor: RelayDescriptor, connection: RelayConnection) {
|
||||
self.flags = 0
|
||||
self.descriptor = descriptor
|
||||
self.connection = connection
|
||||
}
|
||||
|
||||
func mark_broken() {
|
||||
flags |= RelayFlags.broken.rawValue
|
||||
}
|
||||
|
||||
var is_broken: Bool {
|
||||
return (flags & RelayFlags.broken.rawValue) == RelayFlags.broken.rawValue
|
||||
}
|
||||
|
||||
var id: String {
|
||||
return get_relay_id(descriptor.url)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user