Model: listenPort and persistentKeepAlive should be 16-bit integers
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
@@ -22,7 +22,7 @@ struct InterfaceConfiguration: Codable {
|
|||||||
var name: String
|
var name: String
|
||||||
var privateKey: Data
|
var privateKey: Data
|
||||||
var addresses: [IPAddressRange] = []
|
var addresses: [IPAddressRange] = []
|
||||||
var listenPort: UInt64? = nil
|
var listenPort: UInt16? = nil
|
||||||
var mtu: UInt64? = nil
|
var mtu: UInt64? = nil
|
||||||
var dns: String? = nil
|
var dns: String? = nil
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ struct PeerConfiguration: Codable {
|
|||||||
}
|
}
|
||||||
var allowedIPs: [IPAddressRange] = []
|
var allowedIPs: [IPAddressRange] = []
|
||||||
var endpoint: Endpoint?
|
var endpoint: Endpoint?
|
||||||
var persistentKeepAlive: UInt64?
|
var persistentKeepAlive: UInt16?
|
||||||
|
|
||||||
init(publicKey: Data) {
|
init(publicKey: Data) {
|
||||||
self.publicKey = publicKey
|
self.publicKey = publicKey
|
||||||
|
|||||||
@@ -109,11 +109,11 @@ class TunnelViewModel {
|
|||||||
config.addresses = addresses
|
config.addresses = addresses
|
||||||
}
|
}
|
||||||
if let listenPortString = scratchpad[.listenPort] {
|
if let listenPortString = scratchpad[.listenPort] {
|
||||||
if let listenPort = UInt64(listenPortString) {
|
if let listenPort = UInt16(listenPortString) {
|
||||||
config.listenPort = listenPort
|
config.listenPort = listenPort
|
||||||
} else {
|
} else {
|
||||||
fieldsWithError.insert(.listenPort)
|
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] {
|
if let mtuString = scratchpad[.mtu] {
|
||||||
@@ -231,11 +231,11 @@ class TunnelViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let persistentKeepAliveString = scratchpad[.persistentKeepAlive] {
|
if let persistentKeepAliveString = scratchpad[.persistentKeepAlive] {
|
||||||
if let persistentKeepAlive = UInt64(persistentKeepAliveString) {
|
if let persistentKeepAlive = UInt16(persistentKeepAliveString) {
|
||||||
config.persistentKeepAlive = persistentKeepAlive
|
config.persistentKeepAlive = persistentKeepAlive
|
||||||
} else {
|
} else {
|
||||||
fieldsWithError.insert(.persistentKeepAlive)
|
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)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user