Parse MTU from --tun-mtu

This commit is contained in:
Davide De Rosa 2020-12-27 23:40:20 +01:00
parent 6cb04da05d
commit 1966143fe9
2 changed files with 15 additions and 0 deletions

View File

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- Parse `--tun-mtu` option.
### Changed
- Update API to access current Wi-Fi SSID.

View File

@ -72,6 +72,8 @@ extension OpenVPN {
static let remoteRandom = NSRegularExpression("^remote-random")
static let mtu = NSRegularExpression("^tun-mtu +\\d+")
// MARK: Server
static let authToken = NSRegularExpression("^auth-token +[a-zA-Z0-9/=+]+")
@ -216,6 +218,7 @@ extension OpenVPN {
var optRemotes: [(String, UInt16?, SocketType?)] = [] // address, port, socket
var optChecksEKU: Bool?
var optRandomizeEndpoint: Bool?
var optMTU: Int?
//
var optAuthToken: String?
var optPeerId: UInt32?
@ -468,6 +471,13 @@ extension OpenVPN {
isHandled = true
optRandomizeEndpoint = true
}
Regex.mtu.enumerateArguments(in: line) {
isHandled = true
guard let str = $0.first else {
return
}
optMTU = Int(str)
}
// MARK: Server
@ -677,6 +687,7 @@ extension OpenVPN {
sessionBuilder.checksEKU = optChecksEKU
sessionBuilder.randomizeEndpoint = optRandomizeEndpoint
sessionBuilder.mtu = optMTU
// MARK: Server