Show all ports for nodes in gossip table (#6717)
* Show all ports for nodes in gossip table * review comments
This commit is contained in:
@ -255,31 +255,44 @@ impl ClusterInfo {
|
|||||||
} else if Self::is_archiver(&node) {
|
} else if Self::is_archiver(&node) {
|
||||||
archivers += 1;
|
archivers += 1;
|
||||||
}
|
}
|
||||||
fn addr_to_string(addr: &SocketAddr) -> String {
|
fn addr_to_string(default_ip: &IpAddr, addr: &SocketAddr) -> String {
|
||||||
if ContactInfo::is_valid_address(addr) {
|
if ContactInfo::is_valid_address(addr) {
|
||||||
|
if &addr.ip() == default_ip {
|
||||||
|
addr.port().to_string()
|
||||||
|
} else {
|
||||||
addr.to_string()
|
addr.to_string()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
"none".to_string()
|
"none".to_string()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let ip_addr = node.gossip.ip();
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
"- gossip: {:20} | {:5}ms | {} {}\n \
|
"{:15} {:4}| {:5}ms | {:45} | {:5} | {:5} | {:5} | {:5} | {:5} | {:5} | {:5} | {:5} | {:5}\n",
|
||||||
tpu: {:20} | |\n \
|
ip_addr.to_string(),
|
||||||
rpc: {:20} | |\n",
|
|
||||||
addr_to_string(&node.gossip),
|
|
||||||
now.saturating_sub(last_updated),
|
|
||||||
node.id,
|
|
||||||
if node.id == my_pubkey { "(me)" } else { "" }.to_string(),
|
if node.id == my_pubkey { "(me)" } else { "" }.to_string(),
|
||||||
addr_to_string(&node.tpu),
|
now.saturating_sub(last_updated),
|
||||||
addr_to_string(&node.rpc),
|
node.id.to_string(),
|
||||||
|
addr_to_string(&ip_addr, &node.gossip),
|
||||||
|
addr_to_string(&ip_addr, &node.tpu),
|
||||||
|
addr_to_string(&ip_addr, &node.tpu_forwards),
|
||||||
|
addr_to_string(&ip_addr, &node.tvu),
|
||||||
|
addr_to_string(&ip_addr, &node.tvu_forwards),
|
||||||
|
addr_to_string(&ip_addr, &node.repair),
|
||||||
|
addr_to_string(&ip_addr, &node.storage_addr),
|
||||||
|
addr_to_string(&ip_addr, &node.rpc),
|
||||||
|
addr_to_string(&ip_addr, &node.rpc_pubsub),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
" Node contact info | Age | Node identifier \n\
|
" IP Address | Age | Node identifier \
|
||||||
-------------------------------+---------+-----------------------------------\n\
|
| Gossip| TPU |TPU fwd| TVU |TVU fwd|Repair |Storage| RPC | PubSub\n\
|
||||||
|
--------------------+---------+-----------------------------------------------+\
|
||||||
|
-------+-------+-------+-------+-------+-------+-------+-------+-------\n\
|
||||||
{}\
|
{}\
|
||||||
Nodes: {}{}{}",
|
Nodes: {}{}{}",
|
||||||
nodes.join(""),
|
nodes.join(""),
|
||||||
|
Reference in New Issue
Block a user