diff --git a/substrate/client/cli/src/commands/runcmd.rs b/substrate/client/cli/src/commands/runcmd.rs index a24cadcd4f..3365c7a27a 100644 --- a/substrate/client/cli/src/commands/runcmd.rs +++ b/substrate/client/cli/src/commands/runcmd.rs @@ -230,10 +230,13 @@ pub struct RunCmd { pub max_runtime_instances: Option, /// Specify a list of sentry node public addresses. + /// + /// Can't be used with --public-addr as the sentry node would take precedence over the public address + /// specified there. #[structopt( long = "sentry-nodes", value_name = "ADDR", - conflicts_with_all = &[ "sentry" ] + conflicts_with_all = &[ "sentry", "public-addr" ] )] pub sentry_nodes: Vec, } diff --git a/substrate/client/cli/src/params/network_params.rs b/substrate/client/cli/src/params/network_params.rs index d0ec3fb9f3..79112b041c 100644 --- a/substrate/client/cli/src/params/network_params.rs +++ b/substrate/client/cli/src/params/network_params.rs @@ -41,6 +41,11 @@ pub struct NetworkParams { #[structopt(long = "reserved-only")] pub reserved_only: bool, + /// The public address that other nodes will use to connect to it. + /// This can be used if there's a proxy in front of this node. + #[structopt(long, value_name = "PUBLIC_ADDR")] + pub public_addr: Vec, + /// Listen on this multiaddress. #[structopt(long = "listen-addr", value_name = "LISTEN_ADDR")] pub listen_addr: Vec, @@ -125,6 +130,8 @@ impl NetworkParams { self.listen_addr.clone() }; + let public_addresses = self.public_addr.clone(); + let mut boot_nodes = chain_spec.boot_nodes().to_vec(); boot_nodes.extend(self.bootnodes.clone()); @@ -138,7 +145,7 @@ impl NetworkParams { NonReservedPeerMode::Accept }, listen_addresses, - public_addresses: Vec::new(), + public_addresses, notifications_protocols: Vec::new(), node_key, node_name: node_name.to_string(),