Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "Swift",
"image": "swift:6.0",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/go:1": {}
},
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"lldb.library": "/usr/lib/liblldb.so"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"sswg.swift-lang"
]
}
},
"postCreateCommand": "sudo apt-get update && sudo apt-get install libsodium-dev -y",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.4.2"),
.package(url: "https://github.com/nats-io/nkeys.swift.git", from: "0.1.2"),
.package(url: "https://github.com/nats-io/nkeys.swift.git", from: "0.2.0"),
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.0.0"),
.package(url: "https://github.com/Jarema/swift-nuid.git", from: "0.2.0"),
.package(url: "https://github.com/Jarema/swift-nuid.git", from: "0.3.0"),
.package(url: "https://github.com/apple/swift-crypto.git", "1.0.0" ..< "4.0.0"),
],
targets: [
.target(
Expand All @@ -38,6 +39,7 @@ let package = Package(
dependencies: [
"Nats",
.product(name: "Logging", package: "swift-log"),
.product(name: "Crypto", package: "swift-crypto", condition: .when(platforms: [.linux])),
]),
.target(
name: "NatsServer",
Expand Down
2 changes: 1 addition & 1 deletion Sources/BenchmarkPubSub/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ try await withThrowingTaskGroup(of: Void.self) { group in
hm.append(try! NatsHeaderName("foo"), NatsHeaderValue("baz"))
hm.insert(try! NatsHeaderName("another"), NatsHeaderValue("one"))
var i = 0
for try await msg in sub {
for try await msg in await sub {
let payload = msg.payload!
if String(data: payload, encoding: .utf8) != "\(i)" {
let emptyString = ""
Expand Down
7 changes: 6 additions & 1 deletion Sources/JetStream/Consumer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import CryptoKit
import Foundation
import Nuid

#if canImport(CryptoKit)
import CryptoKit
#else
import Crypto
#endif

public class Consumer {

private static var rdigits: [UInt8] = Array(
Expand Down
2 changes: 1 addition & 1 deletion Sources/JetStream/JetStreamContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Combine
// import Combine
import Foundation
import Nats
import Nuid
Expand Down
4 changes: 4 additions & 0 deletions Sources/Nats/NatsConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import NIOSSL
import NIOWebSocket
import NKeys

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

class ConnectionHandler: ChannelInboundHandler {
let lang = "Swift"
let version = "0.0.1"
Expand Down
4 changes: 4 additions & 0 deletions Tests/NatsTests/Unit/JwtTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ import XCTest

@testable import Nats

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

class JwtTests: XCTestCase {

static var allTests = [
Expand Down