Skip to content

Conversation

@laanwj
Copy link
Member

@laanwj laanwj commented May 30, 2017

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.

Copy link
Contributor

@ryanofsky ryanofsky left a 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
Copy link
Contributor

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
Copy link
Contributor

@ryanofsky ryanofsky May 30, 2017

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
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bogoip :P

@laanwj
Copy link
Member Author

laanwj commented May 30, 2017

I would maybe consider renaming addrlisten to addrbind and not just restricting it to incoming connections.

Good point. We could also call getsockname for for outgoing connections, though the meaning is somewhat more obscure.

We use both bind and listen in command line options so I wasn't sure what to call it, but you're right it correlates more with bind's meaning.

Copy link
Contributor

@ryanofsky ryanofsky left a 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
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh yes

@laanwj
Copy link
Member Author

laanwj commented May 31, 2017

@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 addrbind it's possible to correlate 100% the connection ids between local nodes.

laanwj added 2 commits June 5, 2017 13:35
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.
@laanwj laanwj force-pushed the 2017_05_peer_listenaddr branch from a281a20 to 3457331 Compare June 5, 2017 11:57
@laanwj
Copy link
Member Author

laanwj commented Jun 5, 2017

Rebased, squashed, and added a basic python test.

@laanwj laanwj merged commit 3457331 into bitcoin:master Jun 5, 2017
laanwj added a commit that referenced this pull request Jun 5, 2017
…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
@laanwj laanwj mentioned this pull request Jun 5, 2017
12 tasks
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 26, 2019
…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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants