Don't forward localhost connections over the public network

This commit is contained in:
Maran 2014-05-12 15:43:10 +02:00
parent 7f9fd08792
commit 5fcbaefd0b

View File

@ -534,8 +534,11 @@ func (p *Peer) peersMessage() *ethwire.Msg {
outPeers := make([]interface{}, len(p.ethereum.InOutPeers())) outPeers := make([]interface{}, len(p.ethereum.InOutPeers()))
// Serialise each peer // Serialise each peer
for i, peer := range p.ethereum.InOutPeers() { for i, peer := range p.ethereum.InOutPeers() {
// Don't return localhost as valid peer
if !net.ParseIP(peer.conn.RemoteAddr().String()).IsLoopback() {
outPeers[i] = peer.RlpData() outPeers[i] = peer.RlpData()
} }
}
// Return the message to the peer with the known list of connected clients // Return the message to the peer with the known list of connected clients
return ethwire.NewMessage(ethwire.MsgPeersTy, outPeers) return ethwire.NewMessage(ethwire.MsgPeersTy, outPeers)