2018-08-23 08:19:25 +00:00
|
|
|
//
|
|
|
|
// LinkInterface+Strategy.swift
|
2018-08-23 10:07:55 +00:00
|
|
|
// TunnelKit
|
2018-08-23 08:19:25 +00:00
|
|
|
//
|
|
|
|
// Created by Davide De Rosa on 6/28/18.
|
|
|
|
// Copyright © 2018 London Trust Media. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
extension LinkInterface {
|
|
|
|
func hardReset(with encryption: SessionProxy.EncryptionParameters) -> Data? {
|
|
|
|
switch communicationType {
|
|
|
|
case .pia:
|
|
|
|
guard let caDigest = encryption.caDigest else {
|
|
|
|
fatalError("PIA communication requires CA MD5 digest")
|
|
|
|
}
|
|
|
|
let settings = TunnelSettings(
|
|
|
|
caMd5Digest: caDigest,
|
|
|
|
cipherName: encryption.cipherName,
|
|
|
|
digestName: encryption.digestName
|
|
|
|
)
|
|
|
|
return (try? settings.encodedData()) ?? Data()
|
|
|
|
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|