Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 5 additions & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ jobs:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors"
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors"
linux_6_2_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -warnings-as-errors"
linux_nightly_next_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable -Xswiftc -warnings-as-errors"
linux_6_1_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable -Xswiftc -warnings-as-errors"
linux_6_2_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable -Xswiftc -warnings-as-errors"
linux_nightly_next_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -require-explicit-sendable"

benchmarks:
name: Benchmarks
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.10
// swift-tools-version:6.0

import PackageDescription

Expand Down
32 changes: 12 additions & 20 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.10
// swift-tools-version:6.0
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
Expand All @@ -17,21 +17,13 @@ import PackageDescription

let strictConcurrencyDevelopment = false

let strictConcurrencySettings: [SwiftSetting] = {
var initialSettings: [SwiftSetting] = []
initialSettings.append(contentsOf: [
.enableUpcomingFeature("StrictConcurrency"),
.enableUpcomingFeature("InferSendableFromCaptures"),
])
var swiftSettings: [SwiftSetting] = []

if strictConcurrencyDevelopment {
// -warnings-as-errors here is a workaround so that IDE-based development can
// get tripped up on -require-explicit-sendable.
initialSettings.append(.unsafeFlags(["-Xfrontend", "-require-explicit-sendable", "-warnings-as-errors"]))
}

return initialSettings
}()
if strictConcurrencyDevelopment {
// -warnings-as-errors here is a workaround so that IDE-based development can
// get tripped up on -require-explicit-sendable.
swiftSettings.append(.unsafeFlags(["-Xfrontend", "-require-explicit-sendable", "-warnings-as-errors"]))
}

let package = Package(
name: "swift-nio-ssh",
Expand Down Expand Up @@ -59,7 +51,7 @@ let package = Package(
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "Atomics", package: "swift-atomics"),
],
swiftSettings: strictConcurrencySettings
swiftSettings: swiftSettings
),
.executableTarget(
name: "NIOSSHClient",
Expand All @@ -69,7 +61,7 @@ let package = Package(
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
],
swiftSettings: strictConcurrencySettings
swiftSettings: swiftSettings
),
.executableTarget(
name: "NIOSSHServer",
Expand All @@ -80,7 +72,7 @@ let package = Package(
.product(name: "NIOFoundationCompat", package: "swift-nio"),
.product(name: "Crypto", package: "swift-crypto"),
],
swiftSettings: strictConcurrencySettings
swiftSettings: swiftSettings
),
.executableTarget(
name: "NIOSSHPerformanceTester",
Expand All @@ -90,7 +82,7 @@ let package = Package(
.product(name: "NIOEmbedded", package: "swift-nio"),
.product(name: "Crypto", package: "swift-crypto"),
],
swiftSettings: strictConcurrencySettings
swiftSettings: swiftSettings
),
.testTarget(
name: "NIOSSHTests",
Expand All @@ -100,7 +92,7 @@ let package = Package(
.product(name: "NIOEmbedded", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
],
swiftSettings: strictConcurrencySettings
swiftSettings: swiftSettings
),
]
)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ SwiftNIO SSH | Minimum Swift Version
`0.6.2 ..< 0.9.0` | 5.6
`0.9.0 ..< 0.9.2` | 5.8
`0.9.2 ..< 0.10.0` | 5.9
`0.10.0 ...` | 5.10
`0.10.0 ... 0.12.0` | 5.10
`0.12.0 ...` | 6.0

## What does SwiftNIO SSH support?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import NIOCore

protocol AcceptsUserAuthMessages {
protocol AcceptsUserAuthMessages: _NIOSSHSendableMetatype {
var userAuthStateMachine: UserAuthenticationStateMachine { get set }

var role: SSHConnectionRole { get }
Expand Down
7 changes: 4 additions & 3 deletions Sources/NIOSSH/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
public enum Constants: Sendable {
static let version = "SSH-2.0-SwiftNIOSSH_1.0"

public static let bundledTransportProtectionSchemes: [NIOSSHTransportProtection.Type] = [
AES256GCMOpenSSHTransportProtection.self, AES128GCMOpenSSHTransportProtection.self,
]
public static let bundledTransportProtectionSchemes: [(NIOSSHTransportProtection & _NIOSSHSendableMetatype).Type] =
[
AES256GCMOpenSSHTransportProtection.self, AES128GCMOpenSSHTransportProtection.self,
]
}
2 changes: 1 addition & 1 deletion Sources/NIOSSH/Key Exchange/EllipticCurveKeyExchange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Foundation

/// This protocol defines a container used by the key exchange state machine to manage key exchange.
/// This type erases the specific key exchanger.
protocol EllipticCurveKeyExchangeProtocol {
protocol EllipticCurveKeyExchangeProtocol: _NIOSSHSendableMetatype {
init(ourRole: SSHConnectionRole, previousSessionIdentifier: ByteBuffer?)

func initiateKeyExchangeClientSide(allocator: ByteBufferAllocator) -> SSHMessage.KeyExchangeECDHInitMessage
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOSSH/TransportProtection/AESGCM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ extension AESGCMTransportProtection: NIOSSHTransportProtection {
/// algorithm, and instead by ignoring the result of the MAC negotiation.
///
/// This algorithm does not encrypt the length field, instead encoding it as associated data.
final class AES128GCMOpenSSHTransportProtection: AESGCMTransportProtection {
final class AES128GCMOpenSSHTransportProtection: AESGCMTransportProtection, _NIOSSHSendableMetatype {
override static var cipherName: String {
"[email protected]"
}
Expand All @@ -182,7 +182,7 @@ final class AES128GCMOpenSSHTransportProtection: AESGCMTransportProtection {
/// algorithm, and instead by ignoring the result of the MAC negotiation.
///
/// This algorithm does not encrypt the length field, instead encoding it as associated data.
final class AES256GCMOpenSSHTransportProtection: AESGCMTransportProtection {
final class AES256GCMOpenSSHTransportProtection: AESGCMTransportProtection, _NIOSSHSendableMetatype {
override static var cipherName: String {
"[email protected]"
}
Expand Down
19 changes: 19 additions & 0 deletions Sources/NIOSSH/_NIOSSHSendableMetatype.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2019-2020 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

#if compiler(>=6.2)
public typealias _NIOSSHSendableMetatype = SendableMetatype
#else
public typealias _NIOSSHSendableMetatype = Any
#endif
Loading