providerConfiguration is now a WgQuickConfig
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
This commit is contained in:
@@ -12,30 +12,6 @@ struct DNSServer {
|
||||
}
|
||||
}
|
||||
|
||||
extension DNSServer: Codable {
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
try container.encode(stringRepresentation)
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let values = try decoder.singleValueContainer()
|
||||
let addressString = try values.decode(String.self)
|
||||
|
||||
if let address = IPv4Address(addressString) {
|
||||
self.address = address
|
||||
} else if let address = IPv6Address(addressString) {
|
||||
self.address = address
|
||||
} else {
|
||||
throw DecodingError.invalidData
|
||||
}
|
||||
}
|
||||
|
||||
enum DecodingError: Error {
|
||||
case invalidData
|
||||
}
|
||||
}
|
||||
|
||||
extension DNSServer {
|
||||
var stringRepresentation: String {
|
||||
return "\(address)"
|
||||
|
||||
Reference in New Issue
Block a user