diff options
author | 2023-04-09 20:58:27 +0200 | |
---|---|---|
committer | 2023-04-09 21:05:26 +0200 | |
commit | a1e983538c5aad1bb7e361873a2d6af1d349ceae (patch) | |
tree | 3b60e84229d58371fa91a16d3644e6e7f2aa99f7 /src | |
parent | 1d7f8b9a8c2dcdc0cc08b238f12cebb3941121ed (diff) | |
download | it-tools-a1e983538c5aad1bb7e361873a2d6af1d349ceae.tar.gz it-tools-a1e983538c5aad1bb7e361873a2d6af1d349ceae.tar.zst it-tools-a1e983538c5aad1bb7e361873a2d6af1d349ceae.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')
-rw-r--r-- | src/tools/ipv6-ula-generator/ipv6-ula-generator.vue | 9 | ||||
-rw-r--r-- | src/utils/macAddress.ts | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/tools/ipv6-ula-generator/ipv6-ula-generator.vue b/src/tools/ipv6-ula-generator/ipv6-ula-generator.vue index d5c3766..ee74d4c 100644 --- a/src/tools/ipv6-ula-generator/ipv6-ula-generator.vue +++ b/src/tools/ipv6-ula-generator/ipv6-ula-generator.vue @@ -2,7 +2,7 @@ <div> <n-space vertical :size="50"> <n-alert title="Info" type="info"> - This page uses the first method suggested by IETF using the current timestamp plus the mac address, sha1 hashed, + This tool uses the first method suggested by IETF using the current timestamp plus the mac address, sha1 hashed, and the lower 40 bits to generate your random ULA. </n-alert> @@ -40,19 +40,20 @@ const calculatedSections = computed(() => { const hex40bit = SHA1(timestamp + macAddress.value) .toString() .substring(30); + const ula = 'fd' + hex40bit.substring(0, 2) + ':' + hex40bit.substring(2, 6) + ':' + hex40bit.substring(6); return [ { - label: 'IPv6 ULA : ', + label: 'IPv6 ULA:', value: `${ula}::/48`, }, { - label: 'First routable block: ', + label: 'First routable block:', value: `${ula}:0::/64`, }, { - label: 'Last routable block: ', + label: 'Last routable block:', value: `${ula}:ffff::/64`, }, ]; diff --git a/src/utils/macAddress.ts b/src/utils/macAddress.ts index 5451a36..ff6000c 100644 --- a/src/utils/macAddress.ts +++ b/src/utils/macAddress.ts @@ -1,4 +1,4 @@ -import { useValidation, type ValidationAttrs } from '@/composable/validation'; +import { useValidation } from '@/composable/validation'; import type { Ref } from 'vue'; function macAddressValidation(value: Ref) { |