(peer: dict[str, Any])
| 511 | |
| 512 | |
| 513 | def pick_mobile_display_name(peer: dict[str, Any]) -> str: |
| 514 | host_name = str(peer.get("HostName") or "").strip() |
| 515 | dns_name = normalize_dns_name(peer.get("DNSName")) or "" |
| 516 | tail_ip = (peer.get("TailscaleIPs") or [""])[0] |
| 517 | if host_name and host_name.lower() != "localhost": |
| 518 | return host_name |
| 519 | if dns_name: |
| 520 | return dns_name |
| 521 | if tail_ip: |
| 522 | return tail_ip |
| 523 | return "未命名手机" |
| 524 | |
| 525 | |
| 526 | def extract_mobile_peers(tailscale_status: dict[str, Any]) -> list[dict[str, Any]]: |
no test coverage detected