Add --private-rpc flag
This commit is contained in:
		| @@ -496,6 +496,12 @@ pub fn main() { | ||||
|                 .validator(port_validator) | ||||
|                 .help("RPC port to use for this node"), | ||||
|         ) | ||||
|         .arg( | ||||
|             Arg::with_name("private_rpc") | ||||
|                 .long("--private-rpc") | ||||
|                 .takes_value(false) | ||||
|                 .help("Do not publish the RPC port for use by other nodes") | ||||
|         ) | ||||
|         .arg( | ||||
|             Arg::with_name("enable_rpc_exit") | ||||
|                 .long("enable-rpc-exit") | ||||
| @@ -657,7 +663,7 @@ pub fn main() { | ||||
|     let cuda = matches.is_present("cuda"); | ||||
|     let no_genesis_fetch = matches.is_present("no_genesis_fetch"); | ||||
|     let no_snapshot_fetch = matches.is_present("no_snapshot_fetch"); | ||||
|     let rpc_port = value_t!(matches, "rpc_port", u16); | ||||
|     let private_rpc = matches.is_present("private_rpc"); | ||||
|  | ||||
|     // Canonicalize ledger path to avoid issues with symlink creation | ||||
|     let _ = fs::create_dir_all(&ledger_path); | ||||
| @@ -678,6 +684,9 @@ pub fn main() { | ||||
|         expected_shred_version: value_t!(matches, "expected_shred_version", u16).ok(), | ||||
|         new_hard_forks: hardforks_of(&matches, "hard_forks"), | ||||
|         rpc_config: JsonRpcConfig { | ||||
|             rpc_ports: value_t!(matches, "rpc_port", u16) | ||||
|                 .ok() | ||||
|                 .map(|rpc_port| (rpc_port, rpc_port + 1)), | ||||
|             enable_validator_exit: matches.is_present("enable_rpc_exit"), | ||||
|             faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| { | ||||
|                 solana_net_utils::parse_host_port(address).expect("failed to parse faucet address") | ||||
| @@ -852,12 +861,14 @@ pub fn main() { | ||||
|     let mut tcp_ports = vec![]; | ||||
|     let mut node = | ||||
|         Node::new_with_external_ip(&identity_keypair.pubkey(), &gossip_addr, dynamic_port_range); | ||||
|     if let Ok(rpc_port) = rpc_port { | ||||
|         let rpc_pubsub_port = rpc_port + 1; | ||||
|         node.info.rpc = SocketAddr::new(node.info.gossip.ip(), rpc_port); | ||||
|         node.info.rpc_pubsub = SocketAddr::new(node.info.gossip.ip(), rpc_pubsub_port); | ||||
|         tcp_ports = vec![rpc_port, rpc_pubsub_port]; | ||||
|     }; | ||||
|  | ||||
|     if !private_rpc { | ||||
|         if let Some((rpc_port, rpc_pubsub_port)) = validator_config.rpc_config.rpc_ports { | ||||
|             node.info.rpc = SocketAddr::new(node.info.gossip.ip(), rpc_port); | ||||
|             node.info.rpc_pubsub = SocketAddr::new(node.info.gossip.ip(), rpc_pubsub_port); | ||||
|             tcp_ports = vec![rpc_port, rpc_pubsub_port]; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if let Some(ref cluster_entrypoint) = cluster_entrypoint { | ||||
|         let udp_sockets = vec![&node.sockets.gossip, &node.sockets.repair]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user