@@ -30,7 +30,36 @@ public struct ServerContext: Sendable {
30
30
/// - "ipv4:127.0.0.1:31415",
31
31
/// - "ipv6:[::1]:443",
32
32
/// - "in-process:27182".
33
- public var peer : String
33
+ @available ( * , deprecated, renamed: " remotePeer " )
34
+ public var peer : String {
35
+ remotePeer
36
+ }
37
+
38
+ /// A description of the remote peer.
39
+ ///
40
+ /// The format of the description should follow the pattern "<transport>:<address>" where
41
+ /// "<transport>" indicates the underlying network transport (such as "ipv4", "unix", or
42
+ /// "in-process"). This is a guideline for how descriptions should be formatted; different
43
+ /// implementations may not follow this format so you shouldn't make assumptions based on it.
44
+ ///
45
+ /// Some examples include:
46
+ /// - "ipv4:127.0.0.1:31415",
47
+ /// - "ipv6:[::1]:443",
48
+ /// - "in-process:27182".
49
+ public var remotePeer : String
50
+
51
+ /// A description of the local peer.
52
+ ///
53
+ /// The format of the description should follow the pattern "<transport>:<address>" where
54
+ /// "<transport>" indicates the underlying network transport (such as "ipv4", "unix", or
55
+ /// "in-process"). This is a guideline for how descriptions should be formatted; different
56
+ /// implementations may not follow this format so you shouldn't make assumptions based on it.
57
+ ///
58
+ /// Some examples include:
59
+ /// - "ipv4:127.0.0.1:31415",
60
+ /// - "ipv6:[::1]:443",
61
+ /// - "in-process:27182".
62
+ public var localPeer : String
34
63
35
64
/// A handle for checking the cancellation status of an RPC.
36
65
public var cancellation : RPCCancellationHandle
@@ -39,16 +68,19 @@ public struct ServerContext: Sendable {
39
68
///
40
69
/// - Parameters:
41
70
/// - descriptor: A description of the method being called.
42
- /// - peer: A description of the remote peer.
71
+ /// - remotePeer: A description of the remote peer.
72
+ /// - localPeer: A description of the local peer.
43
73
/// - cancellation: A cancellation handle. You can create a cancellation handle
44
74
/// using ``withServerContextRPCCancellationHandle(_:)``.
45
75
public init (
46
76
descriptor: MethodDescriptor ,
47
- peer: String ,
77
+ remotePeer: String ,
78
+ localPeer: String ,
48
79
cancellation: RPCCancellationHandle
49
80
) {
50
81
self . descriptor = descriptor
51
- self . peer = peer
82
+ self . remotePeer = remotePeer
83
+ self . localPeer = localPeer
52
84
self . cancellation = cancellation
53
85
}
54
86
}
0 commit comments