()
| 11 | * Hash the MAC addresses on the machine (Windows-only) and log telemetry. |
| 12 | */ |
| 13 | export async function logMachineIdMappings(): Promise<void> { |
| 14 | if (!isWindows) { |
| 15 | return; |
| 16 | } |
| 17 | |
| 18 | const macAddresses = await getMacAddresses(); |
| 19 | |
| 20 | // The first MAC address is the one Visual Studio uses |
| 21 | const primary = await getMachineId(macAddresses.shift()); |
| 22 | if (primary) { |
| 23 | logLanguageServerEvent('machineIdMap', { primary }); |
| 24 | } |
| 25 | |
| 26 | // VS Code uses os.networkInterfaces() which has different sorting and availability, |
| 27 | // but all MAC addresses are returned by getmac.exe. The ID VS Code uses may change |
| 28 | // based on changes to the network configuration. Log the extras so we can assess |
| 29 | // how frequently this impacts the machine id. |
| 30 | for (const macAddress of macAddresses) { |
| 31 | const additional = await getMachineId(macAddress); |
| 32 | if (additional) { |
| 33 | logLanguageServerEvent('machineIdMap', { additional }); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Parse the output of getmac.exe to get the list of MAC addresses for the PC. |
no test coverage detected