mirror of
https://github.com/fluencelabs/tendermint
synced 2025-07-31 20:21:56 +00:00
Let peerConn handle IPs in for tests
This commit is contained in:
12
p2p/peer.go
12
p2p/peer.go
@@ -12,6 +12,8 @@ import (
|
||||
tmconn "github.com/tendermint/tendermint/p2p/conn"
|
||||
)
|
||||
|
||||
var testIPSuffix = 0
|
||||
|
||||
// Peer is an interface representing a peer connected on a reactor.
|
||||
type Peer interface {
|
||||
cmn.Service
|
||||
@@ -53,6 +55,16 @@ func (pc peerConn) RemoteIP() net.IP {
|
||||
return pc.ips[0]
|
||||
}
|
||||
|
||||
if pc.conn.RemoteAddr().String() == "pipe" {
|
||||
pc.ips = []net.IP{
|
||||
net.IP{172, 16, 0, byte(testIPSuffix)},
|
||||
}
|
||||
|
||||
testIPSuffix++
|
||||
|
||||
return pc.ips[0]
|
||||
}
|
||||
|
||||
host, _, err := net.SplitHostPort(pc.conn.RemoteAddr().String())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
Reference in New Issue
Block a user