Merge pull request #1 from keeshux/ovpn-parsing-errors

.ovpn parsing errors
This commit is contained in:
Davide De Rosa 2018-10-18 00:14:13 +02:00 committed by GitHub
commit 684480c826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View File

@ -42,7 +42,7 @@
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>LSSupportsOpeningDocumentsInPlace</key> <key>LSSupportsOpeningDocumentsInPlace</key>
<true/> <false/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>

View File

@ -31,31 +31,31 @@ private let log = SwiftyBeaver.self
extension TunnelKitProvider.Configuration { extension TunnelKitProvider.Configuration {
private struct Regex { private struct Regex {
static let proto = Utils.regex("proto +(udp6?|tcp6?)") static let proto = Utils.regex("^proto +(udp6?|tcp6?)")
static let port = Utils.regex("port +\\d+") static let port = Utils.regex("^port +\\d+")
static let remote = Utils.regex("remote +[^ ]+( +\\d+)?( +(udp6?|tcp6?))?") static let remote = Utils.regex("^remote +[^ ]+( +\\d+)?( +(udp6?|tcp6?))?")
static let cipher = Utils.regex("cipher +[\\w\\-]+") static let cipher = Utils.regex("^cipher +[\\w\\-]+")
static let auth = Utils.regex("auth +[\\w\\-]+") static let auth = Utils.regex("^auth +[\\w\\-]+")
static let compLZO = Utils.regex("comp-lzo") static let compLZO = Utils.regex("^comp-lzo")
static let compress = Utils.regex("compress") static let compress = Utils.regex("^compress")
static let ping = Utils.regex("ping +\\d+") static let ping = Utils.regex("^ping +\\d+")
static let renegSec = Utils.regex("reneg-sec +\\d+") static let renegSec = Utils.regex("^reneg-sec +\\d+")
static let fragment = Utils.regex("fragment +\\d+") static let fragment = Utils.regex("^fragment +\\d+")
static let keyDirection = Utils.regex("key-direction +\\d") static let keyDirection = Utils.regex("^key-direction +\\d")
static let blockBegin = Utils.regex("<[\\w\\-]+>") static let blockBegin = Utils.regex("^<[\\w\\-]+>")
static let blockEnd = Utils.regex("<\\/[\\w\\-]+>") static let blockEnd = Utils.regex("^<\\/[\\w\\-]+>")
} }
static func parsed(from url: URL) throws -> (String, TunnelKitProvider.Configuration) { static func parsed(from url: URL) throws -> (String, TunnelKitProvider.Configuration) {