Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: add more services to getClusterNodes #1637

Merged
merged 8 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rpc-client-api/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,20 @@ pub struct RpcContactInfo {
pub pubkey: String,
/// Gossip port
pub gossip: Option<SocketAddr>,
/// Tvu UDP port
pub tvu: Option<SocketAddr>,
/// Tpu UDP port
pub tpu: Option<SocketAddr>,
/// Tpu QUIC port
pub tpu_quic: Option<SocketAddr>,
/// Tpu UDP forwards port
pub tpu_forwards: Option<SocketAddr>,
/// Tpu QUIC forwards port
pub tpu_forwards_quic: Option<SocketAddr>,
/// Tpu UDP vote port
pub tpu_vote: Option<SocketAddr>,
/// Server repair UDP port
pub serve_repair: Option<SocketAddr>,
/// JSON RPC port
pub rpc: Option<SocketAddr>,
/// WebSocket PubSub port
Expand Down
5 changes: 5 additions & 0 deletions rpc-client/src/mock_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,13 @@ impl RpcSender for MockSender {
"getClusterNodes" => serde_json::to_value(vec![RpcContactInfo {
pubkey: PUBKEY.to_string(),
gossip: Some(SocketAddr::from(([10, 239, 6, 48], 8899))),
tvu: Some(SocketAddr::from(([10, 239, 6, 48], 8865))),
tpu: Some(SocketAddr::from(([10, 239, 6, 48], 8856))),
tpu_quic: Some(SocketAddr::from(([10, 239, 6, 48], 8862))),
tpu_forwards: Some(SocketAddr::from(([10, 239, 6, 48], 8857))),
tpu_forwards_quic: Some(SocketAddr::from(([10, 239, 6, 48], 8863))),
tpu_vote: Some(SocketAddr::from(([10, 239, 6, 48], 8870))),
serve_repair: Some(SocketAddr::from(([10, 239, 6, 48], 8880))),
rpc: Some(SocketAddr::from(([10, 239, 6, 48], 8899))),
pubsub: Some(SocketAddr::from(([10, 239, 6, 48], 8900))),
version: Some("1.0.0 c375ce1f".to_string()),
Expand Down
30 changes: 30 additions & 0 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,10 @@ pub mod rpc_full {
Some(RpcContactInfo {
pubkey: contact_info.pubkey().to_string(),
gossip: contact_info.gossip().ok(),
tvu: contact_info
.tvu(Protocol::UDP)
.ok()
.filter(|addr| socket_addr_space.check(addr)),
tpu: contact_info
.tpu(Protocol::UDP)
.ok()
Expand All @@ -3560,6 +3564,22 @@ pub mod rpc_full {
.tpu(Protocol::QUIC)
.ok()
.filter(|addr| socket_addr_space.check(addr)),
tpu_forwards: contact_info
.tpu_forwards(Protocol::UDP)
.ok()
.filter(|addr| socket_addr_space.check(addr)),
tpu_forwards_quic: contact_info
.tpu_forwards(Protocol::QUIC)
.ok()
.filter(|addr| socket_addr_space.check(addr)),
tpu_vote: contact_info
.tpu_vote()
.ok()
.filter(|addr| socket_addr_space.check(addr)),
serve_repair: contact_info
.serve_repair(Protocol::UDP)
.ok()
.filter(|addr| socket_addr_space.check(addr)),
rpc: contact_info
.rpc()
.ok()
Expand Down Expand Up @@ -5321,8 +5341,13 @@ pub mod tests {
"pubkey": rpc.identity.to_string(),
"gossip": "127.0.0.1:8000",
"shredVersion": 0u16,
"tvu": "127.0.0.1:8001",
"tpu": "127.0.0.1:8003",
"tpuQuic": "127.0.0.1:8009",
"tpuForwards": "127.0.0.1:8004",
"tpuForwardsQuic": "127.0.0.1:8010",
"tpuVote": "127.0.0.1:8005",
"serveRepair": "127.0.0.1:8008",
"rpc": format!("127.0.0.1:{}", rpc_port::DEFAULT_RPC_PORT),
"pubsub": format!("127.0.0.1:{}", rpc_port::DEFAULT_RPC_PUBSUB_PORT),
"version": format!("{version}"),
Expand All @@ -5331,8 +5356,13 @@ pub mod tests {
"pubkey": rpc.leader_pubkey().to_string(),
"gossip": "127.0.0.1:1235",
"shredVersion": 0u16,
"tvu": "127.0.0.1:1236",
"tpu": "127.0.0.1:1234",
"tpuQuic": "127.0.0.1:1240",
"tpuForwards": "127.0.0.1:1239",
"tpuForwardsQuic": "127.0.0.1:1245",
"tpuVote": "127.0.0.1:1241",
"serveRepair": "127.0.0.1:1242",
"rpc": format!("127.0.0.1:{}", rpc_port::DEFAULT_RPC_PORT),
"pubsub": format!("127.0.0.1:{}", rpc_port::DEFAULT_RPC_PUBSUB_PORT),
"version": format!("{version}"),
Expand Down