mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 23:00:19 +03:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4ec4da68b | ||
|
|
921f3aadc9 | ||
|
|
98f6b044de | ||
|
|
2abc3149e2 | ||
|
|
c99871bdad | ||
|
|
a0141dc215 | ||
|
|
6a9fb02193 | ||
|
|
591cdcda7e | ||
|
|
2908763346 |
No files matched your search
@@ -286,6 +286,9 @@
|
||||
"watchTriggerable": true,
|
||||
"watchWithFilter": true,
|
||||
"whenever": true,
|
||||
"toValue": true
|
||||
"toValue": true,
|
||||
"injectLocal": true,
|
||||
"provideLocal": true,
|
||||
"useClipboardItems": true
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -36,6 +36,7 @@ declare global {
|
||||
const h: typeof import('vue')['h']
|
||||
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const injectLocal: typeof import('@vueuse/core')['injectLocal']
|
||||
const isDefined: typeof import('@vueuse/core')['isDefined']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
@@ -65,6 +66,7 @@ declare global {
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const provideLocal: typeof import('@vueuse/core')['provideLocal']
|
||||
const reactify: typeof import('@vueuse/core')['reactify']
|
||||
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
@@ -128,6 +130,7 @@ declare global {
|
||||
const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
|
||||
const useCached: typeof import('@vueuse/core')['useCached']
|
||||
const useClipboard: typeof import('@vueuse/core')['useClipboard']
|
||||
const useClipboardItems: typeof import('@vueuse/core')['useClipboardItems']
|
||||
const useCloned: typeof import('@vueuse/core')['useCloned']
|
||||
const useColorMode: typeof import('@vueuse/core')['useColorMode']
|
||||
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
|
||||
@@ -326,6 +329,7 @@ declare module 'vue' {
|
||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
|
||||
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||
@@ -355,6 +359,7 @@ declare module 'vue' {
|
||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
|
||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||
@@ -418,6 +423,7 @@ declare module 'vue' {
|
||||
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
||||
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
||||
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
|
||||
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
|
||||
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
|
||||
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
||||
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
||||
@@ -610,6 +616,7 @@ declare module '@vue/runtime-core' {
|
||||
readonly h: UnwrapRef<typeof import('vue')['h']>
|
||||
readonly ignorableWatch: UnwrapRef<typeof import('@vueuse/core')['ignorableWatch']>
|
||||
readonly inject: UnwrapRef<typeof import('vue')['inject']>
|
||||
readonly injectLocal: UnwrapRef<typeof import('@vueuse/core')['injectLocal']>
|
||||
readonly isDefined: UnwrapRef<typeof import('@vueuse/core')['isDefined']>
|
||||
readonly isProxy: UnwrapRef<typeof import('vue')['isProxy']>
|
||||
readonly isReactive: UnwrapRef<typeof import('vue')['isReactive']>
|
||||
@@ -639,6 +646,7 @@ declare module '@vue/runtime-core' {
|
||||
readonly onUpdated: UnwrapRef<typeof import('vue')['onUpdated']>
|
||||
readonly pausableWatch: UnwrapRef<typeof import('@vueuse/core')['pausableWatch']>
|
||||
readonly provide: UnwrapRef<typeof import('vue')['provide']>
|
||||
readonly provideLocal: UnwrapRef<typeof import('@vueuse/core')['provideLocal']>
|
||||
readonly reactify: UnwrapRef<typeof import('@vueuse/core')['reactify']>
|
||||
readonly reactifyObject: UnwrapRef<typeof import('@vueuse/core')['reactifyObject']>
|
||||
readonly reactive: UnwrapRef<typeof import('vue')['reactive']>
|
||||
@@ -702,6 +710,7 @@ declare module '@vue/runtime-core' {
|
||||
readonly useBrowserLocation: UnwrapRef<typeof import('@vueuse/core')['useBrowserLocation']>
|
||||
readonly useCached: UnwrapRef<typeof import('@vueuse/core')['useCached']>
|
||||
readonly useClipboard: UnwrapRef<typeof import('@vueuse/core')['useClipboard']>
|
||||
readonly useClipboardItems: UnwrapRef<typeof import('@vueuse/core')['useClipboardItems']>
|
||||
readonly useCloned: UnwrapRef<typeof import('@vueuse/core')['useCloned']>
|
||||
readonly useColorMode: UnwrapRef<typeof import('@vueuse/core')['useColorMode']>
|
||||
readonly useConfirmDialog: UnwrapRef<typeof import('@vueuse/core')['useConfirmDialog']>
|
||||
|
||||
Vendored
+3
-7
@@ -101,9 +101,9 @@ declare module '@vue/runtime-core' {
|
||||
IconMdiSearch: typeof import('~icons/mdi/search')['default']
|
||||
IconMdiTranslate: typeof import('~icons/mdi/translate')['default']
|
||||
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
|
||||
ImageConverter: typeof import('./src/tools/image-converter/image-converter.vue')['default']
|
||||
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
|
||||
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
|
||||
IpCidrToRange: typeof import('./src/tools/ip-cidr-to-range/ip-cidr-to-range.vue')['default']
|
||||
Ipv4AddressConverter: typeof import('./src/tools/ipv4-address-converter/ipv4-address-converter.vue')['default']
|
||||
Ipv4RangeExpander: typeof import('./src/tools/ipv4-range-expander/ipv4-range-expander.vue')['default']
|
||||
Ipv4SubnetCalculator: typeof import('./src/tools/ipv4-subnet-calculator/ipv4-subnet-calculator.vue')['default']
|
||||
@@ -136,18 +136,14 @@ declare module '@vue/runtime-core' {
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NLayout: typeof import('naive-ui')['NLayout']
|
||||
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
|
||||
NMenu: typeof import('naive-ui')['NMenu']
|
||||
NProgress: typeof import('naive-ui')['NProgress']
|
||||
NScrollbar: typeof import('naive-ui')['NScrollbar']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NTable: typeof import('naive-ui')['NTable']
|
||||
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
|
||||
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
|
||||
+7
-4
@@ -54,6 +54,7 @@
|
||||
"@vueuse/router": "^10.0.0",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"change-case": "^4.1.2",
|
||||
"cidr-tools": "^7.0.4",
|
||||
"colord": "^2.9.3",
|
||||
"composerize-ts": "^0.6.2",
|
||||
"country-code-lookup": "^0.1.0",
|
||||
@@ -70,8 +71,13 @@
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
"image-in-browser": "^3.2.0",
|
||||
"js-base64": "^3.7.6",
|
||||
"ip-address": "^9.0.5",
|
||||
"ip-bigint": "^8.0.2",
|
||||
"ip-cidr": "^4.0.0",
|
||||
"ip-matching": "^2.1.2",
|
||||
"is-cidr": "^5.0.3",
|
||||
"is-ip": "^5.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"libphonenumber-js": "^1.10.28",
|
||||
@@ -90,9 +96,7 @@
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"qrcode": "^1.5.1",
|
||||
"randexp": "^0.5.3",
|
||||
"roboto-base64": "^0.1.2",
|
||||
"sql-formatter": "^13.0.0",
|
||||
"svg2png-wasm": "^1.4.1",
|
||||
"ua-parser-js": "^1.0.35",
|
||||
"ulid": "^2.3.0",
|
||||
"unicode-emoji-json": "^0.4.0",
|
||||
@@ -103,7 +107,6 @@
|
||||
"vue-router": "^4.1.6",
|
||||
"vue-shadow-dom": "^4.2.0",
|
||||
"vue-tsc": "^1.8.1",
|
||||
"webp-converter-browser": "^1.0.4",
|
||||
"vuedraggable": "^4.1.0",
|
||||
"xml-formatter": "^3.3.2",
|
||||
"xml-js": "^1.6.11",
|
||||
|
||||
Generated
+121
-30
@@ -56,6 +56,9 @@ dependencies:
|
||||
change-case:
|
||||
specifier: ^4.1.2
|
||||
version: 4.1.2
|
||||
cidr-tools:
|
||||
specifier: ^7.0.4
|
||||
version: 7.0.7
|
||||
colord:
|
||||
specifier: ^2.9.3
|
||||
version: 2.9.3
|
||||
@@ -104,9 +107,24 @@ dependencies:
|
||||
ibantools:
|
||||
specifier: ^4.3.3
|
||||
version: 4.3.3
|
||||
image-in-browser:
|
||||
specifier: ^3.2.0
|
||||
version: 3.2.1
|
||||
ip-address:
|
||||
specifier: ^9.0.5
|
||||
version: 9.0.5
|
||||
ip-bigint:
|
||||
specifier: ^8.0.2
|
||||
version: 8.2.0
|
||||
ip-cidr:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.2
|
||||
ip-matching:
|
||||
specifier: ^2.1.2
|
||||
version: 2.1.2
|
||||
is-cidr:
|
||||
specifier: ^5.0.3
|
||||
version: 5.1.0
|
||||
is-ip:
|
||||
specifier: ^5.0.1
|
||||
version: 5.0.1
|
||||
js-base64:
|
||||
specifier: ^3.7.6
|
||||
version: 3.7.7
|
||||
@@ -164,15 +182,9 @@ dependencies:
|
||||
randexp:
|
||||
specifier: ^0.5.3
|
||||
version: 0.5.3
|
||||
roboto-base64:
|
||||
specifier: ^0.1.2
|
||||
version: 0.1.2
|
||||
sql-formatter:
|
||||
specifier: ^13.0.0
|
||||
version: 13.0.0
|
||||
svg2png-wasm:
|
||||
specifier: ^1.4.1
|
||||
version: 1.4.1
|
||||
ua-parser-js:
|
||||
specifier: ^1.0.35
|
||||
version: 1.0.35
|
||||
@@ -206,9 +218,6 @@ dependencies:
|
||||
vuedraggable:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0(vue@3.3.4)
|
||||
webp-converter-browser:
|
||||
specifier: ^1.0.4
|
||||
version: 1.0.4
|
||||
xml-formatter:
|
||||
specifier: ^3.3.2
|
||||
version: 3.3.2
|
||||
@@ -5043,6 +5052,20 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/cidr-regex@4.1.1:
|
||||
resolution: {integrity: sha512-ekKcVp+iRB9zlKFXyx7io7nINgb0oRjgRdXNEodp1OuxRui8FXr/CA40Tz1voWUp9DPPrMyQKy01vJhDo4N1lw==}
|
||||
engines: {node: '>=14'}
|
||||
dependencies:
|
||||
ip-regex: 5.0.0
|
||||
dev: false
|
||||
|
||||
/cidr-tools@7.0.7:
|
||||
resolution: {integrity: sha512-JeLGxKmaxk59IDRptqYfKa6Pw0bq8EzX7NoBu5XRKLPP9YmUu9mYcqiNliX4h3exjOqMdtzuY6F/rFj43V4Yww==}
|
||||
engines: {node: '>=18'}
|
||||
dependencies:
|
||||
ip-bigint: 8.2.0
|
||||
dev: false
|
||||
|
||||
/clean-regexp@1.0.0:
|
||||
resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -5070,6 +5093,13 @@ packages:
|
||||
wrap-ansi: 6.2.0
|
||||
dev: false
|
||||
|
||||
/clone-regexp@3.0.0:
|
||||
resolution: {integrity: sha512-ujdnoq2Kxb8s3ItNBtnYeXdm07FcU0u8ARAT1lQ2YdMwQC+cdiXX8KoqMVuglztILivceTtp4ivqGSmEmhBUJw==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
is-regexp: 3.1.0
|
||||
dev: false
|
||||
|
||||
/clone@1.0.4:
|
||||
resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}
|
||||
engines: {node: '>=0.8'}
|
||||
@@ -5181,6 +5211,11 @@ packages:
|
||||
upper-case: 2.0.2
|
||||
dev: false
|
||||
|
||||
/convert-hrtime@5.0.0:
|
||||
resolution: {integrity: sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/convert-source-map@1.9.0:
|
||||
resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==}
|
||||
dev: true
|
||||
@@ -6531,6 +6566,11 @@ packages:
|
||||
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
||||
dev: true
|
||||
|
||||
/function-timeout@0.1.1:
|
||||
resolution: {integrity: sha512-0NVVC0TaP7dSTvn1yMiy6d6Q8gifzbvQafO46RtLG/kHJUBNd+pVRGOBoK44wNBvtSPUJRfdVvkFdD3p0xvyZg==}
|
||||
engines: {node: '>=14.16'}
|
||||
dev: false
|
||||
|
||||
/function.prototype.name@1.1.8:
|
||||
resolution: {integrity: sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -6927,10 +6967,6 @@ packages:
|
||||
engines: {node: '>= 4'}
|
||||
dev: true
|
||||
|
||||
/image-in-browser@3.2.1:
|
||||
resolution: {integrity: sha512-QIhRnkz7ikwtu+U5Q2IkyUeC+7MtiIg0xATF4i72/hxaWjqOPm+VurD7ekCv+dwREmf19nwCurDDeHDayoIgZw==}
|
||||
dev: false
|
||||
|
||||
/image-size@0.5.5:
|
||||
resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -7004,6 +7040,19 @@ packages:
|
||||
sprintf-js: 1.1.2
|
||||
dev: false
|
||||
|
||||
/ip-address@9.0.5:
|
||||
resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==}
|
||||
engines: {node: '>= 12'}
|
||||
dependencies:
|
||||
jsbn: 1.1.0
|
||||
sprintf-js: 1.1.3
|
||||
dev: false
|
||||
|
||||
/ip-bigint@8.2.0:
|
||||
resolution: {integrity: sha512-46EAEKzGNxojH5JaGEeCix49tL4h1W8ia5mhogZ68HroVAfyLj1E+SFFid4GuyK0mdIKjwcAITLqwg1wlkx2iQ==}
|
||||
engines: {node: '>=18'}
|
||||
dev: false
|
||||
|
||||
/ip-cidr@3.1.0:
|
||||
resolution: {integrity: sha512-HUCn4snshEX1P8cja/IyU3qk8FVDW8T5zZcegDFbu4w7NojmAhk5NcOgj3M8+0fmumo1afJTPDtJlzsxLdOjtg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
@@ -7012,6 +7061,22 @@ packages:
|
||||
jsbn: 1.1.0
|
||||
dev: false
|
||||
|
||||
/ip-cidr@4.0.2:
|
||||
resolution: {integrity: sha512-KifhLKBjdS/hB3TD4UUOalVp1BpzPFvRpgJvXcP0Ya98tuSQTUQ71iI7EW7CKddkBJTYB3GfTWl5eJwpLOXj2A==}
|
||||
engines: {node: '>=16.14.0'}
|
||||
dependencies:
|
||||
ip-address: 9.0.5
|
||||
dev: false
|
||||
|
||||
/ip-matching@2.1.2:
|
||||
resolution: {integrity: sha512-/ok+VhKMasgR5gvTRViwRFQfc0qYt9Vdowg6TO4/pFlDCob5ZjGPkwuOoQVCd5OrMm20zqh+1vA8KLJZTeWudg==}
|
||||
dev: false
|
||||
|
||||
/ip-regex@5.0.0:
|
||||
resolution: {integrity: sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==}
|
||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||
dev: false
|
||||
|
||||
/is-alphabetical@1.0.4:
|
||||
resolution: {integrity: sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg==}
|
||||
dev: true
|
||||
@@ -7076,6 +7141,13 @@ packages:
|
||||
engines: {node: '>= 0.4'}
|
||||
dev: true
|
||||
|
||||
/is-cidr@5.1.0:
|
||||
resolution: {integrity: sha512-OkVS+Ht2ssF27d48gZdB+ho1yND1VbkJRKKS6Pc1/Cw7uqkd9IOJg8/bTwBDQL6tfBhSdguPRnlGiE8pU/X5NQ==}
|
||||
engines: {node: '>=14'}
|
||||
dependencies:
|
||||
cidr-regex: 4.1.1
|
||||
dev: false
|
||||
|
||||
/is-core-module@2.13.0:
|
||||
resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==}
|
||||
dependencies:
|
||||
@@ -7165,6 +7237,14 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/is-ip@5.0.1:
|
||||
resolution: {integrity: sha512-FCsGHdlrOnZQcp0+XT5a+pYowf33itBalCl+7ovNXC/7o5BhIpG14M3OrpPPdBSIQJCm+0M5+9mO7S9VVTTCFw==}
|
||||
engines: {node: '>=14.16'}
|
||||
dependencies:
|
||||
ip-regex: 5.0.0
|
||||
super-regex: 0.2.0
|
||||
dev: false
|
||||
|
||||
/is-lower-case@1.1.3:
|
||||
resolution: {integrity: sha512-+5A1e/WJpLLXZEDlgz4G//WYSHyQBD32qa4Jd3Lw06qQlv3fJHnp3YIHjTQSGzHMgzmVKz2ZP3rBxTHkPw/lxA==}
|
||||
dependencies:
|
||||
@@ -7233,6 +7313,11 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/is-regexp@3.1.0:
|
||||
resolution: {integrity: sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
/is-set@2.0.3:
|
||||
resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -8902,10 +8987,6 @@ packages:
|
||||
glob: 7.2.3
|
||||
dev: true
|
||||
|
||||
/roboto-base64@0.1.2:
|
||||
resolution: {integrity: sha512-vXOGVIresupkks/WVNy4upNA4OorZx6XbHJt5ZQaat1tHBdJxui3oI101n9XV9Yg6HWIQKeAGnQbJJaUa8mfvA==}
|
||||
dev: false
|
||||
|
||||
/rollup@2.79.2:
|
||||
resolution: {integrity: sha512-fS6iqSPZDs3dr/y7Od6y5nha8dW1YnbgtsyotCVvoFGKbERG++CVRFv1meyGDE1SNItQA8BrnCw7ScdAhRJ3XQ==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
@@ -9258,6 +9339,10 @@ packages:
|
||||
resolution: {integrity: sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==}
|
||||
dev: false
|
||||
|
||||
/sprintf-js@1.1.3:
|
||||
resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==}
|
||||
dev: false
|
||||
|
||||
/sql-formatter@13.0.0:
|
||||
resolution: {integrity: sha512-V21cVvge4rhn9Fa7K/fTKcmPM+x1yee6Vhq8ZwgaWh3VPBqApgsaoFB5kLAhiqRo5AmSaRyLU7LIdgnNwH01/w==}
|
||||
hasBin: true
|
||||
@@ -9400,6 +9485,15 @@ packages:
|
||||
dependencies:
|
||||
acorn: 8.11.2
|
||||
|
||||
/super-regex@0.2.0:
|
||||
resolution: {integrity: sha512-WZzIx3rC1CvbMDloLsVw0lkZVKJWbrkJ0k1ghKFmcnPrW1+jWbgTkTEWVtD9lMdmI4jZEz40+naBxl1dCUhXXw==}
|
||||
engines: {node: '>=14.16'}
|
||||
dependencies:
|
||||
clone-regexp: 3.0.0
|
||||
function-timeout: 0.1.1
|
||||
time-span: 5.1.0
|
||||
dev: false
|
||||
|
||||
/supports-color@5.5.0:
|
||||
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -9423,10 +9517,6 @@ packages:
|
||||
resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==}
|
||||
dev: true
|
||||
|
||||
/svg2png-wasm@1.4.1:
|
||||
resolution: {integrity: sha512-ZFy1NtwZVAsslaTQoI+/QqX2sg0vjmgJ/jGAuLZZvYcRlndI54hLPiwLC9JzXlFBerfxN5JiS7kpEUG0mrXS3Q==}
|
||||
dev: false
|
||||
|
||||
/svgo@3.3.2:
|
||||
resolution: {integrity: sha512-OoohrmuUlBs8B8o6MB2Aevn+pRIH9zDALSR+6hhqVfa6fRwG/Qw9VUMSMW9VNg2CFc/MTIfabtdOVl9ODIJjpw==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
@@ -9494,6 +9584,13 @@ packages:
|
||||
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
|
||||
dev: true
|
||||
|
||||
/time-span@5.1.0:
|
||||
resolution: {integrity: sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==}
|
||||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
convert-hrtime: 5.0.0
|
||||
dev: false
|
||||
|
||||
/tiny-emitter@2.1.0:
|
||||
resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==}
|
||||
dev: false
|
||||
@@ -10465,12 +10562,6 @@ packages:
|
||||
engines: {node: '>=12'}
|
||||
dev: true
|
||||
|
||||
/webp-converter-browser@1.0.4:
|
||||
resolution: {integrity: sha512-ZkcrrM4TyxBI7mPmE4uG6PU2MF5YXhKTtvub/ll/4ZjXM7THcms0C0tA10CwnsrLzRBC+ry/sUzwpW6vdPzA8g==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.23.2
|
||||
dev: false
|
||||
|
||||
/webpack-sources@3.2.3:
|
||||
resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
Binary file not shown.
@@ -1,7 +1,6 @@
|
||||
import { extension as getExtensionFromMimeType, extension as getMimeTypeFromExtension } from 'mime-types';
|
||||
import type { MaybeRef, Ref } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import _ from 'lodash';
|
||||
import { get } from '@vueuse/core';
|
||||
|
||||
export {
|
||||
getMimeTypeFromBase64,
|
||||
@@ -76,11 +75,21 @@ function downloadFromBase64({ sourceValue, filename, extension, fileMimeType }:
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64(
|
||||
{ source, filename, extension }:
|
||||
{ source: MaybeRef<string>; filename?: MaybeRef<string>; extension?: MaybeRef<string> }) {
|
||||
{ source, filename, extension, fileMimeType }:
|
||||
{ source: Ref<string>; filename?: string; extension?: string; fileMimeType?: string }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: get(source), filename: get(filename), extension: get(extension) });
|
||||
downloadFromBase64({ sourceValue: source.value, filename, extension, fileMimeType });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64Refs(
|
||||
{ source, filename, extension }:
|
||||
{ source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -107,13 +116,3 @@ function previewImageFromBase64(base64String: string): HTMLImageElement {
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
function useDownloadFileFromBase64Refs(
|
||||
{ source, filename, extension }:
|
||||
{ source: Ref<string>; filename?: Ref<string>; extension?: Ref<string> }) {
|
||||
return {
|
||||
download() {
|
||||
downloadFromBase64({ sourceValue: source.value, filename: filename?.value, extension: extension?.value });
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -128,7 +128,7 @@ function activateOption(option: PaletteOption) {
|
||||
<c-input-text ref="inputRef" v-model:value="searchPrompt" raw-text placeholder="Type to search a tool or a command..." autofocus clearable />
|
||||
|
||||
<div v-for="(options, category) in filteredSearchResult" :key="category">
|
||||
<div ml-3 mt-3 text-sm font-bold text-primary op-60>
|
||||
<div ml-3 mt-3 text-sm text-primary font-bold op-60>
|
||||
{{ category }}
|
||||
</div>
|
||||
<command-palette-option v-for="option in options" :key="option.name" :option="option" :selected="selectedOptionIndex === getOptionIndex(option)" @activated="activateOption" />
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Base64 } from 'js-base64';
|
||||
import type { MemoryImage } from 'image-in-browser';
|
||||
import { decodeImage, encodeBmp, encodeGif, encodeIco, encodeJpg, encodePng, encodePvr, encodeTga, encodeTiff } from 'image-in-browser';
|
||||
import { arrayBufferToWebP } from 'webp-converter-browser';
|
||||
import { createSvg2png, initialize } from 'svg2png-wasm';
|
||||
import { normal as robotoBase64 } from 'roboto-base64';
|
||||
import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
function readAsText(file: File) {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(file);
|
||||
reader.onload = () => resolve(reader.result?.toString() ?? '');
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle');
|
||||
const file = ref<File | null>(null);
|
||||
|
||||
const svgScale = ref(2);
|
||||
const base64OutputFile = ref('');
|
||||
const fileName = ref('');
|
||||
const fileExtension = ref('');
|
||||
const { download } = useDownloadFileFromBase64(
|
||||
{
|
||||
source: base64OutputFile,
|
||||
filename: fileName,
|
||||
extension: fileExtension,
|
||||
});
|
||||
|
||||
const outputQuality = useQueryParamOrStorage({ name: 'qual', storageName: 'imgconv:q', defaultValue: 0.95 });
|
||||
const outputFormats = {
|
||||
png: {
|
||||
mime: 'image/png',
|
||||
save: (image: MemoryImage) => encodePng({ image }),
|
||||
},
|
||||
jpg: {
|
||||
mime: 'image/jpeg',
|
||||
save: (image: MemoryImage) => encodeJpg({ image, quality: outputQuality.value }),
|
||||
},
|
||||
bmp: {
|
||||
mime: 'image/bmp',
|
||||
save: (image: MemoryImage) => encodeBmp({ image }),
|
||||
},
|
||||
gif: {
|
||||
mime: 'image/gif',
|
||||
save: (image: MemoryImage) => encodeGif({ image }),
|
||||
},
|
||||
ico: {
|
||||
mime: 'image/x-icon',
|
||||
save: (image: MemoryImage) => encodeIco({ image }),
|
||||
},
|
||||
tga: {
|
||||
mime: 'image/tga',
|
||||
save: (image: MemoryImage) => encodeTga({ image }),
|
||||
},
|
||||
pvr: {
|
||||
mime: 'image/pvr',
|
||||
save: (image: MemoryImage) => encodePvr({ image }),
|
||||
},
|
||||
tif: {
|
||||
mime: 'image/tif',
|
||||
save: (image: MemoryImage) => encodeTiff({ image }),
|
||||
},
|
||||
webp: {
|
||||
mime: 'image/webp',
|
||||
save: () => null,
|
||||
},
|
||||
};
|
||||
|
||||
const outputFormat = useQueryParamOrStorage({ name: 'fmt', storageName: 'imgconv:fmt', defaultValue: 'png' });
|
||||
const outputFormatHasQuality = computed(() => {
|
||||
return outputFormat.value === 'jpg';
|
||||
});
|
||||
|
||||
const svgWasmLoaded = ref(false);
|
||||
|
||||
async function onFilesUploaded(uploadedFiles: File[]) {
|
||||
for (const file of uploadedFiles) {
|
||||
await onFileUploaded(file);
|
||||
}
|
||||
}
|
||||
async function onFileUploaded(uploadedFile: File) {
|
||||
const outputFormatValue = outputFormat.value;
|
||||
file.value = uploadedFile;
|
||||
let fileBuffer = new Uint8Array(await uploadedFile.arrayBuffer());
|
||||
|
||||
fileName.value = uploadedFile.name.replace(/\.\w+$/, '');
|
||||
status.value = 'processing';
|
||||
try {
|
||||
if (outputFormatValue === 'webp') {
|
||||
const encodedImage = await arrayBufferToWebP(fileBuffer);
|
||||
fileExtension.value = 'webp';
|
||||
base64OutputFile.value = `data:image/webp;base64,${Base64.fromUint8Array(new Uint8Array(await encodedImage.arrayBuffer()))}`;
|
||||
}
|
||||
else {
|
||||
if (uploadedFile.type === 'image/svg+xml') {
|
||||
if (!svgWasmLoaded.value) {
|
||||
await initialize(fetch('/svg2png_wasm_bg.wasm'));
|
||||
svgWasmLoaded.value = true;
|
||||
}
|
||||
const svg2png = createSvg2png({
|
||||
fonts: [Base64.toUint8Array(robotoBase64)],
|
||||
});
|
||||
fileBuffer = await svg2png(await readAsText(uploadedFile), { scale: svgScale.value });
|
||||
svg2png.dispose();
|
||||
}
|
||||
const decodedImage = decodeImage({
|
||||
data: fileBuffer,
|
||||
});
|
||||
|
||||
if (decodedImage == null) {
|
||||
throw new Error('Invalid Image file!');
|
||||
};
|
||||
|
||||
const outConfig = outputFormats[outputFormatValue as (keyof typeof outputFormats)];
|
||||
const encodedImage = outConfig.save(decodedImage);
|
||||
fileExtension.value = outputFormatValue;
|
||||
base64OutputFile.value = `data:${outConfig.mime};base64,${Base64.fromUint8Array(encodedImage!)}`;
|
||||
}
|
||||
status.value = 'done';
|
||||
|
||||
download();
|
||||
}
|
||||
catch (e) {
|
||||
status.value = 'error';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h4>First, select output options:</h4>
|
||||
|
||||
<c-select
|
||||
v-model:value="outputFormat"
|
||||
label="Output format:"
|
||||
label-position="left"
|
||||
:options="Object.keys(outputFormats)"
|
||||
placeholder="Select output format"
|
||||
mb-2
|
||||
/>
|
||||
|
||||
<div mb-2 flex justify-center>
|
||||
<n-form-item v-if="outputFormatHasQuality" label="Output quality:" label-placement="left">
|
||||
<n-input-number v-model:value="outputQuality" :max="100" :min="0" w-full />
|
||||
</n-form-item>
|
||||
<n-form-item label="SVG scaling:" label-placement="left">
|
||||
<n-input-number v-model:value="svgScale" :min="0" />
|
||||
</n-form-item>
|
||||
</div>
|
||||
|
||||
<h4>Then, drag and drop your images below and they will be converted and downloaded immediately:</h4>
|
||||
|
||||
<div style="flex: 0 0 100%" mb-2>
|
||||
<div mx-auto max-w-600px>
|
||||
<c-file-upload
|
||||
title="Drag and drop images files here, or click to select some files"
|
||||
accept="image/*"
|
||||
paste-image
|
||||
multiple
|
||||
@file-upload="onFileUploaded"
|
||||
@files-upload="onFilesUploaded"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div mt-3 flex justify-center>
|
||||
<c-alert v-if="status === 'error'" type="error">
|
||||
An error occured processing {{ fileName }}
|
||||
</c-alert>
|
||||
<n-spin
|
||||
v-if="status === 'processing'"
|
||||
size="small"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,12 +0,0 @@
|
||||
import { PictureInPicture } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Image Formats Converter',
|
||||
path: '/image-converter',
|
||||
description: 'Convert images from one format to another',
|
||||
keywords: ['image', 'bmp', 'gif', 'ico', 'jpg', 'png', 'tga', 'pvr', 'tiff', 'pnm', 'pbm', 'pgm', 'ppm', 'psd', 'webp', 'converter'],
|
||||
component: () => import('./image-converter.vue'),
|
||||
icon: PictureInPicture,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
declare module 'roboto-base64' {
|
||||
export const normal: string;
|
||||
}
|
||||
+11
-9
@@ -2,7 +2,6 @@ import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as emailNormalizer } from './email-normalizer';
|
||||
import { tool as imageConverter } from './image-converter';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
|
||||
@@ -88,6 +87,7 @@ import { tool as uuidGenerator } from './uuid-generator';
|
||||
import { tool as macAddressLookup } from './mac-address-lookup';
|
||||
import { tool as xmlFormatter } from './xml-formatter';
|
||||
import { tool as yamlViewer } from './yaml-viewer';
|
||||
import { tool as ipCidrToRange } from './ip-cidr-to-range';
|
||||
|
||||
export const toolsByCategory: ToolCategory[] = [
|
||||
{
|
||||
@@ -142,13 +142,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Images and videos',
|
||||
components: [
|
||||
qrCodeGenerator,
|
||||
wifiQrCodeGenerator,
|
||||
svgPlaceholderGenerator,
|
||||
cameraRecorder,
|
||||
imageConverter,
|
||||
],
|
||||
components: [qrCodeGenerator, wifiQrCodeGenerator, svgPlaceholderGenerator, cameraRecorder],
|
||||
},
|
||||
{
|
||||
name: 'Development',
|
||||
@@ -171,7 +165,15 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
},
|
||||
{
|
||||
name: 'Network',
|
||||
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
|
||||
components: [
|
||||
ipv4SubnetCalculator,
|
||||
ipv4AddressConverter,
|
||||
ipv4RangeExpander,
|
||||
ipCidrToRange,
|
||||
macAddressLookup,
|
||||
macAddressGenerator,
|
||||
ipv6UlaGenerator,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Math',
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Binary } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Ipv4/6 CIDR to IP Range Calculator',
|
||||
path: '/ip-cidr-to-range',
|
||||
description: 'Calculate IP Range from a CIDR (IPv4/6)',
|
||||
keywords: ['ipv4', 'ipv6', 'cidr'],
|
||||
component: () => import('./ip-cidr-to-range.vue'),
|
||||
icon: Binary,
|
||||
createdAt: new Date('2024-01-10'),
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
<script setup lang="ts">
|
||||
import isCidr from 'is-cidr';
|
||||
import { expand } from 'cidr-tools';
|
||||
import { getIPNetworkType, parseAsCIDR } from '@/utils/ip';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
|
||||
const rawCIDR = useStorage('ip-cidr-to-range:cidr', '192.168.1.0/24'); // NOSONAR
|
||||
|
||||
const result = computed(() => {
|
||||
const parsedCIDR = parseAsCIDR(rawCIDR.value) || rawCIDR.value;
|
||||
const ips = expand(parsedCIDR);
|
||||
if (!ips || !ips.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
startIpAddress: ips.slice(0, 1)[0],
|
||||
endIpAddress: ips.slice(-1)[0],
|
||||
parsedCIDR,
|
||||
networkType: getIPNetworkType(ips.slice(0, 1)[0]) || 'Public',
|
||||
};
|
||||
});
|
||||
|
||||
const cidrValidation = useValidation({
|
||||
source: rawCIDR,
|
||||
rules: [{ message: 'Invalid ipv4/6 CIDR', validator: cidr => isCidr(parseAsCIDR(cidr) || cidr) }],
|
||||
});
|
||||
|
||||
const showResult = computed(() => cidrValidation.isValid && result.value !== undefined);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="rawCIDR"
|
||||
label="IPv4/6 CIDR (ie, 1.0.0.0/23 or 1.1.1.1/255.255.252.0 or 1.1.1.1-2.2.2.2 or 10.0.0.*)"
|
||||
placeholder="IPv4/6 CIDR (ie, 1.0.0.0/23 or 1.1.1.1/255.255.252.0 or 1.1.1.1-2.2.2.2 or 10.0.0.*)"
|
||||
:validation="cidrValidation"
|
||||
clearable
|
||||
/>
|
||||
|
||||
<c-card v-if="showResult" title="Resulting CIDR" mt-4>
|
||||
<input-copyable
|
||||
label="CIDR"
|
||||
label-position="left"
|
||||
label-width="150px"
|
||||
label-align="right"
|
||||
|
||||
:value="result?.parsedCIDR"
|
||||
disabled mb-2
|
||||
/>
|
||||
</c-card>
|
||||
|
||||
<c-card v-if="showResult" title="IPv4/6 range" mt-4>
|
||||
<input-copyable
|
||||
label="Start IP Address"
|
||||
label-position="left"
|
||||
label-width="150px"
|
||||
label-align="right"
|
||||
|
||||
:value="result?.startIpAddress"
|
||||
disabled mb-2
|
||||
/>
|
||||
<input-copyable
|
||||
label="End IP Address"
|
||||
label-position="left"
|
||||
label-width="150px"
|
||||
label-align="right"
|
||||
|
||||
:value="result?.endIpAddress"
|
||||
disabled mb-2
|
||||
/>
|
||||
|
||||
<input-copyable
|
||||
label="Network type"
|
||||
label-position="left"
|
||||
label-width="150px"
|
||||
label-align="right"
|
||||
|
||||
:value="result?.networkType"
|
||||
disabled mb-2
|
||||
/>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -151,7 +151,7 @@ function onSearchInput() {
|
||||
>
|
||||
<div flex-1 truncate>
|
||||
<slot name="displayed-value">
|
||||
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full lh-normal color-current @input="onSearchInput">
|
||||
<input v-if="searchable && isOpen" ref="searchInputRef" v-model="searchQuery" type="text" placeholder="Search..." class="search-input" w-full color-current lh-normal @input="onSearchInput">
|
||||
<span v-else-if="selectedOption" lh-normal>
|
||||
{{ selectedOption.label }}
|
||||
</span>
|
||||
|
||||
@@ -39,7 +39,7 @@ const headers = computed(() => {
|
||||
<template>
|
||||
<div class="relative overflow-x-auto rounded">
|
||||
<table class="w-full border-collapse text-left text-sm text-gray-500 dark:text-gray-400" role="table" :aria-label="description">
|
||||
<thead v-if="!hideHeaders" class="bg-#ffffff uppercase text-gray-700 dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
||||
<thead v-if="!hideHeaders" class="bg-#ffffff text-gray-700 uppercase dark:bg-#333333 dark:text-gray-400" border-b="1px solid dark:transparent #efeff5">
|
||||
<tr>
|
||||
<th v-for="header in headers" :key="header.key" scope="col" class="px-6 py-3 text-xs">
|
||||
{{ header.label }}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { getIPNetworkType, getNetworksCount, getSubnets, parseAsCIDR, to6to4Prefix, toARPA, toIPv4MappedAddress, toIPv4MappedAddressDecimal } from './ip';
|
||||
|
||||
describe('ipv4/6 util', () => {
|
||||
describe('parseAsCIDR', () => {
|
||||
it('returns cidr', () => {
|
||||
expect(parseAsCIDR('1.1.1.1/6')).to.eql('1.1.1.1/6'); // NOSONAR
|
||||
expect(parseAsCIDR('172.16.2.2/16')).to.eql('172.16.2.2/16'); // NOSONAR
|
||||
expect(parseAsCIDR('1a:b:c::d:e:f/ffff:ffff:f4ff:ffff:ffff:ff5f:ffff:ff00')).to.eql(undefined); // NOSONAR
|
||||
expect(parseAsCIDR('10.1.2.3/255.255.255.252')).to.eql('10.1.2.0/30'); // NOSONAR
|
||||
expect(parseAsCIDR('10.*.0.*')).to.eql(undefined); // NOSONAR
|
||||
expect(parseAsCIDR('10.1.0.*')).to.eql('10.1.0.0/24'); // NOSONAR
|
||||
expect(parseAsCIDR('10.2.*.*')).to.eql('10.2.0.0/16'); // NOSONAR
|
||||
expect(parseAsCIDR('a:b:0:8000::/ffff:ffff:ffff:8000::')).to.eql('a:b:0:8000::/49'); // NOSONAR
|
||||
expect(parseAsCIDR('::/::')).to.eql('::/0'); // NOSONAR
|
||||
expect(parseAsCIDR('10.20.30.64-10.20.30.127')).to.eql('10.20.30.64/26'); // NOSONAR
|
||||
expect(parseAsCIDR('10.0.128.0/255.0.128.0')).to.eql(undefined); // NOSONAR
|
||||
expect(parseAsCIDR('a::bc:1234/128')).to.eql('a::bc:1234/128'); // NOSONAR
|
||||
expect(parseAsCIDR('a::bc:ff00-a::bc:ff0f')).to.eql('a::bc:ff00/124'); // NOSONAR
|
||||
expect(parseAsCIDR('10.0.1.1/255.255.1.0')).to.eql(undefined); // NOSONAR
|
||||
expect(parseAsCIDR('10.0.0.0/255.255.0.0')).to.eql('10.0.0.0/16'); // NOSONAR
|
||||
});
|
||||
}); // NOSONAR
|
||||
describe('getSubnets', () => {
|
||||
it('returns subnets', () => {
|
||||
expect(getSubnets('1.1.1.1/1')).to.eql([ // NOSONAR
|
||||
'0.0.0.0/1', // NOSONAR
|
||||
'128.0.0.0/1', // NOSONAR
|
||||
]); // NOSONAR
|
||||
expect(getSubnets('1.1.1.1/6')).to.eql([ // NOSONAR
|
||||
'0.0.0.0/6', // NOSONAR
|
||||
'4.0.0.0/6', // NOSONAR
|
||||
'8.0.0.0/6', // NOSONAR
|
||||
'12.0.0.0/6', // NOSONAR
|
||||
'16.0.0.0/6', // NOSONAR
|
||||
'20.0.0.0/6', // NOSONAR
|
||||
'24.0.0.0/6', // NOSONAR
|
||||
'28.0.0.0/6', // NOSONAR
|
||||
'32.0.0.0/6', // NOSONAR
|
||||
'36.0.0.0/6', // NOSONAR
|
||||
'40.0.0.0/6', // NOSONAR
|
||||
'44.0.0.0/6', // NOSONAR
|
||||
'48.0.0.0/6', // NOSONAR
|
||||
'52.0.0.0/6', // NOSONAR
|
||||
'56.0.0.0/6', // NOSONAR
|
||||
'60.0.0.0/6', // NOSONAR
|
||||
'64.0.0.0/6', // NOSONAR
|
||||
'68.0.0.0/6', // NOSONAR
|
||||
'72.0.0.0/6', // NOSONAR
|
||||
'76.0.0.0/6', // NOSONAR
|
||||
'80.0.0.0/6', // NOSONAR
|
||||
'84.0.0.0/6', // NOSONAR
|
||||
'88.0.0.0/6', // NOSONAR
|
||||
'92.0.0.0/6', // NOSONAR
|
||||
'96.0.0.0/6', // NOSONAR
|
||||
'100.0.0.0/6', // NOSONAR
|
||||
'104.0.0.0/6', // NOSONAR
|
||||
'108.0.0.0/6', // NOSONAR
|
||||
'112.0.0.0/6', // NOSONAR
|
||||
'116.0.0.0/6', // NOSONAR
|
||||
'120.0.0.0/6', // NOSONAR
|
||||
'124.0.0.0/6', // NOSONAR
|
||||
'128.0.0.0/6', // NOSONAR
|
||||
'132.0.0.0/6', // NOSONAR
|
||||
'136.0.0.0/6', // NOSONAR
|
||||
'140.0.0.0/6', // NOSONAR
|
||||
'144.0.0.0/6', // NOSONAR
|
||||
'148.0.0.0/6', // NOSONAR
|
||||
'152.0.0.0/6', // NOSONAR
|
||||
'156.0.0.0/6', // NOSONAR
|
||||
'160.0.0.0/6', // NOSONAR
|
||||
'164.0.0.0/6', // NOSONAR
|
||||
'168.0.0.0/6', // NOSONAR
|
||||
'172.0.0.0/6', // NOSONAR
|
||||
'176.0.0.0/6', // NOSONAR
|
||||
'180.0.0.0/6', // NOSONAR
|
||||
'184.0.0.0/6', // NOSONAR
|
||||
'188.0.0.0/6', // NOSONAR
|
||||
'192.0.0.0/6', // NOSONAR
|
||||
'196.0.0.0/6', // NOSONAR
|
||||
'200.0.0.0/6', // NOSONAR
|
||||
'204.0.0.0/6', // NOSONAR
|
||||
'208.0.0.0/6', // NOSONAR
|
||||
'212.0.0.0/6', // NOSONAR
|
||||
'216.0.0.0/6', // NOSONAR
|
||||
'220.0.0.0/6', // NOSONAR
|
||||
'224.0.0.0/6', // NOSONAR
|
||||
'228.0.0.0/6', // NOSONAR
|
||||
'232.0.0.0/6', // NOSONAR
|
||||
'236.0.0.0/6', // NOSONAR
|
||||
'240.0.0.0/6', // NOSONAR
|
||||
'244.0.0.0/6', // NOSONAR
|
||||
'248.0.0.0/6', // NOSONAR
|
||||
'252.0.0.0/6', // NOSONAR
|
||||
]); // NOSONAR
|
||||
expect(getSubnets('1.1.1.1/8')).to.eql([]); // NOSONAR
|
||||
expect(getSubnets('1.1.1.1/11')).to.eql([ // NOSONAR
|
||||
'1.0.0.0/11', // NOSONAR
|
||||
'1.32.0.0/11', // NOSONAR
|
||||
'1.64.0.0/11', // NOSONAR
|
||||
'1.96.0.0/11', // NOSONAR
|
||||
'1.128.0.0/11', // NOSONAR
|
||||
'1.160.0.0/11', // NOSONAR
|
||||
'1.192.0.0/11', // NOSONAR
|
||||
'1.224.0.0/11', // NOSONAR
|
||||
]); // NOSONAR
|
||||
expect(getSubnets('172.16.2.2/16')).to.eql([]); // NOSONAR
|
||||
expect(getSubnets('172.16.2.2/26')).to.eql([ // NOSONAR
|
||||
'172.16.2.0/26', // NOSONAR
|
||||
'172.16.2.64/26', // NOSONAR
|
||||
'172.16.2.128/26', // NOSONAR
|
||||
'172.16.2.192/26', // NOSONAR
|
||||
]); // NOSONAR
|
||||
expect(getSubnets('172.16.2.2/31').length).to.eql(128); // NOSONAR
|
||||
expect(getSubnets('255.255.255.0/32')).to.eql([]); // NOSONAR
|
||||
expect(getSubnets('2001:db8:0:85a3::ac1f:8001/62')).to.eql([]); // NOSONAR
|
||||
expect(getSubnets('2001:db8:0:85a3:0:0:ac1f:8001/62')).to.eql([]); // NOSONAR
|
||||
expect(getSubnets('2001:db8:0:85a3::ac1f:8001/112')).to.eql([]); // NOSONAR
|
||||
expect(getSubnets('2001:db8:0:85a3:0:0:ac1f:8001/112')).to.eql([]); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
describe('getNetworksCount', () => {
|
||||
it('returns networks count', () => {
|
||||
expect(getNetworksCount('1.1.1.1/1')).to.eql(2); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/2')).to.eql(4); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/3')).to.eql(8); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/4')).to.eql(16); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/5')).to.eql(32); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/6')).to.eql(64); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/7')).to.eql(128); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/8')).to.eql(0); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/9')).to.eql(2); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/10')).to.eql(4); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/11')).to.eql(8); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/12')).to.eql(16); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/13')).to.eql(32); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/14')).to.eql(64); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/15')).to.eql(128); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/16')).to.eql(0); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/17')).to.eql(2); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/18')).to.eql(4); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/19')).to.eql(8); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/20')).to.eql(16); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/21')).to.eql(32); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/22')).to.eql(64); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/23')).to.eql(128); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/24')).to.eql(0); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/25')).to.eql(2); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/26')).to.eql(4); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/27')).to.eql(8); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/28')).to.eql(16); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/29')).to.eql(32); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/30')).to.eql(64); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/31')).to.eql(128); // NOSONAR
|
||||
expect(getNetworksCount('1.1.1.1/32')).to.eql(0); // NOSONAR
|
||||
expect(getNetworksCount('2001:db8:0:85a3::ac1f:8001/32')).to.eql(4294967296n); // NOSONAR
|
||||
expect(getNetworksCount('2001:db8:0:85a3::ac1f:8001/42')).to.eql(4194304n); // NOSONAR
|
||||
expect(getNetworksCount('2001:db8:0:85a3:0:0:ac1f:8001/62')).to.eql(4n); // NOSONAR
|
||||
expect(getNetworksCount('2001:db8:0:85a3::ac1f:8001/112')).to.eql(-1); // NOSONAR
|
||||
expect(getNetworksCount('2001:db8:0:85a3:0:0:ac1f:8001/122')).to.eql(-1); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
describe('getIPNetworkType', () => {
|
||||
it('returns network type', () => {
|
||||
expect(getIPNetworkType('1.1.1.1')).to.eql('Public'); // NOSONAR
|
||||
expect(getIPNetworkType('10.10.1.1')).to.eql('Private Use'); // NOSONAR
|
||||
expect(getIPNetworkType('172.16.0.1')).to.eql('Private Use'); // NOSONAR
|
||||
expect(getIPNetworkType('192.168.1.1')).to.eql('Private Use'); // NOSONAR
|
||||
expect(getIPNetworkType('255.255.255.0')).to.eql('Reserved'); // NOSONAR
|
||||
expect(getIPNetworkType('224.0.0.1')).to.eql('Multicast'); // NOSONAR
|
||||
expect(getIPNetworkType('198.51.100.1')).to.eql('Documentation (TEST-NET-2)'); // NOSONAR
|
||||
expect(getIPNetworkType('198.18.0.1')).to.eql('Benchmarking'); // NOSONAR
|
||||
expect(getIPNetworkType('169.254.0.1')).to.eql('Link Local'); // NOSONAR
|
||||
expect(getIPNetworkType('127.0.0.1')).to.eql('Loopback'); // NOSONAR
|
||||
expect(getIPNetworkType('2001:db8:8:4::2')).to.eql('Documentation'); // NOSONAR
|
||||
expect(getIPNetworkType('FF02::2')).to.eql('Multicast address'); // NOSONAR
|
||||
expect(getIPNetworkType('2345:0425:2CA1:0000:0000:0567:5673:23b5')).to.eql('Public'); // NOSONAR
|
||||
expect(getIPNetworkType('fdf8:f53b:82e4::53')).to.eql('Unique-Local'); // NOSONAR
|
||||
expect(getIPNetworkType('::ffff:192.0.2.47')).to.eql('IPv4-mapped Address'); // NOSONAR
|
||||
expect(getIPNetworkType('::ffff:ac12:0a09')).to.eql('IPv4-mapped Address'); // NOSONAR
|
||||
expect(getIPNetworkType('::1')).to.eql('Loopback Address'); // NOSONAR
|
||||
expect(getIPNetworkType('fe80::200:5aee:feaa:20a2')).to.eql('Link-Local Unicast'); // NOSONAR
|
||||
expect(getIPNetworkType('2001:0002::6c::430')).to.eql('Benchmarking'); // NOSONAR
|
||||
expect(getIPNetworkType('2001:0000:4136:e378:8000:63bf:3fff:fdd2')).to.eql('TEREDO'); // NOSONAR
|
||||
expect(getIPNetworkType('2002:cb0a:3cdd:1::1')).to.eql('6to4'); // NOSONAR
|
||||
expect(getIPNetworkType('ff01:0:0:0:0:0:0:2')).to.eql('Multicast address'); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
|
||||
describe('toARPA', () => {
|
||||
it('returns ARPA address', () => {
|
||||
expect(toARPA('1.1.1.1')).to.eql('1.1.1.1.in-addr.arpa'); // NOSONAR
|
||||
expect(toARPA('10.10.1.1')).to.eql('1.1.10.10.in-addr.arpa'); // NOSONAR
|
||||
expect(toARPA('192.168.1.1')).to.eql('1.1.168.192.in-addr.arpa'); // NOSONAR
|
||||
expect(toARPA('255.255.255.0')).to.eql('0.255.255.255.in-addr.arpa'); // NOSONAR
|
||||
expect(toARPA('FF02::2')).to.eql('2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.f.f.ip6.arpa.'); // NOSONAR
|
||||
expect(toARPA('2345:0425:2CA1:0000:0000:0567:5673:23b5')).to.eql('5.b.3.2.3.7.6.5.7.6.5.0.0.0.0.0.0.0.0.0.1.a.c.2.5.2.4.0.5.4.3.2.ip6.arpa.'); // NOSONAR
|
||||
expect(toARPA('fdf8:f53b:82e4::53')).to.eql('3.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.4.e.2.8.b.3.5.f.8.f.d.f.ip6.arpa.'); // NOSONAR
|
||||
expect(toARPA('::ffff:192.0.2.47')).to.eql('f.2.2.0.0.0.0.c.f.f.f.f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.'); // NOSONAR
|
||||
expect(toARPA('::1')).to.eql('1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa.'); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
describe('toIPv4MappedAddress', () => {
|
||||
it('returns IPv4MappedAddress', () => {
|
||||
expect(toIPv4MappedAddress('1.1.1.1')).to.eql('::ffff:0101:0101'); // NOSONAR
|
||||
expect(toIPv4MappedAddress('10.10.1.1')).to.eql('::ffff:0a0a:0101'); // NOSONAR
|
||||
expect(toIPv4MappedAddress('172.18.10.9')).to.eql('::ffff:ac12:0a09'); // NOSONAR
|
||||
expect(toIPv4MappedAddress('192.168.1.1')).to.eql('::ffff:c0a8:0101'); // NOSONAR
|
||||
expect(toIPv4MappedAddress('255.255.255.0')).to.eql('::ffff:ffff:ff00'); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
describe('toIPv4MappedAddressDecimal', () => {
|
||||
it('returns networks count', () => {
|
||||
expect(toIPv4MappedAddressDecimal('1.1.1.1')).to.eql('::ffff:1.1.1.1'); // NOSONAR
|
||||
expect(toIPv4MappedAddressDecimal('10.10.1.1')).to.eql('::ffff:10.10.1.1'); // NOSONAR
|
||||
expect(toIPv4MappedAddressDecimal('192.168.1.1')).to.eql('::ffff:192.168.1.1'); // NOSONAR
|
||||
expect(toIPv4MappedAddressDecimal('172.18.10.9')).to.eql('::ffff:172.18.10.9'); // NOSONAR
|
||||
expect(toIPv4MappedAddressDecimal('255.255.255.0')).to.eql('::ffff:255.255.255.0'); // NOSONAR
|
||||
expect(toIPv4MappedAddressDecimal('2001:db8:0:85a3::ac1f:8001')).to.eql(''); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
describe('to6to4Prefix', () => {
|
||||
it('returns networks count', () => {
|
||||
expect(to6to4Prefix('1.1.1.1')).to.eql('2002:01:0:1:01:01::/48'); // NOSONAR
|
||||
expect(to6to4Prefix('10.10.1.1')).to.eql('2002:0a:0:a:01:01::/48'); // NOSONAR
|
||||
expect(to6to4Prefix('172.18.10.9')).to.eql('2002:ac:1:2:0a:09::/48'); // NOSONAR
|
||||
expect(to6to4Prefix('192.168.1.1')).to.eql('2002:c0:a:8:01:01::/48'); // NOSONAR
|
||||
expect(to6to4Prefix('255.255.255.0')).to.eql('2002:ff:f:f:ff:00::/48'); // NOSONAR
|
||||
expect(to6to4Prefix('2001:db8:0:85a3::ac1f:8001')).to.eql(''); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
}); // NOSONAR
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
import { isIPv4 } from 'is-ip';
|
||||
import { Address4, Address6 } from 'ip-address';
|
||||
import { contains as containsCidr } from 'cidr-tools';
|
||||
import type { IPMatch } from 'ip-matching';
|
||||
import { IPMask, IPSubnetwork, getMatch } from 'ip-matching';
|
||||
import isCidr from 'is-cidr';
|
||||
import ipv4registry from './ipv4registry.json';
|
||||
import ipv6registry from './ipv6registry.json';
|
||||
|
||||
const IPv4MAX = (BigInt(2) ** BigInt(32)) - BigInt(1);
|
||||
|
||||
// IP range specific information, see IANA allocations.
|
||||
// http://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
|
||||
const _ipv4Registry = new Map(ipv4registry.map(v => [v[0] as string, v[1]]));
|
||||
|
||||
// https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
|
||||
const _ipv6Registry = new Map(ipv6registry.map(v => [v[0] as string, v[1]]));
|
||||
|
||||
export function parseAsCIDR(form: string) {
|
||||
if (isCidr(form)) {
|
||||
return form;
|
||||
}
|
||||
|
||||
const ipMatch: IPMatch = getMatch(form);
|
||||
if (ipMatch instanceof IPSubnetwork) {
|
||||
return (ipMatch as IPSubnetwork).toString();
|
||||
}
|
||||
if (ipMatch instanceof IPMask) {
|
||||
return (ipMatch as IPMask).convertToSubnet()?.toString();
|
||||
}
|
||||
return (ipMatch.convertToMasks() || [])[0]?.convertToSubnet()?.toString();
|
||||
}
|
||||
|
||||
export function getSubnets(cidr: string) {
|
||||
const [address, prefix] = cidr.split('/');
|
||||
if (isIPv4(address)) {
|
||||
const prefix4Int = Number(prefix || '32');
|
||||
const getMask = (prefix: number) => (IPv4MAX >> (BigInt(32) - BigInt(prefix))) << (BigInt(32) - BigInt(prefix));
|
||||
const bigInt = BigInt((new Address4(address)).bigInteger());
|
||||
|
||||
const subnets = [];
|
||||
let startNetwork;
|
||||
if (prefix4Int < 8) {
|
||||
startNetwork = 0;
|
||||
}
|
||||
if (prefix4Int % 8 === 0) {
|
||||
return [];
|
||||
}
|
||||
startNetwork = bigInt & getMask(prefix4Int);
|
||||
const increment = BigInt(2) ** BigInt(32 - prefix4Int);
|
||||
const netCount = getNetworksCount(cidr);
|
||||
for (let netIndex = 0; netIndex < netCount; netIndex += 1) {
|
||||
const netAddr = Address4.fromBigInteger(startNetwork.toString()).correctForm();
|
||||
subnets.push(`${netAddr}/${prefix4Int}`);
|
||||
startNetwork += increment;
|
||||
}
|
||||
return subnets;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
export function getNetworksCount(cidr: string) {
|
||||
const [address, prefix] = cidr.split('/');
|
||||
if (isIPv4(address)) {
|
||||
const prefix4Int = Number(prefix || '32');
|
||||
|
||||
if (prefix4Int % 8 === 0) {
|
||||
return 0;
|
||||
}
|
||||
else if (prefix4Int < 8) {
|
||||
return 2 ** prefix4Int;
|
||||
}
|
||||
else if (prefix4Int < 16) {
|
||||
return 2 ** (prefix4Int - 8);
|
||||
}
|
||||
else if (prefix4Int < 24) {
|
||||
return 2 ** (prefix4Int - 16);
|
||||
}
|
||||
else {
|
||||
return 2 ** (prefix4Int - 24);
|
||||
}
|
||||
}
|
||||
|
||||
const prefix6Int = Number(prefix || '128');
|
||||
return prefix6Int <= 64 ? (BigInt(2) ** BigInt(64n - BigInt(prefix6Int))) : -1;
|
||||
}
|
||||
|
||||
export function getIPNetworkType(address: string) {
|
||||
const results = [];
|
||||
for (const [addr, info] of (isIPv4(address) ? _ipv4Registry : _ipv6Registry).entries()) {
|
||||
const found = containsCidr([`${addr}/${Number(info[0])}`], address);
|
||||
if (found) {
|
||||
results.unshift(info[1]);
|
||||
}
|
||||
}
|
||||
return results.length === 0 ? 'Public' : results[0]?.toString();
|
||||
}
|
||||
|
||||
export function toARPA(address: string) {
|
||||
if (isIPv4(address)) {
|
||||
const bigInt = BigInt((new Address4(address)).bigInteger());
|
||||
const reverseIP = (
|
||||
[(bigInt & BigInt(255)), (bigInt >> BigInt(8) & BigInt(255)),
|
||||
(bigInt >> BigInt(16) & BigInt(255)),
|
||||
(bigInt >> BigInt(24) & BigInt(255)),
|
||||
].join('.')
|
||||
);
|
||||
return `${reverseIP}.in-addr.arpa`;
|
||||
}
|
||||
|
||||
return (new Address6(address)).reverseForm();
|
||||
}
|
||||
|
||||
export function toIPv4MappedAddress(address: string) {
|
||||
if (!isIPv4(address)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const hexIP = (new Address4(address)).toHex().replace(/:/g, '');
|
||||
return `::ffff:${hexIP.substring(0, 4)}:${hexIP.substring(4)}`;
|
||||
}
|
||||
|
||||
export function toIPv4MappedAddressDecimal(address: string) {
|
||||
if (!isIPv4(address)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return `::ffff:${address}`;
|
||||
}
|
||||
|
||||
export function to6to4Prefix(address: string) {
|
||||
if (!isIPv4(address)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const hexIP = (new Address4(address)).toHex();
|
||||
return `2002:${hexIP.substring(0, 4)}:${hexIP.substring(4)}::/48`;
|
||||
}
|
||||
|
||||
export function toMicrosoftTranscription(address: string) {
|
||||
if (!isIPv4(address)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (new Address6(address)).microsoftTranscription();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
[
|
||||
["0.0.0.0", [8, "This host on this network"]],
|
||||
["10.0.0.0", [8, "Private Use"]],
|
||||
["100.64.0.0", [10, "Shared Address Space"]],
|
||||
["127.0.0.0", [8, "Loopback"]],
|
||||
["169.254.0.0", [16, "Link Local"]],
|
||||
["172.16.0.0", [12, "Private Use"]],
|
||||
["192.0.0.0", [24, "IETF Protocol Assignments"]],
|
||||
["192.0.0.0", [29, "IPv4 Service Continuity Prefix"]],
|
||||
["192.0.0.8", [32, "IPv4 dummy address"]],
|
||||
["192.0.0.9", [32, "Port Control Protocol Anycast"]],
|
||||
["192.0.0.10", [32, "Traversal Using Relays around NAT Anycast"]],
|
||||
["192.0.0.170", [32, "NAT64/DNS64 Discovery"]],
|
||||
["192.0.0.171", [32, "NAT64/DNS64 Discovery"]],
|
||||
["192.0.2.0", [24, "Documentation (TEST-NET-1)"]],
|
||||
["192.31.196.0", [24, "AS112-v4"]],
|
||||
["192.52.193.0", [24, "AMT"]],
|
||||
["192.88.99.0", [24, "Deprecated (6to4 Relay Anycast)"]],
|
||||
["192.168.0.0", [16, "Private Use"]],
|
||||
["192.175.48.0", [24, "Direct Delegation AS112 Service"]],
|
||||
["198.18.0.0", [15, "Benchmarking"]],
|
||||
["198.51.100.0", [24, "Documentation (TEST-NET-2)"]],
|
||||
["203.0.113.0", [24, "Documentation (TEST-NET-3)"]],
|
||||
["224.0.0.0", [24, "Multicast"]],
|
||||
["240.0.0.0", [4, "Reserved"]],
|
||||
["255.255.255.255", [32, "Limited Broadcast"]]
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
[
|
||||
["::1", [128, "Loopback Address"]],
|
||||
["::", [128, "Unspecified Address"]],
|
||||
["::ffff::", [96, "IPv4-mapped Address"]],
|
||||
["64:ff9b::", [96, "IPv4-IPv6 Translat."]],
|
||||
["64:ff9b:1::", [48, "IPv4-IPv6 Translat."]],
|
||||
["100::", [64, "Discard-Only Address Block"]],
|
||||
["2001::", [23, "IETF Protocol Assignments"]],
|
||||
["2001::", [32, "TEREDO"]],
|
||||
["2001:1::1", [128, "Port Control Protocol Anycast"]],
|
||||
["2001:1::2", [128, "Traversal Using Relays around NAT Anycast"]],
|
||||
["2001:2::", [48, "Benchmarking"]],
|
||||
["2001:3::", [32, "AMT"]],
|
||||
["2001:4:112::", [48, "AS112-v6"]],
|
||||
["2001:5::", [32, "EID Space for LISP (Managed by RIPE NCC)"]],
|
||||
["2001:10::", [28, "Deprecated (previously ORCHID)"]],
|
||||
["2001:20::", [28, "ORCHIDv2"]],
|
||||
["2001:db8::", [32, "Documentation"]],
|
||||
["2002::", [16, "6to4"]],
|
||||
["2620:4f:8000::", [48, "Direct Delegation AS112 Service"]],
|
||||
["fc00::", [7, "Unique-Local"]],
|
||||
["fe80::", [10, "Link-Local Unicast"]],
|
||||
["ff00::", [8, "Multicast address"]]
|
||||
]
|
||||
Reference in new issue
Block a user