Rename network to ip for wg gw

This commit is contained in:
Bogdan-Ștefan Neacşu
2024-05-20 09:46:22 +00:00
parent 34e1709b75
commit 72c40d8576
9 changed files with 27 additions and 24 deletions
+6 -6
View File
@@ -253,13 +253,13 @@ pub(crate) struct WireguardArgs {
)]
pub(crate) wireguard_bind_address: Option<SocketAddr>,
/// Ip address of the private wireguard network.
/// default: `10.1.0.0`
/// Private IP address of the wireguard gateway.
/// default: `10.1.0.1`
#[clap(
long,
env = NYMNODE_WG_IP_NETWORK_ARG,
env = NYMNODE_WG_IP_ARG,
)]
pub(crate) wireguard_private_network_ip: Option<IpAddr>,
pub(crate) wireguard_private_ip: Option<IpAddr>,
/// Port announced to external clients wishing to connect to the wireguard interface.
/// Useful in the instances where the node is behind a proxy.
@@ -300,8 +300,8 @@ impl WireguardArgs {
section.announced_port = announced_port
}
if let Some(private_network_ip) = self.wireguard_private_network_ip {
section.private_network_ip = private_network_ip
if let Some(private_ip) = self.wireguard_private_ip {
section.private_ip = private_ip
}
if let Some(private_network_prefix) = self.wireguard_private_network_prefix {
+1 -1
View File
@@ -248,7 +248,7 @@ pub fn ephemeral_exit_gateway_config(
config: super::Wireguard {
enabled: config.wireguard.enabled,
bind_address: config.wireguard.bind_address,
private_network_ip: config.wireguard.private_network_ip,
private_ip: config.wireguard.private_ip,
announced_port: config.wireguard.announced_port,
private_network_prefix: config.wireguard.private_network_prefix,
storage_paths: config.wireguard.storage_paths.clone(),
+6 -6
View File
@@ -40,7 +40,7 @@ pub use crate::config::mixnode::MixnodeConfig;
const DEFAULT_NYMNODES_DIR: &str = "nym-nodes";
pub const DEFAULT_WIREGUARD_PORT: u16 = WG_PORT;
pub const DEFAULT_WIREGUARD_NETWORK_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(10, 1, 0, 0));
pub const DEFAULT_WIREGUARD_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(10, 1, 0, 1));
pub const DEFAULT_WIREGUARD_PREFIX: u8 = 16;
pub const DEFAULT_HTTP_PORT: u16 = DEFAULT_NYM_NODE_HTTP_PORT;
pub const DEFAULT_MIXNET_PORT: u16 = DEFAULT_MIX_LISTENING_PORT;
@@ -500,9 +500,9 @@ pub struct Wireguard {
/// default: `0.0.0.0:51822`
pub bind_address: SocketAddr,
/// Ip address of the private wireguard network.
/// default: `10.1.0.0`
pub private_network_ip: IpAddr,
/// Private IP address of the wireguard gateway.
/// default: `10.1.0.1`
pub private_ip: IpAddr,
/// Port announced to external clients wishing to connect to the wireguard interface.
/// Useful in the instances where the node is behind a proxy.
@@ -524,7 +524,7 @@ impl Wireguard {
IpAddr::V4(Ipv4Addr::UNSPECIFIED),
DEFAULT_WIREGUARD_PORT,
),
private_network_ip: DEFAULT_WIREGUARD_NETWORK_IP,
private_ip: DEFAULT_WIREGUARD_IP,
announced_port: DEFAULT_WIREGUARD_PORT,
private_network_prefix: DEFAULT_WIREGUARD_PREFIX,
storage_paths: persistence::WireguardPaths::new(data_dir),
@@ -536,7 +536,7 @@ impl Into<nym_wireguard_types::Config> for Wireguard {
fn into(self) -> nym_wireguard_types::Config {
nym_wireguard_types::Config {
bind_address: self.bind_address,
private_network_ip: self.private_network_ip,
private_ip: self.private_ip,
announced_port: self.announced_port,
private_network_prefix: self.private_network_prefix,
}
+3 -3
View File
@@ -115,9 +115,9 @@ enabled = {{ wireguard.enabled }}
# default: `0.0.0.0:51822`
bind_address = '{{ wireguard.bind_address }}'
# Ip address of the private wireguard network.
# default: `10.1.0.0`
private_network_ip = '{{ wireguard.private_network_ip }}'
# Private IP address of the wireguard gateway.
# default: `10.1.0.1`
private_ip = '{{ wireguard.private_ip }}'
# Port announced to external clients wishing to connect to the wireguard interface.
# Useful in the instances where the node is behind a proxy.
+1 -1
View File
@@ -40,7 +40,7 @@ pub mod vars {
// wireguard:
pub const NYMNODE_WG_ENABLED_ARG: &str = "NYMNODE_WG_ENABLED";
pub const NYMNODE_WG_BIND_ADDRESS_ARG: &str = "NYMNODE_WG_BIND_ADDRESS";
pub const NYMNODE_WG_IP_NETWORK_ARG: &str = "NYMNODE_WG_IP_NETWORK";
pub const NYMNODE_WG_IP_ARG: &str = "NYMNODE_WG_IP";
pub const NYMNODE_WG_ANNOUNCED_PORT_ARG: &str = "NYMNODE_WG_ANNOUNCED_PORT";
pub const NYMNODE_WG_PRIVATE_NETWORK_PREFIX_ARG: &str = "NYMNODE_WG_PRIVATE_NETWORK_PREFIX";
+1 -1
View File
@@ -576,7 +576,7 @@ impl NymNode {
};
let wireguard_private_network = IpNetwork::new(
self.config.wireguard.private_network_ip,
self.config.wireguard.private_ip,
self.config.wireguard.private_network_prefix,
)?;