tools: Network Quality and STUN
This commit is contained in:
@@ -66,6 +66,7 @@ public class CommandClient: ObservableObject {
|
||||
case log
|
||||
case clashMode
|
||||
case connections
|
||||
case outbounds
|
||||
}
|
||||
|
||||
private let connectionTypes: [ConnectionType]
|
||||
@@ -88,6 +89,7 @@ public class CommandClient: ObservableObject {
|
||||
}
|
||||
|
||||
@Published public var groups: [LibboxOutboundGroup]?
|
||||
@Published public var outbounds: [LibboxOutboundGroupItem]?
|
||||
@Published public var logList: [LogEntry]
|
||||
@Published public var defaultLogLevel = 0
|
||||
@Published public var selectedLogLevel: Int?
|
||||
@@ -246,6 +248,8 @@ public class CommandClient: ObservableObject {
|
||||
clientOptions.addCommand(LibboxCommandClashMode)
|
||||
case .connections:
|
||||
clientOptions.addCommand(LibboxCommandConnections)
|
||||
case .outbounds:
|
||||
clientOptions.addCommand(LibboxCommandOutbounds)
|
||||
}
|
||||
}
|
||||
clientOptions.statusInterval = Int64(NSEC_PER_SEC)
|
||||
@@ -384,6 +388,19 @@ public class CommandClient: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
func writeOutbounds(_ message: (any LibboxOutboundGroupItemIteratorProtocol)?) {
|
||||
guard let message else { return }
|
||||
guard isActiveConnection() else { return }
|
||||
var newOutbounds: [LibboxOutboundGroupItem] = []
|
||||
while message.hasNext() {
|
||||
newOutbounds.append(message.next()!)
|
||||
}
|
||||
DispatchQueue.main.async { [self] in
|
||||
guard isActiveConnection() else { return }
|
||||
commandClient.outbounds = newOutbounds
|
||||
}
|
||||
}
|
||||
|
||||
func initializeClashMode(_ modeList: LibboxStringIteratorProtocol?, currentMode: String?) {
|
||||
DispatchQueue.main.async { [self] in
|
||||
guard isActiveConnection() else { return }
|
||||
|
||||
@@ -48,6 +48,15 @@ public struct OutboundGroupItem: Codable, Hashable {
|
||||
self.urlTestDelay = urlTestDelay
|
||||
}
|
||||
|
||||
public init(_ item: LibboxOutboundGroupItem) {
|
||||
self.init(
|
||||
tag: item.tag,
|
||||
type: item.type,
|
||||
urlTestTime: Date(timeIntervalSince1970: Double(item.urlTestTime)),
|
||||
urlTestDelay: UInt16(item.urlTestDelay)
|
||||
)
|
||||
}
|
||||
|
||||
public var displayType: String {
|
||||
LibboxProxyDisplayType(type)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user