Can specify MAC addresses for domains

This commit is contained in:
2023-12-19 13:26:56 +01:00
parent 6c56b62833
commit 924c972984
9 changed files with 122 additions and 18 deletions

View File

@ -0,0 +1,11 @@
/**
* Generate a random MAC address
*/
export function randomMacAddress(prefix: string | undefined): string {
let mac = "XX:XX:XX:XX:XX:XX";
mac = prefix + mac.slice(prefix?.length);
return mac.replace(/X/g, () =>
"0123456789abcdef".charAt(Math.floor(Math.random() * 16))
);
}