Rename network to ip for wg gw
This commit is contained in:
@@ -9,9 +9,9 @@ pub struct Config {
|
||||
/// 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.
|
||||
|
||||
@@ -24,14 +24,17 @@ pub async fn start_wireguard(
|
||||
let ifname = String::from("wg0");
|
||||
let wgapi = WGApi::new(ifname.clone(), false)?;
|
||||
wgapi.create_interface()?;
|
||||
log::info!("Created interface");
|
||||
let interface_config = InterfaceConfiguration {
|
||||
name: ifname.clone(),
|
||||
prvkey: wireguard_data.keypair().private_key().to_string(),
|
||||
address: wireguard_data.config().private_network_ip.to_string(),
|
||||
address: wireguard_data.config().private_ip.to_string(),
|
||||
port: wireguard_data.config().announced_port as u32,
|
||||
peers,
|
||||
};
|
||||
log::info!("Configuring with {:?}", interface_config);
|
||||
wgapi.configure_interface(&interface_config)?;
|
||||
log::info!("Configured interface");
|
||||
// wgapi.configure_peer_routing(&peers)?;
|
||||
|
||||
tokio::spawn(async move { task_client.recv().await });
|
||||
|
||||
@@ -148,8 +148,8 @@ Options:
|
||||
Specifies whether the wireguard service is enabled on this node [env: NYMNODE_WG_ENABLED=] [possible values: true, false]
|
||||
--wireguard-bind-address <WIREGUARD_BIND_ADDRESS>
|
||||
Socket address this node will use for binding its wireguard interface. default: `0.0.0.0:51822` [env: NYMNODE_WG_BIND_ADDRESS=]
|
||||
--wireguard-private-network-ip <WIREGUARD_PRIVATE_NETWORK_IP>
|
||||
Ip address of the private wireguard network. default: `10.1.0.0` [env: NYMNODE_WG_IP_NETWORK=]
|
||||
--wireguard-private-gw-ip <WIREGUARD_PRIVATE_IP>
|
||||
Private IP address of the wireguard gateway. default: `10.1.0.1` [env: NYMNODE_WG_IP=]
|
||||
--wireguard-announced-port <WIREGUARD_ANNOUNCED_PORT>
|
||||
Port announced to external clients wishing to connect to the wireguard interface. Useful in the instances where the node is behind a proxy [env: NYMNODE_WG_ANNOUNCED_PORT=]
|
||||
--wireguard-private-network-prefix <WIREGUARD_PRIVATE_NETWORK_PREFIX>
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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
@@ -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";
|
||||
|
||||
|
||||
@@ -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,
|
||||
)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user