Skip to content

Commit 9da59a0

Browse files
committed
update VPN protocol version; fmt & lint
1 parent fdcf9c3 commit 9da59a0

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Coder-Desktop/VPNLib/Speaker.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ public actor Speaker<SendMsg: RPCMessage & Message, RecvMsg: RPCMessage & Messag
8989
/// Does the VPN Protocol handshake and validates the result
9090
public func handshake() async throws(HandshakeError) {
9191
let hndsh = Handshaker(writeFD: writeFD, dispatch: dispatch, queue: queue, role: role)
92-
// ignore the version for now because we know it can only be 1.0
92+
// ignore the version for now because we know it can only be 1.0 or 1.1.
93+
// 1.1 adds support for telemetry to StartRequest, but since setting these
94+
// fields won't adversely affect a 1.0 speaker, we set them regardless.
9395
try _ = await hndsh.handshake()
9496
}
9597

@@ -178,7 +180,7 @@ actor Handshaker {
178180

179181
init(writeFD: FileHandle, dispatch: DispatchIO, queue: DispatchQueue,
180182
role: ProtoRole,
181-
versions: [ProtoVersion] = [.init(1, 0)])
183+
versions: [ProtoVersion] = [.init(1, 1)])
182184
{
183185
self.writeFD = writeFD
184186
self.dispatch = dispatch

Coder-Desktop/VPNLib/TelemetryEnricher.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public struct TelemetryEnricher {
2323
var req = original
2424
req.deviceOs = "macOS"
2525
req.deviceID = deviceID
26-
if version != nil {
27-
req.coderDesktopVersion = version!
26+
if let version {
27+
req.coderDesktopVersion = version
2828
}
2929
return req
3030
}

Coder-Desktop/VPNLibTests/SpeakerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct SpeakerTests: Sendable {
3636
@Test func handshake() async throws {
3737
async let v = handshaker.handshake()
3838
try await uut.handshake()
39-
#expect(try await v == ProtoVersion(1, 0))
39+
#expect(try await v == ProtoVersion(1, 1))
4040
}
4141

4242
@Test func handleSingleMessage() async throws {

Coder-Desktop/VPNLibTests/TelemetryEnricherTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct TelemetryEnricherTests {
1616
#expect(try enriched.coderDesktopVersion.contains(Regex(#"^\d+\.\d+\.\d+$"#)))
1717
let deviceID = enriched.deviceID
1818
#expect(!deviceID.isEmpty)
19-
19+
2020
// check we get the same deviceID from a new enricher
2121
let enricher1 = TelemetryEnricher()
2222
enriched = enricher1.enrich(original)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy