2018-10-27 12:22:20 +08:00
|
|
|
//
|
|
|
|
// ClashRule.swift
|
|
|
|
// ClashX
|
|
|
|
//
|
|
|
|
// Created by CYC on 2018/10/27.
|
|
|
|
// Copyright © 2018 west2online. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2019-10-20 13:40:50 +08:00
|
|
|
class ClashRule: Codable {
|
|
|
|
let type: String
|
|
|
|
let payload: String?
|
|
|
|
let proxy: String?
|
2018-10-27 12:22:20 +08:00
|
|
|
}
|
|
|
|
|
2019-10-20 13:40:50 +08:00
|
|
|
class ClashRuleResponse: Codable {
|
|
|
|
var rules: [ClashRule]? = nil
|
|
|
|
|
2019-02-13 23:16:19 +08:00
|
|
|
static func empty() -> ClashRuleResponse {
|
|
|
|
return ClashRuleResponse()
|
|
|
|
}
|
2019-10-20 13:40:50 +08:00
|
|
|
|
|
|
|
static func fromData(_ data: Data) -> ClashRuleResponse {
|
2018-10-27 12:22:20 +08:00
|
|
|
let decoder = JSONDecoder()
|
|
|
|
let model = try? decoder.decode(ClashRuleResponse.self, from: data)
|
2019-02-13 23:16:19 +08:00
|
|
|
return model ?? ClashRuleResponse.empty()
|
2018-10-27 12:22:20 +08:00
|
|
|
}
|
|
|
|
}
|