diff --git a/Sources/GRPCCore/Call/Server/ServerContext.swift b/Sources/GRPCCore/Call/Server/ServerContext.swift index d2518adf9..f027ad058 100644 --- a/Sources/GRPCCore/Call/Server/ServerContext.swift +++ b/Sources/GRPCCore/Call/Server/ServerContext.swift @@ -16,6 +16,10 @@ /// Additional information about an RPC handled by a server. public struct ServerContext: Sendable { + + /// Protocol used to help identify transport specific context fields + public protocol TransportSpecific: Sendable {} + /// A description of the method being called. public var descriptor: MethodDescriptor @@ -45,6 +49,15 @@ public struct ServerContext: Sendable { /// - "in-process:27182". public var localPeer: String + /// An optional field for transports to store specific data + /// + /// Refer to the transport documentation to understand what type of + /// value this field will contain, if any. + /// + /// An example of what this field can be used for, would be to store + /// things like a peer certificate from a mTLS connection + public var transportSpecific: (any TransportSpecific)? + /// A handle for checking the cancellation status of an RPC. public var cancellation: RPCCancellationHandle