mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-25 23:24:14 +03:00
DNS Zone diff, lint, stats, parsing, len check
This commit is contained in:
1 parent
f3396b632f
commit
7470a8d92f
12 files changed
+4618
-6
No files matched your search
@@ -45,12 +45,16 @@
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>
|
||||
</svg>
|
||||
{:else if name === 'shield-check'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128 203.7C128.5 295.1 166.4 453 314.4 523.8C318 525.5 322.2 525.5 325.7 523.8C473.7 453 511.6 295.1 512 203.7C512 198.7 508.9 193.5 503 191L320 113.4L137 191C131.1 193.5 127.9 198.7 128 203.7zM230.8 349.5C221.6 340 221.8 324.8 231.4 315.6C240.9 306.4 256.1 306.7 265.3 316.2L291.8 343.6L377.4 225.9C385.2 215.2 400.2 212.8 410.9 220.6C421.6 228.4 424 243.4 416.2 254.1L313.8 394.9C309.6 400.6 303.1 404.2 296 404.7C288.9 405.2 282 402.5 277.1 397.4L230.7 349.4z"/><path d="M320.1 64C324.7 64 329.3 65 333.4 66.9L521.8 146.8C543.8 156.1 560.2 177.8 560.1 204C559.6 303.2 518.8 484.7 346.5 567.2C329.8 575.2 310.4 575.2 293.7 567.2C121.3 484.7 80.5 303.3 80 204C79.9 177.8 96.3 156.1 118.3 146.8L306.7 66.9C310.8 65 315.4 64 320.1 64zM137.1 191C131.2 193.5 128 198.7 128.1 203.7C128.6 295.1 166.5 453 314.5 523.8C318.1 525.5 322.3 525.5 325.8 523.8C473.8 453 511.7 295.1 512.1 203.7C512.1 198.7 509 193.5 503.1 191L320.1 113.4L137.1 191zM377.4 225.9C385.2 215.2 400.2 212.8 410.9 220.6C421.6 228.4 424 243.4 416.2 254.1L313.8 394.9C309.6 400.6 303.1 404.2 296 404.7C288.9 405.2 282 402.5 277.1 397.4L230.7 349.4C221.5 339.9 221.7 324.7 231.3 315.5C240.8 306.3 256 306.6 265.2 316.1L291.7 343.5L377.3 225.8z"/></svg>
|
||||
{:else if name === 'shield-alert'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128 203.7C128.5 295.1 166.4 453 314.4 523.8C318 525.5 322.2 525.5 325.7 523.8C473.7 453 511.6 295.1 512 203.7C512 198.7 508.9 193.5 503 190.9L320 113.4L137.1 191C131.2 193.5 128 198.8 128.1 203.8zM252.1 236.1C261.5 226.7 276.7 226.7 286 236.1L320 270.1L354 236.1C363.4 226.7 378.6 226.7 387.9 236.1C397.2 245.5 397.3 260.7 387.9 270L354 304L387.9 337.9C397.3 347.3 397.3 362.5 387.9 371.8C378.5 381.1 363.3 381.2 354 371.8L320.1 337.9L286.2 371.8C276.8 381.2 261.6 381.2 252.3 371.8C243 362.4 242.9 347.2 252.3 337.9L286.2 304L252.3 270.1C242.9 260.7 242.9 245.5 252.3 236.2z"/><path d="M137.1 191L320 113.4L503 191C508.9 193.5 512.1 198.8 512 203.8C511.6 295.2 473.6 453.1 325.7 523.9C322.1 525.6 317.9 525.6 314.4 523.9C166.4 453.1 128.5 295.2 128 203.8C128 198.8 131.1 193.6 137 191zM521.8 146.8L333.4 66.9C329.2 65 324.7 64 320 64C315.3 64 310.8 65 306.6 66.9L118.3 146.8C96.3 156.1 79.9 177.8 80 204C80.5 303.2 121.3 484.7 293.6 567.2C310.3 575.2 329.7 575.2 346.4 567.2C518.8 484.7 559.5 303.2 560 204C560.1 177.8 543.7 156.1 521.7 146.8zM387.9 236.1C378.5 226.7 363.3 226.7 354 236.1L320.1 270L286.2 236.1C276.8 226.7 261.6 226.7 252.3 236.1C243 245.5 242.9 260.7 252.3 270L286.2 303.9L252.3 337.8C242.9 347.2 242.9 362.4 252.3 371.7C261.7 381 276.9 381.1 286.2 371.7L320 337.9L354 371.9C363.4 381.3 378.6 381.3 387.9 371.9C397.2 362.5 397.3 347.3 387.9 338L354 304L387.9 270.1C397.3 260.7 397.3 245.5 387.9 236.2z"/></svg>
|
||||
{:else if name === 'maximize'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M144 144L220.1 144L144 220.1L144 144zM144 419.9L220.1 496L144 496L144 419.9zM419.9 144L496 144L496 220.1L419.9 144zM419.9 496L496 419.9L496 496L419.9 496z"/><path d="M220.1 144L144 144L144 220.1L220.1 144zM96 256L96 128C96 110.3 110.3 96 128 96L256 96C273.7 96 288 110.3 288 128L288 130.7C288 139.2 284.6 147.3 278.6 153.3L232.9 199L319.9 286L406.9 199L361.2 153.3C355.2 147.3 351.8 139.2 351.8 130.7L351.8 128C351.8 110.3 366.1 96 383.8 96L511.8 96C529.5 96 543.8 110.3 543.8 128L543.8 256C543.8 273.7 529.5 288 511.8 288L509.1 288C500.6 288 492.5 284.6 486.5 278.6L440.8 232.9L353.8 319.9L440.8 406.9L486.5 361.2C492.5 355.2 500.6 351.8 509.1 351.8L511.8 351.8C529.5 351.8 543.8 366.1 543.8 383.8L543.8 511.8C543.8 529.5 529.5 543.8 511.8 543.8L383.8 543.8C366.1 543.8 351.8 529.5 351.8 511.8L351.8 509.1C351.8 500.6 355.2 492.5 361.2 486.5L406.9 440.8L319.9 353.8L232.9 440.8L278.6 486.5C284.6 492.5 288 500.6 288 509.1L288 511.8C288 529.5 273.7 543.8 256 543.8L128 544C110.3 544 96 529.7 96 512L96 384C96 366.3 110.3 352 128 352L130.7 352C139.2 352 147.3 355.4 153.3 361.4L199 407.1L286 320.1L199 233.1L153.3 278.8C147.3 284.8 139.2 288.2 130.7 288.2L128 288C110.3 288 96 273.7 96 256zM419.9 496L496 496L496 419.9L419.9 496zM144 419.9L144 496L220.1 496L144 419.9zM419.9 144L496 220.1L496 144L419.9 144z"/></svg>
|
||||
{:else if name === 'pie' || name === 'dns-zone-stats'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M112.4 336C112.4 442 198.4 528 304.4 528C329 528 352.4 523.4 373.9 515.1L257 373.9C246.3 361 240.4 344.7 240.4 328L240.4 154.9C165.8 181.3 112.4 252.4 112.4 336z"/><path d="M384.4 118L384.4 256L522.4 256C505 188.6 451.9 135.4 384.4 118zM240.4 328L240.4 154.9C165.8 181.3 112.4 252.4 112.4 336C112.4 442 198.4 528 304.4 528C329 528 352.4 523.4 373.9 515.1L257 373.9C246.3 361 240.4 344.7 240.4 328zM574.3 272.1C576.6 289.6 562.1 304 544.4 304L368.4 304C350.7 304 336.4 289.7 336.4 272L336.4 96C336.4 78.3 350.8 63.8 368.3 66.1C475.3 80.3 560.1 165.1 574.3 272.1zM288.4 130.7L288.4 328C288.4 333.6 290.4 339 293.9 343.3L426 502.7C437.7 516.8 435.2 538.1 419.1 546.8C385 565.4 345.9 576 304.4 576C171.9 576 64.4 468.5 64.4 336C64.4 220.5 145.9 124.1 254.6 101.2C272.7 97.4 288.4 112.2 288.4 130.7zM573.7 352C592.2 352 607 367.7 603.2 385.8C593 434.2 568.2 477.2 533.6 510C521.3 521.7 502 519.2 491.2 506.1L406.9 404.4C389.6 383.5 404.5 352 431.5 352L573.7 352z"/></svg>
|
||||
{:else if name === 'layers'}
|
||||
<svg fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M12 2l-5.5 9h11z"/>
|
||||
<path d="M12 8.5L6.5 17h11z"/>
|
||||
<path d="M12 15l-5.5 9h11z"/>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M145.2 192L316.6 271.2C318.7 272.2 321.2 272.2 323.3 271.2L494.8 192L323.4 112.7C321.3 111.7 318.8 111.7 316.7 112.7L145.2 192z"/><path d="M323.4 112.7L494.8 192L323.4 271.2C321.3 272.2 318.8 272.2 316.7 271.2L145.2 192L316.6 112.7C318.7 111.7 321.2 111.7 323.3 112.7zM343.5 69.2C328.6 62.3 311.4 62.3 296.5 69.2L77.9 170.2C69.4 174.1 64 182.6 64 192C64 201.4 69.4 209.9 77.9 213.8L296.5 314.8C311.4 321.7 328.6 321.7 343.5 314.8L562.1 213.8C570.6 209.9 576 201.4 576 192C576 182.6 570.6 174.1 562.1 170.2L343.5 69.2zM112.1 282.4L77.9 298.2C69.4 302.1 64 310.6 64 320C64 329.4 69.4 337.9 77.9 341.8L296.5 442.8C311.4 449.7 328.6 449.7 343.5 442.8L562.1 341.8C570.6 337.9 576 329.4 576 320C576 310.6 570.6 302.1 562.1 298.2L528 282.4L470.8 308.8L494.9 319.9L323.5 399.1C321.4 400.1 318.9 400.1 316.8 399.1L145.2 320L169.3 308.9L112.1 282.4zM77.9 426.2C69.4 430.1 64 438.6 64 448C64 457.4 69.4 465.9 77.9 469.8L296.5 570.8C311.4 577.7 328.6 577.7 343.5 570.8L562.1 469.8C570.6 465.9 576 457.4 576 448C576 438.6 570.6 430.1 562.1 426.2L528 410.4L470.8 436.8L494.9 447.9L323.5 527.1C321.4 528.1 318.9 528.1 316.8 527.1L145.4 447.9L169.5 436.8L112.3 410.4L78.2 426.2z"/></svg>
|
||||
{:else if name === 'warning'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d="M117.4 496L320 120.8L522.6 496L117.4 496zM293.3 448C292.7 457.9 297.6 467.3 306.1 472.5C314.6 477.6 325.3 477.6 333.8 472.5C342.3 467.3 347.2 457.9 346.6 448C347.2 438.1 342.3 428.7 333.8 423.5C325.3 418.4 314.6 418.4 306.1 423.5C297.6 428.7 292.7 438.1 293.3 448zM296 256L296 368C296 381.3 306.7 392 320 392C333.3 392 344 381.3 344 368L344 256C344 242.7 333.3 232 320 232C306.7 232 296 242.7 296 256z"/><path d="M117.4 496L320 120.8L522.6 496L117.4 496zM355.2 85C348.2 72.1 334.7 64 320 64C305.3 64 291.8 72.1 284.8 85L68.8 485C62.1 497.4 62.4 512.4 69.6 524.5C76.8 536.6 89.9 544 104 544L536 544C550.1 544 563.1 536.6 570.4 524.5C577.7 512.4 577.9 497.4 571.2 485L355.2 85zM320 232C306.7 232 296 242.7 296 256L296 368C296 381.3 306.7 392 320 392C333.3 392 344 381.3 344 368L344 256C344 242.7 333.3 232 320 232zM346.7 448C347.3 438.1 342.4 428.7 333.9 423.5C325.4 418.4 314.7 418.4 306.2 423.5C297.7 428.7 292.8 438.1 293.4 448C292.8 457.9 297.7 467.3 306.2 472.5C314.7 477.6 325.4 477.6 333.9 472.5C342.4 467.3 347.3 457.9 346.7 448z"/></svg>
|
||||
{:else if name === 'info'}
|
||||
@@ -185,6 +189,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 160C496 151.2 488.8 144 480 144L449 144C458.6 163.3 464 185 464 208C464 230 459.1 250.8 450.3 269.4C444.6 281.5 431.8 288 418.4 288L221.6 288C208.3 288 195.4 281.5 189.7 269.4C180.9 250.8 176 229.9 176 208C176 185 181.4 163.3 191 144L160 144C151.2 144 144 151.2 144 160z"/><path d="M410.6 240C414.1 230 416 219.3 416 208C416 155 373 112 320 112C267 112 224 155 224 208C224 219.3 225.9 230 229.4 240L300.8 240L330 174.3C335.4 162.2 349.6 156.7 361.7 162.1C373.8 167.5 379.3 181.7 373.9 193.8L353.3 240.1L410.5 240.1zM450.3 269.4C444.6 281.5 431.8 288 418.4 288L221.6 288C208.3 288 195.4 281.5 189.7 269.4C180.9 250.8 176 229.9 176 208C176 185 181.4 163.3 191 144L160 144C151.2 144 144 151.2 144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 160C496 151.2 488.8 144 480 144L449 144C458.6 163.3 464 185 464 208C464 230 459.1 250.8 450.3 269.4zM160 96L229.5 96C254.2 76 285.7 64 320 64C354.3 64 385.8 76 410.5 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160C96 124.7 124.7 96 160 96z"/></svg>
|
||||
{:else if name === 'dns-label-normalize'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M128.1 152C128.1 138.7 138.8 128 152.1 128L308.2 128C314.6 128 320.7 130.5 325.2 135L533.2 343C539.1 348.9 541.3 357.1 539.8 364.7C538.3 368.8 535.9 372.7 532.6 376L452.9 457.2L377 533.1C367.6 542.5 352.4 542.5 343.1 533.1L135.1 325.1C130.6 320.6 128.1 314.5 128.1 308.1L128.1 152zM176.1 208C176.1 225.7 190.4 240 208.1 240C225.8 240 240.1 225.7 240.1 208C240.1 190.3 225.8 176 208.1 176C190.4 176 176.1 190.3 176.1 208z"/><path d="M128.1 152C128.1 138.7 138.8 128 152.1 128L308.2 128C314.6 128 320.7 130.5 325.2 135L533.2 343C542.6 352.4 542.6 367.6 533.2 376.9L377.1 533.1C367.7 542.5 352.5 542.5 343.2 533.1L135.2 325.1C130.7 320.6 128.2 314.5 128.2 308.1L128.1 152zM152.1 80C112.3 80 80.1 112.2 80.1 152L80.1 308.1C80.1 327.2 87.7 345.5 101.2 359L309.2 567C337.3 595.1 382.9 595.1 411 567L567.1 410.9C595.2 382.8 595.2 337.2 567.1 309.1L359.1 101.1C345.6 87.6 327.3 80 308.2 80L152.1 80zM208.1 240C225.8 240 240.1 225.7 240.1 208C240.1 190.3 225.8 176 208.1 176C190.4 176 176.1 190.3 176.1 208C176.1 225.7 190.4 240 208.1 240z"/></svg>
|
||||
{:else if name === 'dns-zone-linter'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M116.7 356.7C122.9 350.5 133.1 350.5 139.3 356.7L183 400.4C189.9 407.3 200.2 409.3 209.2 405.6C218.2 401.9 224 393.1 224 383.4L224 160C224 151.2 231.2 144 240 144C248.8 144 256 151.1 256 159.9L256 296C256 309.3 266.7 320 280 320C293.3 320 304 309.3 304 296C304 188.2 304 132 304 128C304 119.2 311.2 112 320 112C328.8 112 336 119.2 336 128L336 296C336 309.3 346.7 320 360 320C373.3 320 384 309.3 384 296L384 160C384 151.1 391.2 144 400 144C408.8 144 416 151.2 416 160L416 296C416 309.3 426.7 320 440 320C453.3 320 464 309.3 464 296L464 224.1C464 215.2 471.2 208 480 208C488.8 208 496 215.2 496 224L496 396.9C495.9 397.5 495.9 398.2 495.8 398.8C495.2 411.6 492.8 423.9 488.8 435.5C484 436.9 479.2 438.2 474.4 439.6C449.2 446.8 431.9 469.8 431.9 496C431.9 499.7 432.2 503.3 432.9 506.8C413.6 519.1 391 526.7 366.7 527.9C366.1 527.9 365.4 528 364.8 528.1L351.4 528.1C296.2 528.1 243.3 506.2 204.3 467.2L116.5 379.4C110.3 373.2 110.3 363 116.5 356.8zM256 432C256 436.1 258.7 439.6 262.6 440.7L288 448L295.3 473.4C296.4 477.3 300 480 304 480C308 480 311.6 477.3 312.7 473.4L320 448L345.4 440.7C349.3 439.6 352 436 352 432C352 428 349.3 424.4 345.4 423.3L320 416L312.7 390.6C311.6 386.7 308 384 304 384C300 384 296.4 386.7 295.3 390.6L288 416L262.6 423.3C258.7 424.4 256 428 256 432z"/><path d="M262.4 100C272.8 78.7 294.7 64 320 64C345.3 64 367.2 78.7 377.6 100C384.6 97.4 392.1 96 400 96C435.3 96 464 124.7 464 160L464 162C469.1 160.7 474.5 160 480 160C515.3 160 544 188.7 544 224L544 370.2C524.8 375.6 509.3 390.6 503.6 410.5L497.1 433.2L488.8 435.6C492.7 424 495.1 411.7 495.8 398.9C495.8 398.3 495.9 397.6 496 397L496 224C496 215.2 488.8 208 480 208C471.2 208 464 215.2 464 224L464 296C464 309.3 453.3 320 440 320C426.7 320 416 309.3 416 296L416 160C416 151.2 408.8 144 400 144C391.2 144 384 151.1 384 160L384 296C384 309.3 373.3 320 360 320C346.7 320 336 309.3 336 296L336 128C336 119.2 328.8 112 320 112C311.2 112 304 119.2 304 128L304 160L304 160.1L304 296C304 309.3 293.3 320 280 320C266.7 320 256 309.3 256 296L256 159.9C256 151.1 248.8 144 240 144C231.2 144 224 151.2 224 160L224 383.4C224 393.1 218.2 401.9 209.2 405.6C200.2 409.3 189.9 407.3 183 400.4L139.3 356.7C133.1 350.5 122.9 350.5 116.7 356.7C110.5 362.9 110.5 373.1 116.7 379.3L204.5 467.1C243.5 506.1 296.4 528 351.6 528L365 528C365.6 527.9 366.3 527.9 366.9 527.8C391.2 526.6 413.8 519 433.1 506.7C436.2 523.2 446.2 537.6 460.5 546.2C434.9 562.9 404.9 573.4 372.6 575.6C371.2 575.9 369.6 576 368.1 576L351.6 576C283.7 576 218.6 549 170.6 501L82.7 413.3C57.7 388.3 57.7 347.8 82.7 322.8C107.7 297.8 148.2 297.8 173.2 322.8L175.9 325.5L175.9 160C175.9 124.7 204.6 96 239.9 96C247.8 96 255.3 97.4 262.3 100zM312.7 390.6L320 416L345.4 423.3C349.3 424.4 352 428 352 432C352 436 349.3 439.6 345.4 440.7L320 448L312.7 473.4C311.6 477.3 308 480 304 480C300 480 296.4 477.3 295.3 473.4L288 448L262.6 440.7C258.7 439.6 256 436 256 432C256 428 258.7 424.4 262.6 423.3L288 416L295.3 390.6C296.4 386.7 300 384 304 384C308 384 311.6 386.7 312.7 390.6zM570.2 423.7L584 472L632.3 485.8C636.9 487.1 640 491.3 640 496C640 500.7 636.9 504.9 632.3 506.2L584 520L570.2 568.3C568.9 572.9 564.7 576 560 576C555.3 576 551.1 572.9 549.8 568.3L536 520L487.7 506.2C483.1 504.9 480 500.7 480 496C480 491.3 483.1 487.1 487.7 485.8L536 472L549.8 423.7C551.1 419.1 555.3 416 560 416C564.7 416 568.9 419.1 570.2 423.7zM104 152L144 163.4L144 188.5L104 199.9L90.2 248.2C88.9 252.8 84.7 255.9 80 255.9C75.3 255.9 71.1 252.8 69.8 248.2L56 200L7.7 186.2C3.1 184.9 0 180.7 0 176C0 171.3 3.1 167.1 7.7 165.8L56 152L69.8 103.7C71.1 99.1 75.3 96 80 96C84.7 96 88.9 99.1 90.2 103.7L104 152z"/></svg>
|
||||
{:else if name === 'dns-ttl'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M152 352C152 444.8 227.2 520 320 520C412.8 520 488 444.8 488 352C488 259.2 412.8 184 320 184C227.2 184 152 259.2 152 352zM296 248C296 234.7 306.7 224 320 224C333.3 224 344 234.7 344 248L344 352C344 365.3 333.3 376 320 376C306.7 376 296 365.3 296 352L296 248z"/><path d="M240 88C240 74.7 250.7 64 264 64L376 64C389.3 64 400 74.7 400 88C400 101.3 389.3 112 376 112L344 112L344 137.3C393.6 142.8 438.1 165 471.8 198.3L495 175C504.4 165.6 519.6 165.6 528.9 175C538.2 184.4 538.3 199.6 528.9 208.9L502.1 235.7C523.5 269.2 536 309.1 536 351.9C536 471.2 439.3 567.9 320 567.9C200.7 567.9 104 471.3 104 352C104 240.8 188 149.3 296 137.3L296 112L264 112C250.7 112 240 101.3 240 88zM320 184C227.2 184 152 259.2 152 352C152 444.8 227.2 520 320 520C412.8 520 488 444.8 488 352C488 259.2 412.8 184 320 184zM344 248L344 352C344 365.3 333.3 376 320 376C306.7 376 296 365.3 296 352L296 248C296 234.7 306.7 224 320 224C333.3 224 344 234.7 344 248z"/></svg>
|
||||
{:else if name === 'alias'}
|
||||
@@ -195,8 +201,12 @@
|
||||
<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 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm0 10c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
|
||||
</svg>
|
||||
{:else if name === 'code-diff' || name === 'dns-zone-diff'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 128L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 272L376 272C336.2 272 304 239.8 304 200L304 112L192 112C183.2 112 176 119.2 176 128zM248 352C248 338.7 258.7 328 272 328L296 328L296 304C296 290.7 306.7 280 320 280C333.3 280 344 290.7 344 304L344 328L368 328C381.3 328 392 338.7 392 352C392 365.3 381.3 376 368 376L344 376L344 400C344 413.3 333.3 424 320 424C306.7 424 296 413.3 296 400L296 376L272 376C258.7 376 248 365.3 248 352zM248 472C248 458.7 258.7 448 272 448L368 448C381.3 448 392 458.7 392 472C392 485.3 381.3 496 368 496L272 496C258.7 496 248 485.3 248 472z"/><path d="M192 112L304 112L304 200C304 239.8 336.2 272 376 272L464 272L464 512C464 520.8 456.8 528 448 528L192 528C183.2 528 176 520.8 176 512L176 128C176 119.2 183.2 112 192 112zM352 131.9L444.1 224L376 224C362.7 224 352 213.3 352 200L352 131.9zM192 64C156.7 64 128 92.7 128 128L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 250.5C512 233.5 505.3 217.2 493.3 205.2L370.7 82.7C358.7 70.7 342.5 64 325.5 64L192 64zM344 304C344 290.7 333.3 280 320 280C306.7 280 296 290.7 296 304L296 328L272 328C258.7 328 248 338.7 248 352C248 365.3 258.7 376 272 376L296 376L296 400C296 413.3 306.7 424 320 424C333.3 424 344 413.3 344 400L344 376L368 376C381.3 376 392 365.3 392 352C392 338.7 381.3 328 368 328L344 328L344 304zM272 448C258.7 448 248 458.7 248 472C248 485.3 258.7 496 272 496L368 496C381.3 496 392 485.3 392 472C392 458.7 381.3 448 368 448L272 448z"/></svg>
|
||||
{:else if name === 'file'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 128L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 272L376 272C336.2 272 304 239.8 304 200L304 112L192 112C183.2 112 176 119.2 176 128zM224 344C224 330.7 234.7 320 248 320L392 320C405.3 320 416 330.7 416 344C416 357.3 405.3 368 392 368L248 368C234.7 368 224 357.3 224 344zM224 440C224 426.7 234.7 416 248 416L392 416C405.3 416 416 426.7 416 440C416 453.3 405.3 464 392 464L248 464C234.7 464 224 453.3 224 440z"/><path d="M192 112L304 112L304 200C304 239.8 336.2 272 376 272L464 272L464 512C464 520.8 456.8 528 448 528L192 528C183.2 528 176 520.8 176 512L176 128C176 119.2 183.2 112 192 112zM352 131.9L444.1 224L376 224C362.7 224 352 213.3 352 200L352 131.9zM192 64C156.7 64 128 92.7 128 128L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 250.5C512 233.5 505.3 217.2 493.3 205.2L370.7 82.7C358.7 70.7 342.5 64 325.5 64L192 64zM248 320C234.7 320 224 330.7 224 344C224 357.3 234.7 368 248 368L392 368C405.3 368 416 357.3 416 344C416 330.7 405.3 320 392 320L248 320zM248 416C234.7 416 224 426.7 224 440C224 453.3 234.7 464 248 464L392 464C405.3 464 416 453.3 416 440C416 426.7 405.3 416 392 416L248 416z"/></svg>
|
||||
{:else if name === 'file-tick'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 128L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 272L376 272C336.2 272 304 239.8 304 200L304 112L192 112C183.2 112 176 119.2 176 128zM246.8 426.2C237.6 416.7 237.9 401.5 247.4 392.3C256.9 383.1 272.1 383.3 281.3 392.9L297.4 409.5L356.7 327.9C364.5 317.2 379.5 314.8 390.2 322.6C400.9 330.4 403.3 345.4 395.5 356.1L319.4 460.8C315.2 466.5 308.7 470.1 301.6 470.6C294.5 471.1 287.6 468.4 282.7 463.3L246.8 426.1z"/><path d="M331.8 64.3C346.5 65.8 360.2 72.2 370.7 82.7L493.3 205.2C505.3 217.2 512 233.5 512 250.4L512 511.9L511.7 518.4C508.6 548.5 484.7 572.5 454.6 575.5L448.1 575.8L192.1 575.8C156.8 575.8 128.1 547.1 128.1 511.8L128 128C128 92.7 156.7 64 192 64L325.5 64L331.8 64.3zM192 112C183.2 112 176 119.2 176 128L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 272L376 272C336.2 272 304 239.8 304 200L304 112L192 112zM356.7 327.9C364.5 317.2 379.5 314.8 390.2 322.6C400.9 330.4 403.3 345.4 395.5 356.1L319.4 460.8C315.2 466.5 308.7 470.1 301.6 470.6C294.5 471.1 287.6 468.4 282.7 463.3L246.8 426.1C237.6 416.6 237.9 401.4 247.4 392.2C256.9 383 272.1 383.2 281.3 392.8L297.4 409.4L356.7 327.8zM352 200C352 213.3 362.7 224 376 224L444.1 224L352 131.9L352 200z"/></svg>
|
||||
{:else if name === 'map-pin'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M224 208C224 261 267 304 320 304C373 304 416 261 416 208C416 155 373 112 320 112C267 112 224 155 224 208z"/><path d="M224 208C224 155 267 112 320 112C373 112 416 155 416 208C416 261 373 304 320 304C267 304 224 261 224 208zM344 350C412.1 338.6 464 279.3 464 208C464 128.5 399.5 64 320 64C240.5 64 176 128.5 176 208C176 279.4 227.9 338.6 296 350L296 552C296 565.3 306.7 576 320 576C333.3 576 344 565.3 344 552L344 350z"/></svg>
|
||||
{:else if name === 'arrow-up-down'}
|
||||
@@ -263,16 +273,20 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 128L176 512C176 520.8 183.2 528 192 528L448 528C456.8 528 464 520.8 464 512L464 272L376 272C336.2 272 304 239.8 304 200L304 112L192 112C183.2 112 176 119.2 176 128zM239 391C248.4 381.6 263.6 381.6 272.9 391L295.9 414L295.9 327.9C295.9 314.6 306.6 303.9 319.9 303.9C333.2 303.9 343.9 314.6 343.9 327.9L343.9 414L366.9 391C376.3 381.6 391.5 381.6 400.8 391C410.1 400.4 410.2 415.6 400.8 424.9L336.8 488.9C327.4 498.3 312.2 498.3 302.9 488.9L238.9 424.9C229.5 415.5 229.5 400.3 238.9 391z"/><path d="M192 112L304 112L304 200C304 239.8 336.2 272 376 272L464 272L464 512C464 520.8 456.8 528 448 528L192 528C183.2 528 176 520.8 176 512L176 128C176 119.2 183.2 112 192 112zM352 131.9L444.1 224L376 224C362.7 224 352 213.3 352 200L352 131.9zM192 64C156.7 64 128 92.7 128 128L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 250.5C512 233.5 505.3 217.2 493.3 205.2L370.7 82.7C358.7 70.7 342.5 64 325.5 64L192 64zM303 489C312.4 498.4 327.6 498.4 336.9 489L400.9 425C410.3 415.6 410.3 400.4 400.9 391.1C391.5 381.8 376.3 381.7 367 391.1L344 414.1L344 328C344 314.7 333.3 304 320 304C306.7 304 296 314.7 296 328L296 414.1L273 391.1C263.6 381.7 248.4 381.7 239.1 391.1C229.8 400.5 229.7 415.7 239.1 425L303.1 489z"/></svg>
|
||||
{:else if name === 'sort'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M198.6 240L441.4 240L320 118.6C279.5 159.1 239.1 199.5 198.6 240zM198.6 400L319.9 521.3C360.5 480.9 400.9 440.4 441.3 400L198.6 400z"/><path d="M320 118.6L198.6 240L441.4 240L320 118.6zM160 288C147.1 288 135.4 280.2 130.4 268.2C125.4 256.2 128.2 242.5 137.4 233.4L297.4 73.4C309.9 60.9 330.2 60.9 342.7 73.4L502.7 233.4C511.9 242.6 514.6 256.3 509.6 268.3C504.6 280.3 492.9 288 480 288L160 288zM320 521.4L441.4 400L198.6 400L320 521.4zM160 352L480 352C492.9 352 504.6 359.8 509.6 371.8C514.6 383.8 511.8 397.5 502.7 406.7L342.7 566.7C330.2 579.2 309.9 579.2 297.4 566.7L137.4 406.7C128.2 397.5 125.5 383.8 130.5 371.8C135.5 359.8 147.1 352 160 352z"/></svg>
|
||||
{:else if name === 'minus'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d=""/><path d="M96 320C96 306.7 106.7 296 120 296L520 296C533.3 296 544 306.7 544 320C544 333.3 533.3 344 520 344L120 344C106.7 344 96 333.3 96 320z"/></svg>
|
||||
{:else if name === 'plus'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d=""/><path d="M344 88C344 74.7 333.3 64 320 64C306.7 64 296 74.7 296 88L296 296L88 296C74.7 296 64 306.7 64 320C64 333.3 74.7 344 88 344L296 344L296 552C296 565.3 306.7 576 320 576C333.3 576 344 565.3 344 552L344 344L552 344C565.3 344 576 333.3 576 320C576 306.7 565.3 296 552 296L344 296L344 88z"/></svg>
|
||||
{:else if name === 'certified'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M208 128C208 119.2 215.2 112 224 112L336 112L336 200C336 239.8 368.2 272 408 272L496 272L496 512C496 520.8 488.8 528 480 528L288 528L288 504.8C317.8 473.3 336 430.8 336 384C336 303.4 281.9 235.5 208 214.6L208 128z"/><path d="M224 112L336 112L336 200C336 239.8 368.2 272 408 272L496 272L496 512C496 520.8 488.8 528 480 528L288 528L288 576L480 576C515.3 576 544 547.3 544 512L544 250.5C544 233.5 537.3 217.2 525.3 205.2L402.7 82.7C390.7 70.7 374.5 64 357.5 64L224 64C188.7 64 160 92.7 160 128L160 208C176.6 208 192.7 210.3 208 214.6L208 128C208 119.2 215.2 112 224 112zM384 131.9L476.1 224L408 224C394.7 224 384 213.3 384 200L384 131.9zM288 384C288 313.3 230.7 256 160 256C89.3 256 32 313.3 32 384C32 424.4 50.7 460.5 80 483.9L80 589C80 599.5 88.5 608 99 608C102.3 608 105.5 607.1 108.4 605.5L160 576L211.6 605.5C214.5 607.1 217.7 608 221 608C231.5 608 240 599.5 240 589L240 483.9C269.3 460.4 288 424.4 288 384zM160 336C186.5 336 208 357.5 208 384C208 410.5 186.5 432 160 432C133.5 432 112 410.5 112 384C112 357.5 133.5 336 160 336z"/></svg>
|
||||
{:else if name === 'ruler'}
|
||||
{:else if name === 'ruler' || name === 'dns-name-length'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M94 433.1L207.1 546.2L546.5 206.8L433.4 93.7L399.5 127.6L450.4 178.5C459.8 187.9 459.8 203.1 450.4 212.4C441 221.7 425.8 221.8 416.5 212.4L365.6 161.5L320.3 206.8L348.6 235.1C358 244.5 358 259.7 348.6 269C339.2 278.3 324 278.4 314.7 269L286.4 240.7L241.1 286L292 336.9C301.4 346.3 301.4 361.5 292 370.8C282.6 380.1 267.4 380.2 258.1 370.8L207.2 319.9L161.9 365.2L190.2 393.5C199.6 402.9 199.6 418.1 190.2 427.4C180.8 436.7 165.6 436.8 156.3 427.4L127.9 399.2L94 433.1z"/><path d="M207.1 546.3L546.5 206.9L433.4 93.8L399.5 127.7L450.4 178.6C459.8 188 459.8 203.2 450.4 212.5C441 221.8 425.8 221.9 416.5 212.5L365.6 161.6L320.3 206.9L348.6 235.2C358 244.6 358 259.8 348.6 269.1C339.2 278.4 324 278.5 314.7 269.1L286.4 240.8L241.1 286.1L292 337C301.4 346.4 301.4 361.6 292 370.9C282.6 380.2 267.4 380.3 258.1 370.9L207.2 320L161.9 365.3L190.2 393.6C199.6 403 199.6 418.2 190.2 427.5C180.8 436.8 165.6 436.9 156.3 427.5L127.9 399.2L94 433.1L207.1 546.3zM241 580.2C222.3 598.9 191.9 598.9 173.1 580.2L60.1 467.1C41.4 448.4 41.4 418 60.1 399.2L399.5 59.8C418.2 41.1 448.6 41.1 467.4 59.8L580.5 172.9C599.2 191.6 599.2 222 580.5 240.8L241.1 580.2z"/></svg>
|
||||
{:else if name === 'wrench'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M176 240C176 197.8 194.3 162.3 224 137.6L224 224C224 230.4 226.5 236.5 231 241L303 313C307.5 317.5 313.6 320 320 320C326.4 320 332.5 317.5 337 313L409 241C413.5 236.5 416 230.4 416 224L416 137.6C445.7 162.3 464 197.8 464 240C464 291.8 436.6 337.3 395.4 362.7C388.3 367.1 384 374.8 384 383.1L384 552C384 564.6 393.7 574.9 406 576L232 576C245.3 576 256 565.3 256 552L256 383.1C256 374.8 251.7 367 244.6 362.7C203.4 337.3 176 291.8 176 240z"/><path d="M261 74.3C267.9 78.7 272 86.3 272 94.5L272 214.1L320 262.1L368 214.1L368 94.5C368 86.3 372.2 78.7 379 74.3C385.8 69.9 394.5 69.3 402 72.7C466.3 102.2 512 162.6 512 240C512 304.3 480.4 361.1 432 396L432 552C432 565.3 421.3 576 408 576C394.7 576 384 565.3 384 552L384 383.1C384 374.8 388.3 367 395.4 362.7C436.6 337.3 464 291.8 464 240C464 197.8 445.7 162.3 416 137.6L416 224C416 230.4 413.5 236.5 409 241L337 313C332.5 317.5 326.4 320 320 320C313.6 320 307.5 317.5 303 313L231 241C226.5 236.5 224 230.4 224 224L224 137.6C194.3 162.3 176 197.8 176 240C176 291.8 203.4 337.3 244.6 362.7C251.7 367.1 256 374.8 256 383.1L256 552C256 565.3 245.3 576 232 576C218.7 576 208 565.3 208 552L208 396C159.6 361.2 128 304.3 128 240C128 162.5 173.7 102.2 238 72.7C245.4 69.3 254.1 69.9 261 74.3z"/></svg>
|
||||
{:else if name === 'settings'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M65.5 213L72 237.2L101.8 235.6C109.8 235.2 117.4 238.7 122.3 245.1C127.2 251.5 132.9 257.3 139.4 262.2C145.8 267 149.3 274.7 148.9 282.6L147.3 312.3L171.5 318.8L185 292.2C188.6 285.1 195.5 280.2 203.4 279.2C211.5 278.2 219.3 276.1 226.7 272.9C234.1 269.8 242.5 270.5 249.2 274.9L274.2 291.2L291.9 273.5L275.6 248.5C271.2 241.8 270.5 233.4 273.6 226.1C275.1 222.4 276.5 218.6 277.5 214.6C278.5 210.6 279.3 206.6 279.8 202.7C280.8 194.8 285.7 187.9 292.8 184.3L319.4 170.8L312.9 146.6L283.1 148.2C275.1 148.6 267.5 145.1 262.6 138.7C257.7 132.3 252 126.5 245.5 121.6C239.1 116.8 235.6 109.1 236 101.2L237.6 71.5L213.4 65L199.9 91.6C196.3 98.7 189.4 103.6 181.5 104.6C173.4 105.6 165.6 107.7 158.2 110.9C150.8 114 142.4 113.3 135.7 108.9L110.7 92.6L93 110.3L109.3 135.3C113.7 142 114.4 150.4 111.3 157.7C109.8 161.4 108.4 165.2 107.4 169.2C106.4 173.2 105.6 177.2 105.1 181.1C104.1 189 99.2 195.9 92.1 199.5L65.5 213zM223.3 200.3C220.5 211.5 211.9 220.3 200.7 223.4C189.5 226.4 177.6 223.2 169.5 215C161.4 206.8 158.3 194.8 161.5 183.7C164.3 172.5 172.9 163.7 184.1 160.6C195.3 157.6 207.2 160.8 215.3 169C223.4 177.2 226.5 189.2 223.3 200.3zM321.5 427L348.1 440.5C355.2 444.1 360.1 451 361.1 458.9C361.6 462.9 362.4 466.8 363.4 470.8C364.4 474.8 365.8 478.6 367.3 482.3C370.4 489.6 369.6 498 365.3 504.7L349 529.7L366.7 547.4L391.7 531.1C398.4 526.7 406.8 526 414.2 529.1C421.6 532.2 429.5 534.4 437.5 535.4C445.4 536.4 452.3 541.2 455.9 548.4L469.4 575L493.6 568.5L492 538.8C491.6 530.8 495.1 523.2 501.5 518.4C508 513.5 513.7 507.7 518.6 501.3C523.4 494.9 531.1 491.4 539.1 491.8L568.9 493.4L575.4 469.2L548.8 455.7C541.7 452.1 536.8 445.2 535.8 437.3C535.3 433.3 534.5 429.4 533.5 425.4C532.5 421.4 531.1 417.6 529.6 413.9C526.5 406.6 527.3 398.2 531.6 391.5L547.9 366.5L530.2 348.8L505.2 365.1C498.5 369.5 490.1 370.2 482.7 367.1C475.3 364 467.4 361.8 459.4 360.8C451.5 359.8 444.6 355 441 347.8L427.5 321.2L403.3 327.7L404.9 357.4C405.3 365.4 401.8 373 395.4 377.8C388.9 382.7 383.2 388.5 378.3 394.9C373.5 401.3 365.8 404.8 357.8 404.4L328 402.8L321.5 427zM479.3 439.7C482.5 450.8 479.4 462.8 471.3 471C463.2 479.2 451.3 482.4 440.1 479.4C428.9 476.3 420.3 467.5 417.5 456.3C414.3 445.2 417.4 433.2 425.5 425C433.6 416.8 445.5 413.6 456.7 416.6C467.9 419.7 476.5 428.5 479.3 439.7z"/><path d="M170.6 43.4C180.9 23.2 203.9 12.9 225.8 18.7L250 25.2C271.9 31.1 286.7 51.5 285.5 74.2L284.5 92C287.2 94.5 289.8 97.1 292.3 99.8L310.1 98.8C332.8 97.6 353.2 112.4 359.1 134.3L365.6 158.5C371.5 180.4 361.2 203.5 340.9 213.7L325 221.8C324.2 225.4 323.2 229 322.1 232.5L331.8 247.4C344.2 266.4 341.6 291.5 325.5 307.6L308 325.3C291.9 341.4 266.9 344 247.8 331.6L232.9 321.9C229.4 323 225.8 324 222.2 324.8L214.1 340.7C203.8 360.9 180.8 371.2 158.9 365.4L134.7 358.9C112.8 353 98 332.6 99.2 309.9L100.2 292.1C97.5 289.6 94.9 287 92.4 284.3L74.6 285.3C51.9 286.5 31.5 271.7 25.6 249.8L19.1 225.6C13.2 203.7 23.5 180.6 43.8 170.4L43.8 170.4L59.7 162.3C60.5 158.7 61.5 155.1 62.6 151.6L52.8 136.6C40.4 117.6 43 92.5 59.1 76.4L59.1 76.4L76.8 58.7C92.8 42.6 117.9 40 137 52.4L151.9 62.1C155.4 61 159 60 162.6 59.2L170.7 43.3zM237.6 71.6L213.4 65.1L199.9 91.7C196.3 98.8 189.4 103.7 181.5 104.7C173.4 105.7 165.6 107.8 158.2 111C150.8 114.1 142.4 113.4 135.7 109L110.7 92.7L93 110.4L109.3 135.4C113.7 142.1 114.4 150.5 111.3 157.8C109.8 161.5 108.4 165.3 107.4 169.3C106.4 173.3 105.6 177.3 105.1 181.2C104.1 189.1 99.2 196 92.1 199.6L65.5 213.1L72 237.3L101.8 235.7C109.8 235.3 117.4 238.8 122.3 245.2C127.2 251.6 132.9 257.4 139.4 262.3C145.8 267.1 149.3 274.8 148.9 282.7L147.3 312.4L171.5 318.9L185 292.3C188.6 285.2 195.5 280.3 203.4 279.3C211.5 278.3 219.3 276.2 226.7 273C234.1 269.9 242.5 270.6 249.2 275L274.2 291.3L291.9 273.6L275.6 248.6C271.2 241.9 270.5 233.5 273.6 226.2C275.1 222.5 276.5 218.7 277.5 214.7C278.5 210.7 279.3 206.7 279.8 202.8C280.8 194.9 285.7 188 292.8 184.4L319.4 170.9L312.9 146.7L283.1 148.3C275.1 148.7 267.5 145.2 262.6 138.8C257.7 132.4 252 126.6 245.5 121.7C239.1 116.9 235.6 109.2 236 101.3L237.6 71.6zM161.5 183.7C164.3 172.5 172.9 163.7 184.1 160.6C195.3 157.6 207.2 160.8 215.3 169C223.4 177.2 226.5 189.2 223.3 200.3C220.5 211.5 211.9 220.3 200.7 223.4C189.5 226.4 177.6 223.2 169.5 215C161.4 206.8 158.3 194.8 161.5 183.7zM355.2 330.2C354 307.5 368.8 287.1 390.7 281.2L414.9 274.7C436.8 268.8 459.9 279.1 470.1 299.4L478.2 315.3C481.8 316.1 485.4 317.1 488.9 318.2L503.8 308.5C522.8 296.1 547.9 298.7 564 314.8L581.7 332.5C597.8 348.6 600.4 373.7 588 392.7L578.3 407.6C579.4 411.1 580.4 414.7 581.2 418.3L597.1 426.4C617.3 436.7 627.6 459.7 621.8 481.6L615.3 505.8C609.4 527.7 589 542.5 566.3 541.3L548.5 540.3C546 543 543.4 545.6 540.7 548.1L541.7 565.9C542.9 588.6 528.1 609 506.2 614.9L482 621.4C460.1 627.3 4Line truncated
|
||||
{:else if name === 'layout'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M144 160L144 224L496 224L496 160C496 151.2 488.8 144 480 144L160 144C151.2 144 144 151.2 144 160zM144 272L144 480C144 488.8 151.2 496 160 496L208 496L208 272L144 272zM256 272L256 496L480 496C488.8 496 496 488.8 496 480L496 272L256 272z"/><path d="M480 144C488.8 144 496 151.2 496 160L496 224L144 224L144 160C144 151.2 151.2 144 160 144L480 144zM96 224L96 480C96 515.3 124.7 544 160 544L480 544C515.3 544 544 515.3 544 480L544 160C544 124.7 515.3 96 480 96L160 96C124.7 96 96 124.7 96 160L96 224zM496 480C496 488.8 488.8 496 480 496L256 496L256 272L496 272L496 480zM208 496L160 496C151.2 496 144 488.8 144 480L144 272L208 272L208 496z"/></svg>
|
||||
{:else if name === 'calendar'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M144 288L144 368L232 368L232 288L144 288zM144 416L144 480C144 488.8 151.2 496 160 496L232 496L232 416L144 416zM280 288L280 368L360 368L360 288L280 288zM280 416L280 496L360 496L360 416L280 416zM408 288L408 368L496 368L496 288L408 288zM408 416L408 496L480 496C488.8 496 496 488.8 496 480L496 416L408 416z"/><path d="M216 64C229.3 64 240 74.7 240 88L240 128L400 128L400 88C400 74.7 410.7 64 424 64C437.3 64 448 74.7 448 88L448 128L480 128C515.3 128 544 156.7 544 192L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 192C96 156.7 124.7 128 160 128L192 128L192 88C192 74.7 202.7 64 216 64zM480 496C488.8 496 496 488.8 496 480L496 416L408 416L408 496L480 496zM496 368L496 288L408 288L408 368L496 368zM360 368L360 288L280 288L280 368L360 368zM232 368L232 288L144 288L144 368L232 368zM144 416L144 480C144 488.8 151.2 496 160 496L232 496L232 416L144 416zM280 416L280 496L360 496L360 416L280 416zM216 176L160 176C151.2 176 144 183.2 144 192L144 240L496 240L496 192C496 183.2 488.8 176 480 176L216 176z"/></svg>
|
||||
{:else if name === 'check'}
|
||||
@@ -293,8 +307,12 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d="M112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320C528 205.1 434.9 112 320 112C205.1 112 112 205.1 112 320zM172 272C172 234.4 202.4 204 240 204C277.6 204 308 234.4 308 272L308 280C308 291 299 300 288 300C277 300 268 291 268 280L268 272C268 256.5 255.5 244 240 244C224.5 244 212 256.5 212 272L212 280C212 291 203 300 192 300C181 300 172 291 172 280L172 272zM206.7 416.6C197.5 407 197.8 391.8 207.4 382.7C217 373.6 232.2 373.8 241.3 383.4C256.3 399 282.4 416 320 416C357.6 416 383.7 399 398.7 383.4C407.9 373.8 423.1 373.5 432.6 382.7C442.1 391.9 442.5 407.1 433.3 416.6C411.2 439.6 373.3 464 320 464C266.7 464 228.8 439.6 206.7 416.6zM332 272C332 234.4 362.4 204 400 204C437.6 204 468 234.4 468 272L468 280C468 291 459 300 448 300C437 300 428 291 428 280L428 272C428 256.5 415.5 244 400 244C384.5 244 372 256.5 372 272L372 280C372 291 363 300 352 300C341 300 332 291 332 280L332 272z"/><path d="M528 320C528 205.1 434.9 112 320 112C205.1 112 112 205.1 112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320zM64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576C178.6 576 64 461.4 64 320zM241.3 383.4C256.3 399 282.4 416 320 416C357.6 416 383.7 399 398.7 383.4C407.9 373.8 423.1 373.5 432.6 382.7C442.1 391.9 442.5 407.1 433.3 416.6C411.2 439.6 373.3 464 320 464C266.7 464 228.8 439.6 206.7 416.6C197.5 407 197.8 391.8 207.4 382.7C217 373.6 232.2 373.8 241.3 383.4zM240 244C224.5 244 212 256.5 212 272L212 280C212 291 203 300 192 300C181 300 172 291 172 280L172 272C172 234.4 202.4 204 240 204C277.6 204 308 234.4 308 272L308 280C308 291 299 300 288 300C277 300 268 291 268 280L268 272C268 256.5 255.5 244 240 244zM372 272L372 280C372 291 363 300 352 300C341 300 332 291 332 280L332 272C332 234.4 362.4 204 400 204C437.6 204 468 234.4 468 272L468 280C468 291 459 300 448 300C437 300 428 291 428 280L428 272C428 256.5 415.5 244 400 244C384.5 244 372 256.5 372 272z"/></svg>
|
||||
{:else if name === 'scattered'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d="M112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320C528 205.1 434.9 112 320 112C205.1 112 112 205.1 112 320zM173.3 255C165 244.6 166.7 229.5 177 221.3L257 157.3C267.4 149 282.5 150.7 290.7 161C298.9 171.3 297.3 186.5 287 194.7L207 258.7C196.6 267 181.5 265.3 173.3 255zM184.8 317.8C181.6 304.9 189.4 291.9 202.3 288.7L266.3 272.7C279.2 269.5 292.2 277.3 295.4 290.2C298.6 303.1 290.8 316.1 277.9 319.3L213.9 335.3C201 338.5 188 330.7 184.8 317.8zM191 383C200.4 373.6 215.6 373.6 224.9 383L229.7 387.8C238.7 396.8 252.4 399 263.7 393.3C289.9 380.2 321.3 383 344.8 400.6L372.7 421.6C374.8 423.2 377.4 424 380 424C384 424 387.8 422 390 418.7L412.1 386.4C419.6 375.5 434.5 372.7 445.5 380.2C456.5 387.7 459.2 402.6 451.7 413.6L429.6 445.9C418.4 462.3 399.8 472.1 380 472.1C367 472.1 354.3 467.9 343.9 460.1L316 439C307.1 432.3 295.1 431.2 285.2 436.2C255.4 451.1 219.4 445.3 195.8 421.7L191 417C181.6 407.6 181.6 392.4 191 383.1zM352 272C352 236.7 373.5 208 400 208C426.5 208 448 236.7 448 272C448 307.3 426.5 336 400 336C373.5 336 352 307.3 352 272z"/><path d="M320 112C434.9 112 528 205.1 528 320C528 434.9 434.9 528 320 528C205.1 528 112 434.9 112 320C112 205.1 205.1 112 320 112zM320 576C461.4 576 576 461.4 576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 461.4 178.6 576 320 576zM448 272C448 236.7 426.5 208 400 208C373.5 208 352 236.7 352 272C352 307.3 373.5 336 400 336C426.5 336 448 307.3 448 272zM277.8 319.3C290.7 316.1 298.5 303.1 295.3 290.2C292.1 277.3 279.1 269.5 266.2 272.7L202.2 288.7C189.3 291.9 181.5 304.9 184.7 317.8C187.9 330.7 200.9 338.5 213.8 335.3L277.8 319.3zM290.7 161C282.4 150.6 267.3 149 257 157.3L177 221.3C166.6 229.6 165 244.7 173.3 255C181.6 265.3 196.7 267 207 258.7L287 194.7C297.4 186.4 299 171.3 290.7 161zM451.8 413.6C459.3 402.7 456.5 387.7 445.6 380.2C434.7 372.7 419.7 375.5 412.2 386.4L390.1 418.7C387.8 422 384.1 424 380.1 424C377.5 424 374.9 423.1 372.8 421.6L344.9 400.6C321.4 383 290 380.2 263.8 393.3C252.5 399 238.8 396.7 229.8 387.8L225 383C215.6 373.6 200.4 373.6 191.1 383C181.8 392.4 181.7 407.6 191.1 416.9L195.9 421.7C219.5 445.3 255.5 451.1 285.3 436.2C295.3 431.2 307.2 432.3 316.1 439L344 460C354.4 467.8 367.1 472 380.1 472C399.9 472 418.5 462.2 429.7 445.8L451.8 413.5z"/></svg>
|
||||
{:else if name === 'hash'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d=""/><path d="M290.9 93C293.7 80 285.4 67.3 272.5 64.5C259.6 61.7 246.7 70 244 82.9L220.6 192L132.5 192C119.2 192 108.5 202.7 108.5 216C108.5 229.3 119.2 240 132.5 240L210.3 240L176 400L88 400C74.7 400 64 410.7 64 424C64 437.3 74.7 448 88 448L165.7 448L144.5 547C141.7 560 150 572.7 162.9 575.5C175.8 578.3 188.6 570 191.4 557.1L214.8 448.1L370.2 448.1L349 547.1C346.2 560.1 354.5 572.8 367.4 575.6C380.3 578.4 393.1 570.1 395.9 557.2L419.3 448.2L507.3 448.2C520.6 448.2 531.3 437.5 531.3 424.2C531.3 410.9 520.6 400.2 507.3 400.2L429.6 400.2L463.9 240.2L552 240.2C565.3 240.2 576 229.5 576 216.2C576 202.9 565.3 192.2 552 192.2L474.2 192.2L495.4 93.2C498.2 80.2 489.9 67.5 477 64.7C464.1 61.9 451.2 70 448.4 82.9L425 192L269.6 192L290.8 93zM259.4 240L414.8 240L380.5 400L225.1 400L259.4 240z"/></svg>
|
||||
{:else if name === 'help'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d="M112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320C528 205.1 434.9 112 320 112C205.1 112 112 205.1 112 320zM240 272C240 227.8 275.8 192 320 192C364.2 192 400 227.8 400 272C400 319.2 364 339.2 344 346.5L344 350.3C344 363.6 333.3 374.3 320 374.3C306.7 374.3 296 363.6 296 350.3L296 342.2C296 321.7 310.8 307 326.1 302C332.5 299.9 339.3 296.5 344.3 291.7C348.6 287.5 352 281.7 352 272.1C352 254.4 337.7 240.1 320 240.1C302.3 240.1 288 254.4 288 272.1C288 285.4 277.3 296.1 264 296.1C250.7 296.1 240 285.4 240 272.1zM352 432C352 449.7 337.7 464 320 464C302.3 464 288 449.7 288 432C288 414.3 302.3 400 320 400C337.7 400 352 414.3 352 432z"/><path d="M528 320C528 205.1 434.9 112 320 112C205.1 112 112 205.1 112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320zM64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576C178.6 576 64 461.4 64 320zM320 240C302.3 240 288 254.3 288 272C288 285.3 277.3 296 264 296C250.7 296 240 285.3 240 272C240 227.8 275.8 192 320 192C364.2 192 400 227.8 400 272C400 319.2 364 339.2 344 346.5L344 350.3C344 363.6 333.3 374.3 320 374.3C306.7 374.3 296 363.6 296 350.3L296 342.2C296 321.7 310.8 307 326.1 302C332.5 299.9 339.3 296.5 344.3 291.7C348.6 287.5 352 281.7 352 272.1C352 254.4 337.7 240.1 320 240.1zM288 432C288 414.3 302.3 400 320 400C337.7 400 352 414.3 352 432C352 449.7 337.7 464 320 464C302.3 464 288 449.7 288 432z"/></svg>
|
||||
{:else if name === 'bar-chart'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Pro v7.0.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2025 Fonticons, Inc.--><path opacity=".4" d="M96 336L144 336L144 496L96 496L96 336zM480 208L528 208L528 496L480 496L480 208z"/><path d="M336 144L336 496L288 496L288 144L336 144zM288 96C261.5 96 240 117.5 240 144L240 496C240 522.5 261.5 544 288 544L336 544C362.5 544 384 522.5 384 496L384 144C384 117.5 362.5 96 336 96L288 96zM144 336L144 496L96 496L96 336L144 336zM96 288C69.5 288 48 309.5 48 336L48 496C48 522.5 69.5 544 96 544L144 544C170.5 544 192 522.5 192 496L192 336C192 309.5 170.5 288 144 288L96 288zM480 208L528 208L528 496L480 496L480 208zM432 208L432 496C432 522.5 453.5 544 480 544L528 544C554.5 544 576 522.5 576 496L576 208C576 181.5 554.5 160 528 160L480 160C453.5 160 432 181.5 432 208z"/></svg>
|
||||
{:else if name === 'list-check'}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d=""/><path d="M203.7 133.8C211.3 122.9 208.7 108 197.8 100.4C186.9 92.8 172 95.4 164.4 106.3L124.7 162.8L105 143C95.6 133.7 80.4 133.7 71 143C61.6 152.3 61.7 167.6 71 177L111 217C116 222 123 224.6 130.1 223.9C137.2 223.2 143.6 219.6 147.7 213.8L203.7 133.8zM203.7 293.8C211.3 282.9 208.7 268 197.8 260.4C186.9 252.8 172 255.4 164.4 266.3L124.7 322.8L105 303C95.6 293.6 80.4 293.6 71.1 303C61.8 312.4 61.7 327.6 71 337L111 377C116 382 123 384.6 130.1 383.9C137.2 383.2 143.6 379.6 147.7 373.8L203.7 293.8zM256 160C256 173.3 266.7 184 280 184L552 184C565.3 184 576 173.3 576 160C576 146.7 565.3 136 552 136L280 136C266.7 136 256 146.7 256 160zM256 320C256 333.3 266.7 344 280 344L552 344C565.3 344 576 333.3 576 320C576 306.7 565.3 296 552 296L280 296C266.7 296 256 306.7 256 320zM224 480C224 493.3 234.7 504 248 504L552 504C565.3 504 576 493.3 576 480C576 466.7 565.3 456 552 456L248 456C234.7 456 224 466.7 224 480zM160 480C160 462.3 145.7 448 128 448C110.3 448 96 462.3 96 480C96 497.7 110.3 512 128 512C145.7 512 160 497.7 160 480z"/></svg>
|
||||
{:else if name === 'list'}
|
||||
|
||||
@@ -0,0 +1,942 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip.js';
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { parseZoneFile, checkNameLengths, type NameLengthViolation } from '$lib/utils/zone-parser.js';
|
||||
|
||||
let zoneInput = $state('');
|
||||
let results = $state<{
|
||||
violations: NameLengthViolation[];
|
||||
totalNames: number;
|
||||
validNames: number;
|
||||
} | null>(null);
|
||||
let copiedState = $state(false);
|
||||
let activeExampleIndex = $state<number | null>(null);
|
||||
|
||||
const examples = [
|
||||
{
|
||||
name: 'Valid Names',
|
||||
content: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
www.example.com. IN A 192.0.2.1
|
||||
mail.example.com. IN A 192.0.2.10
|
||||
blog.example.com. IN CNAME www.example.com.`,
|
||||
description: 'Zone with all names within DNS limits'
|
||||
},
|
||||
{
|
||||
name: 'Long Labels',
|
||||
content: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
this-is-a-very-long-subdomain-name-that-exceeds-the-sixty-three-character-label-limit.example.com. IN A 192.0.2.1
|
||||
another-extremely-long-label-name-that-is-definitely-over-the-limit.example.com. IN A 192.0.2.2`,
|
||||
description: 'Zone with labels exceeding 63-character limit'
|
||||
},
|
||||
{
|
||||
name: 'Very Long FQDN',
|
||||
content: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
this.is.a.very.deep.subdomain.structure.with.many.labels.that.together.create.a.fully.qualified.domain.name.that.might.exceed.the.maximum.allowed.length.of.two.hundred.fifty.five.characters.which.could.cause.issues.in.dns.resolution.and.should.be.avoided.example.com. IN A 192.0.2.1`,
|
||||
description: 'Zone with FQDN exceeding 255-character limit'
|
||||
},
|
||||
{
|
||||
name: 'Mixed Issues',
|
||||
content: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
www.example.com. IN A 192.0.2.1
|
||||
this-label-is-exactly-sixty-three-characters-long-and-should-be-valid-ok.example.com. IN A 192.0.2.2
|
||||
this-label-is-definitely-over-sixty-three-characters-and-will-cause-a-violation.example.com. IN A 192.0.2.3
|
||||
very.deep.nested.subdomain.with.lots.of.labels.creating.a.domain.name.that.is.extremely.long.and.definitely.over.the.limit.of.two.hundred.fifty.five.characters.which.makes.it.invalid.according.to.dns.specifications.example.com. IN CNAME www.example.com.`,
|
||||
description: 'Mix of valid names and various violations'
|
||||
}
|
||||
];
|
||||
|
||||
function loadExample(example: typeof examples[0], index: number) {
|
||||
zoneInput = example.content;
|
||||
activeExampleIndex = index;
|
||||
checkNames();
|
||||
}
|
||||
|
||||
function clearActiveIfChanged() {
|
||||
if (activeExampleIndex !== null) {
|
||||
const activeExample = examples[activeExampleIndex];
|
||||
if (!activeExample || zoneInput !== activeExample.content) {
|
||||
activeExampleIndex = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkNames() {
|
||||
if (!zoneInput.trim()) {
|
||||
results = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsed = parseZoneFile(zoneInput);
|
||||
const violations = checkNameLengths(parsed);
|
||||
|
||||
// Count unique names
|
||||
const uniqueNames = new Set(parsed.records.map(r => r.owner));
|
||||
|
||||
results = {
|
||||
violations,
|
||||
totalNames: uniqueNames.size,
|
||||
validNames: uniqueNames.size - new Set(violations.map(v => v.name)).size
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Failed to check names:', error);
|
||||
results = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyResults() {
|
||||
if (!results) return;
|
||||
|
||||
const reportText = formatReportForCopy(results);
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(reportText);
|
||||
copiedState = true;
|
||||
setTimeout(() => {
|
||||
copiedState = false;
|
||||
}, 2000);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
function formatReportForCopy(data: typeof results): string {
|
||||
if (!data) return '';
|
||||
|
||||
const lines: string[] = [];
|
||||
|
||||
lines.push(`DNS Name Length Validation Report`);
|
||||
lines.push(`===============================\n`);
|
||||
|
||||
lines.push(`Total Names Checked: ${data.totalNames}`);
|
||||
lines.push(`Valid Names: ${data.validNames}`);
|
||||
lines.push(`Names with Violations: ${data.violations.length}\n`);
|
||||
|
||||
if (data.violations.length > 0) {
|
||||
lines.push(`Violations Found:`);
|
||||
lines.push(`-----------------`);
|
||||
|
||||
const labelViolations = data.violations.filter(v => v.type === 'label');
|
||||
const fqdnViolations = data.violations.filter(v => v.type === 'fqdn');
|
||||
|
||||
if (labelViolations.length > 0) {
|
||||
lines.push(`\nLabel Length Violations (${labelViolations.length}):`);
|
||||
for (const violation of labelViolations) {
|
||||
lines.push(` ${violation.name} - ${violation.length} characters (limit: ${violation.limit})`);
|
||||
}
|
||||
}
|
||||
|
||||
if (fqdnViolations.length > 0) {
|
||||
lines.push(`\nFQDN Length Violations (${fqdnViolations.length}):`);
|
||||
for (const violation of fqdnViolations) {
|
||||
lines.push(` ${violation.name} - ${violation.length} characters (limit: ${violation.limit})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lines.push(`All names are within DNS length limits! ✓`);
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function handleInputChange() {
|
||||
clearActiveIfChanged();
|
||||
checkNames();
|
||||
}
|
||||
|
||||
function getViolationSeverity(violation: NameLengthViolation): string {
|
||||
const excess = violation.length - violation.limit;
|
||||
if (excess > 50) return 'severe';
|
||||
if (excess > 20) return 'high';
|
||||
if (excess > 10) return 'medium';
|
||||
return 'low';
|
||||
}
|
||||
|
||||
function getViolationColor(violation: NameLengthViolation): string {
|
||||
const severity = getViolationSeverity(violation);
|
||||
switch (severity) {
|
||||
case 'severe': return 'var(--color-error)';
|
||||
case 'high': return 'var(--color-error)';
|
||||
case 'medium': return 'var(--color-warning)';
|
||||
case 'low': return 'var(--color-warning)';
|
||||
default: return 'var(--color-warning)';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h1>DNS Name Length Checker</h1>
|
||||
<p>Validate DNS names against RFC length limits: 63 bytes per label, 255 bytes per FQDN</p>
|
||||
</header>
|
||||
|
||||
<!-- Educational Overview -->
|
||||
<div class="card info-card">
|
||||
<div class="overview-content">
|
||||
<div class="overview-item">
|
||||
<Icon name="ruler" size="sm" />
|
||||
<div>
|
||||
<strong>Label Limits:</strong> Each DNS label must be 63 characters or fewer.
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-item">
|
||||
<Icon name="maximize" size="sm" />
|
||||
<div>
|
||||
<strong>FQDN Limits:</strong> Complete domain names must be 255 characters or fewer.
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-item">
|
||||
<Icon name="alert-triangle" size="sm" />
|
||||
<div>
|
||||
<strong>Compliance:</strong> Exceeding limits causes DNS resolution failures.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Examples -->
|
||||
<div class="card examples-card">
|
||||
<details class="examples-details">
|
||||
<summary class="examples-summary">
|
||||
<Icon name="chevron-right" size="sm" />
|
||||
<h3>Name Length Examples</h3>
|
||||
</summary>
|
||||
<div class="examples-grid">
|
||||
{#each examples as example, index}
|
||||
<button
|
||||
class="example-card {activeExampleIndex === index ? 'active' : ''}"
|
||||
onclick={() => loadExample(example, index)}
|
||||
>
|
||||
<div class="example-name">{example.name}</div>
|
||||
<div class="example-description">{example.description}</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<!-- Input Section -->
|
||||
<div class="card input-card">
|
||||
<div class="input-group">
|
||||
<label for="zone-input" use:tooltip={"Paste DNS zone file content to validate all domain names against length limits"}>
|
||||
<Icon name="file" size="sm" />
|
||||
Zone File Content
|
||||
</label>
|
||||
<textarea
|
||||
id="zone-input"
|
||||
bind:value={zoneInput}
|
||||
oninput={handleInputChange}
|
||||
placeholder="example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
www.example.com. IN A 192.0.2.1
|
||||
very-long-subdomain-name.example.com. IN A 192.0.2.2"
|
||||
class="zone-textarea"
|
||||
rows="10"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Results -->
|
||||
{#if results}
|
||||
<section class="results-section">
|
||||
<div class="results-header">
|
||||
<h3>Name Length Validation Results</h3>
|
||||
<button
|
||||
class="copy-button {copiedState ? 'copied' : ''}"
|
||||
onclick={copyResults}
|
||||
>
|
||||
<Icon name={copiedState ? 'check' : 'copy'} size="sm" />
|
||||
{copiedState ? 'Copied!' : 'Copy Report'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="results-inner">
|
||||
<!-- Summary Stats -->
|
||||
<div class="summary-card">
|
||||
<div class="summary-stats">
|
||||
<div class="stat-item total">
|
||||
<div class="stat-icon">
|
||||
<Icon name="hash" size="lg" />
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{results.totalNames}</div>
|
||||
<div class="stat-label">Total Names</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-item valid">
|
||||
<div class="stat-icon">
|
||||
<Icon name="check-circle" size="lg" />
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{results.validNames}</div>
|
||||
<div class="stat-label">Valid Names</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-item violations">
|
||||
<div class="stat-icon">
|
||||
<Icon name="alert-triangle" size="lg" />
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">{results.violations.length}</div>
|
||||
<div class="stat-label">Violations</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stat-item compliance">
|
||||
<div class="stat-icon">
|
||||
<Icon name={results.violations.length === 0 ? 'shield-check' : 'shield-alert'} size="lg" />
|
||||
</div>
|
||||
<div class="stat-info">
|
||||
<div class="stat-value">
|
||||
{results.violations.length === 0 ? '100%' : `${((results.validNames / results.totalNames) * 100).toFixed(1)}%`}
|
||||
</div>
|
||||
<div class="stat-label">Compliance</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if results.violations.length === 0}
|
||||
<!-- Success State -->
|
||||
<div class="success-card">
|
||||
<div class="success-content">
|
||||
<Icon name="check-circle" size="xl" />
|
||||
<div class="success-message">
|
||||
<h4>All Names Valid!</h4>
|
||||
<p>All {results.totalNames} domain names in your zone comply with DNS length limits.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<!-- Violations List -->
|
||||
<div class="violations-section">
|
||||
<h4>Length Limit Violations</h4>
|
||||
|
||||
<!-- Label Violations -->
|
||||
{#if results.violations.filter(v => v.type === 'label').length > 0}
|
||||
<div class="violation-category">
|
||||
<h5>
|
||||
<Icon name="tag" size="sm" />
|
||||
Label Length Violations ({results.violations.filter(v => v.type === 'label').length})
|
||||
</h5>
|
||||
<div class="violations-list">
|
||||
{#each results.violations.filter(v => v.type === 'label') as violation}
|
||||
<div class="violation-item" style="border-left-color: {getViolationColor(violation)}">
|
||||
<div class="violation-header">
|
||||
<div class="violation-name">{violation.name}</div>
|
||||
<div class="violation-stats">
|
||||
<span class="violation-length" style="color: {getViolationColor(violation)}">
|
||||
{violation.length} chars
|
||||
</span>
|
||||
<span class="violation-limit">
|
||||
(limit: {violation.limit})
|
||||
</span>
|
||||
<span class="violation-excess">
|
||||
+{violation.length - violation.limit} over
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{#if violation.labels}
|
||||
<div class="violation-labels">
|
||||
<strong>Labels:</strong>
|
||||
{#each violation.labels as label, index}
|
||||
<span class="label-item {label.length > 63 ? 'invalid' : 'valid'}">
|
||||
{label} <span class="label-length">({label.length})</span>
|
||||
</span>
|
||||
{#if index < violation.labels.length - 1}•{/if}
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- FQDN Violations -->
|
||||
{#if results.violations.filter(v => v.type === 'fqdn').length > 0}
|
||||
<div class="violation-category">
|
||||
<h5>
|
||||
<Icon name="globe" size="sm" />
|
||||
FQDN Length Violations ({results.violations.filter(v => v.type === 'fqdn').length})
|
||||
</h5>
|
||||
<div class="violations-list">
|
||||
{#each results.violations.filter(v => v.type === 'fqdn') as violation}
|
||||
<div class="violation-item" style="border-left-color: {getViolationColor(violation)}">
|
||||
<div class="violation-header">
|
||||
<div class="violation-name">{violation.name}</div>
|
||||
<div class="violation-stats">
|
||||
<span class="violation-length" style="color: {getViolationColor(violation)}">
|
||||
{violation.length} chars
|
||||
</span>
|
||||
<span class="violation-limit">
|
||||
(limit: {violation.limit})
|
||||
</span>
|
||||
<span class="violation-excess">
|
||||
+{violation.length - violation.limit} over
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
<!-- Educational Content -->
|
||||
<div class="education-card">
|
||||
<div class="education-grid">
|
||||
<div class="education-item info-panel">
|
||||
<h4>DNS Name Limits</h4>
|
||||
<p>
|
||||
DNS names have strict length limits defined by RFC specifications. Each label (part
|
||||
between dots) must be 63 octets or less, and the complete FQDN must not exceed
|
||||
255 octets including the length encoding.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Impact of Violations</h4>
|
||||
<p>
|
||||
Names exceeding these limits will cause DNS resolution failures. Some resolvers
|
||||
may truncate names, while others will reject them entirely. This can break
|
||||
applications and services relying on these names.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Common Causes</h4>
|
||||
<p>
|
||||
Long names often result from deep subdomain structures, verbose naming conventions,
|
||||
or automated name generation. Consider shorter alternatives or restructuring
|
||||
your DNS hierarchy to stay within limits.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Best Practices</h4>
|
||||
<p>
|
||||
Use concise, descriptive names. Avoid unnecessary subdomains and overly verbose
|
||||
labels. Regularly validate zone files during development. Consider using aliases
|
||||
or redirects for shorter public-facing names.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.info-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.overview-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.overview-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
color: var(--text-secondary);
|
||||
|
||||
strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.examples-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.examples-details {
|
||||
border: none;
|
||||
background: var(--bg-tertiary);
|
||||
|
||||
&[open] {
|
||||
.examples-summary :global(.icon) {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.examples-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
user-select: none;
|
||||
transition: all var(--transition-fast);
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:global(.icon) {
|
||||
transition: transform var(--transition-fast);
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.examples-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
|
||||
.example-card {
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
text-align: left;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary), transparent 80%);
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
}
|
||||
|
||||
.example-name {
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.example-description {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.input-card {
|
||||
background: var(--bg-tertiary);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.zone-textarea {
|
||||
width: 100%;
|
||||
padding: var(--spacing-md);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
border: 2px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
background-color: var(--bg-secondary);
|
||||
color: var(--text-primary);
|
||||
resize: vertical;
|
||||
min-height: 250px;
|
||||
line-height: 1.4;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary), transparent 90%);
|
||||
}
|
||||
}
|
||||
|
||||
.results-section {
|
||||
background-color: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-lg);
|
||||
margin-bottom: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.results-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--spacing-lg);
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.copy-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
background: none;
|
||||
border: 1px solid var(--border-primary);
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
border-radius: var(--radius-md);
|
||||
transition: all var(--transition-fast);
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&.copied {
|
||||
color: var(--color-success);
|
||||
border-color: var(--color-success);
|
||||
}
|
||||
}
|
||||
|
||||
.results-inner {
|
||||
display: grid;
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.summary-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-md);
|
||||
padding: var(--spacing-md);
|
||||
border-radius: var(--radius-md);
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&.total {
|
||||
background-color: color-mix(in srgb, var(--color-primary), transparent 95%);
|
||||
border: 1px solid var(--color-primary);
|
||||
}
|
||||
|
||||
&.valid {
|
||||
background-color: color-mix(in srgb, var(--color-success), transparent 90%);
|
||||
border: 1px solid var(--color-success);
|
||||
}
|
||||
|
||||
&.violations {
|
||||
background-color: color-mix(in srgb, var(--color-error), transparent 90%);
|
||||
border: 1px solid var(--color-error);
|
||||
}
|
||||
|
||||
&.compliance {
|
||||
background-color: color-mix(in srgb, var(--color-info), transparent 90%);
|
||||
border: 1px solid var(--color-info);
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: var(--radius-md);
|
||||
background-color: var(--bg-tertiary);
|
||||
}
|
||||
|
||||
.stat-info {
|
||||
flex: 1;
|
||||
|
||||
.stat-value {
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: 700;
|
||||
font-family: var(--font-mono);
|
||||
line-height: 1;
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: var(--font-size-sm);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
&.total {
|
||||
.stat-icon {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.stat-value,
|
||||
.stat-label {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
&.valid {
|
||||
.stat-icon {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
.stat-value,
|
||||
.stat-label {
|
||||
color: var(--color-success);
|
||||
}
|
||||
}
|
||||
|
||||
&.violations {
|
||||
.stat-icon {
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
.stat-value,
|
||||
.stat-label {
|
||||
color: var(--color-error);
|
||||
}
|
||||
}
|
||||
|
||||
&.compliance {
|
||||
.stat-icon {
|
||||
color: var(--color-info);
|
||||
}
|
||||
|
||||
.stat-value,
|
||||
.stat-label {
|
||||
color: var(--color-info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.success-card {
|
||||
background-color: color-mix(in srgb, var(--color-success), transparent 90%);
|
||||
border: 1px solid var(--color-success);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: var(--spacing-xl);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.success-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--spacing-md);
|
||||
color: var(--color-success);
|
||||
|
||||
.success-message {
|
||||
h4 {
|
||||
margin: 0 0 var(--spacing-sm);
|
||||
color: var(--color-success);
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--color-success);
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.violations-section {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-lg);
|
||||
|
||||
h4 {
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-lg);
|
||||
color: var(--color-error);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.violation-category {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
h5 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
margin: 0 0 var(--spacing-md);
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
}
|
||||
|
||||
.violations-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.violation-item {
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-tertiary);
|
||||
border-left: 4px solid;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.violation-header {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
gap: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.violation-name {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
word-break: break-all;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.violation-stats {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
flex-shrink: 0;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.violation-length {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.violation-limit {
|
||||
color: var(--text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
.violation-excess {
|
||||
color: var(--color-error);
|
||||
font-weight: 600;
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.violation-labels {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
|
||||
strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.label-item {
|
||||
font-family: var(--font-mono);
|
||||
|
||||
&.valid {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
&.invalid {
|
||||
color: var(--color-error);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.label-length {
|
||||
font-size: var(--font-size-xs);
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.education-card {
|
||||
border-top: 1px solid var(--border-secondary);
|
||||
padding-top: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.education-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.education-item {
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
|
||||
h4 {
|
||||
margin-bottom: var(--spacing-md);
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.examples-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.education-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,933 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip.js';
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { parseZoneFile, compareZones, type ZoneDiff, type ResourceRecord } from '$lib/utils/zone-parser.js';
|
||||
|
||||
let oldZoneInput = $state('');
|
||||
let newZoneInput = $state('');
|
||||
let results = $state<ZoneDiff | null>(null);
|
||||
let showUnified = $state(false);
|
||||
let copiedState = $state(false);
|
||||
let activeExampleIndex = $state<number | null>(null);
|
||||
|
||||
const examples = [
|
||||
{
|
||||
name: 'Simple Changes',
|
||||
oldZone: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.
|
||||
www.example.com. IN A 192.0.2.1
|
||||
mail.example.com. IN A 192.0.2.10`,
|
||||
newZone: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010102 3600 1800 1209600 86400
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.
|
||||
www.example.com. IN A 192.0.2.2
|
||||
ftp.example.com. IN A 192.0.2.3
|
||||
mail.example.com. IN A 192.0.2.10`,
|
||||
description: 'Changed IP address and added new record'
|
||||
},
|
||||
{
|
||||
name: 'Record Type Changes',
|
||||
oldZone: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
www.example.com. IN A 192.0.2.1
|
||||
blog.example.com. IN A 192.0.2.2`,
|
||||
newZone: `example.com. IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
www.example.com. IN A 192.0.2.1
|
||||
blog.example.com. IN CNAME www.example.com.`,
|
||||
description: 'Changed A record to CNAME'
|
||||
},
|
||||
{
|
||||
name: 'Complex Migration',
|
||||
oldZone: `$ORIGIN example.com.
|
||||
$TTL 86400
|
||||
@ IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
IN NS ns1.example.com.
|
||||
IN NS ns2.example.com.
|
||||
www IN A 192.0.2.1
|
||||
mail IN A 192.0.2.10
|
||||
IN MX 10 mail.example.com.`,
|
||||
newZone: `$ORIGIN example.com.
|
||||
$TTL 3600
|
||||
@ IN SOA ns1.example.com. hostmaster.example.com. 2023010201 10800 3600 604800 86400
|
||||
IN NS ns1.example.com.
|
||||
IN NS ns2.example.com.
|
||||
IN NS ns3.example.com.
|
||||
www 300 IN A 203.0.113.1
|
||||
api IN A 203.0.113.2
|
||||
mail IN A 203.0.113.10
|
||||
IN MX 10 mail.example.com.`,
|
||||
description: 'Zone migration with IP changes and additions'
|
||||
}
|
||||
];
|
||||
|
||||
function loadExample(example: typeof examples[0], index: number) {
|
||||
oldZoneInput = example.oldZone;
|
||||
newZoneInput = example.newZone;
|
||||
activeExampleIndex = index;
|
||||
compareZoneFiles();
|
||||
}
|
||||
|
||||
function clearActiveIfChanged() {
|
||||
if (activeExampleIndex !== null) {
|
||||
const activeExample = examples[activeExampleIndex];
|
||||
if (!activeExample ||
|
||||
oldZoneInput !== activeExample.oldZone ||
|
||||
newZoneInput !== activeExample.newZone) {
|
||||
activeExampleIndex = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compareZoneFiles() {
|
||||
if (!oldZoneInput.trim() || !newZoneInput.trim()) {
|
||||
results = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const oldZone = parseZoneFile(oldZoneInput);
|
||||
const newZone = parseZoneFile(newZoneInput);
|
||||
results = compareZones(oldZone, newZone);
|
||||
} catch (error) {
|
||||
console.error('Failed to compare zones:', error);
|
||||
results = null;
|
||||
}
|
||||
}
|
||||
|
||||
function generateUnifiedDiff(): string {
|
||||
if (!results) return '';
|
||||
|
||||
const lines: string[] = [];
|
||||
lines.push('--- Old Zone');
|
||||
lines.push('+++ New Zone');
|
||||
lines.push(`@@ -1,${oldZoneInput.split('\n').length} +1,${newZoneInput.split('\n').length} @@`);
|
||||
|
||||
// Show removed records
|
||||
for (const record of results.removed) {
|
||||
lines.push(`-${formatRecord(record)}`);
|
||||
}
|
||||
|
||||
// Show added records
|
||||
for (const record of results.added) {
|
||||
lines.push(`+${formatRecord(record)}`);
|
||||
}
|
||||
|
||||
// Show changed records
|
||||
for (const change of results.changed) {
|
||||
lines.push(`-${formatRecord(change.before)}`);
|
||||
lines.push(`+${formatRecord(change.after)}`);
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function formatRecord(record: ResourceRecord): string {
|
||||
const ttl = record.ttl ? record.ttl.toString() : '';
|
||||
return [record.owner, ttl, record.class, record.type, record.rdata]
|
||||
.filter(Boolean)
|
||||
.join('\t');
|
||||
}
|
||||
|
||||
async function copyDiff() {
|
||||
if (!results) return;
|
||||
|
||||
const content = showUnified ? generateUnifiedDiff() : formatStructuredDiff();
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(content);
|
||||
copiedState = true;
|
||||
setTimeout(() => {
|
||||
copiedState = false;
|
||||
}, 2000);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
function formatStructuredDiff(): string {
|
||||
if (!results) return '';
|
||||
|
||||
const lines: string[] = [];
|
||||
|
||||
if (results.added.length > 0) {
|
||||
lines.push(`Added Records (${results.added.length}):`);
|
||||
for (const record of results.added) {
|
||||
lines.push(`+ ${formatRecord(record)}`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
if (results.removed.length > 0) {
|
||||
lines.push(`Removed Records (${results.removed.length}):`);
|
||||
for (const record of results.removed) {
|
||||
lines.push(`- ${formatRecord(record)}`);
|
||||
}
|
||||
lines.push('');
|
||||
}
|
||||
|
||||
if (results.changed.length > 0) {
|
||||
lines.push(`Changed Records (${results.changed.length}):`);
|
||||
for (const change of results.changed) {
|
||||
lines.push(`~ ${formatRecord(change.before)}`);
|
||||
lines.push(` ${formatRecord(change.after)}`);
|
||||
}
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
function handleInputChange() {
|
||||
clearActiveIfChanged();
|
||||
compareZoneFiles();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h1>DNS Zone Diff</h1>
|
||||
<p>Compare two zone files and identify added, removed, and changed DNS records</p>
|
||||
</header>
|
||||
|
||||
<!-- Educational Overview -->
|
||||
<div class="card info-card">
|
||||
<div class="overview-content">
|
||||
<div class="overview-item">
|
||||
<Icon name="plus-circle" size="sm" />
|
||||
<div>
|
||||
<strong>Added Records:</strong> Identify new DNS records in the updated zone file.
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-item">
|
||||
<Icon name="minus-circle" size="sm" />
|
||||
<div>
|
||||
<strong>Removed Records:</strong> Find records that were deleted from the original zone.
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-item">
|
||||
<Icon name="edit" size="sm" />
|
||||
<div>
|
||||
<strong>Changed Records:</strong> Detect modifications to existing records' data or TTL.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Examples -->
|
||||
<div class="card examples-card">
|
||||
<details class="examples-details">
|
||||
<summary class="examples-summary">
|
||||
<Icon name="chevron-right" size="sm" />
|
||||
<h3>Zone Comparison Examples</h3>
|
||||
</summary>
|
||||
<div class="examples-grid">
|
||||
{#each examples as example, index}
|
||||
<button
|
||||
class="example-card {activeExampleIndex === index ? 'active' : ''}"
|
||||
onclick={() => loadExample(example, index)}
|
||||
>
|
||||
<div class="example-name">{example.name}</div>
|
||||
<div class="example-description">{example.description}</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<!-- Input Section -->
|
||||
<div class="card input-card">
|
||||
<div class="input-layout">
|
||||
<div class="zone-input-group">
|
||||
<label for="old-zone" use:tooltip={"Original zone file content for comparison"}>
|
||||
<Icon name="file" size="sm" />
|
||||
Original Zone
|
||||
</label>
|
||||
<textarea
|
||||
id="old-zone"
|
||||
bind:value={oldZoneInput}
|
||||
oninput={handleInputChange}
|
||||
placeholder="Original zone file content..."
|
||||
class="zone-textarea"
|
||||
rows="10"
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
<div class="zone-input-group">
|
||||
<label for="new-zone" use:tooltip={"Updated zone file content to compare against"}>
|
||||
<Icon name="file-tick" size="sm" />
|
||||
Updated Zone
|
||||
</label>
|
||||
<textarea
|
||||
id="new-zone"
|
||||
bind:value={newZoneInput}
|
||||
oninput={handleInputChange}
|
||||
placeholder="Updated zone file content..."
|
||||
class="zone-textarea"
|
||||
rows="10"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Results -->
|
||||
{#if results}
|
||||
<section class="results-section">
|
||||
<div class="results-header">
|
||||
<h3>Zone Comparison Results</h3>
|
||||
<div class="results-controls">
|
||||
<label class="diff-format-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="styled-checkbox"
|
||||
bind:checked={showUnified}
|
||||
/>
|
||||
<span class="checkbox-text">Unified diff format</span>
|
||||
</label>
|
||||
<button
|
||||
class="copy-button {copiedState ? 'copied' : ''}"
|
||||
onclick={copyDiff}
|
||||
>
|
||||
<Icon name={copiedState ? 'check' : 'copy'} size="sm" />
|
||||
{copiedState ? 'Copied!' : 'Copy Diff'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="results-inner">
|
||||
<!-- Summary Stats -->
|
||||
<div class="summary-card">
|
||||
<h4>
|
||||
<Icon name="list-check" size="sm" />
|
||||
Change Summary
|
||||
</h4>
|
||||
<div class="summary-stats">
|
||||
<div class="stat-item added">
|
||||
<div class="stat-value">{results.added.length}</div>
|
||||
<div class="stat-label">Added</div>
|
||||
</div>
|
||||
<div class="stat-item removed">
|
||||
<div class="stat-value">{results.removed.length}</div>
|
||||
<div class="stat-label">Removed</div>
|
||||
</div>
|
||||
<div class="stat-item changed">
|
||||
<div class="stat-value">{results.changed.length}</div>
|
||||
<div class="stat-label">Changed</div>
|
||||
</div>
|
||||
<div class="stat-item unchanged">
|
||||
<div class="stat-value">{results.unchanged.length}</div>
|
||||
<div class="stat-label">Unchanged</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Diff Output -->
|
||||
{#if showUnified}
|
||||
<div class="diff-card unified">
|
||||
<h4>
|
||||
<Icon name="code-diff" size="sm" />
|
||||
Unified Diff
|
||||
</h4>
|
||||
<div class="code-output">
|
||||
<pre>{generateUnifiedDiff()}</pre>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="diff-sections">
|
||||
<!-- Added Records -->
|
||||
{#if results.added.length > 0}
|
||||
<div class="diff-card added-card">
|
||||
<h4>
|
||||
<Icon name="plus-circle" size="sm" />
|
||||
Added Records ({results.added.length})
|
||||
</h4>
|
||||
<div class="records-list">
|
||||
{#each results.added as record}
|
||||
<div class="record-item added">
|
||||
<Icon name="plus" size="sm" />
|
||||
<code>{formatRecord(record)}</code>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Removed Records -->
|
||||
{#if results.removed.length > 0}
|
||||
<div class="diff-card removed-card">
|
||||
<h4>
|
||||
<Icon name="minus-circle" size="sm" />
|
||||
Removed Records ({results.removed.length})
|
||||
</h4>
|
||||
<div class="records-list">
|
||||
{#each results.removed as record}
|
||||
<div class="record-item removed">
|
||||
<Icon name="minus" size="sm" />
|
||||
<code>{formatRecord(record)}</code>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Changed Records -->
|
||||
{#if results.changed.length > 0}
|
||||
<div class="diff-card changed-card">
|
||||
<h4>
|
||||
<Icon name="edit" size="sm" />
|
||||
Changed Records ({results.changed.length})
|
||||
</h4>
|
||||
<div class="records-list">
|
||||
{#each results.changed as change}
|
||||
<div class="change-group">
|
||||
<div class="record-item removed">
|
||||
<Icon name="minus" size="sm" />
|
||||
<code>{formatRecord(change.before)}</code>
|
||||
</div>
|
||||
<div class="record-item added">
|
||||
<Icon name="plus" size="sm" />
|
||||
<code>{formatRecord(change.after)}</code>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
<!-- Educational Content -->
|
||||
<div class="education-card">
|
||||
<div class="education-grid">
|
||||
<div class="education-item info-panel">
|
||||
<h4>Zone File Comparison</h4>
|
||||
<p>
|
||||
Comparing zone files helps track DNS changes during migrations, updates, or
|
||||
troubleshooting. It identifies exactly what records were added, removed, or modified
|
||||
between two zone versions.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Change Types</h4>
|
||||
<p>
|
||||
Added records are new entries in the updated zone. Removed records exist in the
|
||||
original but not the updated zone. Changed records have the same owner and type
|
||||
but different data or TTL values.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Diff Formats</h4>
|
||||
<p>
|
||||
Structured format groups changes by type for easy review. Unified diff format
|
||||
follows standard patch conventions, useful for version control systems and
|
||||
automated processing.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Migration Planning</h4>
|
||||
<p>
|
||||
Use zone diffs to plan DNS migrations, verify changes before deployment, and
|
||||
audit modifications. Consider TTL impact on propagation when planning record
|
||||
updates or deletions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.info-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.overview-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.overview-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
color: var(--text-secondary);
|
||||
|
||||
strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.examples-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.examples-details {
|
||||
border: none;
|
||||
background: none;
|
||||
|
||||
&[open] {
|
||||
.examples-summary :global(.icon) {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.examples-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
user-select: none;
|
||||
transition: all var(--transition-fast);
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:global(.icon) {
|
||||
transition: transform var(--transition-fast);
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.examples-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
|
||||
.example-card {
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
text-align: left;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary), transparent 80%);
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
}
|
||||
|
||||
.example-name {
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.example-description {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.input-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.input-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--spacing-lg);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.zone-input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.zone-textarea {
|
||||
width: 100%;
|
||||
padding: var(--spacing-md);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
border: 2px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
background-color: var(--bg-secondary);
|
||||
color: var(--text-primary);
|
||||
resize: vertical;
|
||||
min-height: 200px;
|
||||
line-height: 1.4;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary), transparent 90%);
|
||||
}
|
||||
}
|
||||
|
||||
.results-section {
|
||||
background-color: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-lg);
|
||||
margin-bottom: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.results-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.results-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
}
|
||||
|
||||
.diff-format-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.styled-checkbox {
|
||||
height: 1.6rem;
|
||||
width: 1.6rem;
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-primary);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
transition: all var(--transition-fast);
|
||||
margin: 0;
|
||||
flex-shrink: 0;
|
||||
padding: 0;
|
||||
|
||||
&:checked {
|
||||
background-color: var(--color-primary);
|
||||
border-color: var(--color-primary);
|
||||
|
||||
&::after {
|
||||
content: '✓';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
color: var(--color-primary);
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary), transparent 80%);
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-text {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.copy-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
background: none;
|
||||
border: 1px solid var(--border-primary);
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
border-radius: var(--radius-md);
|
||||
transition: all var(--transition-fast);
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&.copied {
|
||||
color: var(--color-success);
|
||||
border-color: var(--color-success);
|
||||
}
|
||||
}
|
||||
|
||||
.results-inner {
|
||||
display: grid;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
|
||||
h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-md);
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.summary-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: var(--spacing-md);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
padding: var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
|
||||
&.added {
|
||||
background-color: color-mix(in srgb, var(--color-success), transparent 90%);
|
||||
border: 1px solid var(--color-success);
|
||||
}
|
||||
|
||||
&.removed {
|
||||
background-color: color-mix(in srgb, var(--color-error), transparent 90%);
|
||||
border: 1px solid var(--color-error);
|
||||
}
|
||||
|
||||
&.changed {
|
||||
background-color: color-mix(in srgb, var(--color-warning), transparent 90%);
|
||||
border: 1px solid var(--color-warning);
|
||||
}
|
||||
|
||||
&.unchanged {
|
||||
background-color: color-mix(in srgb, var(--color-info), transparent 90%);
|
||||
border: 1px solid var(--color-info);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: 700;
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: var(--font-size-sm);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
&.added .stat-value,
|
||||
&.added .stat-label {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
&.removed .stat-value,
|
||||
&.removed .stat-label {
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
&.changed .stat-value,
|
||||
&.changed .stat-label {
|
||||
color: var(--color-warning);
|
||||
}
|
||||
|
||||
&.unchanged .stat-value,
|
||||
&.unchanged .stat-label {
|
||||
color: var(--color-info);
|
||||
}
|
||||
}
|
||||
|
||||
.diff-sections {
|
||||
display: grid;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.diff-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
|
||||
h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-md);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
|
||||
&.added-card h4 {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
&.removed-card h4 {
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
&.changed-card h4 {
|
||||
color: var(--color-warning);
|
||||
}
|
||||
|
||||
&.unified {
|
||||
.code-output {
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
overflow-x: auto;
|
||||
|
||||
pre {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
white-space: pre;
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.records-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.record-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
code {
|
||||
font-family: var(--font-mono);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&.added {
|
||||
background-color: color-mix(in srgb, var(--color-success), transparent 90%);
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
&.removed {
|
||||
background-color: color-mix(in srgb, var(--color-error), transparent 90%);
|
||||
color: var(--color-error);
|
||||
}
|
||||
}
|
||||
|
||||
.change-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
margin-bottom: var(--spacing-sm);
|
||||
padding: var(--spacing-xs);
|
||||
border-left: 3px solid var(--color-warning);
|
||||
background-color: color-mix(in srgb, var(--color-warning), transparent 95%);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.education-card {
|
||||
border-top: 1px solid var(--border-secondary);
|
||||
padding-top: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.education-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.education-item {
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
|
||||
h4 {
|
||||
margin-bottom: var(--spacing-md);
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.examples-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.education-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,755 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip.js';
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { parseZoneFile, normalizeZone, formatZoneFile, type ParsedZone } from '$lib/utils/zone-parser.js';
|
||||
|
||||
let zoneInput = $state('');
|
||||
let results = $state<{
|
||||
normalized: ParsedZone;
|
||||
formattedZone: string;
|
||||
} | null>(null);
|
||||
let copiedState = $state(false);
|
||||
let activeExampleIndex = $state<number | null>(null);
|
||||
|
||||
const examples = [
|
||||
{
|
||||
name: 'Basic Zone',
|
||||
content: `$ORIGIN example.com.
|
||||
$TTL 3600
|
||||
@ IN SOA ns1.example.com. admin.example.com. (
|
||||
2023010101 ; Serial
|
||||
3600 ; Refresh
|
||||
1800 ; Retry
|
||||
1209600 ; Expire
|
||||
86400 ) ; Minimum TTL
|
||||
|
||||
IN NS ns1.example.com.
|
||||
IN NS ns2.example.com.
|
||||
|
||||
www IN A 192.0.2.1
|
||||
mail IN A 192.0.2.10
|
||||
IN MX 10 mail.example.com.`,
|
||||
description: 'Standard zone with SOA, NS, A, and MX records'
|
||||
},
|
||||
{
|
||||
name: 'Messy Zone',
|
||||
content: `example.com. 3600 IN SOA ns1.example.com. admin.example.com. 2023010101 3600 1800 1209600 86400
|
||||
www.example.com. 300 IN A 192.0.2.1
|
||||
www.example.com. 300 IN A 192.0.2.1
|
||||
mail.example.com. IN A 192.0.2.10
|
||||
example.com. IN MX 10 mail.example.com.
|
||||
example.com. IN NS ns1.example.com.
|
||||
example.com. IN NS ns2.example.com.`,
|
||||
description: 'Unorganized zone with duplicates and inconsistent formatting'
|
||||
},
|
||||
{
|
||||
name: 'Complex Zone',
|
||||
content: `$ORIGIN example.com.
|
||||
$TTL 86400
|
||||
|
||||
@ IN SOA ns1.example.com. hostmaster.example.com. (
|
||||
2023010101 10800 3600 604800 86400 )
|
||||
|
||||
IN NS ns1.example.com.
|
||||
IN NS ns2.example.com.
|
||||
IN MX 10 mail.example.com.
|
||||
IN TXT "v=spf1 mx ~all"
|
||||
|
||||
www 300 IN A 192.0.2.1
|
||||
300 IN AAAA 2001:db8::1
|
||||
ftp IN CNAME www.example.com.
|
||||
mail IN A 192.0.2.10
|
||||
IN AAAA 2001:db8::10
|
||||
|
||||
_http._tcp IN SRV 0 5 80 www.example.com.
|
||||
_https._tcp IN SRV 0 5 443 www.example.com.`,
|
||||
description: 'Comprehensive zone with multiple record types'
|
||||
}
|
||||
];
|
||||
|
||||
function loadExample(example: typeof examples[0], index: number) {
|
||||
zoneInput = example.content;
|
||||
activeExampleIndex = index;
|
||||
lintZone();
|
||||
}
|
||||
|
||||
function clearActiveIfChanged() {
|
||||
if (activeExampleIndex !== null) {
|
||||
const activeExample = examples[activeExampleIndex];
|
||||
if (!activeExample || zoneInput !== activeExample.content) {
|
||||
activeExampleIndex = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function lintZone() {
|
||||
if (!zoneInput.trim()) {
|
||||
results = null;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const parsed = parseZoneFile(zoneInput);
|
||||
const normalized = normalizeZone(parsed);
|
||||
const formattedZone = formatZoneFile(normalized);
|
||||
|
||||
results = {
|
||||
normalized,
|
||||
formattedZone
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Failed to parse zone:', error);
|
||||
results = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyZone() {
|
||||
if (!results) return;
|
||||
|
||||
try {
|
||||
await navigator.clipboard.writeText(results.formattedZone);
|
||||
copiedState = true;
|
||||
setTimeout(() => {
|
||||
copiedState = false;
|
||||
}, 2000);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
function handleInputChange() {
|
||||
clearActiveIfChanged();
|
||||
lintZone();
|
||||
}
|
||||
|
||||
function downloadZone() {
|
||||
if (!results) return;
|
||||
|
||||
const blob = new Blob([results.formattedZone], { type: 'text/plain' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'normalized-zone.txt';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<h1>DNS Zone Linter</h1>
|
||||
<p>Normalize and canonicalize BIND zone files with error checking and formatting</p>
|
||||
</header>
|
||||
|
||||
<!-- Educational Overview -->
|
||||
<div class="card info-card">
|
||||
<div class="overview-content">
|
||||
<div class="overview-item">
|
||||
<Icon name="check-circle" size="sm" />
|
||||
<div>
|
||||
<strong>Normalization:</strong> Sort records, remove duplicates, and apply consistent formatting.
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-item">
|
||||
<Icon name="alert-triangle" size="sm" />
|
||||
<div>
|
||||
<strong>Error Detection:</strong> Identify syntax errors, missing records, and configuration issues.
|
||||
</div>
|
||||
</div>
|
||||
<div class="overview-item">
|
||||
<Icon name="layout" size="sm" />
|
||||
<div>
|
||||
<strong>Canonicalization:</strong> Apply standard ordering and TTL defaults for clean output.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Examples -->
|
||||
<div class="card examples-card">
|
||||
<details class="examples-details">
|
||||
<summary class="examples-summary">
|
||||
<Icon name="chevron-right" size="sm" />
|
||||
<h3>Zone File Examples</h3>
|
||||
</summary>
|
||||
<div class="examples-grid">
|
||||
{#each examples as example, index}
|
||||
<button
|
||||
class="example-card {activeExampleIndex === index ? 'active' : ''}"
|
||||
onclick={() => loadExample(example, index)}
|
||||
>
|
||||
<div class="example-name">{example.name}</div>
|
||||
<div class="example-description">{example.description}</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<!-- Input Section -->
|
||||
<div class="card input-card">
|
||||
<div class="input-group">
|
||||
<label for="zone-input" use:tooltip={"Paste your BIND zone file content here for analysis and normalization"}>
|
||||
<Icon name="file" size="sm" />
|
||||
Zone File Content
|
||||
</label>
|
||||
<textarea
|
||||
id="zone-input"
|
||||
bind:value={zoneInput}
|
||||
oninput={handleInputChange}
|
||||
placeholder="$ORIGIN example.com.
|
||||
$TTL 3600
|
||||
@ IN SOA ns1.example.com. admin.example.com. (
|
||||
2023010101 ; Serial
|
||||
3600 ; Refresh
|
||||
1800 ; Retry
|
||||
1209600 ; Expire
|
||||
86400 ) ; Minimum TTL
|
||||
|
||||
IN NS ns1.example.com.
|
||||
IN NS ns2.example.com.
|
||||
|
||||
www IN A 192.0.2.1"
|
||||
class="zone-textarea"
|
||||
rows="12"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Results -->
|
||||
{#if results}
|
||||
<section class="results-section">
|
||||
<h3>Linting Results</h3>
|
||||
<div class="results-inner">
|
||||
|
||||
<!-- Errors and Warnings -->
|
||||
{#if results.normalized.errors.length > 0 || results.normalized.warnings.length > 0}
|
||||
<div class="issues-card">
|
||||
<h4>
|
||||
<Icon name="alert-circle" size="sm" />
|
||||
Issues Found
|
||||
</h4>
|
||||
|
||||
{#if results.normalized.errors.length > 0}
|
||||
<div class="error-list">
|
||||
<h5>Errors ({results.normalized.errors.length})</h5>
|
||||
{#each results.normalized.errors as error}
|
||||
<div class="issue-item error">
|
||||
<Icon name="x-circle" size="sm" />
|
||||
<div>
|
||||
<span class="issue-line">Line {error.line}:</span>
|
||||
{error.message}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if results.normalized.warnings.length > 0}
|
||||
<div class="warning-list">
|
||||
<h5>Warnings ({results.normalized.warnings.length})</h5>
|
||||
{#each results.normalized.warnings as warning}
|
||||
<div class="issue-item warning">
|
||||
<Icon name="alert-triangle" size="sm" />
|
||||
<div>
|
||||
<span class="issue-line">Line {warning.line || 'General'}:</span>
|
||||
{warning.message}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Zone Summary -->
|
||||
<div class="summary-card">
|
||||
<h4>
|
||||
<Icon name="info" size="sm" />
|
||||
Zone Summary
|
||||
</h4>
|
||||
<div class="summary-stats">
|
||||
<div class="stat-item">
|
||||
<div class="stat-label">Total Records</div>
|
||||
<div class="stat-value">{results.normalized.records.length}</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-label">Origin</div>
|
||||
<div class="stat-value">{results.normalized.origin || 'Not specified'}</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-label">Default TTL</div>
|
||||
<div class="stat-value">{results.normalized.defaultTTL || 'Not specified'}</div>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<div class="stat-label">Has SOA</div>
|
||||
<div class="stat-value {results.normalized.soa ? 'success' : 'error'}">
|
||||
{results.normalized.soa ? 'Yes' : 'No'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Normalized Output -->
|
||||
<div class="output-card">
|
||||
<div class="output-header">
|
||||
<h4>
|
||||
<Icon name="file" size="sm" />
|
||||
Normalized Zone File
|
||||
</h4>
|
||||
<div class="output-actions">
|
||||
<button
|
||||
class="copy-button {copiedState ? 'copied' : ''}"
|
||||
onclick={copyZone}
|
||||
>
|
||||
<Icon name={copiedState ? 'check' : 'copy'} size="sm" />
|
||||
{copiedState ? 'Copied!' : 'Copy'}
|
||||
</button>
|
||||
<button class="download-button" onclick={downloadZone}>
|
||||
<Icon name="download" size="sm" />
|
||||
Download
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="code-output">
|
||||
<pre>{results.formattedZone}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
<!-- Educational Content -->
|
||||
<div class="education-card">
|
||||
<div class="education-grid">
|
||||
<div class="education-item info-panel">
|
||||
<h4>Zone File Format</h4>
|
||||
<p>
|
||||
BIND zone files define DNS records for a domain. They include resource records (RRs)
|
||||
with owner names, TTL values, classes, types, and data. Proper formatting ensures
|
||||
reliable DNS operation.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Normalization Benefits</h4>
|
||||
<p>
|
||||
Normalizing zone files improves readability, reduces errors, and ensures consistent
|
||||
formatting. It also helps identify duplicate records and missing essential records
|
||||
like SOA and NS.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Common Issues</h4>
|
||||
<p>
|
||||
Watch for missing trailing dots in FQDNs, duplicate records, incorrect TTL values,
|
||||
and missing SOA or NS records. The linter helps catch these configuration problems
|
||||
early.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="education-item info-panel">
|
||||
<h4>Best Practices</h4>
|
||||
<p>
|
||||
Use consistent TTL values, maintain proper record ordering, include comprehensive
|
||||
NS records, and regularly validate your zones. Consider using shorter TTLs during
|
||||
transitions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.info-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.overview-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.overview-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
color: var(--text-secondary);
|
||||
|
||||
strong {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.examples-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.examples-details {
|
||||
border: none;
|
||||
background: none;
|
||||
|
||||
&[open] {
|
||||
.examples-summary :global(.icon) {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.examples-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
padding: var(--spacing-md);
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
user-select: none;
|
||||
transition: all var(--transition-fast);
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:global(.icon) {
|
||||
transition: transform var(--transition-fast);
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.examples-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
|
||||
.example-card {
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
text-align: left;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-xs);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary), transparent 80%);
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
}
|
||||
|
||||
.example-name {
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.example-description {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.input-card {
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.input-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-sm);
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.zone-textarea {
|
||||
width: 100%;
|
||||
padding: var(--spacing-md);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
border: 2px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
background-color: var(--bg-secondary);
|
||||
color: var(--text-primary);
|
||||
resize: vertical;
|
||||
min-height: 300px;
|
||||
line-height: 1.4;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary), transparent 90%);
|
||||
}
|
||||
}
|
||||
|
||||
.results-section {
|
||||
background-color: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-lg);
|
||||
margin-bottom: var(--spacing-lg);
|
||||
|
||||
h3 {
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-md);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.results-inner {
|
||||
display: grid;
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.issues-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
|
||||
h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-md);
|
||||
color: var(--color-error);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
|
||||
h5 {
|
||||
margin: var(--spacing-md) 0 var(--spacing-sm);
|
||||
font-size: var(--font-size-sm);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.error-list h5 {
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
.warning-list h5 {
|
||||
color: var(--color-warning);
|
||||
}
|
||||
}
|
||||
|
||||
.issue-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
&.error {
|
||||
background-color: color-mix(in srgb, var(--color-error), transparent 90%);
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
&.warning {
|
||||
background-color: color-mix(in srgb, var(--color-warning), transparent 90%);
|
||||
color: var(--color-warning);
|
||||
}
|
||||
|
||||
.issue-line {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
|
||||
h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-md);
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.summary-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
|
||||
.stat-label {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
font-family: var(--font-mono);
|
||||
|
||||
&.success {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
&.error {
|
||||
color: var(--color-error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.output-card {
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-md);
|
||||
}
|
||||
|
||||
.output-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--spacing-md);
|
||||
|
||||
h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
}
|
||||
|
||||
.output-actions {
|
||||
display: flex;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.copy-button,
|
||||
.download-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-xs);
|
||||
background: none;
|
||||
border: 1px solid var(--border-primary);
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
border-radius: var(--radius-md);
|
||||
transition: all var(--transition-fast);
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
}
|
||||
|
||||
&.copied {
|
||||
color: var(--color-success);
|
||||
border-color: var(--color-success);
|
||||
}
|
||||
}
|
||||
|
||||
.code-output {
|
||||
padding: var(--spacing-md);
|
||||
background-color: var(--bg-tertiary);
|
||||
border: 1px solid var(--border-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
overflow-x: auto;
|
||||
|
||||
pre {
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-primary);
|
||||
white-space: pre;
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
.education-card {
|
||||
border-top: 1px solid var(--border-secondary);
|
||||
padding-top: var(--spacing-xl);
|
||||
}
|
||||
|
||||
.education-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.education-item {
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
|
||||
h4 {
|
||||
margin-bottom: var(--spacing-md);
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.examples-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.summary-stats {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.output-actions {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.education-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -495,6 +495,39 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
|
||||
keywords: ['dns', 'label', 'normalize', 'domain', 'homograph', 'attack', 'script', 'mixing', 'security', 'idn']
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Zone File Tools',
|
||||
items: [
|
||||
{
|
||||
href: '/dns/zone/linter',
|
||||
label: 'Zone Linter',
|
||||
description: 'Normalize and canonicalize BIND zone files with error checking and formatting',
|
||||
icon: 'dns-zone-linter',
|
||||
keywords: ['dns', 'zone', 'linter', 'normalize', 'canonicalize', 'bind', 'error', 'checking', 'format']
|
||||
},
|
||||
{
|
||||
href: '/dns/zone/diff',
|
||||
label: 'Zone Diff',
|
||||
description: 'Compare two zone files and identify added, removed, and changed DNS records',
|
||||
icon: 'dns-zone-diff',
|
||||
keywords: ['dns', 'zone', 'diff', 'compare', 'changes', 'added', 'removed', 'modified', 'migration']
|
||||
},
|
||||
{
|
||||
href: '/dns/zone/stats',
|
||||
label: 'Zone Statistics',
|
||||
description: 'Analyze zone file structure, record distribution, and configuration health',
|
||||
icon: 'dns-zone-stats',
|
||||
keywords: ['dns', 'zone', 'statistics', 'analysis', 'records', 'distribution', 'health', 'metrics']
|
||||
},
|
||||
{
|
||||
href: '/dns/zone/name-length-checker',
|
||||
label: 'Name Length Checker',
|
||||
description: 'Validate DNS names against RFC length limits: 63 bytes per label, 255 bytes per FQDN',
|
||||
icon: 'dns-name-length',
|
||||
keywords: ['dns', 'name', 'length', 'validator', 'rfc', 'limits', 'label', 'fqdn', 'validation']
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
'/reference': [
|
||||
|
||||
@@ -0,0 +1,445 @@
|
||||
export interface ResourceRecord {
|
||||
owner: string;
|
||||
ttl?: number;
|
||||
class: string;
|
||||
type: string;
|
||||
rdata: string;
|
||||
line?: number;
|
||||
raw?: string;
|
||||
}
|
||||
|
||||
export interface ParsedZone {
|
||||
records: ResourceRecord[];
|
||||
errors: ParseError[];
|
||||
warnings: ParseWarning[];
|
||||
soa?: ResourceRecord;
|
||||
defaultTTL?: number;
|
||||
origin?: string;
|
||||
}
|
||||
|
||||
export interface ParseError {
|
||||
line: number;
|
||||
message: string;
|
||||
severity: 'error' | 'warning';
|
||||
}
|
||||
|
||||
export interface ParseWarning extends ParseError {
|
||||
severity: 'warning';
|
||||
}
|
||||
|
||||
export interface ZoneStats {
|
||||
totalRecords: number;
|
||||
recordsByType: Record<string, number>;
|
||||
ttlDistribution: Record<number, number>;
|
||||
nameDepths: {
|
||||
min: number;
|
||||
max: number;
|
||||
average: number;
|
||||
};
|
||||
largestRecord: {
|
||||
record: ResourceRecord;
|
||||
size: number;
|
||||
};
|
||||
longestName: {
|
||||
name: string;
|
||||
length: number;
|
||||
};
|
||||
sanityChecks: {
|
||||
hasSoa: boolean;
|
||||
hasNs: boolean;
|
||||
duplicates: ResourceRecord[];
|
||||
orphanedGlue: ResourceRecord[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface ZoneDiff {
|
||||
added: ResourceRecord[];
|
||||
removed: ResourceRecord[];
|
||||
changed: Array<{
|
||||
before: ResourceRecord;
|
||||
after: ResourceRecord;
|
||||
}>;
|
||||
unchanged: ResourceRecord[];
|
||||
}
|
||||
|
||||
export interface NameLengthViolation {
|
||||
name: string;
|
||||
type: 'label' | 'fqdn';
|
||||
length: number;
|
||||
limit: number;
|
||||
labels?: string[];
|
||||
}
|
||||
|
||||
// Constants
|
||||
const MAX_LABEL_LENGTH = 63;
|
||||
const MAX_FQDN_LENGTH = 255;
|
||||
const DEFAULT_CLASS = 'IN';
|
||||
const DEFAULT_TTL = 3600;
|
||||
|
||||
export function parseZoneFile(content: string): ParsedZone {
|
||||
const lines = content.split('\n');
|
||||
const records: ResourceRecord[] = [];
|
||||
const errors: ParseError[] = [];
|
||||
const warnings: ParseWarning[] = [];
|
||||
|
||||
let currentOrigin = '';
|
||||
let defaultTTL = DEFAULT_TTL;
|
||||
let lastOwner = '';
|
||||
let soa: ResourceRecord | undefined;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
const lineNum = i + 1;
|
||||
|
||||
// Skip empty lines and comments
|
||||
if (!line || line.startsWith(';')) continue;
|
||||
|
||||
try {
|
||||
// Handle $ORIGIN directive
|
||||
if (line.startsWith('$ORIGIN')) {
|
||||
const match = line.match(/^\$ORIGIN\s+(\S+)/);
|
||||
if (match) {
|
||||
currentOrigin = match[1];
|
||||
if (!currentOrigin.endsWith('.')) {
|
||||
currentOrigin += '.';
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle $TTL directive
|
||||
if (line.startsWith('$TTL')) {
|
||||
const match = line.match(/^\$TTL\s+(\d+)/);
|
||||
if (match) {
|
||||
defaultTTL = parseInt(match[1]);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Parse resource record
|
||||
const record = parseResourceRecord(line, lastOwner, defaultTTL, currentOrigin, lineNum);
|
||||
if (record) {
|
||||
records.push(record);
|
||||
lastOwner = record.owner;
|
||||
|
||||
if (record.type === 'SOA' && !soa) {
|
||||
soa = record;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
errors.push({
|
||||
line: lineNum,
|
||||
message: error instanceof Error ? error.message : 'Unknown parsing error',
|
||||
severity: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Add warnings for common issues
|
||||
if (!soa) {
|
||||
warnings.push({
|
||||
line: 0,
|
||||
message: 'No SOA record found in zone',
|
||||
severity: 'warning'
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
records,
|
||||
errors,
|
||||
warnings,
|
||||
soa,
|
||||
defaultTTL,
|
||||
origin: currentOrigin
|
||||
};
|
||||
}
|
||||
|
||||
function parseResourceRecord(
|
||||
line: string,
|
||||
lastOwner: string,
|
||||
defaultTTL: number,
|
||||
origin: string,
|
||||
lineNum: number
|
||||
): ResourceRecord | null {
|
||||
// Remove comments
|
||||
const commentIndex = line.indexOf(';');
|
||||
const cleanLine = commentIndex >= 0 ? line.substring(0, commentIndex).trim() : line;
|
||||
|
||||
if (!cleanLine) return null;
|
||||
|
||||
const parts = cleanLine.split(/\s+/);
|
||||
if (parts.length < 3) return null;
|
||||
|
||||
let owner = parts[0];
|
||||
let ttl: number | undefined;
|
||||
let recordClass = DEFAULT_CLASS;
|
||||
let type: string;
|
||||
let rdata: string;
|
||||
let partIndex = 1;
|
||||
|
||||
// Handle implicit owner (blank or continuation)
|
||||
if (owner === '' || owner === '@') {
|
||||
owner = lastOwner || origin;
|
||||
} else if (!owner.endsWith('.') && origin) {
|
||||
owner = owner + '.' + origin;
|
||||
}
|
||||
|
||||
// Parse TTL (optional)
|
||||
if (/^\d+$/.test(parts[partIndex])) {
|
||||
ttl = parseInt(parts[partIndex]);
|
||||
partIndex++;
|
||||
}
|
||||
|
||||
// Parse class (optional, usually IN)
|
||||
if (parts[partIndex] && ['IN', 'CH', 'HS'].includes(parts[partIndex].toUpperCase())) {
|
||||
recordClass = parts[partIndex].toUpperCase();
|
||||
partIndex++;
|
||||
}
|
||||
|
||||
// Parse type (required)
|
||||
if (partIndex >= parts.length) return null;
|
||||
type = parts[partIndex].toUpperCase();
|
||||
partIndex++;
|
||||
|
||||
// Parse RDATA (rest of the line)
|
||||
rdata = parts.slice(partIndex).join(' ');
|
||||
|
||||
return {
|
||||
owner,
|
||||
ttl: ttl || defaultTTL,
|
||||
class: recordClass,
|
||||
type,
|
||||
rdata,
|
||||
line: lineNum,
|
||||
raw: line
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeZone(zone: ParsedZone): ParsedZone {
|
||||
const normalizedRecords = [...zone.records]
|
||||
.sort((a, b) => {
|
||||
// Sort by owner name first
|
||||
if (a.owner !== b.owner) {
|
||||
return a.owner.localeCompare(b.owner);
|
||||
}
|
||||
// Then by type
|
||||
if (a.type !== b.type) {
|
||||
return a.type.localeCompare(b.type);
|
||||
}
|
||||
// Then by RDATA
|
||||
return a.rdata.localeCompare(b.rdata);
|
||||
})
|
||||
// Remove duplicates
|
||||
.filter((record, index, array) => {
|
||||
if (index === 0) return true;
|
||||
const prev = array[index - 1];
|
||||
return !(
|
||||
record.owner === prev.owner &&
|
||||
record.type === prev.type &&
|
||||
record.rdata === prev.rdata
|
||||
);
|
||||
});
|
||||
|
||||
return {
|
||||
...zone,
|
||||
records: normalizedRecords
|
||||
};
|
||||
}
|
||||
|
||||
export function generateZoneStats(zone: ParsedZone): ZoneStats {
|
||||
const recordsByType: Record<string, number> = {};
|
||||
const ttlDistribution: Record<number, number> = {};
|
||||
const nameLengths: number[] = [];
|
||||
|
||||
let largestRecord = { record: zone.records[0], size: 0 };
|
||||
let longestName = { name: '', length: 0 };
|
||||
|
||||
for (const record of zone.records) {
|
||||
// Count by type
|
||||
recordsByType[record.type] = (recordsByType[record.type] || 0) + 1;
|
||||
|
||||
// Count TTL distribution
|
||||
const ttl = record.ttl || 0;
|
||||
ttlDistribution[ttl] = (ttlDistribution[ttl] || 0) + 1;
|
||||
|
||||
// Track name lengths and depths
|
||||
const nameLength = record.owner.length;
|
||||
nameLengths.push(nameLength);
|
||||
|
||||
if (nameLength > longestName.length) {
|
||||
longestName = { name: record.owner, length: nameLength };
|
||||
}
|
||||
|
||||
// Track largest record
|
||||
const recordSize = (record.raw || '').length;
|
||||
if (recordSize > largestRecord.size) {
|
||||
largestRecord = { record, size: recordSize };
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate name depth statistics
|
||||
const nameDepths = {
|
||||
min: Math.min(...nameLengths),
|
||||
max: Math.max(...nameLengths),
|
||||
average: nameLengths.reduce((sum, len) => sum + len, 0) / nameLengths.length || 0
|
||||
};
|
||||
|
||||
// Find duplicates
|
||||
const duplicates: ResourceRecord[] = [];
|
||||
const seen = new Set<string>();
|
||||
|
||||
for (const record of zone.records) {
|
||||
const key = `${record.owner}:${record.type}:${record.rdata}`;
|
||||
if (seen.has(key)) {
|
||||
duplicates.push(record);
|
||||
} else {
|
||||
seen.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
// Basic sanity checks
|
||||
const hasSoa = zone.records.some(r => r.type === 'SOA');
|
||||
const hasNs = zone.records.some(r => r.type === 'NS');
|
||||
|
||||
// Find orphaned glue records (A/AAAA records for NS that don't exist)
|
||||
const nsTargets = new Set(
|
||||
zone.records
|
||||
.filter(r => r.type === 'NS')
|
||||
.map(r => r.rdata.trim())
|
||||
);
|
||||
|
||||
const orphanedGlue = zone.records.filter(record => {
|
||||
return (record.type === 'A' || record.type === 'AAAA') &&
|
||||
!nsTargets.has(record.owner);
|
||||
});
|
||||
|
||||
return {
|
||||
totalRecords: zone.records.length,
|
||||
recordsByType,
|
||||
ttlDistribution,
|
||||
nameDepths,
|
||||
largestRecord,
|
||||
longestName,
|
||||
sanityChecks: {
|
||||
hasSoa,
|
||||
hasNs,
|
||||
duplicates,
|
||||
orphanedGlue
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function compareZones(oldZone: ParsedZone, newZone: ParsedZone): ZoneDiff {
|
||||
const oldRecords = new Map<string, ResourceRecord>();
|
||||
const newRecords = new Map<string, ResourceRecord>();
|
||||
|
||||
// Create maps for easy comparison
|
||||
oldZone.records.forEach(record => {
|
||||
const key = `${record.owner}:${record.type}`;
|
||||
oldRecords.set(key, record);
|
||||
});
|
||||
|
||||
newZone.records.forEach(record => {
|
||||
const key = `${record.owner}:${record.type}`;
|
||||
newRecords.set(key, record);
|
||||
});
|
||||
|
||||
const added: ResourceRecord[] = [];
|
||||
const removed: ResourceRecord[] = [];
|
||||
const changed: Array<{ before: ResourceRecord; after: ResourceRecord }> = [];
|
||||
const unchanged: ResourceRecord[] = [];
|
||||
|
||||
// Find added and changed records
|
||||
newRecords.forEach((newRecord, key) => {
|
||||
const oldRecord = oldRecords.get(key);
|
||||
if (!oldRecord) {
|
||||
added.push(newRecord);
|
||||
} else if (oldRecord.rdata !== newRecord.rdata || oldRecord.ttl !== newRecord.ttl) {
|
||||
changed.push({ before: oldRecord, after: newRecord });
|
||||
} else {
|
||||
unchanged.push(newRecord);
|
||||
}
|
||||
});
|
||||
|
||||
// Find removed records
|
||||
oldRecords.forEach((oldRecord, key) => {
|
||||
if (!newRecords.has(key)) {
|
||||
removed.push(oldRecord);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
added,
|
||||
removed,
|
||||
changed,
|
||||
unchanged
|
||||
};
|
||||
}
|
||||
|
||||
export function checkNameLengths(zone: ParsedZone): NameLengthViolation[] {
|
||||
const violations: NameLengthViolation[] = [];
|
||||
const checkedNames = new Set<string>();
|
||||
|
||||
for (const record of zone.records) {
|
||||
const name = record.owner;
|
||||
|
||||
if (checkedNames.has(name)) continue;
|
||||
checkedNames.add(name);
|
||||
|
||||
// Check FQDN length
|
||||
if (name.length > MAX_FQDN_LENGTH) {
|
||||
violations.push({
|
||||
name,
|
||||
type: 'fqdn',
|
||||
length: name.length,
|
||||
limit: MAX_FQDN_LENGTH
|
||||
});
|
||||
}
|
||||
|
||||
// Check individual label lengths
|
||||
const labels = name.split('.');
|
||||
for (const label of labels) {
|
||||
if (label.length > MAX_LABEL_LENGTH) {
|
||||
violations.push({
|
||||
name,
|
||||
type: 'label',
|
||||
length: label.length,
|
||||
limit: MAX_LABEL_LENGTH,
|
||||
labels
|
||||
});
|
||||
break; // Only report once per name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return violations;
|
||||
}
|
||||
|
||||
export function formatZoneFile(zone: ParsedZone): string {
|
||||
const lines: string[] = [];
|
||||
|
||||
// Add directives
|
||||
if (zone.origin) {
|
||||
lines.push(`$ORIGIN ${zone.origin}`);
|
||||
}
|
||||
|
||||
if (zone.defaultTTL) {
|
||||
lines.push(`$TTL ${zone.defaultTTL}`);
|
||||
}
|
||||
|
||||
if (lines.length > 0) {
|
||||
lines.push(''); // Empty line after directives
|
||||
}
|
||||
|
||||
// Add records
|
||||
let lastOwner = '';
|
||||
for (const record of zone.records) {
|
||||
const owner = record.owner === lastOwner ? '' : record.owner;
|
||||
const ttl = record.ttl === zone.defaultTTL ? '' : record.ttl?.toString() || '';
|
||||
const parts = [owner, ttl, record.class, record.type, record.rdata].filter(Boolean);
|
||||
lines.push(parts.join('\t'));
|
||||
lastOwner = record.owner;
|
||||
}
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
<script>
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { SUB_NAV } from '$lib/constants/nav.js';
|
||||
|
||||
const zoneTools = SUB_NAV['/dns']?.find(group =>
|
||||
typeof group === 'object' && 'title' in group && group.title === 'Zone File Tools'
|
||||
)?.items || [];
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>DNS Zone File Tools - IP Calculator</title>
|
||||
<meta name="description" content="Comprehensive DNS zone file analysis and management tools. Lint, compare, analyze, and validate BIND zone files." />
|
||||
</svelte:head>
|
||||
|
||||
<div class="zone-tools-page">
|
||||
<div class="hero-section">
|
||||
<div class="hero-content">
|
||||
<h1>DNS Zone File Tools</h1>
|
||||
<p>Professional tools for DNS zone file analysis, validation, and management. Built for network administrators, DNS engineers, and automation workflows.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tools-grid">
|
||||
{#each zoneTools as tool}
|
||||
<a href={tool.href} class="tool-card">
|
||||
<div class="tool-icon">
|
||||
<Icon name="file-text" size="xl" />
|
||||
</div>
|
||||
<div class="tool-info">
|
||||
<h3>{tool.label}</h3>
|
||||
<p>{tool.description}</p>
|
||||
</div>
|
||||
<div class="tool-arrow">
|
||||
<Icon name="chevron-right" size="sm" />
|
||||
</div>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="features-section">
|
||||
<div class="features-grid">
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<Icon name="check-circle" size="lg" />
|
||||
</div>
|
||||
<div class="feature-content">
|
||||
<h4>Zone Validation</h4>
|
||||
<p>Comprehensive RFC compliance checking with detailed error reporting and recommendations for fixing common issues.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<Icon name="git-compare" size="lg" />
|
||||
</div>
|
||||
<div class="feature-content">
|
||||
<h4>Change Tracking</h4>
|
||||
<p>Compare zone file versions to track DNS changes, plan migrations, and audit modifications with unified diff support.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<Icon name="bar-chart" size="lg" />
|
||||
</div>
|
||||
<div class="feature-content">
|
||||
<h4>Analytics & Insights</h4>
|
||||
<p>Deep analysis of record distribution, TTL patterns, name lengths, and zone health metrics for optimization.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<Icon name="shield" size="lg" />
|
||||
</div>
|
||||
<div class="feature-content">
|
||||
<h4>Standards Compliance</h4>
|
||||
<p>Ensure DNS names meet RFC length limits and zone files follow best practices for reliable DNS operation.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="use-cases-section">
|
||||
<h2>Common Use Cases</h2>
|
||||
<div class="use-cases-grid">
|
||||
<div class="use-case">
|
||||
<h4>DNS Migration Planning</h4>
|
||||
<p>Compare existing and target zones to understand exactly what changes during migrations and ensure nothing is missed.</p>
|
||||
</div>
|
||||
|
||||
<div class="use-case">
|
||||
<h4>Zone File Cleanup</h4>
|
||||
<p>Normalize messy zone files with consistent formatting, proper ordering, duplicate removal, and error correction.</p>
|
||||
</div>
|
||||
|
||||
<div class="use-case">
|
||||
<h4>Compliance Auditing</h4>
|
||||
<p>Validate zone files against DNS standards to identify potential issues before they cause resolution failures.</p>
|
||||
</div>
|
||||
|
||||
<div class="use-case">
|
||||
<h4>Configuration Analysis</h4>
|
||||
<p>Understand zone structure, identify optimization opportunities, and track DNS infrastructure growth over time.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="best-practices-section">
|
||||
<h2>Zone File Best Practices</h2>
|
||||
<div class="practices-grid">
|
||||
<div class="practice">
|
||||
<Icon name="check" size="sm" />
|
||||
<span>Always include SOA and NS records for proper delegation</span>
|
||||
</div>
|
||||
|
||||
<div class="practice">
|
||||
<Icon name="check" size="sm" />
|
||||
<span>Use fully qualified domain names ending with dots</span>
|
||||
</div>
|
||||
|
||||
<div class="practice">
|
||||
<Icon name="check" size="sm" />
|
||||
<span>Maintain consistent TTL values based on change frequency</span>
|
||||
</div>
|
||||
|
||||
<div class="practice">
|
||||
<Icon name="check" size="sm" />
|
||||
<span>Keep domain names under 63 characters per label</span>
|
||||
</div>
|
||||
|
||||
<div class="practice">
|
||||
<Icon name="check" size="sm" />
|
||||
<span>Remove duplicate records to avoid confusion</span>
|
||||
</div>
|
||||
|
||||
<div class="practice">
|
||||
<Icon name="check" size="sm" />
|
||||
<span>Validate zones after changes before deployment</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.zone-tools-page {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: var(--spacing-xl) var(--spacing-lg);
|
||||
}
|
||||
|
||||
.hero-section {
|
||||
text-align: center;
|
||||
margin-bottom: var(--spacing-2xl);
|
||||
padding: var(--spacing-2xl) 0;
|
||||
background: linear-gradient(135deg,
|
||||
color-mix(in srgb, var(--color-primary), transparent 95%),
|
||||
color-mix(in srgb, var(--color-secondary), transparent 95%)
|
||||
);
|
||||
border-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
h1 {
|
||||
font-size: var(--font-size-3xl);
|
||||
font-weight: 700;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: var(--font-size-lg);
|
||||
color: var(--text-secondary);
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
|
||||
.tools-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
margin-bottom: var(--spacing-2xl);
|
||||
}
|
||||
|
||||
.tool-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-lg);
|
||||
padding: var(--spacing-xl);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
text-decoration: none;
|
||||
transition: all var(--transition-fast);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--surface-hover);
|
||||
border-color: var(--color-primary);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.tool-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background-color: color-mix(in srgb, var(--color-primary), transparent 90%);
|
||||
color: var(--color-primary);
|
||||
border-radius: var(--radius-md);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tool-info {
|
||||
flex: 1;
|
||||
|
||||
h3 {
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tool-arrow {
|
||||
color: var(--text-secondary);
|
||||
transition: transform var(--transition-fast);
|
||||
}
|
||||
|
||||
&:hover .tool-arrow {
|
||||
transform: translateX(4px);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.features-section {
|
||||
margin-bottom: var(--spacing-2xl);
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
padding: var(--spacing-xl);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-lg);
|
||||
text-align: center;
|
||||
|
||||
.feature-icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: var(--spacing-md);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.feature-content {
|
||||
h4 {
|
||||
font-size: var(--font-size-md);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.use-cases-section {
|
||||
margin-bottom: var(--spacing-2xl);
|
||||
|
||||
h2 {
|
||||
text-align: center;
|
||||
font-size: var(--font-size-2xl);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
}
|
||||
|
||||
.use-cases-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: var(--spacing-lg);
|
||||
}
|
||||
|
||||
.use-case {
|
||||
padding: var(--spacing-lg);
|
||||
background-color: var(--bg-secondary);
|
||||
border: 1px solid var(--border-primary);
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
h4 {
|
||||
font-size: var(--font-size-md);
|
||||
font-weight: 600;
|
||||
color: var(--color-primary);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
p {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.best-practices-section {
|
||||
h2 {
|
||||
text-align: center;
|
||||
font-size: var(--font-size-2xl);
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
margin-bottom: var(--spacing-xl);
|
||||
}
|
||||
}
|
||||
|
||||
.practices-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: var(--spacing-md);
|
||||
}
|
||||
|
||||
.practice {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
padding: var(--spacing-md);
|
||||
background-color: color-mix(in srgb, var(--color-success), transparent 95%);
|
||||
border: 1px solid color-mix(in srgb, var(--color-success), transparent 80%);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--color-success);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.zone-tools-page {
|
||||
padding: var(--spacing-lg) var(--spacing-md);
|
||||
}
|
||||
|
||||
.hero-content h1 {
|
||||
font-size: var(--font-size-2xl);
|
||||
}
|
||||
|
||||
.hero-content p {
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
|
||||
.tools-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.tool-card {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.use-cases-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.practices-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import ZoneDiff from '$lib/components/tools/ZoneDiff.svelte';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>DNS Zone Diff - IP Calculator</title>
|
||||
<meta name="description" content="Compare two DNS zone files and identify added, removed, and changed records. Perfect for migration planning and change auditing." />
|
||||
</svelte:head>
|
||||
|
||||
<ZoneDiff />
|
||||
@@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import ZoneLinter from '$lib/components/tools/ZoneLinter.svelte';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>DNS Zone Linter - IP Calculator</title>
|
||||
<meta name="description" content="Normalize and canonicalize BIND zone files with error checking and formatting. Clean up messy DNS zone configurations." />
|
||||
</svelte:head>
|
||||
|
||||
<ZoneLinter />
|
||||
@@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import NameLengthChecker from '$lib/components/tools/NameLengthChecker.svelte';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>DNS Name Length Checker - IP Calculator</title>
|
||||
<meta name="description" content="Validate DNS names against RFC length limits. Check for labels exceeding 63 characters and FQDNs exceeding 255 characters." />
|
||||
</svelte:head>
|
||||
|
||||
<NameLengthChecker />
|
||||
@@ -0,0 +1,10 @@
|
||||
<script>
|
||||
import ZoneStats from '$lib/components/tools/ZoneStats.svelte';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>DNS Zone Statistics - IP Calculator</title>
|
||||
<meta name="description" content="Analyze DNS zone file statistics including record distribution, TTL patterns, and zone health checks." />
|
||||
</svelte:head>
|
||||
|
||||
<ZoneStats />
|
||||
Reference in new issue
Block a user