rpc: add PeerInfo (#24255)
This replaces the sketchy and undocumented string context keys for HTTP requests with a defined interface. Using string keys with context is discouraged because they may clash with keys created by other packages. We added these keys to make connection metadata available in the signer, so this change also updates signer/core to use the new PeerInfo API.
This commit is contained in:
@@ -198,6 +198,11 @@ func NewCodec(conn Conn) ServerCodec {
|
||||
return NewFuncCodec(conn, enc.Encode, dec.Decode)
|
||||
}
|
||||
|
||||
func (c *jsonCodec) peerInfo() PeerInfo {
|
||||
// This returns "ipc" because all other built-in transports have a separate codec type.
|
||||
return PeerInfo{Transport: "ipc", RemoteAddr: c.remote}
|
||||
}
|
||||
|
||||
func (c *jsonCodec) remoteAddr() string {
|
||||
return c.remote
|
||||
}
|
||||
|
Reference in New Issue
Block a user