aboutsummaryrefslogtreecommitdiffstats
path: root/Shared/ExtensionMessage.swift
diff options
context:
space:
mode:
authorJeroen Leenarts <jeroen.leenarts@gmail.com>2018-09-26 11:26:52 +0200
committerJeroen Leenarts <jeroen.leenarts@gmail.com>2018-09-26 11:26:52 +0200
commit18d82d07af9b8b40aff2cad0acb9f249f1dbf6ca (patch)
treedb1f1dd8737bd9721e1c23556562974bb6fd4b9b /Shared/ExtensionMessage.swift
parentFixe base 64 regex format. (diff)
downloadwireguard-apple-18d82d07af9b8b40aff2cad0acb9f249f1dbf6ca.tar.xz
wireguard-apple-18d82d07af9b8b40aff2cad0acb9f249f1dbf6ca.zip
Use message to extension to obtain version info.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'Shared/ExtensionMessage.swift')
-rw-r--r--Shared/ExtensionMessage.swift25
1 files changed, 25 insertions, 0 deletions
diff --git a/Shared/ExtensionMessage.swift b/Shared/ExtensionMessage.swift
new file mode 100644
index 00000000..beba65f0
--- /dev/null
+++ b/Shared/ExtensionMessage.swift
@@ -0,0 +1,25 @@
+//
+// Copyright © 2018 WireGuard LLC. All rights reserved.
+//
+
+import Foundation
+
+public class ExtensionMessage: Equatable {
+
+ public static let requestVersion = ExtensionMessage(0xff)
+
+ public let data: Data
+
+ private init(_ byte: UInt8) {
+ data = Data(bytes: [byte])
+ }
+
+ init(_ data: Data) {
+ self.data = data
+ }
+
+ // MARK: Equatable
+ public static func ==(lhs: ExtensionMessage, rhs: ExtensionMessage) -> Bool {
+ return (lhs.data == rhs.data)
+ }
+}