diff options
author | 2023-04-09 20:58:27 +0200 | |
---|---|---|
committer | 2023-04-09 20:58:27 +0200 | |
commit | 1d7f8b9a8c2dcdc0cc08b238f12cebb3941121ed (patch) | |
tree | 6e06bd090259ea16a642795e238794c30a7b7a32 /src/utils | |
parent | ec7cb9351cd6dbf6a50fb086f8b40fe87c51ea83 (diff) | |
download | it-tools-1d7f8b9a8c2dcdc0cc08b238f12cebb3941121ed.tar.gz it-tools-1d7f8b9a8c2dcdc0cc08b238f12cebb3941121ed.tar.zst it-tools-1d7f8b9a8c2dcdc0cc08b238f12cebb3941121ed.zip |
feat(new-tool): generate ula based on timestamp and mac address (#344)
* feat(ipv6-ula-generator): new tool: generate ula based on timestamp and mac address
This new tool generates a random unique ula based on the current timestamp and the provided mac address. An ULA is your "secondary" IPV6-Address only for internal use.
It can also be used as a backup address if your provider gets offline and your Prefix-IPs are not longer valid.Also you can create the most of your internal firewall rules based on your ULAs.
* feat(ipv6-ula-generator): changes requested by review
* Update src/tools/ipv6-ula-generator/index.ts
* Update src/tools/ipv6-ula-generator/ipv6-ula-generator.vue
---------
Co-authored-by: Corentin THOMASSET <corentin.thomasset74@gmail.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/macAddress.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/macAddress.ts b/src/utils/macAddress.ts new file mode 100644 index 0000000..5451a36 --- /dev/null +++ b/src/utils/macAddress.ts @@ -0,0 +1,16 @@ +import { useValidation, type ValidationAttrs } from '@/composable/validation'; +import type { Ref } from 'vue'; + +function macAddressValidation(value: Ref) { + return useValidation({ + source: value, + rules: [ + { + message: 'Invalid MAC address', + validator: (value) => value.trim().match(/^([0-9A-Fa-f]{2}[:-]){2,5}([0-9A-Fa-f]{2})$/), + }, + ], + }); +} + +export { macAddressValidation }; |