Skip to content
Snippets Groups Projects
Commit aff24d6f authored by Saqib Rokadia's avatar Saqib Rokadia Committed by GitHub
Browse files

Adding optional public addresses for proxying (#5807)


* Adding optional public addresses for use in network configurations to allow for proxies in front of a node.

* Apply suggestions from code review

Co-Authored-By: default avatarCecile Tonglet <cecile.tonglet@cecton.com>

Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: default avatarCecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: default avatarPierre Krieger <pierre.krieger1708@gmail.com>
parent 1fd18dd2
No related merge requests found
......@@ -230,10 +230,13 @@ pub struct RunCmd {
pub max_runtime_instances: Option<usize>,
/// 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<MultiaddrWithPeerId>,
}
......
......@@ -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<Multiaddr>,
/// Listen on this multiaddress.
#[structopt(long = "listen-addr", value_name = "LISTEN_ADDR")]
pub listen_addr: Vec<Multiaddr>,
......@@ -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(),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment