mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-02-04 10:02:26 +08:00
chore: ClashProxyType ignore case
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import Cocoa
|
||||
import SwiftyJSON
|
||||
|
||||
enum ClashProxyType: String, Codable {
|
||||
enum ClashProxyType: String, Codable, CaseIterable {
|
||||
case urltest = "URLTest"
|
||||
case fallback = "Fallback"
|
||||
case loadBalance = "LoadBalance"
|
||||
@@ -27,13 +27,19 @@ enum ClashProxyType: String, Codable {
|
||||
|
||||
case vless = "Vless"
|
||||
case hysteria = "Hysteria"
|
||||
case wireguardMeta = "WireGuard"
|
||||
case wireguard = "Wireguard"
|
||||
case tuic = "Tuic"
|
||||
|
||||
case pass = "Pass"
|
||||
|
||||
case unknown = "Unknown"
|
||||
|
||||
init(from decoder: Decoder) throws {
|
||||
let container = try decoder.singleValueContainer()
|
||||
let rawString = try container.decode(String.self)
|
||||
|
||||
self = ClashProxyType.allCases.first(where: { $0.rawValue.caseInsensitiveCompare(rawString) == .orderedSame }) ?? .unknown
|
||||
}
|
||||
|
||||
static let proxyGroups: [ClashProxyType] = [.select, .urltest, .fallback, .loadBalance]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user