diff --git a/TunnelKit/Sources/Core/SessionProxy+PushReply.swift b/TunnelKit/Sources/Core/SessionProxy+PushReply.swift index af2282d..1b81f25 100644 --- a/TunnelKit/Sources/Core/SessionProxy+PushReply.swift +++ b/TunnelKit/Sources/Core/SessionProxy+PushReply.swift @@ -179,9 +179,9 @@ extension SessionProxy { case subnet } + private static let prefix = "PUSH_REPLY," + private struct Regex { - static let prefix = "PUSH_REPLY," - static let topology = NSRegularExpression("topology (net30|p2p|subnet)") static let ifconfig = NSRegularExpression("ifconfig [\\d\\.]+ [\\d\\.]+") @@ -228,11 +228,13 @@ extension SessionProxy { let cipher: SessionProxy.Cipher? init?(message: String) throws { - guard message.hasPrefix(Regex.prefix) else { + guard message.hasPrefix(PushReply.prefix) else { return nil } - let prefixOffset = message.index(message.startIndex, offsetBy: Regex.prefix.count) - original = String(message[prefixOffset..