From b2f2756d9ca2b23b37f7c7147242a340bba04319 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Tue, 23 Oct 2018 15:51:19 +0530 Subject: Model: listenPort and persistentKeepAlive should be 16-bit integers Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/UI/TunnelViewModel.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'WireGuard/WireGuard/UI/TunnelViewModel.swift') diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift index 6b6285c..13c831f 100644 --- a/WireGuard/WireGuard/UI/TunnelViewModel.swift +++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift @@ -109,11 +109,11 @@ class TunnelViewModel { config.addresses = addresses } if let listenPortString = scratchpad[.listenPort] { - if let listenPort = UInt64(listenPortString) { + if let listenPort = UInt16(listenPortString) { config.listenPort = listenPort } else { fieldsWithError.insert(.listenPort) - errorMessages.append("Interface's listen port should be a number") + errorMessages.append("Interface's listen port should be a 16-bit integer (0 to 65535)") } } if let mtuString = scratchpad[.mtu] { @@ -231,11 +231,11 @@ class TunnelViewModel { } } if let persistentKeepAliveString = scratchpad[.persistentKeepAlive] { - if let persistentKeepAlive = UInt64(persistentKeepAliveString) { + if let persistentKeepAlive = UInt16(persistentKeepAliveString) { config.persistentKeepAlive = persistentKeepAlive } else { fieldsWithError.insert(.persistentKeepAlive) - errorMessages.append("Peer's persistent keepalive should be a number") + errorMessages.append("Peer's persistent keepalive should be a 16-bit integer (0 to 65535)") } } -- cgit v1.2.3-59-g8ed1b