yarpc / yarpc-go

A message passing platform for Go
MIT License
401 stars 101 forks source link

Include remote address string in Request, Call #2253

Open jquirke opened 3 months ago

jquirke commented 3 months ago

Allow peer address to be accessible to the server handler function as per #2252

This allows the server and middleware to access the underlying peer connection address in a transport agnostic way. Middleware and the server handler can then utilise this to implement audit, logging (debug), various host based rate limiting, etc.

e.g. Server RPC handler

peerAddrPort := yarpc.CallFromContext(ctx).CallerPeerAddrPort()

e.g. Middleware

peerAddrPort := request.CallerPeerAddrPort