From 99132681d592e71d583b9bcd033e0512d0c6dcbe Mon Sep 17 00:00:00 2001 From: Zshan0 Date: Sun, 19 Jun 2022 10:56:30 +0530 Subject: [PATCH] Adding default port value if not provided. Rather than throwing error for invalid host address due to missing port, default port is inserted at the end and validity is checked again. --- src/installer/step/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/installer/step/mod.rs b/src/installer/step/mod.rs index eea3d24f..cbb6b774 100644 --- a/src/installer/step/mod.rs +++ b/src/installer/step/mod.rs @@ -339,6 +339,17 @@ impl Step for DefineCoordinator { self.host.valid = SocketAddr::from_str(&self.host.value).is_ok(); + if !self.host.valid { + // trim spaces at the end if any. + let clean_value = self.host.value.trim_end(); + + let value = format!("{}:8383", clean_value).to_string(); + self.host.valid = SocketAddr::from_str(&value).is_ok(); + if self.host.valid { + self.host.value = value; + } + } + if !self.host.valid || !self.noise_key.valid { return false; }