Skip to content

Commit

Permalink
feat: automatically add .local. when resolving when missing (#34)
Browse files Browse the repository at this point in the history
also omit removing .local. from enumerated service types
  • Loading branch information
hrzlgnm authored Mar 6, 2024
1 parent 5e38ab9 commit be5e372
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ struct ResolvedService {
fn resolve_service(service_type: String, state: State<Daemon>) -> Vec<ResolvedService> {
log::info!("Resolving {}", service_type);
let mdns = state.shared.lock().unwrap();
let mut service_type = service_type;
if !service_type.ends_with(".local.") {
service_type.push_str(".local.");
}
let receiver = mdns
.browse(service_type.as_str())
.expect("Failed to browse");
Expand Down Expand Up @@ -78,7 +82,7 @@ fn enum_service_types(state: State<Daemon>) -> Vec<String> {
match event {
ServiceEvent::ServiceFound(service_type, full_name) => {
if !full_name.starts_with(&service_type) {
found.push(full_name.replace(".local.", ""));
found.push(full_name);
}
}
ServiceEvent::SearchStarted(_service) => {
Expand Down

0 comments on commit be5e372

Please sign in to comment.