-
Notifications
You must be signed in to change notification settings - Fork 38.7k
rpc: Add listen address to incoming connections in getpeerinfo
#10478
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
Conversation
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly tested ACK 63c71582352f62d1ba674f09a5c00b93dd6f9284.
I would maybe consider renaming addrlisten to addrbind and not just restricting it to incoming connections.
src/net.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should replace tab with spaces here.
src/rpc/net.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getpeerinfo help string needs to be updated
Would be nice to test this from python as well.
src/net.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful if you could add comments for addr and addrLocal above, they contain "ip address and port of the peer" and "local address" according to RPC documention, and say specifically how addrListen is different from addrLocal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, addrLocal is pretty much useless in most cases, as it's what is sent by the peer. Wish we could rename that one. But yes it needs to be documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bogoip :P
Good point. We could also call getsockname for for outgoing connections, though the meaning is somewhat more obscure. We use both |
ryanofsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK a501d01491745f5b78d4ae484d50c2bcdb5d4700 with one comment. Thanks for taking some of my suggestions.
src/rpc/net.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"addrlisten" string needs to be updated here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh yes
|
@ryanofsky yes, should have gotten most of them, I still intend to add a python tests. Now that both incoming and outgoing connections have the |
This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures. The address is reported in `getpeerinfo`. This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.
a281a20 to
3457331
Compare
|
Rebased, squashed, and added a basic python test. |
…peerinfo` 3457331 test: Add test for `getpeerinfo` `bindaddr` field (Wladimir J. van der Laan) a7e3c28 rpc: Add listen address to incoming connections in `getpeerinfo` (Wladimir J. van der Laan) Tree-SHA512: bcd58bca2d35fc9698e958e22a7cf8268a6c731a3a309df183f43fc5e725a88ae09f006290fde7aa03cee9a403e2e25772097409677cedbce8f267e01e9040f6
…in `getpeerinfo` 3457331 test: Add test for `getpeerinfo` `bindaddr` field (Wladimir J. van der Laan) a7e3c28 rpc: Add listen address to incoming connections in `getpeerinfo` (Wladimir J. van der Laan) Tree-SHA512: bcd58bca2d35fc9698e958e22a7cf8268a6c731a3a309df183f43fc5e725a88ae09f006290fde7aa03cee9a403e2e25772097409677cedbce8f267e01e9040f6
This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures.
The address is reported in
getpeerinfo.This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.