Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bragelbytes committed Mar 22, 2024
2 parents d31bdc6 + 4c0f273 commit 032dce0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/ShadowSwift/Async/AsyncDarkstarCipher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class AsyncDarkstarCipher
let log: Logger
static let lengthSize = 2
static let tagSize = 16
static let maxPayloadSize = 16417
public static let maxPayloadSize = 16417
static let overhead = Cipher.lengthSize + Cipher.tagSize + Cipher.tagSize
static let maxRead = Cipher.maxPayloadSize + Cipher.overhead
static let minRead = 1 + Cipher.overhead
Expand Down
37 changes: 37 additions & 0 deletions Tests/ShadowSwiftTests/ShadowSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,43 @@ class ShadowSwiftTests: XCTestCase
wait(for: [connected], timeout: 3000)
}

func testShadowToEchoServer()
{
let message = "Hello".data
let logger = Logger(label: "ShadowToEcho")
let shadowClientConfigPath = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("ShadowClientConfig.json")

guard let shadowClientConfig = ShadowConfig.ShadowClientConfig(path: shadowClientConfigPath.path) else
{
XCTFail()
return
}

let shadowConnectionFactory = ShadowConnectionFactory(config: shadowClientConfig, logger: logger)

guard let shadowConnect = shadowConnectionFactory.connect(using: .tcp) else
{
XCTFail()
return
}

shadowConnect.send(content: message, contentContext: .defaultMessage, isComplete: true, completion: NWConnection.SendCompletion.contentProcessed(
{
(error) in

if let errorMessage = error
{
print("Error: \(errorMessage)")
XCTFail()
return
}
else
{
print("Send successful.")
}
}))
}

func testShadowSend() throws
{
let shadowQueue = DispatchQueue(label: "ShadowQueue")
Expand Down

0 comments on commit 032dce0

Please sign in to comment.