Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(new tool): IPv4/6 Range To CIDR #869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ declare module '@vue/runtime-core' {
IconMdiVideo: typeof import('~icons/mdi/video')['default']
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
IpRangeToCidr: typeof import('./src/tools/ip-range-to-cidr/ip-range-to-cidr.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']
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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",
Expand All @@ -62,6 +63,11 @@
"highlight.js": "^11.7.0",
"iarna-toml-esm": "^3.0.5",
"ibantools": "^4.3.3",
"ip-address": "^9.0.5",
"ip-bigint": "^8.0.2",
"ip-cidr": "^4.0.0",
"is-cidr": "^5.0.3",
"is-ip": "^5.0.1",
"json5": "^2.2.3",
"jwt-decode": "^3.1.2",
"libphonenumber-js": "^1.10.28",
Expand Down
120 changes: 117 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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 ipRangeToCidr } from './ip-range-to-cidr';

export const toolsByCategory: ToolCategory[] = [
{
Expand Down Expand Up @@ -147,7 +148,15 @@ export const toolsByCategory: ToolCategory[] = [
},
{
name: 'Network',
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
components: [
ipv4SubnetCalculator,
ipv4AddressConverter,
ipv4RangeExpander,
ipRangeToCidr,
macAddressLookup,
macAddressGenerator,
ipv6UlaGenerator,
],
},
{
name: 'Math',
Expand Down
12 changes: 12 additions & 0 deletions src/tools/ip-range-to-cidr/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Binary } from '@vicons/tabler';
import { defineTool } from '../tool';

export const tool = defineTool({
name: 'IPv4/6 Range to CIDR(s) Calculator',
path: '/ip-range-to-cidr',
description: 'Calculate CIDR(s) from an IP Range (IPv4/6)',
keywords: ['ip', 'range', 'to', 'cidr'],
component: () => import('./ip-range-to-cidr.vue'),
icon: Binary,
createdAt: new Date('2024-01-10'),
});
17 changes: 17 additions & 0 deletions src/tools/ip-range-to-cidr/ip-bigint.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
declare module 'ip-bigint' {
type IPInfo = {
number: bigint;
version: number;
ipv4mapped?: boolean;
scopeid?:string;
};
type StringifyOptions = {
compress?:boolean;
hexify?:boolean;
};

export function normalizeIp(ip: string, options: StringifyOptions = {compress = true, hexify = false} = {})
export function stringifyIp(ip: IPInfo, options: StringifyOptions = {compress = true, hexify = false}): string;
export function ipVersion(ip: string): number;
export function parseIp(ip): IPInfo;
}
Loading
Loading