net/rpc: access to client's IP address
gopherbot opened this issue · 10 comments
by visan.ovidiu:
Right now RemoteAddr() method can be called to get the RPC client's address only on net.Conn when the client dials to server, but suppose that your server has multiple clients connected and each of this clients are calling an RPC exported method. Is there a way to implement a method to get the caller's remote address from inside the RPC method? func (t *Type) Method(args *Args, reply *string) error { //something like *reply = Caller.RemoteAddr().String() // who called the method now? return nil }
How come this issue is now considered closed?
As the record shows, Russ closed the issue as "unfortunate" on July 30, 2013. We use the "unfortunate" status for issues that are the result of a possibly mistaken choice in the past.
I'm not sure that it's true that this issue is unfixable though? For example, given that the RPC layer already does reflection on the RPC methods of the implementing class, it would not be too hard to have it detect if a method also takes a request argument, and if so, pass it when the method is called?
"Unfortunate" doesn't mean it's impossible to fix. It means that we've decided it's not worth fixing given the constraints we have, especially that of backwards compatibility.
Does this issue still exists?
@andyxning: what do you mean? Yes, this is still absolutely a useful feature. Not sure why it was just closed :/