Skip to content

Commit

Permalink
feat: automatically add .local. when resolving when missing
Browse files Browse the repository at this point in the history
also omit removing .local. from enumerated service types
  • Loading branch information
hrzlgnm committed Mar 6, 2024
1 parent a185e77 commit 772558c
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 @@ -35,6 +35,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 @@ -76,7 +80,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 772558c

Please sign in to comment.