mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-03 01:25:37 +00:00
feat: add DHCP subnet (CIDR) configuration parameter
Allow -d to optionally accept a CIDR subnet (e.g. -d 10.0.0.0/24) to fix the DHCP address range. When specified, the DHCP allocator uses the configured subnet instead of deriving it from peer IPs. Changes: - Add dhcp_cidr field to config struct and ConfigLoader trait - Modify -d CLI arg to accept optional CIDR string value - Update DHCP logic to use configured CIDR as default subnet - Add dhcp_cidr to NetworkConfig proto message - Update launcher to handle dhcp_cidr in gen_config/new_from_config - Update i18n translations
This commit is contained in:
@@ -637,6 +637,11 @@ impl NetworkConfig {
|
||||
);
|
||||
cfg.set_hostname(self.hostname.clone());
|
||||
cfg.set_dhcp(self.dhcp.unwrap_or_default());
|
||||
if let Some(ref dhcp_cidr) = self.dhcp_cidr {
|
||||
if let Ok(cidr) = dhcp_cidr.parse::<cidr::Ipv4Cidr>() {
|
||||
cfg.set_dhcp_cidr(Some(cidr));
|
||||
}
|
||||
}
|
||||
cfg.set_inst_name(self.network_name.clone().unwrap_or_default());
|
||||
|
||||
// The web UI does not expose credential inputs directly, but imported/saved
|
||||
@@ -1019,6 +1024,7 @@ impl NetworkConfig {
|
||||
}
|
||||
|
||||
result.dhcp = Some(config.get_dhcp());
|
||||
result.dhcp_cidr = config.get_dhcp_cidr().map(|c| c.to_string());
|
||||
|
||||
let network_identity = config.get_network_identity();
|
||||
result.network_name = Some(network_identity.network_name.clone());
|
||||
|
||||
Reference in New Issue
Block a user