(config: &Config)
| 6014 | |
| 6015 | impl BonjourAdvertisement { |
| 6016 | fn start(config: &Config) -> Option<Self> { |
| 6017 | if config.bind_ip.is_loopback() { |
| 6018 | return None; |
| 6019 | } |
| 6020 | let service_name = bonjour_service_name(&config.advertise_host); |
| 6021 | let server_id = auth::server_identity(config); |
| 6022 | let server_kind = config.server_kind.as_str(); |
| 6023 | match ProcessCommand::new("dns-sd") |
| 6024 | .args([ |
| 6025 | "-R", |
| 6026 | &service_name, |
| 6027 | "_simdeck._tcp.", |
| 6028 | "local.", |
| 6029 | &config.http_port.to_string(), |
| 6030 | &format!("sid={server_id}"), |
| 6031 | &format!("host={}", config.advertise_host), |
| 6032 | &format!("hid={}", config.host_id), |
| 6033 | &format!("hname={}", config.host_name), |
| 6034 | &format!("kind={server_kind}"), |
| 6035 | ]) |
| 6036 | .stdout(Stdio::null()) |
| 6037 | .stderr(Stdio::null()) |
| 6038 | .spawn() |
| 6039 | { |
| 6040 | Ok(child) => { |
| 6041 | info!( |
| 6042 | "Advertising Bonjour service '{}' on _simdeck._tcp. port {}", |
| 6043 | service_name, config.http_port |
| 6044 | ); |
| 6045 | Some(Self { child }) |
| 6046 | } |
| 6047 | Err(error) => { |
| 6048 | warn!("Unable to advertise Bonjour service with dns-sd: {error}"); |
| 6049 | None |
| 6050 | } |
| 6051 | } |
| 6052 | } |
| 6053 | } |
| 6054 | |
| 6055 | impl Drop for BonjourAdvertisement { |
nothing calls this directly
no test coverage detected