Commit a1c1f2a
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 322c0af commit a1c1f2a
2 files changed
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
288 | | - | |
| 289 | + | |
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| |||
329 | 330 | | |
330 | 331 | | |
331 | 332 | | |
332 | | - | |
| 333 | + | |
333 | 334 | | |
334 | 335 | | |
335 | 336 | | |
| |||
| 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 | | |
| |||
271 | 283 | | |
272 | 284 | | |
273 | 285 | | |
274 | | - | |
| 286 | + | |
275 | 287 | | |
276 | 288 | | |
277 | 289 | | |
| |||
311 | 323 | | |
312 | 324 | | |
313 | 325 | | |
314 | | - | |
315 | | - | |
316 | | - | |
| 326 | + | |
| 327 | + | |
317 | 328 | | |
318 | 329 | | |
319 | 330 | | |
| |||
0 commit comments