From 81c51cd4fcc8e826ba4dd4e6d4da696ba5c3fe37 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 11 Jan 2019 17:24:45 +0300 Subject: [PATCH] rpc: include peer's remote IP in `/net_info` (#3052) Refs #3047 --- CHANGELOG_PENDING.md | 1 + rpc/core/net.go | 1 + rpc/core/types/responses.go | 2 ++ 3 files changed, 4 insertions(+) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 6614f7925..6bfdf8457 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -29,6 +29,7 @@ Special thanks to external contributors on this release: - [privval] \#1181 Split immutable and mutable parts of priv_validator.json ### IMPROVEMENTS: +- [rpc] \#3047 Include peer's remote IP in `/net_info` ### BUG FIXES: - [types] \#2926 do not panic if retrieving the private validator's public key fails diff --git a/rpc/core/net.go b/rpc/core/net.go index b80902dae..4d95c2ef0 100644 --- a/rpc/core/net.go +++ b/rpc/core/net.go @@ -53,6 +53,7 @@ func NetInfo() (*ctypes.ResultNetInfo, error) { NodeInfo: nodeInfo, IsOutbound: peer.IsOutbound(), ConnectionStatus: peer.Status(), + RemoteIP: peer.RemoteIP(), }) } // TODO: Should we include PersistentPeers and Seeds in here? diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index af5c4947f..62be1cafd 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -2,6 +2,7 @@ package core_types import ( "encoding/json" + "net" "time" abci "github.com/tendermint/tendermint/abci/types" @@ -110,6 +111,7 @@ type Peer struct { NodeInfo p2p.DefaultNodeInfo `json:"node_info"` IsOutbound bool `json:"is_outbound"` ConnectionStatus p2p.ConnectionStatus `json:"connection_status"` + RemoteIP net.IP `json:"remote_ip"` } // Validators for a height