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