Commit f3566ee
committed
fix(discovery): normalize Bonjour names by stripping
Discovery now caches by service-instance label, but the announcer's
choice of label is platform-dependent: macOS's `hostname::get()`
returns the FQDN (`Foo.local`) while Linux's returns the short name
(`omarchy`). Without normalization this works asymmetrically — a
config of `omarchy.local` for a Linux peer wouldn't match the cached
`omarchy` key.
Add `normalize_mdns_name` (lower-case, drop trailing `.`, drop
`.local` suffix) and apply it on both insert (start_browse) and
lookup (`peer_primary_ip`, `should_attempt`, `connect_to_handle`).
The `.local` domain is implied for everything mDNS-SD touches, so
collapsing it on both sides is lossless and matches how `dns-sd`
and Bonjour APIs treat instance labels in their wire form..local
1 parent 5bb4464 commit f3566ee
2 files changed
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
| |||
313 | 325 | | |
314 | 326 | | |
315 | 327 | | |
316 | | - | |
| 328 | + | |
317 | 329 | | |
318 | 330 | | |
319 | 331 | | |
| |||
0 commit comments