http-server-rs 0.0.27

Simple, zero-configuration command-line static HTTP server.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::get_intranet_ip;

pub struct DomainOptions<'a> {
  pub domain: &'a str,
  pub domain_pretty: &'a str,
  pub port: usize,
}

pub fn get_domain(config: &DomainOptions) -> Option<String> {
  let intranet_domain = get_intranet_ip();
  let intranet_domain_str = intranet_domain.as_ref()?;
  if intranet_domain_str == config.domain_pretty || intranet_domain_str == config.domain {
    return None;
  }
  Some(format!("{}:{}", intranet_domain_str, config.port))
}