diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-12-21 15:16:09 -0600 |
---|---|---|
committer | Eric Kuck <eric@bluelinelabs.com> | 2018-12-21 16:32:08 -0600 |
commit | 1fecd8eb6c5c2327d4bfd5044876be12876fc7e5 (patch) | |
tree | 45c7f4c552eb01bd15c54e58615c9122acc99e83 /WireGuard/Shared/Model/PeerConfiguration.swift | |
parent | Do not require NetworkExtension to know its own name (diff) | |
download | wireguard-apple-1fecd8eb6c5c2327d4bfd5044876be12876fc7e5.tar.xz wireguard-apple-1fecd8eb6c5c2327d4bfd5044876be12876fc7e5.zip |
providerConfiguration is now a WgQuickConfig
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'WireGuard/Shared/Model/PeerConfiguration.swift')
-rw-r--r-- | WireGuard/Shared/Model/PeerConfiguration.swift | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/WireGuard/Shared/Model/PeerConfiguration.swift b/WireGuard/Shared/Model/PeerConfiguration.swift index 0fad842..a113821 100644 --- a/WireGuard/Shared/Model/PeerConfiguration.swift +++ b/WireGuard/Shared/Model/PeerConfiguration.swift @@ -25,42 +25,3 @@ struct PeerConfiguration { } } } - -extension PeerConfiguration: Codable { - enum CodingKeys: String, CodingKey { - case publicKey = "PublicKey" - case preSharedKey = "PreSharedKey" - case allowedIPs = "AllowedIPs" - case endpoint = "Endpoint" - case persistentKeepAlive = "PersistentKeepAlive" - } - - init(from decoder: Decoder) throws { - let values = try decoder.container(keyedBy: CodingKeys.self) - publicKey = try Data(base64Encoded: values.decode(String.self, forKey: .publicKey))! - if let base64PreSharedKey = try? values.decode(Data.self, forKey: .preSharedKey) { - preSharedKey = Data(base64Encoded: base64PreSharedKey) - } else { - preSharedKey = nil - } - allowedIPs = try values.decode([IPAddressRange].self, forKey: .allowedIPs) - endpoint = try? values.decode(Endpoint.self, forKey: .endpoint) - persistentKeepAlive = try? values.decode(UInt16.self, forKey: .persistentKeepAlive) - } - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(publicKey.base64EncodedString(), forKey: .publicKey) - if let preSharedKey = preSharedKey { - try container.encode(preSharedKey.base64EncodedString(), forKey: .preSharedKey) - } - - try container.encode(allowedIPs, forKey: .allowedIPs) - if let endpoint = endpoint { - try container.encode(endpoint, forKey: .endpoint) - } - if let persistentKeepAlive = persistentKeepAlive { - try container.encode(persistentKeepAlive, forKey: .persistentKeepAlive) - } - } -} |