|
|
@@ -30,7 +30,37 @@ public struct ServerContext: Sendable {
|
|
|
/// - "ipv4:127.0.0.1:31415",
|
|
|
/// - "ipv6:[::1]:443",
|
|
|
/// - "in-process:27182".
|
|
|
- public var peer: String
|
|
|
+ @available(*, deprecated, renamed: "remotePeer")
|
|
|
+ public var peer: String {
|
|
|
+ get { remotePeer }
|
|
|
+ set { remotePeer = newValue }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// A description of the remote peer.
|
|
|
+ ///
|
|
|
+ /// The format of the description should follow the pattern "<transport>:<address>" where
|
|
|
+ /// "<transport>" indicates the underlying network transport (such as "ipv4", "unix", or
|
|
|
+ /// "in-process"). This is a guideline for how descriptions should be formatted; different
|
|
|
+ /// implementations may not follow this format so you shouldn't make assumptions based on it.
|
|
|
+ ///
|
|
|
+ /// Some examples include:
|
|
|
+ /// - "ipv4:127.0.0.1:31415",
|
|
|
+ /// - "ipv6:[::1]:443",
|
|
|
+ /// - "in-process:27182".
|
|
|
+ public var remotePeer: String
|
|
|
+
|
|
|
+ /// A description of the local peer.
|
|
|
+ ///
|
|
|
+ /// The format of the description should follow the pattern "<transport>:<address>" where
|
|
|
+ /// "<transport>" indicates the underlying network transport (such as "ipv4", "unix", or
|
|
|
+ /// "in-process"). This is a guideline for how descriptions should be formatted; different
|
|
|
+ /// implementations may not follow this format so you shouldn't make assumptions based on it.
|
|
|
+ ///
|
|
|
+ /// Some examples include:
|
|
|
+ /// - "ipv4:127.0.0.1:31415",
|
|
|
+ /// - "ipv6:[::1]:443",
|
|
|
+ /// - "in-process:27182".
|
|
|
+ public var localPeer: String
|
|
|
|
|
|
/// A handle for checking the cancellation status of an RPC.
|
|
|
public var cancellation: RPCCancellationHandle
|
|
|
@@ -39,16 +69,19 @@ public struct ServerContext: Sendable {
|
|
|
///
|
|
|
/// - Parameters:
|
|
|
/// - descriptor: A description of the method being called.
|
|
|
- /// - peer: A description of the remote peer.
|
|
|
+ /// - remotePeer: A description of the remote peer.
|
|
|
+ /// - localPeer: A description of the local peer.
|
|
|
/// - cancellation: A cancellation handle. You can create a cancellation handle
|
|
|
/// using ``withServerContextRPCCancellationHandle(_:)``.
|
|
|
public init(
|
|
|
descriptor: MethodDescriptor,
|
|
|
- peer: String,
|
|
|
+ remotePeer: String,
|
|
|
+ localPeer: String,
|
|
|
cancellation: RPCCancellationHandle
|
|
|
) {
|
|
|
self.descriptor = descriptor
|
|
|
- self.peer = peer
|
|
|
+ self.remotePeer = remotePeer
|
|
|
+ self.localPeer = localPeer
|
|
|
self.cancellation = cancellation
|
|
|
}
|
|
|
}
|