Ethan Buchman 882622ec10
Fixes tendermint/tendermint#3522
* OriginalAddr -> SocketAddr

OriginalAddr records the originally dialed address for outbound peers,
rather than the peer's self reported address. For inbound peers, it was
nil. Here, we rename it to SocketAddr and for inbound peers, set it to
the RemoteAddr of the connection.

* use SocketAddr

Numerous places in the code call peer.NodeInfo().NetAddress().
However, this call to NetAddress() may perform a DNS lookup if the
reported NodeInfo.ListenAddr includes a name. Failure of this lookup
returns a nil address, which can lead to panics in the code.

Instead, call peer.SocketAddr() to return the static address of the
connection.

* remove nodeInfo.NetAddress()

Expose `transport.NetAddress()`, a static result determined
when the transport is created. Removing NetAddress() from the nodeInfo
prevents accidental DNS lookups.

* fixes from review

* linter

* fixes from review
2019-04-01 19:59:57 -04:00
..
2019-04-01 19:59:57 -04:00
2019-04-01 19:59:57 -04:00
2019-01-22 13:23:18 -05:00
2018-07-01 22:36:49 -04:00
2018-07-01 22:36:49 -04:00
2019-04-01 19:59:57 -04:00
2019-04-01 19:59:57 -04:00
2019-04-01 19:59:57 -04:00
2019-01-11 17:41:02 -05:00
2019-04-01 19:59:57 -04:00
2019-04-01 19:59:57 -04:00
2019-04-01 19:59:57 -04:00
2019-01-28 16:13:17 +04:00

p2p

The p2p package provides an abstraction around peer-to-peer communication.

Docs:

  • Connection for details on how connections and multiplexing work
  • Peer for details on peer ID, handshakes, and peer exchange
  • Node for details about different types of nodes and how they should work
  • Pex for details on peer discovery and exchange
  • Config for details on some config option