|
|
@@ -21,6 +21,7 @@ import NIOHTTP2
|
|
|
import NIOPosix
|
|
|
|
|
|
@_spi(Package)
|
|
|
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
extension HTTP2Connector where Self == ThrowingConnector {
|
|
|
/// A connector which throws the given error on a connect attempt.
|
|
|
static func throwing(_ error: RPCError) -> Self {
|
|
|
@@ -29,6 +30,7 @@ extension HTTP2Connector where Self == ThrowingConnector {
|
|
|
}
|
|
|
|
|
|
@_spi(Package)
|
|
|
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
extension HTTP2Connector where Self == NeverConnector {
|
|
|
/// A connector which fatal errors if a connect attempt is made.
|
|
|
static var never: Self {
|
|
|
@@ -37,6 +39,7 @@ extension HTTP2Connector where Self == NeverConnector {
|
|
|
}
|
|
|
|
|
|
@_spi(Package)
|
|
|
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
extension HTTP2Connector where Self == NIOPosixConnector {
|
|
|
/// A connector which uses NIOPosix to establish a connection.
|
|
|
static func posix(
|
|
|
@@ -56,6 +59,7 @@ extension HTTP2Connector where Self == NIOPosixConnector {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
struct ThrowingConnector: HTTP2Connector {
|
|
|
private let error: RPCError
|
|
|
|
|
|
@@ -70,6 +74,7 @@ struct ThrowingConnector: HTTP2Connector {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
struct NeverConnector: HTTP2Connector {
|
|
|
func establishConnection(
|
|
|
to address: GRPCHTTP2Core.SocketAddress
|
|
|
@@ -78,6 +83,7 @@ struct NeverConnector: HTTP2Connector {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
|
|
|
struct NIOPosixConnector: HTTP2Connector {
|
|
|
private let eventLoopGroup: any EventLoopGroup
|
|
|
private let maxIdleTime: TimeAmount?
|