mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-12-06 11:12:56 +03:00
Split into seperate pages, with working global styles which still need a bllody good refactor
This commit is contained in:
1 parent
6b9e58cfe9
commit
ce71f95ae3
29 files changed
+2386
-1185
No files matched your search
@@ -1,613 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cidrToMask, maskToCidr } from '$lib/utils/ip-calculations.js';
|
||||
import { validateSubnetMask } from '$lib/utils/ip-validation.js';
|
||||
import { COMMON_SUBNETS } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
|
||||
let cidrValue = $state(24);
|
||||
let maskValue = $state('255.255.255.0');
|
||||
let selectedTab = $state<'cidr-to-mask' | 'mask-to-cidr'>('cidr-to-mask');
|
||||
|
||||
/**
|
||||
* Converts CIDR to mask when CIDR input changes
|
||||
*/
|
||||
$effect(() => {
|
||||
if (selectedTab === 'cidr-to-mask') {
|
||||
const mask = cidrToMask(cidrValue);
|
||||
maskValue = mask.octets.join('.');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Converts mask to CIDR when mask input changes
|
||||
*/
|
||||
function handleMaskChange(event: Event) {
|
||||
const target = event.target as HTMLInputElement;
|
||||
maskValue = target.value;
|
||||
|
||||
if (validateSubnetMask(maskValue).valid) {
|
||||
cidrValue = maskToCidr(maskValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets subnet information for current values
|
||||
*/
|
||||
function getSubnetInfo(cidr: number) {
|
||||
const subnet = COMMON_SUBNETS.find(s => s.cidr === cidr);
|
||||
return subnet || { cidr, mask: cidrToMask(cidr).octets.join('.'), hosts: Math.pow(2, 32 - cidr) - 2 };
|
||||
}
|
||||
|
||||
let subnetInfo = $derived(getSubnetInfo(cidrValue));
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>CIDR ↔ Subnet Mask Converter</h2>
|
||||
<p>Convert between CIDR notation and subnet mask formats.</p>
|
||||
</header>
|
||||
|
||||
<!-- Tab Navigation -->
|
||||
<div class="tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="tab {selectedTab === 'cidr-to-mask' ? 'active' : ''}"
|
||||
onclick={() => selectedTab = 'cidr-to-mask'}
|
||||
>
|
||||
CIDR → Subnet Mask
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="tab {selectedTab === 'mask-to-cidr' ? 'active' : ''}"
|
||||
onclick={() => selectedTab = 'mask-to-cidr'}
|
||||
>
|
||||
Subnet Mask → CIDR
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- CIDR to Mask Tab -->
|
||||
{#if selectedTab === 'cidr-to-mask'}
|
||||
<div class="converter-section fade-in">
|
||||
<!-- CIDR Input -->
|
||||
<div class="form-group">
|
||||
<Tooltip text="Drag slider to adjust CIDR prefix length - higher values create smaller subnets" position="right">
|
||||
<label for="cidr-slider" class="slider-label">
|
||||
CIDR Prefix Length: /{cidrValue}
|
||||
</label>
|
||||
</Tooltip>
|
||||
<div class="slider-container">
|
||||
<input
|
||||
id="cidr-slider"
|
||||
type="range"
|
||||
min="0"
|
||||
max="32"
|
||||
bind:value={cidrValue}
|
||||
class="cidr-slider"
|
||||
/>
|
||||
<div class="slider-markers">
|
||||
<span>0</span>
|
||||
<span>8</span>
|
||||
<span>16</span>
|
||||
<span>24</span>
|
||||
<span>32</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Result Display -->
|
||||
<div class="result-display info">
|
||||
<div class="result-content">
|
||||
<span class="result-label">Subnet Mask</span>
|
||||
<span class="result-value">
|
||||
{maskValue}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Mask to CIDR Tab -->
|
||||
{#if selectedTab === 'mask-to-cidr'}
|
||||
<div class="converter-section fade-in">
|
||||
<!-- Mask Input -->
|
||||
<div class="form-group">
|
||||
<label for="mask-input">Subnet Mask</label>
|
||||
<input
|
||||
id="mask-input"
|
||||
type="text"
|
||||
value={maskValue}
|
||||
placeholder="255.255.255.0"
|
||||
class="mask-input"
|
||||
oninput={handleMaskChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Result Display -->
|
||||
<div class="result-display success">
|
||||
<div class="result-content">
|
||||
<span class="result-label">CIDR Notation</span>
|
||||
<span class="result-value">
|
||||
/{cidrValue}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Subnet Information -->
|
||||
<section class="info-panel">
|
||||
<h3>Subnet Information</h3>
|
||||
<div class="grid grid-3">
|
||||
<Tooltip text="Number of bits used for network identification - higher values create smaller, more specific subnets" position="top">
|
||||
<div class="info-metric">
|
||||
<span class="info-label">Network Bits</span>
|
||||
<span class="metric-value info">{cidrValue}</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip text="Number of bits available for host addresses - more host bits allow for more devices" position="top">
|
||||
<div class="info-metric">
|
||||
<span class="info-label">Host Bits</span>
|
||||
<span class="metric-value info">{32 - cidrValue}</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip text="Number of IP addresses available for devices (excludes network and broadcast addresses)" position="top">
|
||||
<div class="info-metric">
|
||||
<span class="info-label">Usable Hosts</span>
|
||||
<span class="metric-value success">
|
||||
{(subnetInfo.hosts).toLocaleString()}
|
||||
</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Common Subnets Reference -->
|
||||
<section class="common-subnets-section">
|
||||
<h3>Common Subnets</h3>
|
||||
<div class="subnets-grid">
|
||||
{#each COMMON_SUBNETS as subnet}
|
||||
<Tooltip text="Click to select this common subnet configuration" position="top">
|
||||
<button
|
||||
type="button"
|
||||
class="subnet-card {cidrValue === subnet.cidr ? 'active' : ''}"
|
||||
onclick={() => cidrValue = subnet.cidr}
|
||||
aria-label="Select /{subnet.cidr} subnet with {subnet.hosts.toLocaleString()} hosts"
|
||||
>
|
||||
<div class="subnet-info">
|
||||
<div class="subnet-cidr">
|
||||
<span class="cidr-notation">/{subnet.cidr}</span>
|
||||
<span class="subnet-mask">{subnet.mask}</span>
|
||||
</div>
|
||||
<span class="host-count">{subnet.hosts.toLocaleString()} hosts</span>
|
||||
</div>
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Explainer Section -->
|
||||
<section class="explainer-section">
|
||||
<h3>Understanding CIDR and Subnet Masks</h3>
|
||||
|
||||
<div class="explainer-grid">
|
||||
<div class="explainer-card">
|
||||
<h4>CIDR Notation</h4>
|
||||
<p>CIDR (Classless Inter-Domain Routing) uses a slash followed by a number (e.g., /24) to indicate how many bits are used for the network portion of an IP address.</p>
|
||||
</div>
|
||||
|
||||
<div class="explainer-card">
|
||||
<h4>Subnet Mask</h4>
|
||||
<p>A 32-bit number that masks an IP address to divide it into network and host portions. Written in dotted decimal notation (e.g., 255.255.255.0).</p>
|
||||
</div>
|
||||
|
||||
<div class="explainer-card">
|
||||
<h4>Network Bits</h4>
|
||||
<p>The leftmost bits in an IP address that identify the network. More network bits mean smaller subnets with fewer available host addresses.</p>
|
||||
</div>
|
||||
|
||||
<div class="explainer-card">
|
||||
<h4>Host Bits</h4>
|
||||
<p>The remaining bits used for host addresses within the network. More host bits allow for more devices but fewer possible subnets.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="conversion-examples">
|
||||
<h4>Common Conversions</h4>
|
||||
<div class="examples-grid">
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/24</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.0</span>
|
||||
<span class="example-desc">254 hosts</span>
|
||||
</div>
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/25</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.128</span>
|
||||
<span class="example-desc">126 hosts</span>
|
||||
</div>
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/26</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.192</span>
|
||||
<span class="example-desc">62 hosts</span>
|
||||
</div>
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/30</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.252</span>
|
||||
<span class="example-desc">2 hosts</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tips-box">
|
||||
<h4>🔧 Usage Tips</h4>
|
||||
<ul>
|
||||
<li><strong>Smaller CIDR = Bigger Network:</strong> /16 has more hosts than /24</li>
|
||||
<li><strong>Binary Thinking:</strong> Each bit doubles or halves the number of addresses</li>
|
||||
<li><strong>/30 for Links:</strong> Perfect for point-to-point connections (only 2 usable IPs)</li>
|
||||
<li><strong>Planning:</strong> Start with larger subnets and subdivide as needed</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.converter-section {
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
.slider-label {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.slider-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.cidr-slider {
|
||||
width: 100%;
|
||||
height: 0.5rem;
|
||||
background-color: var(--bg-tertiary);
|
||||
border-radius: var(--radius-lg);
|
||||
appearance: none;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.cidr-slider::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
height: 1.25rem;
|
||||
width: 1.25rem;
|
||||
border-radius: 50%;
|
||||
background: var(--color-primary);
|
||||
cursor: pointer;
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: transform var(--transition-fast);
|
||||
}
|
||||
|
||||
.cidr-slider::-webkit-slider-thumb:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.cidr-slider::-moz-range-thumb {
|
||||
height: 1.25rem;
|
||||
width: 1.25rem;
|
||||
border-radius: 50%;
|
||||
background: var(--color-primary);
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: transform var(--transition-fast);
|
||||
}
|
||||
|
||||
.cidr-slider::-moz-range-thumb:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.slider-markers {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
margin-top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.mask-input {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
.result-display {
|
||||
padding: var(--spacing-md);
|
||||
border-radius: var(--radius-lg);
|
||||
margin-top: var(--spacing-md);
|
||||
}
|
||||
|
||||
.result-display.info {
|
||||
background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
|
||||
border: 1px solid var(--color-info);
|
||||
}
|
||||
|
||||
.result-display.success {
|
||||
background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
|
||||
border: 1px solid var(--color-success);
|
||||
}
|
||||
|
||||
.result-content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.result-label {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.result-value {
|
||||
display: block;
|
||||
font-size: var(--font-size-2xl);
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.info-panel {
|
||||
margin-top: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.info-metric {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.info-metric .info-label {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.common-subnets-section {
|
||||
margin-top: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.subnets-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: var(--spacing-sm);
|
||||
margin-top: var(--spacing-md);
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.subnet-card {
|
||||
padding: var(--spacing-sm);
|
||||
text-align: left;
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
transition: all var(--transition-fast);
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.subnet-card:hover {
|
||||
background-color: var(--surface-hover);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.subnet-card.active {
|
||||
background-color: var(--surface-hover);
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
.subnet-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.subnet-cidr {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.cidr-notation {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 700;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.subnet-mask {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.host-count {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.subnet-info {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.host-count {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.explainer-section {
|
||||
margin-top: var(--spacing-xl);
|
||||
padding: var(--spacing-lg);
|
||||
background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--border-secondary);
|
||||
}
|
||||
|
||||
.explainer-section h3 {
|
||||
margin-bottom: var(--spacing-lg);
|
||||
text-align: center;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.explainer-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
margin-bottom: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.explainer-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
transition: all var(--transition-fast);
|
||||
}
|
||||
|
||||
.explainer-card:hover {
|
||||
border-color: color-mix(in srgb, var(--color-primary) 33%, transparent);
|
||||
box-shadow: var(--shadow-md);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.explainer-card h4 {
|
||||
color: var(--color-primary);
|
||||
font-size: var(--font-size-md);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.explainer-card p {
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.conversion-examples {
|
||||
margin-bottom: var(--spacing-lg);
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-primary);
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-primary);
|
||||
}
|
||||
|
||||
.conversion-examples h4 {
|
||||
color: var(--color-info-light);
|
||||
margin-bottom: var(--spacing-md);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.examples-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.example-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--bg-secondary);
|
||||
border-radius: var(--radius-sm);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.example-cidr {
|
||||
color: var(--color-info-light);
|
||||
font-weight: 700;
|
||||
min-width: 2rem;
|
||||
}
|
||||
|
||||
.example-arrow {
|
||||
color: var(--text-secondary);
|
||||
margin: 0 var(--spacing-xs);
|
||||
}
|
||||
|
||||
.example-mask {
|
||||
color: var(--color-success-light);
|
||||
font-weight: 600;
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.example-desc {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
min-width: 4rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tips-box {
|
||||
background-color: var(--bg-primary);
|
||||
border: 1px solid var(--color-warning);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
|
||||
.tips-box h4 {
|
||||
color: var(--color-warning);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.tips-box ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tips-box li {
|
||||
margin-bottom: var(--spacing-sm);
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.tips-box li::before {
|
||||
content: "•";
|
||||
color: var(--color-warning);
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
margin-right: var(--spacing-xs);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.explainer-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.examples-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.example-item {
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.explainer-section {
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -195,4 +195,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -0,0 +1,87 @@
|
||||
<script lang="ts">
|
||||
import { COMMON_SUBNETS } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import SvgIcon from '$lib/components/SvgIcon.svelte';
|
||||
import '../../styles/converters.scss';
|
||||
import '../../styles/components.scss';
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Common Subnets Reference</h2>
|
||||
<p>Frequently used subnet configurations with CIDR notation, masks, and host counts.</p>
|
||||
</header>
|
||||
|
||||
<!-- Common Subnets Table -->
|
||||
<div class="subnets-table">
|
||||
<div class="table-header">
|
||||
<span>CIDR</span>
|
||||
<span>Subnet Mask</span>
|
||||
<span>Hosts</span>
|
||||
<span>Usage</span>
|
||||
</div>
|
||||
|
||||
{#each COMMON_SUBNETS as subnet}
|
||||
<Tooltip text="/{subnet.cidr} subnet with mask {subnet.mask} supports {subnet.hosts.toLocaleString()} hosts" position="top">
|
||||
<div class="table-row">
|
||||
<span class="cidr-cell">
|
||||
/{subnet.cidr}
|
||||
</span>
|
||||
<span class="mask-cell">
|
||||
{subnet.mask}
|
||||
</span>
|
||||
<span class="hosts-cell">
|
||||
{subnet.hosts.toLocaleString()}
|
||||
</span>
|
||||
<span class="usage-cell">
|
||||
{#if subnet.cidr === 8}
|
||||
Large ISPs
|
||||
{:else if subnet.cidr === 16}
|
||||
Universities
|
||||
{:else if subnet.cidr === 24}
|
||||
Small businesses
|
||||
{:else if subnet.cidr === 25}
|
||||
Departments
|
||||
{:else if subnet.cidr === 26}
|
||||
Teams
|
||||
{:else if subnet.cidr === 27}
|
||||
Small offices
|
||||
{:else if subnet.cidr === 28}
|
||||
Workgroups
|
||||
{:else if subnet.cidr === 29}
|
||||
Small groups
|
||||
{:else if subnet.cidr === 30}
|
||||
Point-to-point
|
||||
{:else}
|
||||
General use
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<!-- Explainer Section -->
|
||||
<div class="explainer-card">
|
||||
<h3>
|
||||
<SvgIcon icon="info" size="md" />
|
||||
Subnet Planning Guidelines
|
||||
</h3>
|
||||
<div class="explainer-content">
|
||||
<p>
|
||||
Choosing the right subnet size is crucial for efficient network design.
|
||||
Consider future growth, address conservation, and security requirements when planning subnets.
|
||||
</p>
|
||||
<div class="planning-tips">
|
||||
<h4>Planning Considerations</h4>
|
||||
<ul>
|
||||
<li><strong>Future Growth:</strong> Always plan for 2-3x current requirements</li>
|
||||
<li><strong>VLSM:</strong> Use Variable Length Subnet Masking for efficient allocation</li>
|
||||
<li><strong>Security:</strong> Separate different network segments and services</li>
|
||||
<li><strong>Point-to-Point Links:</strong> Use /30 or /31 for WAN connections</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<footer class="footer">
|
||||
<div class="footer-content">
|
||||
<p>
|
||||
Built with 🩷 and 🍺 by
|
||||
<a href="https://github.com/lissy93" target="_blank" rel="noopener noreferrer">Lissy93</a>.
|
||||
<a href="https://github.com/lissy93/ip-calc" target="_blank" rel="noopener noreferrer">View on GitHub</a>
|
||||
</p>
|
||||
<p class="footer-sub">
|
||||
<a href="https://ip-calc.as93.net" target="_blank" rel="noopener noreferrer">IP-Calc</a>
|
||||
is licensed under
|
||||
<a href="https://github.com/lissy93/ip-calc/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">MIT</a>,
|
||||
(C)
|
||||
<a href="https://github.com/lissy93" target="_blank" rel="noopener noreferrer">Alicia Sykes</a> 2025
|
||||
</p>
|
||||
<p class="footer-sub">
|
||||
<a href="/about">About</a> •
|
||||
<a href="/subnet-calculator">Subnet Calc</a> •
|
||||
<a href="/cidr-convertor">CIDR Convert</a> •
|
||||
<a href="/ip-address-convertor">IP Convert</a> •
|
||||
<a href="/reference">Reference</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -0,0 +1,68 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { TOP_NAV, isActive } from '$lib/constants/nav';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
|
||||
// Props from +layout for theme state & toggler
|
||||
export let darkMode: boolean;
|
||||
export let toggleTheme: () => void;
|
||||
$: currentPath = $page.url.pathname;
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<div class="header-content">
|
||||
<div class="logo">
|
||||
<div class="logo-icon">
|
||||
<a href="/" aria-label="Home">
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<h1><a href="/">IP Calc</a></h1>
|
||||
<p class="subtitle">Network Reference</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-actions">
|
||||
<nav class="nav-links" aria-label="Primary">
|
||||
{#each TOP_NAV as item}
|
||||
<a
|
||||
href={item.href}
|
||||
class="nav-link {isActive(currentPath, item.href) ? 'active' : ''}"
|
||||
aria-current={isActive(currentPath, item.href) ? 'page' : undefined}
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
{/each}
|
||||
</nav>
|
||||
|
||||
<button
|
||||
class="theme-toggle"
|
||||
class:dark={darkMode}
|
||||
onclick={toggleTheme}
|
||||
aria-label={darkMode ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||
title={darkMode ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||
>
|
||||
<div class="toggle-slider">
|
||||
{#if darkMode}
|
||||
<svg fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{:else}
|
||||
<svg fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M17.293 13.293A8 8 0 716.707 2.707a8.001 8.001 0 1010.586 10.586z"/>
|
||||
</svg>
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -296,6 +296,9 @@
|
||||
|
||||
.class-info {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.class-value {
|
||||
|
||||
@@ -1,436 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { NETWORK_CLASSES, RESERVED_RANGES, COMMON_SUBNETS } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
|
||||
let selectedCategory = $state<'classes' | 'reserved' | 'subnets'>('classes');
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Network Reference</h2>
|
||||
<p>Essential networking information and constants for IP address planning.</p>
|
||||
</header>
|
||||
|
||||
<!-- Category Tabs -->
|
||||
<div class="tabs">
|
||||
<button
|
||||
type="button"
|
||||
class="tab {selectedCategory === 'classes' ? 'active' : ''}"
|
||||
onclick={() => selectedCategory = 'classes'}
|
||||
>
|
||||
Network Classes
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="tab {selectedCategory === 'reserved' ? 'active' : ''}"
|
||||
onclick={() => selectedCategory = 'reserved'}
|
||||
>
|
||||
Reserved Ranges
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="tab {selectedCategory === 'subnets' ? 'active' : ''}"
|
||||
onclick={() => selectedCategory = 'subnets'}
|
||||
>
|
||||
Common Subnets
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Network Classes -->
|
||||
{#if selectedCategory === 'classes'}
|
||||
<div class="reference-section fade-in">
|
||||
{#each Object.entries(NETWORK_CLASSES) as [className, classInfo]}
|
||||
<Tooltip text="Class {className} networks use {classInfo.defaultMask} as default subnet mask and support {classInfo.range}" position="top">
|
||||
<div class="reference-card">
|
||||
<div class="card-header-inline">
|
||||
<div class="class-info">
|
||||
<div class="class-badge {className.toLowerCase()}">
|
||||
{className}
|
||||
</div>
|
||||
<div class="class-details">
|
||||
<h3>Class {className}</h3>
|
||||
<span class="mask-info">
|
||||
{classInfo.defaultMask} (/{classInfo.cidr})
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="range-badge">
|
||||
{classInfo.range.split(' - ')[0]} - {classInfo.range.split(' - ')[1]}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p class="class-description">
|
||||
{classInfo.description}
|
||||
</p>
|
||||
|
||||
<p class="usage-info">
|
||||
<strong>Typical Usage:</strong> {classInfo.usage}
|
||||
</p>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Reserved Ranges -->
|
||||
{#if selectedCategory === 'reserved'}
|
||||
<div class="reference-section fade-in">
|
||||
{#each Object.entries(RESERVED_RANGES) as [rangeName, rangeInfo]}
|
||||
<Tooltip text="{rangeInfo.description} - Defined in {rangeInfo.rfc}" position="top">
|
||||
<div class="reference-card">
|
||||
<div class="card-header-inline">
|
||||
<div class="range-info">
|
||||
<h3 class="range-address">
|
||||
{rangeInfo.range}
|
||||
</h3>
|
||||
<span class="range-description">
|
||||
{rangeInfo.description}
|
||||
</span>
|
||||
</div>
|
||||
<span class="rfc-badge">
|
||||
{rangeInfo.rfc}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Special highlighting for private networks -->
|
||||
{#if rangeName.includes('PRIVATE')}
|
||||
<div class="private-notice">
|
||||
<strong>Private Network:</strong> Not routed on the public Internet
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Common Subnets -->
|
||||
{#if selectedCategory === 'subnets'}
|
||||
<div class="subnets-table fade-in">
|
||||
<div class="table-header">
|
||||
<span>CIDR</span>
|
||||
<span>Subnet Mask</span>
|
||||
<span>Hosts</span>
|
||||
<span>Usage</span>
|
||||
</div>
|
||||
|
||||
{#each COMMON_SUBNETS as subnet}
|
||||
<Tooltip text="/{subnet.cidr} subnet with mask {subnet.mask} supports {subnet.hosts.toLocaleString()} hosts" position="top">
|
||||
<div class="table-row">
|
||||
<span class="cidr-cell">
|
||||
/{subnet.cidr}
|
||||
</span>
|
||||
<span class="mask-cell">
|
||||
{subnet.mask}
|
||||
</span>
|
||||
<span class="hosts-cell">
|
||||
{subnet.hosts.toLocaleString()}
|
||||
</span>
|
||||
<span class="usage-cell">
|
||||
{#if subnet.cidr === 8}
|
||||
Large ISPs
|
||||
{:else if subnet.cidr === 16}
|
||||
Universities
|
||||
{:else if subnet.cidr === 24}
|
||||
Small businesses
|
||||
{:else if subnet.cidr === 25}
|
||||
Departments
|
||||
{:else if subnet.cidr === 26}
|
||||
Teams
|
||||
{:else if subnet.cidr === 27}
|
||||
Small offices
|
||||
{:else if subnet.cidr === 28}
|
||||
Workgroups
|
||||
{:else if subnet.cidr === 29}
|
||||
Small groups
|
||||
{:else if subnet.cidr === 30}
|
||||
Point-to-point
|
||||
{:else}
|
||||
General use
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Quick Tips -->
|
||||
<section class="tips-section">
|
||||
<h4 class="tips-header">
|
||||
<svg class="tip-icon" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Pro Tips
|
||||
</h4>
|
||||
<ul class="tips-list">
|
||||
<li>• Always plan for future growth when choosing subnet sizes</li>
|
||||
<li>• Use /30 subnets for point-to-point links to save addresses</li>
|
||||
<li>• Consider VLSM (Variable Length Subnet Masking) for efficient allocation</li>
|
||||
<li>• Private addresses (RFC 1918) are not routable on the Internet</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.reference-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
.card-header-inline {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
.class-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.class-badge {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
|
||||
&.a { background-color: var(--color-info); }
|
||||
&.b { background-color: var(--color-success); }
|
||||
&.c { background-color: var(--color-warning); }
|
||||
}
|
||||
|
||||
.class-details {
|
||||
h3 {
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mask-info {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.range-badge {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
background-color: var(--bg-tertiary);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.class-description {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.usage-info {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.range-info {
|
||||
h3 {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.range-description {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.rfc-badge {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-info-light);
|
||||
background-color: rgba(9, 105, 218, 0.1);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.private-notice {
|
||||
margin-top: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
background-color: rgba(35, 134, 54, 0.1);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-success-light);
|
||||
}
|
||||
|
||||
.subnets-table {
|
||||
margin: var(--spacing-lg) 0;
|
||||
|
||||
:global(.tooltip-container) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr 1.5fr 2fr;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
> span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&:nth-child(1), &:nth-child(2), &:nth-child(4) {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.table-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr 1.5fr 2fr;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-radius: var(--radius-lg);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
transition: background-color var(--transition-fast);
|
||||
cursor: help;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
|
||||
.cidr-cell, .mask-cell, .hosts-cell, .usage-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-family: var(--font-mono);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
color: var(--text-secondary);
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cidr-cell {
|
||||
font-weight: 700;
|
||||
color: var(--color-info-light);
|
||||
justify-content: flex-start;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'CIDR: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mask-cell {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
justify-content: flex-start;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'Mask: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hosts-cell {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-success-light);
|
||||
justify-content: flex-end;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'Hosts: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.usage-cell {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
justify-content: flex-start;
|
||||
font-family: inherit;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'Usage: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tips-section {
|
||||
margin-top: var(--spacing-xl);
|
||||
padding: var(--spacing-md);
|
||||
background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--border-secondary);
|
||||
|
||||
.tips-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
.tip-icon {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
color: var(--color-warning);
|
||||
}
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
list-style: none;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,100 @@
|
||||
<script lang="ts">
|
||||
import { NETWORK_CLASSES } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import SvgIcon from '$lib/components/SvgIcon.svelte';
|
||||
import '../../styles/converters.scss';
|
||||
import '../../styles/components.scss';
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Network Classes Reference</h2>
|
||||
<p>Traditional IP address classes and their characteristics for network planning.</p>
|
||||
</header>
|
||||
|
||||
<!-- Network Classes -->
|
||||
<div class="reference-section">
|
||||
{#each Object.entries(NETWORK_CLASSES) as [className, classInfo]}
|
||||
<Tooltip text="Class {className} networks use {classInfo.defaultMask} as default subnet mask and support {classInfo.range}" position="top">
|
||||
<div class="reference-card">
|
||||
<div class="card-header-inline">
|
||||
<div class="class-info">
|
||||
<div class="class-badge {className.toLowerCase()}">
|
||||
{className}
|
||||
</div>
|
||||
<div class="class-details">
|
||||
<h3>Class {className}</h3>
|
||||
<span class="mask-info">
|
||||
{classInfo.defaultMask} (/{classInfo.cidr})
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="range-badge">
|
||||
{classInfo.range.split(' - ')[0]} - {classInfo.range.split(' - ')[1]}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p class="class-description">
|
||||
{classInfo.description}
|
||||
</p>
|
||||
|
||||
<p class="usage-info">
|
||||
<strong>Typical Usage:</strong> {classInfo.usage}
|
||||
</p>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<!-- Quick Tips -->
|
||||
<section class="tips-section">
|
||||
<h4 class="tips-header">
|
||||
<SvgIcon icon="info" size="md" />
|
||||
Understanding Network Classes
|
||||
</h4>
|
||||
<div class="tips-content">
|
||||
<p>
|
||||
<strong>Historical Context:</strong> Network classes were the original method of IP address allocation,
|
||||
now largely replaced by CIDR (Classless Inter-Domain Routing) for more efficient address utilization.
|
||||
</p>
|
||||
<ul class="tips-list">
|
||||
<li>• <strong>Class A:</strong> Large networks with millions of hosts (0-127 first octet)</li>
|
||||
<li>• <strong>Class B:</strong> Medium networks with thousands of hosts (128-191 first octet)</li>
|
||||
<li>• <strong>Class C:</strong> Small networks with up to 254 hosts (192-223 first octet)</li>
|
||||
<li>• Classes D and E are reserved for multicast and experimental use</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Explainer Section -->
|
||||
<div class="explainer-card">
|
||||
<h3>
|
||||
<SvgIcon icon="info" size="md" />
|
||||
Network Class Fundamentals
|
||||
</h3>
|
||||
<div class="explainer-content">
|
||||
<p>
|
||||
Network classes provide a standardized way to understand IP address ranges and their intended use.
|
||||
While modern networks use CIDR notation, understanding classes helps with legacy systems and network analysis.
|
||||
</p>
|
||||
<div class="class-comparison">
|
||||
<h4>Class Comparison</h4>
|
||||
<div class="comparison-grid">
|
||||
<div class="comparison-item">
|
||||
<span class="class-name class-a">Class A</span>
|
||||
<span>16.7M networks, 16.7M hosts each</span>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<span class="class-name class-b">Class B</span>
|
||||
<span>65K networks, 65K hosts each</span>
|
||||
</div>
|
||||
<div class="comparison-item">
|
||||
<span class="class-name class-c">Class C</span>
|
||||
<span>2M networks, 254 hosts each</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<script lang="ts">
|
||||
import { RESERVED_RANGES } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import SvgIcon from '$lib/components/SvgIcon.svelte';
|
||||
import '../../styles/converters.scss';
|
||||
import '../../styles/components.scss';
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Reserved IP Ranges Reference</h2>
|
||||
<p>Special-purpose IP address ranges defined by RFCs and their intended uses.</p>
|
||||
</header>
|
||||
|
||||
<!-- Reserved Ranges -->
|
||||
<div class="reference-section">
|
||||
{#each Object.entries(RESERVED_RANGES) as [rangeName, rangeInfo]}
|
||||
<Tooltip text="{rangeInfo.description} - Defined in {rangeInfo.rfc}" position="top">
|
||||
<div class="reference-card">
|
||||
<div class="card-header-inline">
|
||||
<div class="range-info">
|
||||
<h3 class="range-address">
|
||||
{rangeInfo.range}
|
||||
</h3>
|
||||
<span class="range-description">
|
||||
{rangeInfo.description}
|
||||
</span>
|
||||
</div>
|
||||
<span class="rfc-badge">
|
||||
{rangeInfo.rfc}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Special highlighting for private networks -->
|
||||
{#if rangeName.includes('PRIVATE')}
|
||||
<div class="private-notice">
|
||||
<strong>Private Network:</strong> Not routed on the public Internet
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<!-- Explainer Section -->
|
||||
<div class="explainer-card">
|
||||
<h3>
|
||||
<SvgIcon icon="info" size="md" />
|
||||
Understanding Reserved IP Ranges
|
||||
</h3>
|
||||
<div class="explainer-content">
|
||||
<p>
|
||||
Reserved IP ranges serve specific purposes in networking and are defined by various RFCs (Request for Comments).
|
||||
Understanding these ranges is crucial for network planning and avoiding conflicts.
|
||||
</p>
|
||||
<div class="range-categories">
|
||||
<h4>Key Categories</h4>
|
||||
<ul>
|
||||
<li><strong>Private Networks (RFC 1918):</strong> Used for internal networks, not routed on the Internet</li>
|
||||
<li><strong>Loopback (RFC 1122):</strong> Traffic that never leaves the local machine</li>
|
||||
<li><strong>Link-Local (RFC 3927):</strong> Automatic IP configuration when DHCP is unavailable</li>
|
||||
<li><strong>Multicast (RFC 3171):</strong> One-to-many communication protocols</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { SUB_NAV, findSectionKey, isActive } from '$lib/constants/nav';
|
||||
|
||||
$: currentPath = $page.url.pathname;
|
||||
$: sectionKey = findSectionKey(currentPath); // e.g. '/reference' or '/cidr-convertor'
|
||||
$: links = sectionKey ? SUB_NAV[sectionKey] : null;
|
||||
</script>
|
||||
|
||||
{#if links}
|
||||
<nav class="sub-nav" aria-label="Section">
|
||||
<div class="container">
|
||||
<div class="sub-nav-links">
|
||||
{#each links as link}
|
||||
<a
|
||||
href={link.href}
|
||||
class="sub-nav-link {isActive(currentPath, link.href) ? 'active' : ''}"
|
||||
aria-current={isActive(currentPath, link.href) ? 'page' : undefined}
|
||||
>
|
||||
{link.label}
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{/if}
|
||||
@@ -0,0 +1,36 @@
|
||||
export type NavItem = {
|
||||
href: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
export const TOP_NAV: NavItem[] = [
|
||||
{ href: '/subnet-calculator', label: 'Subnet Calc' },
|
||||
{ href: '/cidr-convertor', label: 'CIDR Convert' },
|
||||
{ href: '/ip-address-convertor', label: 'IP Convert' },
|
||||
{ href: '/ip-reference', label: 'Reference' }
|
||||
];
|
||||
|
||||
// Sections that have sub-pages (drives the conditional SubHeader)
|
||||
export const SUB_NAV: Record<string, NavItem[]> = {
|
||||
'/cidr-convertor': [
|
||||
{ href: '/cidr-convertor/cidr-to-subnet-mask', label: 'CIDR → Mask' },
|
||||
{ href: '/cidr-convertor/subnet-mask-to-cidr', label: 'Mask → CIDR' }
|
||||
],
|
||||
'/ip-reference': [
|
||||
{ href: '/ip-reference/network-classes', label: 'Network Classes' },
|
||||
{ href: '/ip-reference/reserved-ranges', label: 'Reserved Ranges' },
|
||||
{ href: '/ip-reference/common-subnets', label: 'Common Subnets' }
|
||||
]
|
||||
};
|
||||
|
||||
// Helper: is a nav item active for a given pathname?
|
||||
export function isActive(pathname: string, href: string): boolean {
|
||||
if (href === '/') return pathname === '/';
|
||||
return pathname === href || pathname.startsWith(href + '/');
|
||||
}
|
||||
|
||||
// Helper: find the section key (e.g. '/reference') that matches a pathname
|
||||
export function findSectionKey(pathname: string): string | null {
|
||||
const keys = Object.keys(SUB_NAV);
|
||||
return keys.find((k) => isActive(pathname, k)) ?? null;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
export const CIDR_CTX = Symbol('CIDR_CTX');
|
||||
|
||||
export type SubnetInfo = {
|
||||
cidr: number;
|
||||
mask: string;
|
||||
hosts: number;
|
||||
};
|
||||
|
||||
export interface CidrContext {
|
||||
cidr: Writable<number>;
|
||||
mask: Writable<string>;
|
||||
handleMaskChange: (value: string) => void;
|
||||
getSubnetInfo: (cidr: number) => SubnetInfo;
|
||||
COMMON_SUBNETS: Array<{ cidr: number; mask: string; hosts: number }>;
|
||||
}
|
||||
@@ -4,11 +4,64 @@
|
||||
import '../styles/components.scss';
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
|
||||
|
||||
import Header from '$lib/components/Header.svelte';
|
||||
import SubHeader from '$lib/components/SubHeader.svelte';
|
||||
import Footer from '$lib/components/Footer.svelte';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
import '../styles/pages.scss';
|
||||
|
||||
let darkMode = $state(true);
|
||||
|
||||
function initializeTheme() {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
const saved = localStorage.getItem('theme');
|
||||
if (saved === 'light') {
|
||||
darkMode = false;
|
||||
document.documentElement.classList.add('theme-light');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
darkMode = !darkMode;
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem('theme', darkMode ? 'dark' : 'light');
|
||||
if (darkMode) {
|
||||
document.documentElement.classList.remove('theme-light');
|
||||
} else {
|
||||
document.documentElement.classList.add('theme-light');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
initializeTheme();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
{@render children?.()}
|
||||
|
||||
<Header {darkMode} {toggleTheme} />
|
||||
<SubHeader />
|
||||
<main class="main-content">
|
||||
{@render children?.()}
|
||||
</main>
|
||||
<Footer />
|
||||
|
||||
<style>
|
||||
main {
|
||||
max-width: 1200px;
|
||||
margin: 1.5rem auto 1rem;
|
||||
padding: 0 var(--spacing-md);
|
||||
margin: 1rem auto;
|
||||
background: var(--bg-primary);
|
||||
padding: var(--spacing-lg) 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
+76
-126
@@ -1,10 +1,6 @@
|
||||
<script lang="ts">
|
||||
import SubnetCalculator from '$lib/components/SubnetCalculator.svelte';
|
||||
import CIDRConverter from '$lib/components/CIDRConverter.svelte';
|
||||
import IPConverter from '$lib/components/IPConverter.svelte';
|
||||
import InfoPanel from '$lib/components/InfoPanel.svelte';
|
||||
|
||||
let activeTab = $state<'subnet' | 'cidr' | 'converter' | 'reference'>('subnet');
|
||||
import '../styles/pages.scss';
|
||||
|
||||
let darkMode = $state(true); // Default to hacker theme
|
||||
|
||||
/**
|
||||
@@ -40,135 +36,89 @@
|
||||
initializeTheme();
|
||||
});
|
||||
|
||||
const tabs = [
|
||||
{ id: 'subnet' as const, label: 'Subnet Calc' },
|
||||
{ id: 'cidr' as const, label: 'CIDR Convert' },
|
||||
{ id: 'converter' as const, label: 'IP Convert' },
|
||||
{ id: 'reference' as const, label: 'Reference' }
|
||||
const sections = [
|
||||
{
|
||||
title: 'Subnet Calculator',
|
||||
description: 'Calculate subnet information, network addresses, and host ranges',
|
||||
href: '/subnet-calculator',
|
||||
icon: 'calculator'
|
||||
},
|
||||
{
|
||||
title: 'CIDR Converter',
|
||||
description: 'Convert between CIDR notation and subnet masks',
|
||||
href: '/cidr-convertor/cidr-to-subnet-mask',
|
||||
icon: 'convert'
|
||||
},
|
||||
{
|
||||
title: 'IP Address Converter',
|
||||
description: 'Convert IP addresses between different formats',
|
||||
href: '/ip-address-convertor',
|
||||
icon: 'transform'
|
||||
},
|
||||
{
|
||||
title: 'Network Reference',
|
||||
description: 'Essential networking information, classes, and reserved ranges',
|
||||
href: '/ip-reference/network-classes',
|
||||
icon: 'reference'
|
||||
}
|
||||
];
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>IP Calc - Network Calculator</title>
|
||||
<meta name="description" content="IP address calculator with subnet calculations, CIDR conversion, and network analysis tools." />
|
||||
<meta name="keywords" content="IP calculator, subnet calculator, CIDR converter, network tools" />
|
||||
<meta property="og:title" content="IP Calc" />
|
||||
<meta property="og:description" content="Network calculator and IP tools" />
|
||||
<title>IP Calc - Network Calculator & IP Tools</title>
|
||||
<meta name="description" content="Comprehensive IP address calculator with subnet calculations, CIDR conversion, IP format conversion, and network reference tools." />
|
||||
<meta name="keywords" content="IP calculator, subnet calculator, CIDR converter, network tools, IP tools, networking" />
|
||||
<meta property="og:title" content="IP Calc - Network Calculator & IP Tools" />
|
||||
<meta property="og:description" content="Comprehensive network calculator and IP tools for subnet calculations, CIDR conversion, and network analysis" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://ip-calc.as93.net" />
|
||||
</svelte:head>
|
||||
|
||||
<div class="page">
|
||||
<!-- Header -->
|
||||
<header class="header">
|
||||
<div class="container">
|
||||
<div class="header-content">
|
||||
<div class="logo">
|
||||
<div class="logo-icon">
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<h1>IP Calc</h1>
|
||||
<p class="subtitle">Network Calculator</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="theme-toggle"
|
||||
class:dark={darkMode}
|
||||
onclick={toggleTheme}
|
||||
aria-label={darkMode ? 'Switch to light mode' : 'Switch to dark mode'}
|
||||
>
|
||||
<div class="toggle-slider">
|
||||
{#if darkMode}
|
||||
<svg fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
{:else}
|
||||
<svg fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/>
|
||||
</svg>
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<!-- Tab Navigation -->
|
||||
<nav class="tabs">
|
||||
{#each tabs as tab}
|
||||
<button
|
||||
type="button"
|
||||
class="tab"
|
||||
class:active={activeTab === tab.id}
|
||||
onclick={() => activeTab = tab.id}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
{/each}
|
||||
</nav>
|
||||
<!-- Hero Section -->
|
||||
<section class="hero">
|
||||
<div class="hero-content">
|
||||
<h2>Professional Network Calculation Tools</h2>
|
||||
<p class="hero-description">
|
||||
Comprehensive suite of networking tools for subnet calculations, CIDR conversions,
|
||||
IP format transformations, and network reference information.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Tab Content -->
|
||||
<div class="fade-in">
|
||||
{#if activeTab === 'subnet'}
|
||||
<SubnetCalculator />
|
||||
{:else if activeTab === 'cidr'}
|
||||
<CIDRConverter />
|
||||
{:else if activeTab === 'converter'}
|
||||
<IPConverter />
|
||||
{:else if activeTab === 'reference'}
|
||||
<InfoPanel />
|
||||
<!-- Tools Grid -->
|
||||
<section class="tools-grid">
|
||||
{#each sections as section}
|
||||
<a href={section.href} class="tool-card">
|
||||
<div class="tool-icon">
|
||||
{#if section.icon === 'calculator'}
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8-4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8-4H7V7h2v2zm4 0h-2V7h2v2zm4 0h-2V7h2v2z"/>
|
||||
</svg>
|
||||
{:else if section.icon === 'convert'}
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/>
|
||||
</svg>
|
||||
{:else if section.icon === 'transform'}
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
||||
</svg>
|
||||
{:else if section.icon === 'reference'}
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
|
||||
</svg>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<div class="tool-content">
|
||||
<h3>{section.title}</h3>
|
||||
<p>{section.description}</p>
|
||||
</div>
|
||||
<div class="tool-arrow">
|
||||
<svg fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
</div>
|
||||
</a>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="footer">
|
||||
<div class="footer-content">
|
||||
<p>Built with 🩷 and 🍺 by <a href="https://github.com/lissy93" target="_blank" rel="noopener noreferrer">Lissy93</a>. <a href="https://github.com/lissy93/ip-calc" target="_blank" rel="noopener noreferrer">View on GitHub</a></p>
|
||||
<p class="footer-sub"><a href="https://ip-calc.as93.net" target="_blank" rel="noopener noreferrer">IP-Calc</a> is licensed under <a href="https://github.com/lissy93/ip-calc/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">MIT</a>, (C) <a href="https://github.com/lissy93" target="_blank" rel="noopener noreferrer">Alicia Sykes</a> 2025</p>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding: var(--spacing-lg);
|
||||
border-top: 1px solid var(--border-primary);
|
||||
margin-top: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.footer-content p {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.footer-sub {
|
||||
font-size: var(--font-size-xs) !important;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
color: var(--color-primary-light);
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,133 @@
|
||||
<script lang="ts">
|
||||
import '../../styles/pages.scss';
|
||||
|
||||
let darkMode = $state(true);
|
||||
|
||||
function initializeTheme() {
|
||||
if (typeof window === 'undefined') return;
|
||||
|
||||
const saved = localStorage.getItem('theme');
|
||||
if (saved === 'light') {
|
||||
darkMode = false;
|
||||
document.documentElement.classList.add('theme-light');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
darkMode = !darkMode;
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem('theme', darkMode ? 'dark' : 'light');
|
||||
if (darkMode) {
|
||||
document.documentElement.classList.remove('theme-light');
|
||||
} else {
|
||||
document.documentElement.classList.add('theme-light');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
initializeTheme();
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>About - IP Calc</title>
|
||||
<meta name="description" content="Learn about IP Calc, a comprehensive network calculator and IP tools suite built with modern web technologies." />
|
||||
<meta name="keywords" content="IP calc, network tools, about, subnet calculator, CIDR converter" />
|
||||
<meta property="og:title" content="About - IP Calc" />
|
||||
<meta property="og:description" content="Comprehensive network calculator and IP tools for professionals" />
|
||||
<meta property="og:url" content="https://ip-calc.as93.net/about" />
|
||||
</svelte:head>
|
||||
|
||||
<div class="page">
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<div class="about-content">
|
||||
<section class="hero-section">
|
||||
<h2>About IP Calc</h2>
|
||||
<p class="lead">
|
||||
A comprehensive suite of networking tools designed for professionals, students,
|
||||
and anyone working with IP addresses and network configurations.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="features-section">
|
||||
<h3>Features</h3>
|
||||
<div class="features-grid">
|
||||
<div class="feature-card">
|
||||
<h4>Subnet Calculator</h4>
|
||||
<p>Calculate subnet information, network addresses, broadcast addresses, and host ranges with visual network analysis.</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4>CIDR Converter</h4>
|
||||
<p>Bidirectional conversion between CIDR notation and subnet mask formats with instant results.</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4>IP Address Converter</h4>
|
||||
<p>Convert IP addresses between decimal, binary, hexadecimal, and octal number systems.</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4>Network Reference</h4>
|
||||
<p>Comprehensive reference for network classes, reserved IP ranges, and common subnet configurations.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="tech-section">
|
||||
<h3>Technology Stack</h3>
|
||||
<p>Built with modern web technologies for optimal performance and user experience:</p>
|
||||
<ul class="tech-list">
|
||||
<li><strong>SvelteKit:</strong> Modern web framework with server-side rendering</li>
|
||||
<li><strong>TypeScript:</strong> Type-safe JavaScript for better code quality</li>
|
||||
<li><strong>SCSS:</strong> Advanced CSS with nesting and variables</li>
|
||||
<li><strong>Responsive Design:</strong> Works seamlessly across all devices</li>
|
||||
<li><strong>Progressive Web App:</strong> Fast loading and offline capabilities</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="author-section">
|
||||
<h3>About the Author</h3>
|
||||
<p>
|
||||
IP Calc is developed and maintained by <a href="https://github.com/lissy93" target="_blank" rel="noopener noreferrer">Alicia Sykes</a>,
|
||||
a software engineer passionate about networking, cybersecurity, and open-source development.
|
||||
</p>
|
||||
<div class="links-grid">
|
||||
<a href="https://github.com/lissy93/ip-calc" target="_blank" rel="noopener noreferrer" class="link-card">
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
|
||||
</svg>
|
||||
<div>
|
||||
<h4>GitHub Repository</h4>
|
||||
<p>View source code and contribute</p>
|
||||
</div>
|
||||
</a>
|
||||
<a href="https://as93.net" target="_blank" rel="noopener noreferrer" class="link-card">
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
|
||||
</svg>
|
||||
<div>
|
||||
<h4>Author's Website</h4>
|
||||
<p>Learn more about the developer</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="license-section">
|
||||
<h3>Open Source</h3>
|
||||
<p>
|
||||
IP Calc is open-source software licensed under the MIT License.
|
||||
Feel free to use, modify, and distribute according to the license terms.
|
||||
</p>
|
||||
<p class="copyright">
|
||||
© 2025 Alicia Sykes. All rights reserved.
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
<!-- src/routes/cidr-convertor/+layout.svelte -->
|
||||
<script lang="ts">
|
||||
import { setContext } from 'svelte';
|
||||
import { writable, derived, get } from 'svelte/store';
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import { cidrToMask, maskToCidr } from '$lib/utils/ip-calculations.js';
|
||||
import { validateSubnetMask } from '$lib/utils/ip-validation.js';
|
||||
import { COMMON_SUBNETS } from '$lib/constants/networks.js';
|
||||
import { CIDR_CTX, type CidrContext } from '$lib/contexts/cidr';
|
||||
|
||||
// Shared state as stores so pages can subscribe & update reactively
|
||||
const cidr = writable<number>(24);
|
||||
const mask = writable<string>('255.255.255.0');
|
||||
|
||||
// Keep mask in sync when CIDR changes (single source of truth -> cidr)
|
||||
cidr.subscribe(($cidr) => {
|
||||
const m = cidrToMask($cidr).octets.join('.');
|
||||
if (get(mask) !== m) mask.set(m);
|
||||
});
|
||||
|
||||
// Mask changes -> attempt to update CIDR (only when valid)
|
||||
function handleMaskChange(value: string) {
|
||||
mask.set(value);
|
||||
if (validateSubnetMask(value).valid) {
|
||||
const newCidr = maskToCidr(value);
|
||||
if (get(cidr) !== newCidr) cidr.set(newCidr);
|
||||
}
|
||||
}
|
||||
|
||||
function getSubnetInfo(c: number) {
|
||||
const subnet = COMMON_SUBNETS.find((s) => s.cidr === c);
|
||||
return subnet || {
|
||||
cidr: c,
|
||||
mask: cidrToMask(c).octets.join('.'),
|
||||
hosts: Math.pow(2, 32 - c) - 2
|
||||
};
|
||||
}
|
||||
|
||||
const subnetInfo = derived(cidr, ($c) => getSubnetInfo($c));
|
||||
|
||||
// Provide everything to children through context
|
||||
const ctx: CidrContext = {
|
||||
cidr,
|
||||
mask,
|
||||
handleMaskChange,
|
||||
getSubnetInfo,
|
||||
COMMON_SUBNETS
|
||||
};
|
||||
setContext(CIDR_CTX, ctx);
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>CIDR ↔ Subnet Mask Converter</h2>
|
||||
<p>Convert between CIDR notation and subnet mask formats.</p>
|
||||
</header>
|
||||
|
||||
<!-- Per-page converter UIs render here -->
|
||||
<slot />
|
||||
|
||||
<!-- Subnet Information (shared) -->
|
||||
<section class="info-panel">
|
||||
<h3>Subnet Information</h3>
|
||||
<div class="grid grid-3">
|
||||
<Tooltip text="Number of bits used for network identification - higher values create smaller, more specific subnets" position="top">
|
||||
<div class="info-metric">
|
||||
<span class="info-label">Network Bits</span>
|
||||
<span class="metric-value info">{$cidr}</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip text="Number of bits available for host addresses - more host bits allow for more devices" position="top">
|
||||
<div class="info-metric">
|
||||
<span class="info-label">Host Bits</span>
|
||||
<span class="metric-value info">{32 - $cidr}</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip text="Number of IP addresses available for devices (excludes network and broadcast addresses)" position="top">
|
||||
<div class="info-metric">
|
||||
<span class="info-label">Usable Hosts</span>
|
||||
<span class="metric-value success">
|
||||
{get(subnetInfo).hosts.toLocaleString()}
|
||||
</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Common Subnets (shared) -->
|
||||
<section class="common-subnets-section">
|
||||
<h3>Common Subnets</h3>
|
||||
<div class="subnets-grid">
|
||||
{#each COMMON_SUBNETS as subnet}
|
||||
<Tooltip text="Click to select this common subnet configuration" position="top">
|
||||
<button
|
||||
type="button"
|
||||
class="subnet-card { $cidr === subnet.cidr ? 'active' : ''}"
|
||||
onclick={() => cidr.set(subnet.cidr)}
|
||||
aria-label="Select /{subnet.cidr} subnet with {subnet.hosts.toLocaleString()} hosts"
|
||||
>
|
||||
<div class="subnet-info">
|
||||
<div class="subnet-cidr">
|
||||
<span class="cidr-notation">/{subnet.cidr}</span>
|
||||
<span class="subnet-mask">{subnet.mask}</span>
|
||||
</div>
|
||||
<span class="host-count">{subnet.hosts.toLocaleString()} hosts</span>
|
||||
</div>
|
||||
</button>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Explainer (shared) -->
|
||||
<section class="explainer-section">
|
||||
<h3>Understanding CIDR and Subnet Masks</h3>
|
||||
|
||||
<div class="explainer-grid">
|
||||
<div class="explainer-card">
|
||||
<h4>CIDR Notation</h4>
|
||||
<p>CIDR (Classless Inter-Domain Routing) uses a slash followed by a number (e.g., /24) to indicate how many bits are used for the network portion of an IP address.</p>
|
||||
</div>
|
||||
|
||||
<div class="explainer-card">
|
||||
<h4>Subnet Mask</h4>
|
||||
<p>A 32-bit number that masks an IP address to divide it into network and host portions. Written in dotted decimal notation (e.g., 255.255.255.0).</p>
|
||||
</div>
|
||||
|
||||
<div class="explainer-card">
|
||||
<h4>Network Bits</h4>
|
||||
<p>The leftmost bits in an IP address that identify the network. More network bits mean smaller subnets with fewer available host addresses.</p>
|
||||
</div>
|
||||
|
||||
<div class="explainer-card">
|
||||
<h4>Host Bits</h4>
|
||||
<p>The remaining bits used for host addresses within the network. More host bits allow for more devices but fewer possible subnets.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="conversion-examples">
|
||||
<h4>Common Conversions</h4>
|
||||
<div class="examples-grid">
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/24</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.0</span>
|
||||
<span class="example-desc">254 hosts</span>
|
||||
</div>
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/25</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.128</span>
|
||||
<span class="example-desc">126 hosts</span>
|
||||
</div>
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/26</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.192</span>
|
||||
<span class="example-desc">62 hosts</span>
|
||||
</div>
|
||||
<div class="example-item">
|
||||
<span class="example-cidr">/30</span>
|
||||
<span class="example-arrow">↔</span>
|
||||
<span class="example-mask">255.255.255.252</span>
|
||||
<span class="example-desc">2 hosts</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tips-box">
|
||||
<h4>🔧 Usage Tips</h4>
|
||||
<ul>
|
||||
<li><strong>Smaller CIDR = Bigger Network:</strong> /16 has more hosts than /24</li>
|
||||
<li><strong>Binary Thinking:</strong> Each bit doubles or halves the number of addresses</li>
|
||||
<li><strong>/30 for Links:</strong> Perfect for point-to-point connections (only 2 usable IPs)</li>
|
||||
<li><strong>Planning:</strong> Start with larger subnets and subdivide as needed</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.info-panel { margin-top:var(--spacing-xl); }
|
||||
.info-metric { text-align:center; }
|
||||
.info-metric .info-label { display:block;font-size:var(--font-size-sm);color:var(--text-secondary);margin-bottom:var(--spacing-xs); }
|
||||
.common-subnets-section { margin-top:var(--spacing-lg); }
|
||||
.subnets-grid { display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:var(--spacing-sm);margin-top:var(--spacing-md);justify-content:space-between; }
|
||||
.subnet-card { padding:var(--spacing-sm);text-align:left;border:1px solid var(--border-primary);border-radius:var(--radius-lg);background-color:var(--bg-secondary);transition:all var(--transition-fast);cursor:pointer;width:100%; }
|
||||
.subnet-card:hover { background-color:var(--surface-hover);border-color:var(--color-primary); }
|
||||
.subnet-card.active { background-color:var(--surface-hover);border-color:var(--color-primary);box-shadow:var(--shadow-md); }
|
||||
.subnet-info { display:flex;justify-content:space-between;align-items:flex-start; }
|
||||
.subnet-cidr { display:flex;flex-direction:column;gap:var(--spacing-xs); }
|
||||
.cidr-notation { font-family:var(--font-mono);font-weight:700;font-size:var(--font-size-sm);color:var(--text-primary); }
|
||||
.subnet-mask { font-family:var(--font-mono);font-size:var(--font-size-xs);color:var(--text-secondary); }
|
||||
.host-count { font-size:var(--font-size-xs);color:var(--text-secondary);text-align:right; }
|
||||
@media (max-width:768px){ .subnet-info{flex-direction:column;align-items:flex-start;gap:var(--spacing-xs);} .host-count{text-align:left;} }
|
||||
.explainer-section { margin-top:var(--spacing-xl);padding:var(--spacing-lg);background:linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));border-radius:var(--radius-lg);border:1px solid var(--border-secondary); }
|
||||
.explainer-section h3 { margin-bottom:var(--spacing-lg);text-align:center;color:var(--color-primary); }
|
||||
.explainer-grid { display:grid;grid-template-columns:repeat(auto-fit, minmax(250px, 1fr));gap:var(--spacing-md);margin-bottom:var(--spacing-lg); }
|
||||
.explainer-card { background-color:var(--bg-secondary);border:1px solid var(--border-primary);border-radius:var(--radius-md);padding:var(--spacing-md);transition:all var(--transition-fast); }
|
||||
.explainer-card:hover { border-color:color-mix(in srgb, var(--color-primary) 33%, transparent);box-shadow:var(--shadow-md);transform:translateY(-2px); }
|
||||
.explainer-card h4 { color:var(--color-primary);font-size:var(--font-size-md);margin-bottom:var(--spacing-sm);font-weight:600; }
|
||||
.explainer-card p { color:var(--text-primary);font-size:var(--font-size-sm);line-height:1.6;margin:0; }
|
||||
.conversion-examples { margin-bottom:var(--spacing-lg);padding:var(--spacing-md);background-color:var(--bg-primary);border-radius:var(--radius-md);border:1px solid var(--border-primary); }
|
||||
.conversion-examples h4 { color:var(--color-info-light);margin-bottom:var(--spacing-md);text-align:center; }
|
||||
.examples-grid { display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:var(--spacing-sm); }
|
||||
.example-item { display:flex;align-items:center;justify-content:space-between;padding:var(--spacing-sm);background-color:var(--bg-secondary);border-radius:var(--radius-sm);font-family:var(--font-mono);font-size:var(--font-size-sm); }
|
||||
.example-cidr { color:var(--color-info-light);font-weight:700;min-width:2rem; }
|
||||
.example-arrow { color:var(--text-secondary);margin:0 var(--spacing-xs); }
|
||||
.example-mask { color:var(--color-success-light);font-weight:600;flex:1;text-align:center; }
|
||||
.example-desc { color:var(--text-secondary);font-size:var(--font-size-xs);min-width:4rem;text-align:right; }
|
||||
.tips-box { background-color:var(--bg-primary);border:1px solid var(--color-warning);border-radius:var(--radius-md);padding:var(--spacing-md); }
|
||||
.tips-box h4 { color:var(--color-warning);margin-bottom:var(--spacing-sm); }
|
||||
.tips-box ul { list-style:none;margin:0;padding:0; }
|
||||
.tips-box li { margin-bottom:var(--spacing-sm);color:var(--text-primary);font-size:var(--font-size-sm);line-height:1.6; }
|
||||
.tips-box li::before { content:"•";color:var(--color-warning);font-weight:bold;display:inline-block;width:1em;margin-right:var(--spacing-xs); }
|
||||
@media (max-width:768px){ .explainer-grid{grid-template-columns:1fr;} .examples-grid{grid-template-columns:1fr;} .example-item{flex-direction:column;gap:var(--spacing-xs);text-align:center;} .explainer-section{padding:var(--spacing-md);} }
|
||||
</style>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(() => {
|
||||
goto('/cidr-convertor/cidr-to-subnet-mask', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>CIDR Converter - IP Calc</title>
|
||||
<meta name="description" content="Convert between CIDR notation and subnet masks. Professional networking tools." />
|
||||
</svelte:head>
|
||||
|
||||
<!-- This page automatically redirects to the first sub-page -->
|
||||
<div>Redirecting to CIDR to Subnet Mask converter...</div>
|
||||
@@ -0,0 +1,56 @@
|
||||
<!-- src/routes/cidr-convertor/cidr-to-subnet-mask/+page.svelte -->
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import { CIDR_CTX, type CidrContext } from '$lib/contexts/cidr';
|
||||
|
||||
const { cidr, mask } = getContext<CidrContext>(CIDR_CTX);
|
||||
</script>
|
||||
|
||||
<div class="converter-section fade-in">
|
||||
<!-- CIDR Input -->
|
||||
<div class="form-group">
|
||||
<label for="cidr-slider" class="slider-label">
|
||||
CIDR Prefix Length: /{$cidr}
|
||||
</label>
|
||||
|
||||
<div class="slider-container">
|
||||
<input
|
||||
id="cidr-slider"
|
||||
type="range"
|
||||
min="0"
|
||||
max="32"
|
||||
value={$cidr}
|
||||
on:input={(e) => cidr.set(Number((e.target as HTMLInputElement).value))}
|
||||
class="cidr-slider"
|
||||
/>
|
||||
<div class="slider-markers">
|
||||
<span>0</span><span>8</span><span>16</span><span>24</span><span>32</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Result Display -->
|
||||
<div class="result-display info">
|
||||
<div class="result-content">
|
||||
<span class="result-label">Subnet Mask</span>
|
||||
<span class="result-value">{$mask}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.converter-section { margin: var(--spacing-lg) 0; }
|
||||
.slider-label { display:block;font-size:var(--font-size-sm);font-weight:600;color:var(--text-primary);margin-bottom:var(--spacing-sm);cursor:help; }
|
||||
.slider-container { position:relative; }
|
||||
.cidr-slider { width:100%;height:0.5rem;background-color:var(--bg-tertiary);border-radius:var(--radius-lg);appearance:none;cursor:pointer;outline:none; }
|
||||
.cidr-slider::-webkit-slider-thumb { appearance:none;height:1.25rem;width:1.25rem;border-radius:50%;background:var(--color-primary);cursor:pointer;box-shadow:var(--shadow-md);transition:transform var(--transition-fast); }
|
||||
.cidr-slider::-webkit-slider-thumb:hover { transform:scale(1.1); }
|
||||
.cidr-slider::-moz-range-thumb { height:1.25rem;width:1.25rem;border-radius:50%;background:var(--color-primary);cursor:pointer;border:none;box-shadow:var(--shadow-md);transition:transform var(--transition-fast); }
|
||||
.cidr-slider::-moz-range-thumb:hover { transform:scale(1.1); }
|
||||
.slider-markers { display:flex;justify-content:space-between;font-size:var(--font-size-xs);color:var(--text-secondary);margin-top:var(--spacing-xs); }
|
||||
.result-display { padding:var(--spacing-md);border-radius:var(--radius-lg);margin-top:var(--spacing-md); }
|
||||
.result-display.info { background:linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));border:1px solid var(--color-info); }
|
||||
.result-content { text-align:center; }
|
||||
.result-label { display:block;font-size:var(--font-size-sm);color:var(--text-secondary);margin-bottom:var(--spacing-xs); }
|
||||
.result-value { display:block;font-size:var(--font-size-2xl);font-family:var(--font-mono);font-weight:700;color:var(--text-primary); }
|
||||
</style>
|
||||
@@ -0,0 +1,40 @@
|
||||
<!-- src/routes/cidr-convertor/subnet-mask-to-cidr/+page.svelte -->
|
||||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import { CIDR_CTX, type CidrContext } from '$lib/contexts/cidr';
|
||||
|
||||
const { cidr, mask, handleMaskChange } = getContext<CidrContext>(CIDR_CTX);
|
||||
</script>
|
||||
|
||||
<div class="converter-section fade-in">
|
||||
<!-- Mask Input -->
|
||||
<div class="form-group">
|
||||
<label for="mask-input">Subnet Mask</label>
|
||||
<input
|
||||
id="mask-input"
|
||||
type="text"
|
||||
value={$mask}
|
||||
placeholder="255.255.255.0"
|
||||
class="mask-input"
|
||||
on:input={(e) => handleMaskChange((e.target as HTMLInputElement).value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Result Display -->
|
||||
<div class="result-display success">
|
||||
<div class="result-content">
|
||||
<span class="result-label">CIDR Notation</span>
|
||||
<span class="result-value">/{$cidr}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.converter-section { margin: var(--spacing-lg) 0; }
|
||||
.mask-input { font-family:var(--font-mono);font-size:var(--font-size-lg); }
|
||||
.result-display { padding:var(--spacing-md);border-radius:var(--radius-lg);margin-top:var(--spacing-md); }
|
||||
.result-display.success { background:linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));border:1px solid var(--color-success); }
|
||||
.result-content { text-align:center; }
|
||||
.result-label { display:block;font-size:var(--font-size-sm);color:var(--text-secondary);margin-bottom:var(--spacing-xs); }
|
||||
.result-value { display:block;font-size:var(--font-size-2xl);font-family:var(--font-mono);font-weight:700;color:var(--text-primary); }
|
||||
</style>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
import IPConverter from '$lib/components/IPConverter.svelte';
|
||||
import '../../styles/pages.scss';
|
||||
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>IP Address Converter - IP Calc</title>
|
||||
<meta name="description" content="Convert IP addresses between decimal, binary, hexadecimal, and octal formats. Professional IP address conversion tool." />
|
||||
<meta name="keywords" content="IP converter, IP address converter, binary IP, hexadecimal IP, octal IP, decimal IP" />
|
||||
<meta property="og:title" content="IP Address Converter - IP Calc" />
|
||||
<meta property="og:description" content="Convert IP addresses between different number formats with professional networking tools" />
|
||||
<meta property="og:url" content="https://ip-calc.as93.net/ip-address-convertor" />
|
||||
</svelte:head>
|
||||
|
||||
|
||||
<IPConverter />
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<!-- src/routes/reference/+page.svelte -->
|
||||
<script lang="ts">
|
||||
// No heavy logic needed on the landing page
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Network Reference</h2>
|
||||
<p>Essential networking information and constants for IP address planning.</p>
|
||||
</header>
|
||||
|
||||
<section class="grid grid-3 landing-cards">
|
||||
<a class="ref-card" href="/ip-reference/network-classes" aria-label="Network Classes reference">
|
||||
<h3>Network Classes</h3>
|
||||
<p>Class A/B/C summary with default masks, ranges, and usage.</p>
|
||||
<span class="cta">View →</span>
|
||||
</a>
|
||||
|
||||
<a class="ref-card" href="/ip-reference/reserved-ranges" aria-label="Reserved Ranges reference">
|
||||
<h3>Reserved Ranges</h3>
|
||||
<p>Loopback, link-local, private (RFC 1918), multicast & more.</p>
|
||||
<span class="cta">View →</span>
|
||||
</a>
|
||||
|
||||
<a class="ref-card" href="/ip-reference/common-subnets" aria-label="Common Subnets reference">
|
||||
<h3>Common Subnets</h3>
|
||||
<p>Handy CIDR ↔ mask table with typical usage and host counts.</p>
|
||||
<span class="cta">View →</span>
|
||||
</a>
|
||||
</section>
|
||||
|
||||
<!-- Quick Tips -->
|
||||
<section class="tips-section">
|
||||
<h4 class="tips-header">
|
||||
<svg class="tip-icon" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Pro Tips
|
||||
</h4>
|
||||
<ul class="tips-list">
|
||||
<li>• Always plan for future growth when choosing subnet sizes</li>
|
||||
<li>• Use /30 subnets for point-to-point links to save addresses</li>
|
||||
<li>• Consider VLSM (Variable Length Subnet Masking) for efficient allocation</li>
|
||||
<li>• Private addresses (RFC 1918) are not routable on the Internet</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.landing-cards {
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
.ref-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
text-decoration: none;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
h3 { margin: 0; color: var(--text-primary); }
|
||||
p { margin: 0; color: var(--text-secondary); }
|
||||
.cta { margin-top: auto; color: var(--color-primary); font-weight: 600; }
|
||||
|
||||
&:hover {
|
||||
border-color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
}
|
||||
|
||||
.tips-section {
|
||||
margin-top: var(--spacing-xl);
|
||||
padding: var(--spacing-md);
|
||||
background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--border-secondary);
|
||||
|
||||
.tips-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
.tip-icon {
|
||||
width: 1rem; height: 1rem; color: var(--color-warning);
|
||||
}
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
list-style: none;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
display: flex; flex-direction: column; gap: var(--spacing-xs);
|
||||
margin: 0; padding: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,134 @@
|
||||
<!-- src/routes/reference/common-subnets/+page.svelte -->
|
||||
<script lang="ts">
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import { COMMON_SUBNETS } from '$lib/constants/networks.js';
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Common Subnets</h2>
|
||||
<p>Frequently used CIDR prefixes with masks, host counts, and typical usage.</p>
|
||||
</header>
|
||||
|
||||
<div class="subnets-table fade-in">
|
||||
<div class="table-header">
|
||||
<span>CIDR</span>
|
||||
<span>Subnet Mask</span>
|
||||
<span>Hosts</span>
|
||||
<span>Usage</span>
|
||||
</div>
|
||||
|
||||
{#each COMMON_SUBNETS as subnet}
|
||||
<Tooltip text={`/${subnet.cidr} with ${subnet.mask} supports ${subnet.hosts.toLocaleString()} hosts`} position="top">
|
||||
<div class="table-row">
|
||||
<span class="cidr-cell">/{subnet.cidr}</span>
|
||||
<span class="mask-cell">{subnet.mask}</span>
|
||||
<span class="hosts-cell">{subnet.hosts.toLocaleString()}</span>
|
||||
<span class="usage-cell">
|
||||
{#if subnet.cidr === 8}
|
||||
Large ISPs
|
||||
{:else if subnet.cidr === 16}
|
||||
Universities
|
||||
{:else if subnet.cidr === 24}
|
||||
Small businesses
|
||||
{:else if subnet.cidr === 25}
|
||||
Departments
|
||||
{:else if subnet.cidr === 26}
|
||||
Teams
|
||||
{:else if subnet.cidr === 27}
|
||||
Small offices
|
||||
{:else if subnet.cidr === 28}
|
||||
Workgroups
|
||||
{:else if subnet.cidr === 29}
|
||||
Small groups
|
||||
{:else if subnet.cidr === 30}
|
||||
Point-to-point
|
||||
{:else}
|
||||
General use
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.subnets-table {
|
||||
margin: var(--spacing-lg) 0;
|
||||
|
||||
:global(.tooltip-container) { width: 100%; }
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr 1.5fr 2fr;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
> span {
|
||||
display: flex; align-items: center;
|
||||
|
||||
&:nth-child(1), &:nth-child(2), &:nth-child(4) { justify-content: flex-start; }
|
||||
&:nth-child(3) { justify-content: flex-end; }
|
||||
}
|
||||
|
||||
@media (max-width: 768px) { display: none; }
|
||||
}
|
||||
|
||||
.table-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr 1.5fr 2fr;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-radius: var(--radius-lg);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
transition: background-color var(--transition-fast);
|
||||
cursor: help;
|
||||
|
||||
&:hover { background-color: var(--surface-hover); }
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: flex; flex-direction: column; gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
|
||||
.cidr-cell, .mask-cell, .hosts-cell, .usage-cell {
|
||||
display: flex; align-items: center; font-family: var(--font-mono);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
color: var(--text-secondary);
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cidr-cell {
|
||||
font-weight: 700; color: var(--color-info-light); justify-content: flex-start;
|
||||
@media (max-width: 768px) { &::before { content: 'CIDR: '; } }
|
||||
}
|
||||
|
||||
.mask-cell {
|
||||
font-size: var(--font-size-sm); color: var(--text-primary); justify-content: flex-start;
|
||||
@media (max-width: 768px) { &::before { content: 'Mask: '; } }
|
||||
}
|
||||
|
||||
.hosts-cell {
|
||||
font-size: var(--font-size-sm); color: var(--color-success-light); justify-content: flex-end;
|
||||
@media (max-width: 768px) { &::before { content: 'Hosts: '; } }
|
||||
}
|
||||
|
||||
.usage-cell {
|
||||
font-size: var(--font-size-sm); color: var(--text-secondary); justify-content: flex-start;
|
||||
font-family: inherit;
|
||||
@media (max-width: 768px) { &::before { content: 'Usage: '; } }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,108 @@
|
||||
<!-- src/routes/reference/network-classes/+page.svelte -->
|
||||
<script lang="ts">
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import { NETWORK_CLASSES } from '$lib/constants/networks.js';
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Network Classes</h2>
|
||||
<p>Class A/B/C overview with default masks, ranges, and typical usage.</p>
|
||||
</header>
|
||||
|
||||
<div class="reference-section fade-in">
|
||||
{#each Object.entries(NETWORK_CLASSES) as [className, classInfo]}
|
||||
<Tooltip text={`Class ${className} networks use ${classInfo.defaultMask} (/${classInfo.cidr}) and cover ${classInfo.range}`} position="top">
|
||||
<div class="reference-card">
|
||||
<div class="card-header-inline">
|
||||
<div class="class-info">
|
||||
<div class="class-badge {className.toLowerCase()}">
|
||||
{className}
|
||||
</div>
|
||||
<div class="class-details">
|
||||
<h3>Class {className}</h3>
|
||||
<span class="mask-info">
|
||||
{classInfo.defaultMask} (/{classInfo.cidr})
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<span class="range-badge">
|
||||
{classInfo.range.split(' - ')[0]} - {classInfo.range.split(' - ')[1]}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p class="class-description">
|
||||
{classInfo.description}
|
||||
</p>
|
||||
|
||||
<p class="usage-info">
|
||||
<strong>Typical Usage:</strong> {classInfo.usage}
|
||||
</p>
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.reference-section {
|
||||
display: flex; flex-direction: column; gap: var(--spacing-md);
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
.reference-card {
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--bg-secondary);
|
||||
padding: var(--spacing-md);
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
border-color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
}
|
||||
|
||||
.card-header-inline {
|
||||
display: flex; justify-content: space-between; align-items: flex-start;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column; align-items: flex-start; gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
.class-info { display: flex; align-items: center; gap: var(--spacing-sm); }
|
||||
|
||||
.class-badge {
|
||||
width: 2rem; height: 2rem; border-radius: 50%;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-weight: 700; color: var(--text-primary);
|
||||
|
||||
&.a { background-color: var(--color-info); }
|
||||
&.b { background-color: var(--color-success); }
|
||||
&.c { background-color: var(--color-warning); }
|
||||
}
|
||||
|
||||
.class-details {
|
||||
h3 { margin: 0; color: var(--text-primary); font-weight: 600; }
|
||||
}
|
||||
|
||||
.mask-info {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.range-badge {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
background-color: var(--bg-tertiary);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.class-description { font-size: var(--font-size-sm); color: var(--text-primary); margin-bottom: var(--spacing-sm); }
|
||||
.usage-info { font-size: var(--font-size-xs); color: var(--text-secondary); }
|
||||
</style>
|
||||
@@ -0,0 +1,90 @@
|
||||
<!-- src/routes/reference/reserved-ranges/+page.svelte -->
|
||||
<script lang="ts">
|
||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||
import { RESERVED_RANGES } from '$lib/constants/networks.js';
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h2>Reserved Ranges</h2>
|
||||
<p>Special-purpose IPv4 ranges (loopback, private, link-local, multicast, etc.).</p>
|
||||
</header>
|
||||
|
||||
<div class="reference-section fade-in">
|
||||
{#each Object.entries(RESERVED_RANGES) as [rangeName, rangeInfo]}
|
||||
<Tooltip text={`${rangeInfo.description} — Defined in ${rangeInfo.rfc}`} position="top">
|
||||
<div class="reference-card">
|
||||
<div class="card-header-inline">
|
||||
<div class="range-info">
|
||||
<h3 class="range-address">{rangeInfo.range}</h3>
|
||||
<span class="range-description">{rangeInfo.description}</span>
|
||||
</div>
|
||||
<span class="rfc-badge">{rangeInfo.rfc}</span>
|
||||
</div>
|
||||
|
||||
{#if rangeName.includes('PRIVATE')}
|
||||
<div class="private-notice">
|
||||
<strong>Private Network:</strong> Not routed on the public Internet
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.reference-section {
|
||||
display: flex; flex-direction: column; gap: var(--spacing-md);
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
.reference-card {
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--bg-secondary);
|
||||
padding: var(--spacing-md);
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
border-color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
}
|
||||
|
||||
.card-header-inline {
|
||||
display: flex; justify-content: space-between; align-items: flex-start;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column; align-items: flex-start; gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
.range-info h3 {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.range-description { font-size: var(--font-size-sm); color: var(--text-secondary); }
|
||||
|
||||
.rfc-badge {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-info-light);
|
||||
background-color: rgba(9, 105, 218, 0.1);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.private-notice {
|
||||
margin-top: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
background-color: rgba(35, 134, 54, 0.1);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-success-light);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
import SubnetCalculator from '$lib/components/SubnetCalculator.svelte';
|
||||
import '../../styles/pages.scss';
|
||||
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Subnet Calculator - IP Calc</title>
|
||||
<meta name="description" content="Calculate subnet information, network addresses, broadcast addresses, and host ranges. Professional subnet calculator with visual network analysis." />
|
||||
<meta name="keywords" content="subnet calculator, network calculator, IP subnetting, CIDR, network analysis" />
|
||||
<meta property="og:title" content="Subnet Calculator - IP Calc" />
|
||||
<meta property="og:description" content="Professional subnet calculator with network visualization and detailed analysis" />
|
||||
<meta property="og:url" content="https://ip-calc.as93.net/subnet-calculator" />
|
||||
</svelte:head>
|
||||
|
||||
<div class="page">
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
<SubnetCalculator />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -130,10 +130,6 @@ code, pre {
|
||||
background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.header {
|
||||
background-color: var(--bg-secondary);
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
// Header
|
||||
.header {
|
||||
background-color: var(--bg-secondary);
|
||||
|
||||
@@ -0,0 +1,506 @@
|
||||
/* Converter and Reference Component Styles */
|
||||
|
||||
/* Converter section styles */
|
||||
.converter-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--spacing-lg);
|
||||
margin: var(--spacing-lg) 0;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
|
||||
.input-group, .output-group {
|
||||
flex: 1;
|
||||
max-width: 300px;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
.conversion-arrow {
|
||||
color: var(--color-primary);
|
||||
flex-shrink: 0;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.input-prefix {
|
||||
position: absolute;
|
||||
left: var(--spacing-sm);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: var(--text-secondary);
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.input-number {
|
||||
padding-left: 2rem !important;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-lg);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.input-mask {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-lg);
|
||||
padding-right: 2.5rem;
|
||||
|
||||
&.valid {
|
||||
border-color: var(--color-success);
|
||||
}
|
||||
|
||||
&.invalid {
|
||||
border-color: var(--color-error);
|
||||
}
|
||||
}
|
||||
|
||||
.input-result {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-lg);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-color: var(--border-secondary);
|
||||
color: var(--color-success);
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
|
||||
&[type="text"] {
|
||||
padding-right: 4rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Preset styles */
|
||||
.presets-section {
|
||||
margin: var(--spacing-lg) 0;
|
||||
|
||||
h3 {
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.presets-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.preset-btn {
|
||||
padding: var(--spacing-xs) var(--spacing-md);
|
||||
font-size: var(--font-size-sm);
|
||||
font-family: var(--font-mono);
|
||||
border-radius: var(--radius-sm);
|
||||
background-color: var(--bg-tertiary);
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--border-secondary);
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: var(--color-primary);
|
||||
color: var(--text-primary);
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Mask preset specific styles */
|
||||
.presets-section .presets-grid.mask-presets {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
|
||||
.preset-btn {
|
||||
font-size: var(--font-size-xs);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
/* Result section styles */
|
||||
.result-section {
|
||||
margin-top: var(--spacing-lg);
|
||||
|
||||
h3 {
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
.result-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
|
||||
.result-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-radius: var(--radius-sm);
|
||||
|
||||
.result-label {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.result-value {
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Reference component styles */
|
||||
.reference-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
.card-header-inline {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
.class-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.class-badge {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
|
||||
&.a { background-color: var(--color-info); }
|
||||
&.b { background-color: var(--color-success); }
|
||||
&.c { background-color: var(--color-warning); }
|
||||
}
|
||||
|
||||
.class-details {
|
||||
h3 {
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.mask-info {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.range-badge {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
background-color: var(--bg-tertiary);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.range-info {
|
||||
h3 {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.range-description {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.rfc-badge {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-info-light);
|
||||
background-color: rgba(9, 105, 218, 0.1);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.private-notice {
|
||||
margin-top: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
background-color: rgba(35, 134, 54, 0.1);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-success-light);
|
||||
}
|
||||
|
||||
/* Tips and explanatory sections */
|
||||
.tips-section {
|
||||
margin-top: var(--spacing-xl);
|
||||
padding: var(--spacing-md);
|
||||
background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--border-secondary);
|
||||
|
||||
.tips-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.tips-content {
|
||||
p {
|
||||
margin-bottom: var(--spacing-sm);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
list-style: none;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
}
|
||||
|
||||
.range-categories,
|
||||
.planning-tips,
|
||||
.class-comparison {
|
||||
margin-top: var(--spacing-md);
|
||||
|
||||
h4 {
|
||||
margin-bottom: var(--spacing-sm);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
padding: var(--spacing-xs) 0;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.comparison-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
|
||||
.comparison-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-radius: var(--radius-sm);
|
||||
|
||||
.class-name {
|
||||
font-weight: 600;
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
&.class-a {
|
||||
background-color: var(--color-info);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&.class-b {
|
||||
background-color: var(--color-success);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
&.class-c {
|
||||
background-color: var(--color-warning);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
span:last-child {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix for input prefix positioning in mask converter */
|
||||
.input-group .input-prefix.mask-prefix {
|
||||
right: 3rem;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
/* Subnet table styles for CommonSubnetsReference */
|
||||
.subnets-table {
|
||||
margin: var(--spacing-lg) 0;
|
||||
|
||||
:global(.tooltip-container) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.table-header {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr 1.5fr 2fr;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
|
||||
> span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&:nth-child(1), &:nth-child(2), &:nth-child(4) {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&:nth-child(3) {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.table-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2fr 1.5fr 2fr;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-radius: var(--radius-lg);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
transition: background-color var(--transition-fast);
|
||||
cursor: help;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
|
||||
.cidr-cell, .mask-cell, .hosts-cell, .usage-cell {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-family: var(--font-mono);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
color: var(--text-secondary);
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cidr-cell {
|
||||
font-weight: 700;
|
||||
color: var(--color-info-light);
|
||||
justify-content: flex-start;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'CIDR: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mask-cell {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
justify-content: flex-start;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'Mask: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hosts-cell {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-success-light);
|
||||
justify-content: flex-end;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'Hosts: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.usage-cell {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
justify-content: flex-start;
|
||||
font-family: inherit;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
&::before {
|
||||
content: 'Usage: ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Additional styles for missing elements */
|
||||
.class-description {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.usage-info {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
/* Page Layout Styles */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-lg);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
gap: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sub-nav {
|
||||
background-color: var(--bg-tertiary);
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
padding: var(--spacing-sm) 0;
|
||||
|
||||
.sub-nav-links {
|
||||
display: flex;
|
||||
gap: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.sub-nav-link {
|
||||
padding: var(--spacing-xs) var(--spacing-md);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: var(--color-primary);
|
||||
background-color: var(--surface-hover);
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.logo {
|
||||
h1 a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.logo-icon a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding: var(--spacing-lg);
|
||||
border-top: 1px solid var(--border-primary);
|
||||
margin-top: var(--spacing-xl);
|
||||
|
||||
.footer-content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.footer-sub {
|
||||
font-size: var(--font-size-xs) !important;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
transition: color var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
color: var(--color-primary-light);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Homepage specific styles */
|
||||
.hero {
|
||||
text-align: center;
|
||||
padding: var(--spacing-xl) 0 var(--spacing-lg);
|
||||
|
||||
.hero-content {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
|
||||
h2 {
|
||||
font-size: var(--font-size-2xl);
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-md);
|
||||
line-height: 1.2;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: var(--font-size-xl);
|
||||
}
|
||||
}
|
||||
|
||||
.hero-description {
|
||||
font-size: var(--font-size-lg);
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tools-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
|
||||
.tool-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-md);
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: all var(--transition-fast);
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
border-color: var(--color-primary);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
|
||||
.tool-arrow {
|
||||
transform: translateX(4px);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
}
|
||||
|
||||
.tool-icon {
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: var(--color-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
color: var(--text-primary);
|
||||
flex-shrink: 0;
|
||||
|
||||
svg {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.tool-content {
|
||||
flex: 1;
|
||||
|
||||
h3 {
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin: 0 0 var(--spacing-xs) 0;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.tool-arrow {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
color: var(--text-secondary);
|
||||
transition: all var(--transition-fast);
|
||||
flex-shrink: 0;
|
||||
|
||||
svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* About page specific styles */
|
||||
.about-content {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
|
||||
section {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
h2, h3 {
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hero-section {
|
||||
text-align: center;
|
||||
padding: var(--spacing-xl) 0;
|
||||
|
||||
h2 {
|
||||
font-size: var(--font-size-2xl);
|
||||
margin-bottom: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.lead {
|
||||
font-size: var(--font-size-lg);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
margin-top: var(--spacing-lg);
|
||||
|
||||
.feature-card {
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
h4 {
|
||||
color: var(--color-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tech-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
||||
li {
|
||||
padding: var(--spacing-sm) 0;
|
||||
border-bottom: 1px solid var(--border-primary);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
strong {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.links-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
margin-top: var(--spacing-lg);
|
||||
|
||||
.link-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-md);
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border-radius: var(--radius-lg);
|
||||
border: 1px solid var(--border-primary);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
border-color: var(--color-primary);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
color: var(--color-primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
color: var(--text-primary);
|
||||
margin: 0 0 var(--spacing-xs) 0;
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-sm);
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
text-align: center;
|
||||
margin-top: var(--spacing-lg);
|
||||
}
|
||||
Reference in new issue
Block a user