add plumbing to allow for arbitrary tpu address in gossip (#22703)

* add plumbing to allow for arbitrary tpu address in gossip

* make clippy happy

* Review comments

Co-authored-by: CherryWorm <nico.gruendel@web.de>
This commit is contained in:
sakridge
2022-03-02 09:42:14 +01:00
committed by GitHub
parent d3ebe8d8f5
commit a4f4ac5279
4 changed files with 24 additions and 1 deletions

View File

@ -775,6 +775,16 @@ pub fn main() {
.help("Gossip DNS name or IP address for the validator to advertise in gossip \
[default: ask --entrypoint, or 127.0.0.1 when --entrypoint is not provided]"),
)
.arg(
Arg::with_name("tpu_host_addr")
.long("tpu-host-addr")
.value_name("HOST:PORT")
.takes_value(true)
.validator(solana_net_utils::is_host_port)
.help("Specify TPU address to advertise in gossip [default: ask --entrypoint or localhost\
when --entrypoint is not provided]"),
)
.arg(
Arg::with_name("public_rpc_addr")
.long("public-rpc-address")
@ -2602,6 +2612,13 @@ pub fn main() {
}),
);
let overwrite_tpu_addr = matches.value_of("tpu_host_addr").map(|tpu_addr| {
solana_net_utils::parse_host_port(tpu_addr).unwrap_or_else(|err| {
eprintln!("Failed to parse --overwrite-tpu-addr: {}", err);
exit(1);
})
});
let cluster_entrypoints = entrypoint_addrs
.iter()
.map(ContactInfo::new_gossip_entry_point)
@ -2612,6 +2629,7 @@ pub fn main() {
&gossip_addr,
dynamic_port_range,
bind_address,
overwrite_tpu_addr,
);
if restricted_repair_only_mode {