Show public key on interface. Do not generate public key on peer on generate. Add public key copy buttons.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jeroen Leenarts
2018-09-16 22:38:32 +02:00
parent c863adce85
commit 8326735fcb
4 changed files with 241 additions and 225 deletions
@@ -73,37 +73,39 @@ class InterfaceInfoTableViewCell: UITableViewCell {
didSet {
nameField.text = model.tunnel?.title
addressesField.text = model.addresses
privateKeyField.text = model.privateKey
listenPortField.text = String(model.listenPort)
dnsField.text = model.dns
mtuField.text = String(model.mtu)
publicKeyField.text = model.publicKey
}
}
@IBOutlet weak var nameField: UILabel!
@IBOutlet weak var addressesField: UILabel!
@IBOutlet weak var privateKeyField: UILabel!
@IBOutlet weak var listenPortField: UILabel!
@IBOutlet weak var dnsField: UILabel!
@IBOutlet weak var mtuField: UILabel!
@IBOutlet weak var publicKeyField: UILabel!
@IBAction func copyPublicKey(_ sender: Any) {
if let publicKey = model.publicKey {
UIPasteboard.general.string = publicKey
}
}
}
class PeerInfoTableViewCell: UITableViewCell {
var peer: Peer! {
didSet {
publicKeyField.text = peer.publicKey
preSharedKeyField.text = peer.presharedKey
allowedIpsField.text = peer.allowedIPs
endpointField.text = peer.endpoint
persistentKeepaliveField.text = String(peer.persistentKeepalive)
}
}
@IBOutlet weak var publicKeyField: UILabel!
@IBOutlet weak var preSharedKeyField: UILabel!
@IBOutlet weak var allowedIpsField: UILabel!
@IBOutlet weak var endpointField: UILabel!
@IBOutlet weak var persistentKeepaliveField: UILabel!
@IBAction func copyPublicKey(_ sender: Any) {
if let publicKey = peer.publicKey {
UIPasteboard.general.string = publicKey
}
}
}
extension TunnelInfoTableViewController: Identifyable {}