Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/rpc: access to client's IP address #4584

Closed
gopherbot opened this issue Dec 22, 2012 · 10 comments
Closed

net/rpc: access to client's IP address #4584

gopherbot opened this issue Dec 22, 2012 · 10 comments

Comments

@gopherbot
Copy link

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
}
@rsc
Copy link
Contributor

rsc commented Dec 22, 2012

Comment 2:

I'm skeptical. It would take an API change (not necessarily a backwards incompatible one
but still a bit of a redesign) to supply this.

Labels changed: added priority-later, removed priority-triage, go1.1.

Status changed to Thinking.

@gopherbot
Copy link
Author

Comment 3 by visan.ovidiu:

I see, it would be nice to have though...

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 4:

Status changed to Unfortunate.

@jonhoo
Copy link

jonhoo commented Dec 8, 2014

How come this issue is now considered closed?

@ianlancetaylor
Copy link
Contributor

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.

@jonhoo
Copy link

jonhoo commented Dec 8, 2014

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?

@rsc
Copy link
Contributor

rsc commented Dec 8, 2014

"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.

@andyxning
Copy link

Does this issue still exists?

@jonhoo
Copy link

jonhoo commented Mar 8, 2016

@andyxning: what do you mean? Yes, this is still absolutely a useful feature. Not sure why it was just closed :/

@andyxning
Copy link

@jonhoo I mean that until now we can not implement this functionality about get remote ip address inside the rpc function. right?

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants