aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/TunnelViewModel.swift18
-rw-r--r--WireGuard/WireGuard/UI/macOS/ParseError+WireGuardAppError.swift4
2 files changed, 22 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift
index 07d1bac..9124a00 100644
--- a/WireGuard/WireGuard/UI/TunnelViewModel.swift
+++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift
@@ -40,6 +40,9 @@ class TunnelViewModel {
case endpoint
case persistentKeepAlive
case allowedIPs
+ case rxBytes
+ case txBytes
+ case lastHandshakeTime
case excludePrivateIPs
case deletePeer
@@ -50,6 +53,9 @@ class TunnelViewModel {
case .endpoint: return tr("tunnelPeerEndpoint")
case .persistentKeepAlive: return tr("tunnelPeerPersistentKeepalive")
case .allowedIPs: return tr("tunnelPeerAllowedIPs")
+ case .rxBytes: return tr("tunnelPeerRxBytes")
+ case .txBytes: return tr("tunnelPeerTxBytes")
+ case .lastHandshakeTime: return tr("tunnelPeerLastHandshakeTime")
case .excludePrivateIPs: return tr("tunnelPeerExcludePrivateIPs")
case .deletePeer: return tr("deletePeerButtonTitle")
}
@@ -248,6 +254,18 @@ class TunnelViewModel {
if let persistentKeepAlive = config.persistentKeepAlive {
scratchpad[.persistentKeepAlive] = String(persistentKeepAlive)
}
+ // TODO(roopc): These next 3 fields should be prettier
+ // - bytes() in https://git.zx2c4.com/WireGuard/tree/src/tools/show.c#n185
+ // - ago() in https://git.zx2c4.com/WireGuard/tree/src/tools/show.c#n158
+ if let rxBytes = config.rxBytes {
+ scratchpad[.rxBytes] = String(rxBytes)
+ }
+ if let txBytes = config.txBytes {
+ scratchpad[.txBytes] = String(txBytes)
+ }
+ if let lastHandshakeTime = config.lastHandshakeTime {
+ scratchpad[.lastHandshakeTime] = lastHandshakeTime.description
+ }
updateExcludePrivateIPsFieldState()
}
diff --git a/WireGuard/WireGuard/UI/macOS/ParseError+WireGuardAppError.swift b/WireGuard/WireGuard/UI/macOS/ParseError+WireGuardAppError.swift
index 9f2c009..6afbadb 100644
--- a/WireGuard/WireGuard/UI/macOS/ParseError+WireGuardAppError.swift
+++ b/WireGuard/WireGuard/UI/macOS/ParseError+WireGuardAppError.swift
@@ -43,6 +43,10 @@ extension TunnelConfiguration.ParseError: WireGuardAppError {
return (tr(format: "macAlertPersistentKeepliveInvalid (%@)", value), tr("alertInvalidPeerMessagePersistentKeepaliveInvalid"))
case .peerHasUnrecognizedKey(let value):
return (tr(format: "macAlertUnrecognizedPeerKey (%@)", value), tr("macAlertInfoUnrecognizedPeerKey"))
+ case .peerHasInvalidTransferBytes(let line):
+ return (tr(format: "macAlertInvalidLine (%@)", String(line)), "")
+ case .peerHasInvalidLastHandshakeTime(let line):
+ return (tr(format: "macAlertInvalidLine (%@)", String(line)), "")
case .multiplePeersWithSamePublicKey:
return (tr("alertInvalidPeerMessagePublicKeyDuplicated"), "")
case .multipleEntriesForKey(let value):