mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-24 13:16:28 +00:00
init xhost
This commit is contained in:
@@ -105,6 +105,30 @@ pub(crate) fn must_get_local_ips() -> Result<Vec<IpAddr>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct XHost {
|
||||||
|
pub name: String,
|
||||||
|
pub port: u16,
|
||||||
|
pub is_port_set: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToString for XHost {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
if !self.is_port_set {
|
||||||
|
self.name.clone()
|
||||||
|
} else {
|
||||||
|
join_host_port(&self.name, self.port)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn join_host_port(host: &str, port: u16) -> String {
|
||||||
|
if host.contains(':') {
|
||||||
|
format!("[{}]:{}", host, port)
|
||||||
|
} else {
|
||||||
|
format!("{}:{}", host, port)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use std::net::Ipv4Addr;
|
use std::net::Ipv4Addr;
|
||||||
|
|||||||
+4
-4
@@ -208,10 +208,10 @@ async fn run(opt: config::Opt) -> Result<()> {
|
|||||||
})?;
|
})?;
|
||||||
warn!(" init store success!");
|
warn!(" init store success!");
|
||||||
|
|
||||||
new_global_notification_sys(endpoint_pools.clone()).await.map_err(|err| {
|
// new_global_notification_sys(endpoint_pools.clone()).await.map_err(|err| {
|
||||||
error!("new_global_notification_sys faild {:?}", &err);
|
// error!("new_global_notification_sys faild {:?}", &err);
|
||||||
Error::from_string(err.to_string())
|
// Error::from_string(err.to_string())
|
||||||
})?;
|
// })?;
|
||||||
|
|
||||||
// init scanner
|
// init scanner
|
||||||
init_data_scanner().await;
|
init_data_scanner().await;
|
||||||
|
|||||||
Reference in New Issue
Block a user