network and tls diagnostic tools

This commit is contained in:
Alicia Sykes committed 2025-09-11 00:50:42 +01:00
1 parent 41ca0cfa0a
commit eded59d6e3
16 files changed
+3740 -38

No files matched your search

+121 -3
View File
@@ -6,9 +6,10 @@
interface Props {
name: string;
size?: 'xs' | 'sm' | 'md' | 'lg';
animate?: 'spin' | 'pulse' | 'pulse-once' | 'bounce' | 'fade' | null;
}
let { name, size = 'md' }: Props = $props();
let { name, size = 'md', animate = null }: Props = $props();
const sizeClasses = {
xs: 'w-2 h-2',
@@ -28,7 +29,7 @@
*/
</script>
<div class="icon {sizeClasses[size]}">
<div class="icon {sizeClasses[size]} {animate ? `animate-${animate}` : ''}">
{#if name === 'calculator'}
<svg fill="currentColor" viewBox="0 0 24 24">
<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8-4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8-4H7V7h2v2zm4 0h-2V7h2v2zm4 0h-2V7h2v2z"/>
@@ -225,6 +226,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="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 === 'activity'}
<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="M319.4 64C330.5 63.7 340.4 71.1 343.2 81.9L421.9 383.6L458.1 302.3C462 293.6 470.5 288 480 288L584 288C597.3 288 608 298.7 608 312C608 325.3 597.3 336 584 336L495.6 336L437.9 465.7C433.8 475 424.2 480.7 414 479.9C403.8 479.1 395.3 471.9 392.7 462L322.6 193.4L247.4 556.8C245.1 567.7 235.7 575.6 224.6 575.9C213.5 576.2 203.6 568.8 200.7 558.1L141.6 336L56 336C42.7 336 32 325.3 32 312C32 298.7 42.7 288 56 288L160 288C170.9 288 180.4 295.3 183.2 305.8L221.1 447.8L296.5 83.1C298.8 72.2 308.2 64.3 319.4 64z"/></svg>
{:else if name === 'arrow-up-down'}
<svg fill="currentColor" viewBox="0 0 24 24">
<path d="M7 14l5-5 5 5z"/>
@@ -273,7 +276,43 @@
{:else if name === 'ref-mtu-mss'}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path opacity=".4" d="M80 184C160 229.3 240 274.7 320 320C349.3 303.4 381.6 285.1 416.9 265.1L196.2 140.9L176.1 129.6L80 184zM224.8 101.9L451.7 229.6L465.7 237.4L560 184L351.5 65.9C332 54.8 308 54.8 288.4 65.9L224.8 101.9z"/><path d="M351.5 574.1L527.5 474.4C547.6 463 560 441.8 560 418.7L560 184L320 320L80 184L80 418.7C80 441.7 92.4 463 112.4 474.4L288.4 574.1C308 585.2 331.9 585.2 351.5 574.1z"/></svg>
<!-- Diagnostic Page Icons-->
{:else if name === 'dns-lookup'}
<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 421.2L112 488C112 492.4 115.6 496 120 496L232 496C236.4 496 240 492.4 240 488L240 224L178.7 224C174.8 224 171.5 226.8 170.8 230.6L165.8 257.9C161.2 283.5 152 308 138.6 330.4L136 334.8C120.3 360.9 112 390.7 112 421.2zM400 224L400 488C400 492.4 403.6 496 408 496L520 496C524.4 496 528 492.4 528 488L528 421.2C528 390.8 519.7 360.9 504.1 334.8L501.5 330.4C488.1 308.1 478.9 283.5 474.2 257.9L469.2 230.6C468.5 226.8 465.2 224 461.3 224L400 224z"/><path d="M160 128C160 110.3 174.3 96 192 96L224 96C241.7 96 256 110.3 256 128L256 144L160 144L160 128zM123.6 222C128.4 195.4 151.6 176 178.7 176L264 176C277.3 176 288 186.7 288 200L288 224L352 224L352 200C352 186.7 362.7 176 376 176L461.3 176C488.4 176 511.6 195.4 516.4 222L521.4 249.3C525 269.2 532.2 288.3 542.6 305.7L545.2 310.1C565.3 343.7 576 382.1 576 421.2L576 488C576 518.9 550.9 544 520 544L408 544C377.1 544 352 518.9 352 488L352 352L288 352L288 488C288 518.9 262.9 544 232 544L120 544C89.1 544 64 518.9 64 488L64 421.2C64 382 74.6 343.6 94.8 310L97.4 305.6C107.8 288.2 115 269.1 118.6 249.2L123.6 221.9zM178.7 224C174.8 224 171.5 226.8 170.8 230.6L165.8 257.9C161.2 283.5 152 308 138.6 330.4L136 334.8C120.3 360.9 112 390.7 112 421.2L112 488C112 492.4 115.6 496 120 496L232 496C236.4 496 240 492.4 240 488L240 224L178.7 224zM461.3 224L400 224L400 488C400 492.4 403.6 496 408 496L520 496C524.4 496 528 492.4 528 488L528 421.2C528 390.8 519.7 360.9 504.1 334.8L501.5 330.4C488.1 308.1 478.9 283.5 474.2 257.9L469.2 230.6C468.5 226.8 465.2 224 461.3 224zM416 96L448 96C465.7 96 480 110.3 480 128L480 144L384 144L384 128C384 110.3 398.3 96 416 96z"/></svg>
{:else if name === 'dns-reverse'}
<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="M133.5 364.7L172.6 432.4L258.3 386.1C257 380.3 256.3 374.2 256.3 368C256.3 323.8 292.1 288 336.3 288C359 288 379.5 297.5 394.1 312.7L434 291.1L384.5 205.4L133.6 364.7zM411.9 157.1L491.9 295.7L553.4 260.2L473.4 121.6L411.9 157.1z"/><path d="M491.9 295.7L553.4 260.2L473.4 121.6L411.9 157.1L491.9 295.7zM360.5 163.6C354.3 149 359.9 131.7 374 123.5L463.3 72C478.6 63.2 498.2 68.4 507 83.7L603 250C611.8 265.3 606.6 284.9 591.3 293.7L502.1 345.2C486.8 354 467.2 348.8 458.4 333.5L457.9 332.7L415.3 355.8C415.9 359.8 416.2 363.9 416.2 368.1C416.2 388.2 408.8 406.6 396.5 420.6L446.4 543C451.4 555.3 445.5 569.3 433.2 574.3C420.9 579.3 406.9 573.4 401.9 561.1L355 445.8C349 447.3 342.7 448 336.2 448C329.7 448 323.4 447.2 317.4 445.8L270.4 561.1C265.4 573.4 251.4 579.3 239.1 574.3C226.8 569.3 220.9 555.3 225.9 543L270.2 434.2L181.6 482.1C166.4 490.3 147.3 485 138.7 470L138 468.7L93.9 494.2C82.4 500.8 67.7 496.9 61.1 485.4L35.2 440.4C28.6 428.9 32.5 414.2 44 407.6L88.1 382.1L84.2 375.3C75.6 360.5 80.3 341.5 94.8 332.3L360.5 163.6zM433.8 291.1L384.3 205.4L133.4 364.7L172.5 432.4L258.2 386.1C256.9 380.3 256.2 374.2 256.2 368C256.2 323.8 292 288 336.2 288C358.9 288 379.4 297.5 394 312.7L433.9 291.1zM336.2 400C353.9 400 368.2 385.7 368.2 368C368.2 350.3 353.9 336 336.2 336C318.5 336 304.2 350.3 304.2 368C304.2 385.7 318.5 400 336.2 400z"/></svg>
{:else if name === 'dns-propagation'}
<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 192C144 218.5 165.5 240 192 240C218.5 240 240 218.5 240 192C240 165.5 218.5 144 192 144C165.5 144 144 165.5 144 192zM400 448C400 474.5 421.5 496 448 496C474.5 496 496 474.5 496 448C496 421.5 474.5 400 448 400C421.5 400 400 421.5 400 448z"/><path d="M192 144C218.5 144 240 165.5 240 192C240 218.5 218.5 240 192 240C165.5 240 144 218.5 144 192C144 165.5 165.5 144 192 144zM192 288C245 288 288 245 288 192C288 139 245 96 192 96C139 96 96 139 96 192C96 245 139 288 192 288zM448 400C474.5 400 496 421.5 496 448C496 474.5 474.5 496 448 496C421.5 496 400 474.5 400 448C400 421.5 421.5 400 448 400zM448 544C501 544 544 501 544 448C544 395 501 352 448 352C395 352 352 395 352 448C352 501 395 544 448 544zM537 137C546.4 127.6 546.4 112.4 537 103.1C527.6 93.8 512.4 93.7 503.1 103.1L103 503C93.6 512.4 93.6 527.6 103 536.9C112.4 546.2 127.6 546.3 136.9 536.9L537 137z"/></svg>
{:else if name === 'dns-spf-eval'}
<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="M48 336L288 336L288 356.8L179.4 416.6C178.3 417.2 177.2 417.5 176 417.5C175.4 417.5 174.8 417.4 174.2 417.3L172.5 416.6L47.9 348L47.9 336zM48 402.8L149.4 458.6L155.7 461.6C162.1 464.2 169 465.5 176 465.5C185.3 465.5 194.5 463.1 202.6 458.7L288 411.7L288 496.1L48 496.1L48 402.9zM347.3 176L384 176L384 152L384.4 144.6C385 138.9 386.3 133.5 388.1 128.3L452.4 128.3C441.7 130 433.3 138.7 432.2 149.5L432.1 152L432.1 296C432.1 309.3 442.8 320 456.1 320C469.4 320 480.1 309.3 480.1 296L480.1 224L520.1 224C533.4 224 544.1 213.3 544.1 200L544.1 152C544.1 147.8 543 143.8 541.1 140.3C560.3 148.2 577.6 159.7 592.1 173.8L592 480C592 488.8 584.8 496 576 496L384 496L384 272C384 235.1 370.1 201.5 347.3 176z"/><path d="M288 336L48 336L48 348L172.6 416.6L174.3 417.3C174.9 417.4 175.5 417.5 176.1 417.5C177.3 417.5 178.5 417.2 179.5 416.6L288.1 356.8L288.1 411.6L202.7 458.6C194.6 463.1 185.4 465.4 176.1 465.4C169.1 465.4 162.2 464.1 155.8 461.5L149.5 458.5L48.1 402.7L48.1 495.9L288.1 495.9L288.1 543.9L48.1 543.9C21.6 543.9 .1 522.4 .1 495.9L0 336C0 309.5 21.5 288 48 288L288 288L288 336zM388.2 128C386.3 133.3 385 138.8 384.4 144.6L384 152L384 176L347.3 176C370.1 201.5 384 235.1 384 272L384 496L576 496C584.8 496 592 488.8 592 480L592 173.8C621.6 202.8 640 243.3 640 288L640 480L639.7 486.5C636.6 516.6 612.7 540.6 582.6 543.6L576.1 543.9L336.1 543.9L336.1 271.9C336.1 218.9 293.1 175.9 240.1 175.9C198.3 175.9 162.9 202.6 149.7 239.9L99.8 239.9C100.1 238.7 100.3 237.5 100.6 236.3C100.9 235.2 101.2 234 101.5 232.9C101.8 231.9 102.1 230.8 102.4 229.8C102.8 228.6 103.2 227.3 103.6 226.1C104 225 104.3 223.9 104.7 222.8C105.3 221.2 105.9 219.7 106.5 218.2C106.7 217.7 106.9 217.2 107.1 216.6C107.6 215.5 108 214.4 108.5 213.3C109 212.3 109.4 211.2 109.9 210.2C110.4 209.2 110.9 208.1 111.5 207.1C112 206 112.6 204.9 113.2 203.8C113.7 203 114.1 202.1 114.6 201.3C115.3 200.1 116 198.9 116.7 197.6C117.1 196.9 117.5 196.2 117.9 195.6C118.7 194.4 119.4 193.1 120.2 191.9C120.7 191.1 121.2 190.4 121.8 189.6C122.5 188.6 123.2 187.7 123.9 186.7C124.6 185.8 125.2 184.9 125.9 184C126.7 183 127.5 181.9 128.3 180.9C128.8 180.2 129.4 179.6 130 178.9C131 177.8 131.9 176.7 132.9 175.6C133.1 175.3 133.4 175.1 133.6 174.8L135.9 172.3C137.9 170.2 140 168.1 142.2 166.1C143 165.4 143.7 164.7 144.5 164C145.3 163.3 146 162.7 146.8 162C147.9 161.1 149 160.2 150.1 159.3C150.8 158.8 151.4 158.3 152.1 157.7C153.1 156.9 154.1 156.1 155.1 155.4C156.1 154.7 157.2 153.9 158.2 153.2C158.9 152.7 159.7 152.2 160.4 151.7C161.6 150.9 162.9 150.1 164.2 149.3C164.8 148.9 165.4 148.6 166 148.2C167.3 147.4 168.6 146.7 170 146C170.9 145.5 171.8 145 172.7 144.5C173.3 144.2 174 143.8 174.7 143.5C176 142.8 177.4 142.1 178.7 141.5C178.9 141.4 179.1 141.3 179.4 141.2L184.2 139.1C184.4 139 184.7 138.9 184.9 138.8C188.3 137.4 191.8 136.1 195.3 135C196.3 134.7 197.2 134.4 198.2 134.1C198.9 133.9 199.5 133.7 200.2 133.5C201.7 133.1 203.2 132.6 204.7 132.3C208.4 131.4 212.1 130.6 215.9 130C216.8 129.8 217.7 129.7 218.6 129.5C223.2 128.8 228 128.3 232.8 128.1L240.2 127.9L388.4 127.9zM522.5 128.1C534.6 129.4 544 139.6 544 152L544 200C544 213.3 533.3 224 520 224L480 224L480 296C480 309.3 469.3 320 456 320C442.7 320 432 309.3 432 296L432 152L432.1 149.5C433.4 137.4 443.6 128 456 128L520 128L522.5 128.1z"/></svg>
{:else if name === 'dns-dmarc-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="M112 189.4C112 182 118 176 125.4 176L509.9 176C417.6 177.1 342.4 249.1 336.4 340.1C323.3 346 307.7 344.5 295.8 335.5L117.3 200.1C114 197.6 112 193.6 112 189.4zM112 256.3L266.8 373.8C288.2 390 315 395.1 340 389.3C346 417.2 358.7 442.7 376.4 464L128 464C119.2 464 112 456.8 112 448L112 256.3z"/><path d="M512 224C582.7 224 640 281.3 640 352C640 392.4 621.2 428.4 592 451.9L592 557C592 567.5 583.5 576 573 576C569.7 576 566.5 575.1 563.6 573.5L512 544L460.4 573.5C457.5 575.1 454.3 576 451 576C440.5 576 432 567.5 432 557L432 451.8C402.8 428.3 384 392.3 384 351.9C384 281.2 441.3 223.9 512 223.9zM512 128C546 128 573.7 154.5 575.8 188C556 180.3 534.5 176 512 176L125.4 176C118 176 112 182 112 189.4C112 193.6 114 197.6 117.3 200.1L295.8 335.5C307.6 344.5 323.3 346 336.4 340.1C336.1 344 336 348 336 352C336 364.8 337.4 377.3 340 389.3C315.1 395.1 288.2 390 266.8 373.8L112 256.3L112 448C112 456.8 119.2 464 128 464L376.3 464C378.8 467 381.3 469.9 384 472.7L384 512L128 512C92.7 512 64 483.3 64 448L64 192L64.2 192C64.2 191.1 64 190.3 64 189.4C64 155.5 91.5 128 125.4 128L512 128zM512 304C485.5 304 464 325.5 464 352C464 378.5 485.5 400 512 400C538.5 400 560 378.5 560 352C560 325.5 538.5 304 512 304z"/></svg>
{:else if name === 'dns-caa-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="M116.5 319.5L162.1 365.1C171.1 374.1 176.2 386.3 176.2 399L176.2 463.9L241.1 463.9L245.8 464.1C256.8 465.2 267.1 470.1 275 477.9L320.1 523L365.2 477.9C374.2 468.9 386.4 463.8 399.2 463.8L464.1 463.8L464.1 398.9C464.1 386.2 469.2 373.9 478.2 364.9L523.8 319.3L478.2 273.7C469.2 264.7 464.1 252.5 464.1 239.8L464.1 175.8L400.1 175.8C387.4 175.8 375.2 170.7 366.2 161.7L320.1 115.6L274 161.7C265 170.7 252.8 175.8 240.1 175.8L176.1 175.8L176.1 239.8C176.1 252.5 171 264.7 162 273.7L116.5 319.5zM352.2 408C352.2 425.7 337.9 440 320.2 440C302.5 440 288.2 425.7 288.2 408C288.2 390.3 302.5 376 320.2 376C337.9 376 352.2 390.3 352.2 408zM288.9 234C287.4 215.7 301.8 200 320.1 200C338.4 200 352.9 215.7 351.4 234L344.1 322C343.1 334.4 332.7 344 320.2 344C307.7 344 297.3 334.4 296.3 322L289 234z"/><path d="M286.2 81.9C305 63.2 335.3 63.2 354.1 81.9L400.2 128L464.2 128C490.7 128 512.2 149.5 512.2 176L512.2 240L557.8 285.6C576.5 304.3 576.5 334.7 557.8 353.5L512.2 399.1L512.2 464C512.2 490.5 490.7 512 464.2 512L399.3 512L354.2 557.1C335.5 575.8 305.1 575.8 286.3 557.1L241.2 512L176.3 512C149.8 512 128.3 490.5 128.3 464L128.3 399.1L82.7 353.5C64 334.8 64 304.4 82.7 285.6L128.3 240L128.3 176C128.3 149.5 149.8 128 176.3 128L240.3 128L286.4 81.9zM274.1 161.9C265.1 170.9 252.9 176 240.2 176L176.2 176L176.2 240C176.2 252.7 171.1 264.9 162.1 273.9L116.5 319.5L162.1 365.1C171.1 374.1 176.2 386.3 176.2 399L176.2 463.9L241.1 463.9L245.8 464.1C256.8 465.2 267.1 470.1 275 477.9L320.1 523L365.2 477.9C374.2 468.9 386.4 463.8 399.2 463.8L464.1 463.8L464.1 398.9C464.1 386.2 469.2 373.9 478.2 364.9L523.8 319.3L478.2 273.7C469.2 264.7 464.1 252.5 464.1 239.8L464.1 175.8L400.1 175.8C387.4 175.8 375.2 170.7 366.2 161.7L320.1 115.6L274 161.7zM320.2 440C302.5 440 288.2 425.7 288.2 408C288.2 390.3 302.5 376 320.2 376C337.9 376 352.2 390.3 352.2 408C352.2 425.7 337.9 440 320.2 440zM320.2 200C338.5 200 353 215.7 351.5 234L344.2 322C343.2 334.4 332.8 344 320.3 344C307.8 344 297.4 334.4 296.4 322L289.1 234C287.6 215.7 302 200 320.3 200z"/></svg>
{:else if name === 'dns-ns-soa'}
<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="M120 576L288 576C279.2 576 271.2 571.2 267 563.5L198.7 439C165.6 462.2 144 500.6 144 544L144 552C144 565.3 133.3 576 120 576zM240 192C240 236.2 275.8 272 320 272C364.2 272 400 236.2 400 192C400 147.8 364.2 112 320 112C275.8 112 240 147.8 240 192zM352 576L520 576C506.7 576 496 565.3 496 552L496 544C496 500.6 474.4 462.2 441.3 439L373 563.5C368.8 571.2 360.7 576 352 576z"/><path d="M320 272C364.2 272 400 236.2 400 192C400 147.8 364.2 112 320 112C275.8 112 240 147.8 240 192C240 236.2 275.8 272 320 272zM448 192C448 262.7 390.7 320 320 320C249.3 320 192 262.7 192 192C192 121.3 249.3 64 320 64C390.7 64 448 121.3 448 192zM289.5 368L350.5 368C360.2 368 368 375.8 368 385.5C368 389.7 366.5 393.7 363.8 396.9L336.4 428.9L354.8 497.1L411 394.6C417 383.5 430.7 379 442.1 384.3C502.2 412.3 544 473.2 544 544L544 552C544 565.3 533.3 576 520 576C506.7 576 496 565.3 496 552L496 544C496 500.6 474.4 462.2 441.3 439L373 563.5C368.8 571.2 360.7 576 352 576L288 576C279.2 576 271.2 571.2 267 563.5L198.7 439C165.6 462.2 144 500.6 144 544L144 552C144 565.3 133.3 576 120 576C106.7 576 96 565.3 96 552L96 544C96 473.2 137.8 412.3 197.9 384.3C209.4 379 223 383.4 229.1 394.5L285 496.5L303.5 428.7L276.3 396.9C273.6 393.7 272.1 389.7 272.1 385.5C272.1 375.8 279.9 368 289.6 368z"/></svg>
{:else if name === 'http-headers'}
<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 288C112 190.8 190.8 112 288 112C374.6 112 446.7 174.6 461.3 257.1C462.2 261.9 464.5 266.4 468 269.9L520.2 322.1C525.2 327.1 528.1 334 528.1 341.1C528.1 356 516.1 368 501.2 368L488 368C474.7 368 464 378.7 464 392L464 440C464 462.1 446.1 480 424 480L376 480C362.7 480 352 490.7 352 504L352 552C352 565.3 362.7 576 376 576C188.1 576 113.5 576 152 576C165.3 576 176 565.3 176 552L176 452.1C176 434 168.2 417.9 157.5 406.1C129.2 374.9 112 333.5 112 288zM168.5 242C165.9 248.8 169 256.3 175.3 260L178.2 261.7C187.4 267 191.9 277.5 191.9 288.1C191.9 298.7 187.4 309.2 178.2 314.5L175.2 316.2C168.9 319.8 165.7 327.3 168.4 334.1C170.5 339.6 173 344.8 175.8 349.9L178.2 354C181.3 359.1 184.6 363.9 188.3 368.5C192.9 374.2 201 375.2 207.3 371.5L210.2 369.8C219.4 364.5 230.6 365.8 239.8 371.1C249 376.4 256 385.6 256 396.2L256 399.6C256 406.9 260.9 413.4 268.1 414.5C274.6 415.5 281.2 416 288 416C294.8 416 301.4 415.5 307.9 414.5C315.1 413.4 320 406.9 320 399.6L320 396.2C320 385.6 326.9 376.4 336.1 371.1C345.3 365.8 356.5 364.5 365.7 369.8L368.6 371.5C374.9 375.1 383 374.1 387.6 368.5C391.3 363.9 394.7 359.1 397.7 354L400.1 349.8C402.9 344.7 405.4 339.5 407.5 334C410.1 327.2 407 319.7 400.7 316.1L397.7 314.4C388.5 309.1 384 298.6 384 288C384 277.4 388.5 266.9 397.7 261.6L400.7 259.9C407 256.3 410.2 248.8 407.5 241.9C405.4 236.4 402.9 231.1 400.1 226L397.8 222C394.7 216.9 391.3 212.1 387.6 207.5C383 201.8 374.9 200.8 368.6 204.5L365.7 206.2C356.5 211.5 345.3 210.2 336.1 204.9C326.9 199.6 320 190.4 320 179.8L320 176.4C320 169.1 315.1 162.6 307.9 161.5C301.4 160.5 294.8 160 288 160C281.2 160 274.6 160.5 268.1 161.5C260.9 162.6 256 169.1 256 176.4L256 179.8C256 190.4 249.1 199.6 239.9 204.9C230.7 210.2 219.5 211.5 210.3 206.2L207.4 204.5C201.1 200.9 193 201.9 188.4 207.5C184.7 212.1 181.3 217 178.2 222.1L175.9 226C173.1 231.1 170.6 236.4 168.5 241.9zM328 288C328 310.1 310.1 328 288 328C265.9 328 248 310.1 248 288C248 265.9 265.9 248 288 248C310.1 248 328 265.9 328 288z"/><path d="M288 64C164.3 64 64 164.3 64 288C64 345.8 86 398.6 122 438.3C126.2 443 128 448 128 452.1L128 552C128 565.3 138.7 576 152 576C165.3 576 176 565.3 176 552L176 452.1C176 434 168.2 417.9 157.5 406.1C129.2 374.9 112 333.5 112 288C112 190.8 190.8 112 288 112C374.6 112 446.7 174.6 461.3 257.1C462.2 261.9 464.5 266.4 468 269.9L520.2 322.1C525.2 327.1 528.1 334 528.1 341.1C528.1 356 516.1 368 501.2 368L488 368C474.7 368 464 378.7 464 392L464 440C464 462.1 446.1 480 424 480L376 480C362.7 480 352 490.7 352 504L352 552C352 565.3 362.7 576 376 576C389.3 576 400 565.3 400 552L400 528L424 528C472.6 528 512 488.6 512 440L512 415.2C548.2 409.9 576 378.7 576 341.1C576 321.2 568.1 302.2 554.1 288.1L507.1 241.1C485.5 139.9 395.7 64 288 64zM400.6 259.9C406.9 256.3 410.1 248.8 407.4 241.9C405.3 236.4 402.8 231.1 400 226L397.7 222C394.6 216.9 391.2 212.1 387.5 207.5C382.9 201.8 374.8 200.8 368.5 204.5L365.6 206.2C356.4 211.5 345.2 210.2 336 204.9C326.8 199.6 320 190.4 320 179.8L320 176.4C320 169.1 315.1 162.6 307.9 161.5C301.4 160.5 294.8 160 288 160C281.2 160 274.6 160.5 268.1 161.5C260.9 162.6 256 169.1 256 176.4L256 179.8C256 190.4 249.1 199.6 239.9 204.9C230.7 210.2 219.5 211.5 210.3 206.2L207.4 204.5C201.1 200.9 193 201.9 188.4 207.5C184.7 212.1 181.3 217 178.2 222.1L175.9 226C173.1 231.1 170.6 236.4 168.5 241.9C165.9 248.7 169 256.2 175.3 259.9L178.2 261.6C187.4 266.9 191.9 277.4 191.9 288C191.9 298.6 187.4 309.1 178.2 314.4L175.2 316.1C168.9 319.7 165.7 327.2 168.4 334C170.5 339.5 173 344.7 175.8 349.8L178.2 353.9C181.3 359 184.6 363.8 188.3 368.4C192.9 374.1 201 375.1 207.3 371.4L210.2 369.7C219.4 364.4 230.6 365.7 239.8 371C249 376.3 256 385.6 256 396.2L256 399.6C256 406.9 260.9 413.4 268.1 414.5C274.6 415.5 281.2 416 288 416C294.8 416 301.4 415.5 307.9 414.5C315.1 413.4 320 406.9 320 399.6L320 396.2C320 385.6 326.9 376.4 336.1 371.1C345.3 365.8 356.5 364.5 365.7 369.8L368.6 371.5C374.9 375.1 383 374.1 387.6 368.5C391.3 363.9 394.7 359.1 397.7 354L400.1 349.8C402.9 344.7 405.4 339.5 407.5 334C410.1 327.2 407 319.7 400.7 316.1L397.7 314.4C388.5 309.1 384 298.6 384 288C384 277.4 388.5 266.9 397.7 261.6L400.7 259.9zM248 288C248 265.9 265.9 248 288 248C310.1 248 328 265.9 328 288C328 310.1 310.1 328 288 328C265.9 328 248 310.1 248 288z"/></svg>
{:else if name === 'redirect-trace'}
<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 320C112 322.6 113 325.2 114.9 327L313 525.1C314.9 527 317.4 528 320 528C322.6 528 325.2 527 327 525.1L525.1 327C527 325.1 528 322.6 528 320C528 317.4 527 314.8 525.1 313L327 114.9C325.1 113 322.6 112 320 112C317.4 112 314.8 113 313 114.9L114.9 313C113 314.9 112 317.4 112 320zM224 352C224 312.2 256.2 280 296 280L350.1 280L327.1 257C317.7 247.6 317.7 232.4 327.1 223.1C336.5 213.8 351.7 213.7 361 223.1L425 287.1C434.4 296.5 434.4 311.7 425 321L361 385C351.6 394.4 336.4 394.4 327.1 385C317.8 375.6 317.7 360.4 327.1 351.1L350.1 328.1L296 328.1C282.7 328.1 272 338.8 272 352.1L272 376.1C272 389.4 261.3 400.1 248 400.1C234.7 400.1 224 389.4 224 376.1L224 352.1z"/><path d="M114.9 313L313 114.9C314.9 113 317.4 112 320 112C322.6 112 325.2 113 327 114.9L525.1 313C527 314.9 528 317.4 528 320C528 322.6 527 325.2 525.1 327L327 525.1C325.1 527 322.6 528 320 528C317.4 528 314.8 527 313 525.1L114.9 327C113 325.1 112 322.6 112 320C112 317.4 113 314.8 114.9 313zM279 81L81 279C70.1 289.9 64 304.6 64 320C64 335.4 70.1 350.1 81 361L279 559C289.9 569.9 304.6 576 320 576C335.4 576 350.1 569.9 361 559L559 361C569.9 350.1 576 335.4 576 320C576 304.6 569.9 289.9 559 279L361 81C350.1 70.1 335.4 64 320 64C304.6 64 289.9 70.1 279 81zM425 321C434.4 311.6 434.4 296.4 425 287.1L361 223.1C351.6 213.7 336.4 213.7 327.1 223.1C317.8 232.5 317.7 247.7 327.1 257L350.1 280L296 280C256.2 280 224 312.2 224 352L224 376C224 389.3 234.7 400 248 400C261.3 400 272 389.3 272 376L272 352C272 338.7 282.7 328 296 328L350.1 328L327.1 351C317.7 360.4 317.7 375.6 327.1 384.9C336.5 394.2 351.7 394.3 361 384.9L425 320.9z"/></svg>
{:else if name === 'security-headers'}
<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 288C112 240.6 130.7 197.6 161.2 165.9L164.6 171C169.4 178.2 172 186.7 172 195.4L172 221.4C160 228.3 152 241.2 152 256C152 278.1 169.9 296 192 296C214.1 296 232 278.1 232 256C232 241.2 224 228.3 212 221.4L212 195.4C212 178.8 207.1 162.6 197.9 148.8L192.2 140.3C214.5 125.8 240.2 116.2 268 113.1L268 157.3C256 164.2 248 177.1 248 191.9C248 214 265.9 231.9 288 231.9C310.1 231.9 328 214 328 191.9C328 177.1 320 164.2 308 157.3L308 113.1C335.7 116.2 361.5 125.8 383.8 140.3L378.1 148.8C368.9 162.6 364 178.8 364 195.4L364 221.4C352 228.3 344 241.2 344 256C344 278.1 361.9 296 384 296C406.1 296 424 278.1 424 256C424 241.2 416 228.3 404 221.4L404 195.4C404 186.7 406.6 178.2 411.4 171L414.8 165.9C438.5 190.5 455.1 222 461.3 257.1C462.2 261.9 464.5 266.4 468 269.9L520.2 322.1C525.2 327.1 528.1 334 528.1 341.1C528.1 356 516.1 368 501.2 368L488 368C474.7 368 464 378.7 464 392L464 440C464 462.1 446.1 480 424 480L376 480C362.7 480 352 490.7 352 504L352 552C352 565.3 362.7 576 376 576L152 576C165.3 576 176 565.3 176 552L176 452.1C176 434 168.2 417.9 157.5 406.1C129.2 374.9 112 333.5 112 288zM248 320C248 342.1 265.9 360 288 360C310.1 360 328 342.1 328 320C328 297.9 310.1 280 288 280C265.9 280 248 297.9 248 320z"/><path d="M288 64C164.3 64 64 164.3 64 288C64 345.8 86 398.6 122 438.3C126.2 443 128 448 128 452.1L128 552C128 565.3 138.7 576 152 576C165.3 576 176 565.3 176 552L176 452.1C176 434 168.2 417.9 157.5 406.1C129.2 374.9 112 333.5 112 288C112 240.6 130.7 197.6 161.2 165.9L164.6 171C169.4 178.2 172 186.7 172 195.4L172 221.4C160 228.3 152 241.2 152 256C152 278.1 169.9 296 192 296C214.1 296 232 278.1 232 256C232 241.2 224 228.3 212 221.4L212 195.4C212 178.8 207.1 162.6 197.9 148.8L192.2 140.3C214.5 125.8 240.2 116.2 268 113.1L268 157.3C256 164.2 248 177.1 248 191.9C248 214 265.9 231.9 288 231.9C310.1 231.9 328 214 328 191.9C328 177.1 320 164.2 308 157.3L308 113.1C335.7 116.2 361.5 125.8 383.8 140.3L378.1 148.8C368.9 162.6 364 178.8 364 195.4L364 221.4C352 228.3 344 241.2 344 256C344 278.1 361.9 296 384 296C406.1 296 424 278.1 424 256C424 241.2 416 228.3 404 221.4L404 195.4C404 186.7 406.6 178.2 411.4 171L414.8 165.9C438.5 190.5 455.1 222 461.3 257.1C462.2 261.9 464.5 266.4 468 269.9L520.2 322.1C525.2 327.1 528.1 334 528.1 341.1C528.1 356 516.1 368 501.2 368L488 368C474.7 368 464 378.7 464 392L464 440C464 462.1 446.1 480 424 480L376 480C362.7 480 352 490.7 352 504L352 552C352 565.3 362.7 576 376 576C389.3 576 400 565.3 400 552L400 528L424 528C472.6 528 512 488.6 512 440L512 415.2C548.2 409.9 576 378.7 576 341.1C576 321.2 568.1 302.2 554.1 288.1L507.1 241.1C485.5 139.9 395.7 64 288 64zM328 320C328 297.9 310.1 280 288 280C265.9 280 248 297.9 248 320C248 342.1 265.9 360 288 360C310.1 360 328 342.1 328 320z"/></svg>
{:else if name === 'cors-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="M112 320L528 320L528 448C528 456.8 520.8 464 512 464L128 464C119.2 464 112 456.8 112 448L112 320z"/><path d="M112 320L112 448C112 456.8 119.2 464 128 464L512 464C520.8 464 528 456.8 528 448L528 320L112 320zM64 192C64 156.7 92.7 128 128 128L512 128C547.3 128 576 156.7 576 192L576 448C576 483.3 547.3 512 512 512L128 512C92.7 512 64 483.3 64 448L64 192zM192 224C192 206.3 177.7 192 160 192C142.3 192 128 206.3 128 224C128 241.7 142.3 256 160 256C177.7 256 192 241.7 192 224zM248 200C234.7 200 224 210.7 224 224C224 237.3 234.7 248 248 248L488 248C501.3 248 512 237.3 512 224C512 210.7 501.3 200 488 200L248 200z"/></svg>
{:else if name === 'http-perf'}
<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 112L144 160L432 160L432 112L144 112zM144 496L144 544L304 544L304 496L144 496z"/><path d="M432 160L432 112L144 112L144 160L432 160zM432 208L144 208C117.5 208 96 186.5 96 160L96 112C96 85.5 117.5 64 144 64L432 64C458.5 64 480 85.5 480 112L480 160C480 186.5 458.5 208 432 208zM496 304L144 304L144 352L496 352L496 304zM544 352C544 378.5 522.5 400 496 400L144 400C117.5 400 96 378.5 96 352L96 304C96 277.5 117.5 256 144 256L496 256C522.5 256 544 277.5 544 304L544 352zM304 496L144 496L144 544L304 544L304 496zM352 544C352 570.5 330.5 592 304 592L144 592C117.5 592 96 570.5 96 544L96 496C96 469.5 117.5 448 144 448L304 448C330.5 448 352 469.5 352 496L352 544z"/></svg>
{:else if name === 'tls-cert'}
<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 === 'tls-version'}
<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.7 164.8L320 113.4L503 191C508.9 193.5 512.1 198.8 512 203.8C511.7 261 496.8 344.1 449.5 415.7L198.7 164.8z"/><path d="M73 39.1C63.6 29.7 48.4 29.7 39.1 39.1C29.8 48.5 29.7 63.7 39 73.1L567 601.1C576.4 610.5 591.6 610.5 600.9 601.1C610.2 591.7 610.3 576.5 600.9 567.2L484.1 450.3C542.6 366.4 559.7 268.1 560 204C560.1 177.8 543.7 156.1 521.7 146.8L333.4 66.9C329.2 65 324.7 64 320 64C315.3 64 310.8 65 306.6 66.9L162.1 128.2L73 39.1zM198.7 164.8L320 113.4L503 191C508.9 193.5 512.1 198.8 512 203.8C511.7 261 496.8 344.1 449.5 415.7L198.7 164.8zM384.9 486.8C367.5 500.8 347.8 513.3 325.7 523.9C322.1 525.6 317.9 525.6 314.4 523.9C180.2 459.7 136.5 323.9 129.2 231L83 184.8C81 190.8 80 197.2 80 204C80.5 303.2 121.3 484.7 293.6 567.2C310.3 575.2 329.7 575.2 346.4 567.2C373.9 554.1 398 538.4 419.1 521L384.9 486.8z"/></svg>
{:else if name === 'tls-alpn'}
<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="M489 95L569 175C578.4 184.4 578.4 199.6 569 208.9L489 288.9C479.6 298.3 464.4 298.3 455.1 288.9C445.8 279.5 445.7 264.3 455.1 255L494.1 216L420 216C404.9 216 390.7 223.1 381.6 235.2L348 280L318 240L343.2 206.4C361.3 182.2 389.8 168 420 168L494.1 168L455.1 129C445.7 119.6 445.7 104.4 455.1 95.1C464.5 85.8 479.7 85.7 489 95.1zM258 400L232.8 433.6C214.7 457.8 186.2 472 156 472L88 472C74.7 472 64 461.3 64 448C64 434.7 74.7 424 88 424L156 424C171.1 424 185.3 416.9 194.4 404.8L228 360L258 400zM455 351C464.4 341.6 479.6 341.6 488.9 351L568.9 431C578.3 440.4 578.3 455.6 568.9 464.9L488.9 544.9C479.5 554.3 464.3 554.3 455 544.9C445.7 535.5 445.6 520.3 455 511L494 472L419.9 472C389.7 472 361.2 457.8 343.1 433.6L194.4 235.2C185.3 223.1 171.1 216 156 216L88 216C74.7 216 64 205.3 64 192C64 178.7 74.7 168 88 168L156 168C186.2 168 214.7 182.2 232.8 206.4L381.6 404.8C390.7 416.9 404.9 424 420 424L494.1 424L455.1 385C445.7 375.6 445.7 360.4 455.1 351.1z"/></svg>
{:else if name === 'network-port'}
<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 304L112 464L152 464L152 408C152 394.7 162.7 384 176 384C189.3 384 200 394.7 200 408L200 464L248 464L248 408C248 394.7 258.7 384 272 384C285.3 384 296 394.7 296 408L296 464L344 464L344 408C344 394.7 354.7 384 368 384C381.3 384 392 394.7 392 408L392 464L440 464L440 408C440 394.7 450.7 384 464 384C477.3 384 488 394.7 488 408L488 464L528 464L528 304L488 304C474.7 304 464 293.3 464 280L464 240L424 240C410.7 240 400 229.3 400 216L400 176L240 176L240 216C240 229.3 229.3 240 216 240L176 240L176 280C176 293.3 165.3 304 152 304L112 304z"/><path d="M192 160C192 142.3 206.3 128 224 128L416 128C433.7 128 448 142.3 448 160L448 192L480 192C497.7 192 512 206.3 512 224L512 256L544 256C561.7 256 576 270.3 576 288L576 480C576 497.7 561.7 512 544 512L96 512C78.3 512 64 497.7 64 480L64 288C64 270.3 78.3 256 96 256L128 256L128 224C128 206.3 142.3 192 160 192L192 192L192 160zM240 176L240 216C240 229.3 229.3 240 216 240L176 240L176 280C176 293.3 165.3 304 152 304L112 304L112 464L152 464L152 408C152 394.7 162.7 384 176 384C189.3 384 200 394.7 200 408L200 464L248 464L248 408C248 394.7 258.7 384 272 384C285.3 384 296 394.7 296 408L296 464L344 464L344 408C344 394.7 354.7 384 368 384C381.3 384 392 394.7 392 408L392 464L440 464L440 408C440 394.7 450.7 384 464 384C477.3 384 488 394.7 488 408L488 464L528 464L528 304L488 304C474.7 304 464 293.3 464 280L464 240L424 240C410.7 240 400 229.3 400 216L400 176L240 176z"/></svg>
{:else if name === 'network-ping'}
<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="M155.2 321.2C138.2 341.5 140.8 371.8 161.1 388.9C165.7 392.7 171 395.8 177.1 397.7C254 422.5 331 447.2 407.9 472L222.8 315.2L218.9 312.3C198.8 298.6 171.2 302.1 155.2 321.2zM216 352C216 365.3 205.3 376 192 376C178.7 376 168 365.3 168 352C168 338.7 178.7 328 192 328C205.3 328 216 338.7 216 352zM400 192C400 218.5 421.5 240 448 240C474.5 240 496 218.5 496 192C496 165.5 474.5 144 448 144C421.5 144 400 165.5 400 192z"/><path d="M496 192C496 165.5 474.5 144 448 144C421.5 144 400 165.5 400 192C400 218.5 421.5 240 448 240C474.5 240 496 218.5 496 192zM448 96C501 96 544 139 544 192C544 245 501 288 448 288C395 288 352 245 352 192C352 139 395 96 448 96zM118.5 290.3C152.6 249.7 213.1 244.4 253.7 278.5L499.7 486.8L480 512L479.9 512.1L480 512.1L508 527.5L506.6 529.9C498.8 541.5 484 547.1 470.1 542.5L162.3 443.3C153.3 440.4 144.9 436.2 137.5 431L130.3 425.5C89.7 391.4 84.3 330.8 118.4 290.2zM480 512L499.7 486.8C512.2 496.6 515.5 513.9 508 527.4L480 512zM218.9 312.3C198.8 298.6 171.2 302.1 155.2 321.2C138.2 341.5 140.8 371.8 161.1 388.9L161.1 388.9C165.6 392.7 171 395.8 177.1 397.7L177.1 397.7L407.9 472L222.8 315.2L218.9 312.3zM192 328C205.3 328 216 338.7 216 352C216 365.3 205.3 376 192 376C178.7 376 168 365.3 168 352C168 338.7 178.7 328 192 328z"/></svg>
{:else if name === 'something'}
<!-- UI Icons-->
{:else if name === 'case'}
<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="M112 232L112 336L240 336L240 232C240 201.1 214.9 176 184 176L168 176C137.1 176 112 201.1 112 232zM112 384L112 488C112 501.3 101.3 512 88 512C74.7 512 64 501.3 64 488L64 232C64 174.6 110.6 128 168 128L184 128C241.4 128 288 174.6 288 232L288 488C288 501.3 277.3 512 264 512C250.7 512 240 501.3 240 488L240 384L112 384zM456 304C425.1 304 400 329.1 400 360L400 408C400 438.9 425.1 464 456 464L472 464C502.9 464 528 438.9 528 408L528 360C528 329.1 502.9 304 472 304L456 304zM529 273C532 263.2 541.1 256 552 256C565.3 256 576 266.7 576 280L576 398.5C576 423.4 580 448.2 587.9 471.9L590.8 480.5C595 493.1 588.2 506.7 575.6 510.9C563 515.1 549.4 508.3 545.2 495.7L542.3 487.1C542.1 486.5 541.9 485.9 541.7 485.2C523.2 501.9 498.8 512.1 471.9 512.1L455.9 512.1C398.5 512.1 351.9 465.5 351.9 408.1L351.9 360.1C351.9 302.7 398.5 256.1 455.9 256.1L471.9 256.1C493 256.1 512.6 262.4 528.9 273.1z"/></svg>
@@ -339,6 +378,10 @@
<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 320zM208 320C208 306.7 218.7 296 232 296L296 296L296 232C296 218.7 306.7 208 320 208C333.3 208 344 218.7 344 232L344 296L408 296C421.3 296 432 306.7 432 320C432 333.3 421.3 344 408 344L344 344L344 408C344 421.3 333.3 432 320 432C306.7 432 296 421.3 296 408L296 344L232 344C218.7 344 208 333.3 208 320z"/><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 576zM296 408C296 421.3 306.7 432 320 432C333.3 432 344 421.3 344 408L344 344L408 344C421.3 344 432 333.3 432 320C432 306.7 421.3 296 408 296L344 296L344 232C344 218.7 333.3 208 320 208C306.7 208 296 218.7 296 232L296 296L232 296C218.7 296 208 306.7 208 320C208 333.3 218.7 344 232 344L296 344L296 408z"/></svg>
{:else if name === 'minus-circle'}
<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 320zM208 320C208 306.7 218.7 296 232 296L408 296C421.3 296 432 306.7 432 320C432 333.3 421.3 344 408 344L232 344C218.7 344 208 333.3 208 320z"/><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 576zM232 296C218.7 296 208 306.7 208 320C208 333.3 218.7 344 232 344L408 344C421.3 344 432 333.3 432 320C432 306.7 421.3 296 408 296L232 296z"/></svg>
{:else if name === 'x-circle'}
<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 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 320zM231 231C240.4 221.6 255.6 221.6 264.9 231L319.9 286L374.9 231C384.3 221.6 399.5 221.6 408.8 231C418.1 240.4 418.2 255.6 408.8 264.9L353.8 319.9L408.8 374.9C418.2 384.3 418.2 399.5 408.8 408.8C399.4 418.1 384.2 418.2 374.9 408.8L319.9 353.8L264.9 408.8C255.5 418.2 240.3 418.2 231 408.8C221.7 399.4 221.6 384.2 231 374.9L286 319.9L231 264.9C221.6 255.5 221.6 240.3 231 231z"/><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 576zM231 231C221.6 240.4 221.6 255.6 231 264.9L286 319.9L231 374.9C221.6 384.3 221.6 399.5 231 408.8C240.4 418.1 255.6 418.2 264.9 408.8L319.9 353.8L374.9 408.8C384.3 418.2 399.5 418.2 408.8 408.8C418.1 399.4 418.2 384.2 408.8 374.9L353.8 319.9L408.8 264.9C418.2 255.5 418.2 240.3 408.8 231C399.4 221.7 384.2 221.6 374.9 231L319.9 286L264.9 231C255.5 221.6 240.3 221.6 231 231z"/></svg>
{:else if name === 'alert-circle'}
<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 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 320zM352 416C352 433.7 337.7 448 320 448C302.3 448 288 433.7 288 416C288 398.3 302.3 384 320 384C337.7 384 352 398.3 352 416zM288.6 225.7C287.3 207.5 301.7 192 320 192C338.2 192 352.7 207.5 351.4 225.7L344 329.7C343.1 342.3 332.6 352 320.1 352C307.5 352 297.1 342.3 296.2 329.7L288.8 225.7z"/><path d="M320 576C178.6 576 64 461.4 64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576zM320 112C205.1 112 112 205.1 112 320C112 434.9 205.1 528 320 528C434.9 528 528 434.9 528 320C528 205.1 434.9 112 320 112zM320 448C302.3 448 288 433.7 288 416C288 398.3 302.3 384 320 384C337.7 384 352 398.3 352 416C352 433.7 337.7 448 320 448zM320 192C338.2 192 352.7 207.5 351.4 225.7L344 329.7C343.1 342.3 332.6 352 320.1 352C307.5 352 297.1 342.3 296.2 329.7L288.8 225.7C287.3 207.5 301.8 192 320 192z"/></svg>
{:else if name === 'check-circle'}
<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 320zM236.8 342.4C228.8 331.8 231 316.8 241.6 308.8C252.2 300.8 267.2 303 275.2 313.6L302.2 349.6L363.6 251.3C370.6 240.1 385.4 236.6 396.7 243.7C408 250.8 411.4 265.5 404.3 276.8L324.3 404.8C320.1 411.5 312.9 415.7 305 416.1C297.1 416.5 289.5 412.9 284.8 406.5L236.8 342.5z"/><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 576zM404.4 276.7C411.4 265.5 408 250.7 396.8 243.6C385.6 236.5 370.8 240 363.7 251.2L302.3 349.5L275.3 313.5C267.3 302.9 252.3 300.7 241.7 308.7C231.1 316.7 228.9 331.7 236.9 342.3L284.9 406.3C289.6 412.6 297.2 416.2 305.1 415.9C313 415.6 320.2 411.4 324.4 404.6L404.4 276.6z"/></svg>
{:else if name === 'alert-triangle'}
@@ -438,4 +481,79 @@
/* fill: var(--color-primary); */
fill: currentColor;
}
/* Icon animations */
.animate-spin {
animation: icon-spin 1s linear infinite;
}
.animate-pulse {
animation: icon-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.animate-pulse-once {
animation: icon-pulse-once 1s cubic-bezier(0.4, 0, 0.6, 1);
}
.animate-bounce {
animation: icon-bounce 1s infinite;
}
.animate-fade {
animation: icon-fade 2s ease-in-out infinite;
}
@keyframes icon-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes icon-pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
@keyframes icon-pulse-once {
0% {
opacity: 1;
}
50% {
opacity: 0.3;
}
100% {
opacity: 1;
}
}
@keyframes icon-bounce {
0%, 20%, 53%, 80%, 100% {
transform: translate3d(0, 0, 0);
}
40%, 43% {
transform: translate3d(0, -8px, 0);
}
70% {
transform: translate3d(0, -4px, 0);
}
90% {
transform: translate3d(0, -2px, 0);
}
}
@keyframes icon-fade {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.3;
}
}
</style>
+45
View File
@@ -665,6 +665,51 @@ export const SUB_NAV: Record<string, (NavItem | NavGroup)[]> = {
keywords: ['http', 'performance', 'timing', 'dns', 'tcp', 'tls', 'ttfb', 'metrics', 'analyzer']
}
]
},
{
title: 'TLS Diagnostics',
items: [
{
href: '/diagnostics/tls/certificate',
label: 'TLS Certificate Analyzer',
description: 'Analyze TLS certificates, view certificate chains, check expiration dates, and examine Subject Alternative Names',
icon: 'tls-cert',
keywords: ['tls', 'certificate', 'analyzer', 'chain', 'expiry', 'san', 'ssl', 'x509', 'fingerprint']
},
{
href: '/diagnostics/tls/versions',
label: 'TLS Versions Probe',
description: 'Test which TLS protocol versions a server supports and assess overall security posture',
icon: 'tls-version',
keywords: ['tls', 'versions', 'probe', 'security', 'protocol', 'support', 'deprecated', 'assessment']
},
{
href: '/diagnostics/tls/alpn',
label: 'TLS ALPN Negotiation',
description: 'Test Application-Layer Protocol Negotiation to see which protocol a server selects (HTTP/2, HTTP/3)',
icon: 'tls-alpn',
keywords: ['tls', 'alpn', 'negotiation', 'http2', 'http3', 'protocol', 'handshake', 'application']
}
]
},
{
title: 'Network Diagnostics',
items: [
{
href: '/diagnostics/network/tcp-port-check',
label: 'TCP Port Checker',
description: 'Test TCP connectivity to host:port combinations and measure connection latency',
icon: 'network-port',
keywords: ['tcp', 'port', 'check', 'connectivity', 'latency', 'open', 'closed', 'firewall', 'scan']
},
{
href: '/diagnostics/network/http-ping',
label: 'HTTP Ping',
description: 'Measure HTTP/HTTPS response latency with statistical analysis (median, p95) without raw ICMP',
icon: 'network-ping',
keywords: ['http', 'ping', 'latency', 'response', 'time', 'statistics', 'median', 'p95', 'web', 'api']
}
]
}
],
'/reference': [
@@ -345,7 +345,10 @@ async function checkDMARC(domain: string): Promise<any> {
try {
const dmarcDomain = `_dmarc.${domain}`;
const result = await performDNSLookup(dmarcDomain, 'TXT');
const dmarcRecord = result.Answer?.find((record: any) => record.data.startsWith('v=DMARC1'));
const dmarcRecord = result.Answer?.find((record: any) => {
const cleanData = record.data.replace(/^"(.*)"$/, '$1'); // Remove surrounding quotes
return cleanData.startsWith('v=DMARC1');
});
if (!dmarcRecord) {
return {
@@ -355,7 +358,7 @@ async function checkDMARC(domain: string): Promise<any> {
};
}
const policy = dmarcRecord.data;
const policy = dmarcRecord.data.replace(/^"(.*)"$/, '$1'); // Clean the policy data
const parsed = {
policy: policy.match(/p=([^;]+)/)?.[1],
subdomainPolicy: policy.match(/sp=([^;]+)/)?.[1],
@@ -0,0 +1,280 @@
import { json, error } from '@sveltejs/kit';
import * as net from 'node:net';
import type { RequestHandler } from './$types';
type Action = "tcp-port-check" | "http-ping";
interface BaseReq { action: Action; }
interface TcpPortCheckReq extends BaseReq {
action: "tcp-port-check";
targets: string[]; // Array of host:port strings
timeout?: number;
}
interface HttpPingReq extends BaseReq {
action: "http-ping";
url: string;
count?: number;
method?: string;
timeout?: number;
}
type RequestBody = TcpPortCheckReq | HttpPingReq;
function parseHostPort(hostPort: string): { host: string; port: number } {
const match = hostPort.match(/^(.+?):(\d+)$/);
if (match) {
return { host: match[1], port: parseInt(match[2], 10) };
}
throw new Error(`Invalid host:port format: ${hostPort}`);
}
async function checkTcpPort(host: string, port: number, timeout: number = 5000): Promise<{
host: string;
port: number;
open: boolean;
latency: number | null;
error: string | null;
}> {
return new Promise((resolve) => {
const startTime = Date.now();
const socket = new net.Socket();
let resolved = false;
const cleanup = () => {
if (!resolved) {
resolved = true;
socket.destroy();
}
};
const timeoutHandle = setTimeout(() => {
cleanup();
resolve({
host,
port,
open: false,
latency: null,
error: 'Connection timeout'
});
}, timeout);
socket.setTimeout(timeout);
socket.on('connect', () => {
const latency = Date.now() - startTime;
clearTimeout(timeoutHandle);
cleanup();
resolve({
host,
port,
open: true,
latency,
error: null
});
});
socket.on('error', (err) => {
clearTimeout(timeoutHandle);
cleanup();
resolve({
host,
port,
open: false,
latency: null,
error: err.message
});
});
socket.on('timeout', () => {
clearTimeout(timeoutHandle);
cleanup();
resolve({
host,
port,
open: false,
latency: null,
error: 'Socket timeout'
});
});
socket.connect(port, host);
});
}
async function httpPing(url: string, count: number = 5, method: string = 'HEAD', timeout: number = 10000): Promise<{
url: string;
method: string;
count: number;
successful: number;
failed: number;
latencies: number[];
statistics: {
min: number;
max: number;
avg: number;
median: number;
p95: number;
};
errors: string[];
}> {
const latencies: number[] = [];
const errors: string[] = [];
for (let i = 0; i < count; i++) {
try {
const startTime = Date.now();
const response = await fetch(url, {
method: method.toUpperCase(),
signal: AbortSignal.timeout(timeout),
// Don't follow redirects for more consistent timing
redirect: 'manual'
});
const latency = Date.now() - startTime;
latencies.push(latency);
// Consume the response to ensure complete timing
if (method.toLowerCase() !== 'head') {
await response.text();
}
} catch (err: any) {
errors.push(err.message);
}
// Small delay between requests to avoid overwhelming the server
if (i < count - 1) {
await new Promise(resolve => setTimeout(resolve, 100));
}
}
const successful = latencies.length;
const failed = count - successful;
// Calculate statistics
let statistics = {
min: 0,
max: 0,
avg: 0,
median: 0,
p95: 0
};
if (latencies.length > 0) {
const sorted = [...latencies].sort((a, b) => a - b);
statistics = {
min: Math.min(...latencies),
max: Math.max(...latencies),
avg: Math.round(latencies.reduce((sum, lat) => sum + lat, 0) / latencies.length),
median: sorted.length % 2 === 0
? Math.round((sorted[sorted.length / 2 - 1] + sorted[sorted.length / 2]) / 2)
: sorted[Math.floor(sorted.length / 2)],
p95: sorted[Math.floor(sorted.length * 0.95)] || sorted[sorted.length - 1]
};
}
return {
url,
method,
count,
successful,
failed,
latencies,
statistics,
errors
};
}
export const POST: RequestHandler = async ({ request }) => {
try {
const body: RequestBody = await request.json();
switch (body.action) {
case 'tcp-port-check': {
const { targets, timeout = 5000 } = body as TcpPortCheckReq;
console.log('Received targets:', targets); // Debug log
console.log('Targets type:', typeof targets, 'Length:', targets?.length); // Debug log
if (!targets || targets.length === 0) {
throw error(400, 'No targets provided');
}
if (targets.length > 50) {
throw error(400, 'Too many targets (max 50)');
}
const results = await Promise.all(
targets.map(async (target) => {
try {
const { host, port } = parseHostPort(target.trim());
return await checkTcpPort(host, port, timeout);
} catch (err: any) {
return {
host: target,
port: 0,
open: false,
latency: null,
error: err.message
};
}
})
);
const summary = {
total: results.length,
open: results.filter(r => r.open).length,
closed: results.filter(r => !r.open).length,
avgLatency: results.filter(r => r.latency !== null).length > 0
? Math.round(results.filter(r => r.latency !== null)
.reduce((sum, r) => sum + (r.latency || 0), 0) /
results.filter(r => r.latency !== null).length)
: null
};
return json({
targets,
timeout,
results,
summary,
timestamp: new Date().toISOString()
});
}
case 'http-ping': {
const { url, count = 5, method = 'HEAD', timeout = 10000 } = body as HttpPingReq;
if (!url) {
throw error(400, 'URL is required');
}
if (count < 1 || count > 20) {
throw error(400, 'Count must be between 1 and 20');
}
// Validate URL
try {
new URL(url);
} catch {
throw error(400, 'Invalid URL format');
}
const result = await httpPing(url, count, method, timeout);
return json({
...result,
timestamp: new Date().toISOString()
});
}
default:
throw error(400, `Unknown action: ${(body as any).action}`);
}
} catch (err: any) {
console.error('Network diagnostics API error:', err);
throw error(500, `Network diagnostic failed: ${err.message}`);
}
};
@@ -0,0 +1,319 @@
import { json, error } from '@sveltejs/kit';
import * as tls from 'node:tls';
import * as net from 'node:net';
import type { RequestHandler } from './$types';
type Action = "certificate" | "versions" | "alpn";
interface BaseReq { action: Action; }
interface CertificateReq extends BaseReq {
action: "certificate";
host: string;
port?: number;
servername?: string;
}
interface VersionsReq extends BaseReq {
action: "versions";
host: string;
port?: number;
servername?: string;
}
interface ALPNReq extends BaseReq {
action: "alpn";
host: string;
port?: number;
servername?: string;
protocols?: string[];
}
type RequestBody = CertificateReq | VersionsReq | ALPNReq;
const TLS_VERSIONS = ['TLSv1', 'TLSv1.1', 'TLSv1.2', 'TLSv1.3'] as const;
function parseHost(hostPort: string): { host: string; port: number } {
const match = hostPort.match(/^(.+?):(\d+)$/);
if (match) {
return { host: match[1], port: parseInt(match[2], 10) };
}
return { host: hostPort, port: 443 };
}
function formatCertificate(cert: any): any {
const now = Date.now();
const validFrom = new Date(cert.valid_from).getTime();
const validTo = new Date(cert.valid_to).getTime();
return {
subject: {
CN: cert.subject?.CN || '',
O: cert.subject?.O || '',
OU: cert.subject?.OU || '',
C: cert.subject?.C || ''
},
issuer: {
CN: cert.issuer?.CN || '',
O: cert.issuer?.O || '',
C: cert.issuer?.C || ''
},
validFrom: cert.valid_from,
validTo: cert.valid_to,
daysUntilExpiry: Math.ceil((validTo - now) / (1000 * 60 * 60 * 24)),
isExpired: now > validTo,
isNotYetValid: now < validFrom,
serialNumber: cert.serialNumber,
fingerprint: cert.fingerprint,
fingerprint256: cert.fingerprint256,
subjectAltNames: cert.subjectaltname && typeof cert.subjectaltname === 'string'
? cert.subjectaltname.split(', ').map((san: string) => san.replace(/^DNS:/, ''))
: [],
keyUsage: cert.ext_key_usage && typeof cert.ext_key_usage === 'string'
? cert.ext_key_usage.split(', ')
: [],
version: cert.version
};
}
async function getCertificateInfo(host: string, port: number, servername?: string): Promise<any> {
return new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Connection timeout'));
}, 10000);
const options: tls.ConnectionOptions = {
host,
port,
servername: servername || host,
rejectUnauthorized: false,
timeout: 10000
};
const socket = tls.connect(options, () => {
clearTimeout(timeout);
const cert = socket.getPeerCertificate(true);
const protocol = socket.getProtocol();
const cipher = socket.getCipher();
let alpnProtocol = null;
// Try the new method first (Node.js 22.12+)
if (typeof socket.getALPNProtocol === 'function') {
alpnProtocol = socket.getALPNProtocol();
} else {
// Fallback: Check if ALPN was negotiated by accessing internal properties
try {
const tlsSocket = socket as any;
if (tlsSocket.alpnProtocol) {
alpnProtocol = tlsSocket.alpnProtocol;
} else if (tlsSocket._handle && tlsSocket._handle.getALPNProtocol) {
alpnProtocol = tlsSocket._handle.getALPNProtocol();
}
} catch (e) {
// Ignore errors from accessing internal properties
}
}
const chain: any[] = [];
let currentCert = cert;
while (currentCert && Object.keys(currentCert).length > 0) {
chain.push(formatCertificate(currentCert));
currentCert = currentCert.issuerCertificate;
// Prevent infinite loops
if (currentCert === cert || chain.length > 10) break;
}
const result = {
chain,
protocol,
cipher: cipher ? {
name: cipher.name,
version: cipher.version,
bits: cipher.bits
} : null,
alpnProtocol,
servername: servername || host,
peerCertificate: formatCertificate(cert)
};
socket.end();
resolve(result);
});
socket.on('error', (err) => {
clearTimeout(timeout);
reject(err);
});
socket.on('timeout', () => {
clearTimeout(timeout);
socket.destroy();
reject(new Error('Connection timeout'));
});
});
}
async function probeTLSVersions(host: string, port: number, servername?: string): Promise<any> {
const results: { [key: string]: boolean } = {};
const errors: { [key: string]: string } = {};
for (const version of TLS_VERSIONS) {
try {
await new Promise<void>((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Timeout'));
}, 5000);
const options: tls.ConnectionOptions = {
host,
port,
servername: servername || host,
minVersion: version,
maxVersion: version,
rejectUnauthorized: false,
timeout: 5000
};
const socket = tls.connect(options, () => {
clearTimeout(timeout);
results[version] = true;
socket.end();
resolve();
});
socket.on('error', (err) => {
clearTimeout(timeout);
results[version] = false;
errors[version] = err.message;
resolve();
});
socket.on('timeout', () => {
clearTimeout(timeout);
socket.destroy();
results[version] = false;
errors[version] = 'Timeout';
resolve();
});
});
} catch (err: any) {
results[version] = false;
errors[version] = err.message;
}
}
const supportedVersions = Object.entries(results)
.filter(([_, supported]) => supported)
.map(([version]) => version);
return {
supported: results,
errors,
supportedVersions,
minVersion: supportedVersions[0] || null,
maxVersion: supportedVersions[supportedVersions.length - 1] || null,
totalSupported: supportedVersions.length
};
}
async function probeALPN(host: string, port: number, protocols: string[], servername?: string): Promise<any> {
return new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Connection timeout'));
}, 10000);
const options: tls.ConnectionOptions = {
host,
port,
servername: servername || host,
ALPNProtocols: protocols,
rejectUnauthorized: false,
timeout: 10000
};
const socket = tls.connect(options, () => {
clearTimeout(timeout);
let negotiatedProtocol = null;
// Try the new method first (Node.js 22.12+)
if (typeof socket.getALPNProtocol === 'function') {
negotiatedProtocol = socket.getALPNProtocol();
} else {
// Fallback: Check if ALPN was negotiated by accessing internal properties
// This is a workaround for older Node.js versions
try {
const tlsSocket = socket as any;
if (tlsSocket.alpnProtocol) {
negotiatedProtocol = tlsSocket.alpnProtocol;
} else if (tlsSocket._handle && tlsSocket._handle.getALPNProtocol) {
negotiatedProtocol = tlsSocket._handle.getALPNProtocol();
}
} catch (e) {
// Ignore errors from accessing internal properties
}
}
const tlsVersion = socket.getProtocol();
const result = {
requestedProtocols: protocols,
negotiatedProtocol: negotiatedProtocol || null,
tlsVersion,
success: !!negotiatedProtocol,
servername: servername || host
};
socket.end();
resolve(result);
});
socket.on('error', (err) => {
clearTimeout(timeout);
reject(err);
});
socket.on('timeout', () => {
clearTimeout(timeout);
socket.destroy();
reject(new Error('Connection timeout'));
});
});
}
export const POST: RequestHandler = async ({ request }) => {
try {
const body: RequestBody = await request.json();
switch (body.action) {
case 'certificate': {
const { host: hostInput, port = 443, servername } = body as CertificateReq;
const { host } = parseHost(hostInput);
const result = await getCertificateInfo(host, port, servername);
return json(result);
}
case 'versions': {
const { host: hostInput, port = 443, servername } = body as VersionsReq;
const { host } = parseHost(hostInput);
const result = await probeTLSVersions(host, port, servername);
return json(result);
}
case 'alpn': {
const { host: hostInput, port = 443, servername, protocols = ['h2', 'http/1.1'] } = body as ALPNReq;
const { host } = parseHost(hostInput);
const result = await probeALPN(host, port, protocols, servername);
return json(result);
}
default:
throw error(400, `Unknown action: ${(body as any).action}`);
}
} catch (err: any) {
console.error('TLS API error:', err);
throw error(500, `TLS operation failed: ${err.message}`);
}
};
@@ -243,7 +243,7 @@
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header">
<div class="card-header row">
<h3>CAA Policy Results</h3>
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
@@ -228,7 +228,7 @@
<div class="action-section">
<button class="check-btn lookup-btn" onclick={checkDMARC} disabled={loading || !domain.trim()}>
{#if loading}
<Icon name="loader-2" size="sm" class="animate-spin" />
<Icon name="loader-2" size="sm" animate="spin" />
Checking DMARC...
{:else}
<Icon name="shield-check" size="sm" />
@@ -239,6 +239,7 @@
</div>
</div>
<!-- Results -->
{#if results && results.hasRecord}
<div class="card results-card">
@@ -250,9 +251,10 @@
</button>
</div>
<div class="card-content">
{#if results && results.hasRecord}
<!-- Status Overview -->
{#if results.parsed}
{@const issues = getIssues()}
<!-- Status Overview -->
{@const parsed = results.parsed}
<div class="status-overview">
<div class="status-item {issues.length === 0 ? 'success' : issues.some(i => i.severity === 'high') ? 'error' : 'warning'}">
<Icon name={issues.length === 0 ? 'shield-check' : issues.some(i => i.severity === 'high') ? 'shield-x' : 'shield-alert'} size="md" />
@@ -276,22 +278,19 @@
</div>
</div>
</div>
{/if}
<!-- Original Record -->
{#if results.record}
<div class="record-section">
<h4>DMARC Record</h4>
<div class="record-display">
<div class="record-location">_dmarc.{domain}</div>
<code>{results.record}</code>
<!-- Original Record -->
{#if results.record}
<div class="record-section">
<h4>DMARC Record</h4>
<div class="record-display">
<div class="record-location">_dmarc.{domain}</div>
<code>{results.record}</code>
</div>
</div>
</div>
{/if}
{/if}
<!-- Parsed Policy -->
{#if results.parsed}
{@const parsed = results.parsed}
<!-- Parsed Policy -->
<div class="policy-section">
<h4>Policy Configuration</h4>
<div class="policy-grid">
@@ -454,7 +453,7 @@
<!-- No Record Found (but not an error) -->
{#if results && results.hasRecord === false}
<div class="card warning-card">
<div class="card warning-card none-found">
<div class="card-content">
<div class="warning-content">
<Icon name="info" size="md" />
@@ -540,8 +539,9 @@
</div>
<style lang="scss">
// Page-specific styles - shared styles removed
// Use shared .lookup-btn instead of .check-btn
.none-found {
margin: var(--spacing-md) 0 var(--spacing-lg);
}
.action-section {
display: flex;
@@ -84,7 +84,7 @@
function getStatusIcon(result: any): string {
if (result.error) return 'x-circle';
if (!result.result?.Answer?.length) return 'alert-circle';
if (!result.result?.Answer?.length) return 'alert-triangle';
return 'check-circle';
}
@@ -193,7 +193,7 @@
<div class="action-section">
<button class="check-btn" onclick={checkPropagation} disabled={loading || !domainName.trim()}>
{#if loading}
<Icon name="loader-2" size="sm" class="animate-spin" />
<Icon name="loader-2" size="sm" animate="spin" />
Checking Propagation...
{:else}
<Icon name="globe" size="sm" />
@@ -454,7 +454,7 @@
}
.resolver-header {
padding: var(--spacing-md);
padding: var(--spacing-sm) var(--spacing-md);
border-bottom: 1px solid var(--border-color);
}
@@ -478,7 +478,17 @@
}
.resolver-content {
padding: var(--spacing-md);
padding: var(--spacing-sm) var(--spacing-md);
.no-records {
display: flex;
align-items: center;
gap: var(--spacing-xs);
width: 100%;
justify-content: center;
margin-bottom: var(--spacing-sm);
font-size: var(--font-size-md);
color: var(--color-info)
}
}
.records {
@@ -217,7 +217,7 @@
{#if results && !results.error}
{@const status = getLookupStatus()}
<div class="card results-card">
<div class="card-header">
<div class="card-header row">
<h3>SPF Evaluation Results</h3>
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
@@ -417,9 +417,13 @@
</div>
<style lang="scss">
// Page-specific styles - shared styles removed
.record-display code {
background: var(--bg-primary);
padding: var(--spacing-sm);
display: block;
}
// Form group layout override for SPF evaluator
.form-group {
label {
flex-direction: column;
@@ -252,7 +252,7 @@
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header">
<div class="card-header row">
<h3>HTTP Response Analysis</h3>
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
@@ -292,7 +292,7 @@
</div>
<!-- Response Headers -->
<div class="record-section">
<div class="record-section card">
<h4>Response Headers</h4>
<div class="records-list">
{#each Object.entries(results.headers) as [name, value]}
@@ -306,7 +306,7 @@
</div>
{#if results.timings}
<div class="record-section">
<div class="record-section card">
<h4>Performance Timing</h4>
<div class="records-list">
<div class="record-item">
@@ -412,4 +412,4 @@
// Page-specific styles only (common utilities moved to diagnostics-pages.scss)
</style>
</style>
@@ -0,0 +1,697 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let url = $state('https://google.com');
let method = $state('HEAD');
let count = $state(5);
let timeout = $state(10000);
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let copiedState = $state(false);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ url: 'https://google.com', method: 'HEAD', description: 'Google homepage' },
{ url: 'https://github.com', method: 'HEAD', description: 'GitHub homepage' },
{ url: 'https://api.github.com', method: 'GET', description: 'GitHub API' },
{ url: 'https://httpbin.org/delay/1', method: 'GET', description: 'Simulated 1s delay' },
{ url: 'https://www.cloudflare.com', method: 'HEAD', description: 'Cloudflare CDN' },
{ url: 'https://stackoverflow.com', method: 'HEAD', description: 'Stack Overflow' }
];
const httpMethods = [
{ value: 'HEAD', label: 'HEAD', description: 'Headers only, fastest' },
{ value: 'GET', label: 'GET', description: 'Full response, more realistic' },
{ value: 'OPTIONS', label: 'OPTIONS', description: 'Preflight requests' }
];
// Reactive validation
const isUrlValid = $derived(() => {
try {
const parsed = new URL(url);
return parsed.protocol === 'http:' || parsed.protocol === 'https:';
} catch {
return false;
}
});
const isInputValid = $derived(() => {
return isUrlValid && count >= 1 && count <= 20;
});
async function httpPing() {
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/network', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'http-ping',
url: url.trim(),
method,
count,
timeout
})
});
if (!response.ok) {
const errorText = await response.text();
try {
const errorData = JSON.parse(errorText);
throw new Error(errorData.message || `HTTP ping failed (${response.status})`);
} catch {
throw new Error(`HTTP ping failed (${response.status})`);
}
}
results = await response.json();
} catch (err: any) {
error = err.message;
} finally {
loading = false;
}
}
function loadExample(example: typeof examples[0], index: number) {
url = example.url;
method = example.method;
count = 5;
timeout = 10000;
selectedExampleIndex = index;
httpPing();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function setMethod(newMethod: string) {
method = newMethod;
clearExampleSelection();
if (isInputValid) httpPing();
}
function getLatencyClass(latency: number): string {
if (latency < 100) return 'excellent';
if (latency < 300) return 'good';
if (latency < 1000) return 'fair';
return 'poor';
}
function getLatencyDescription(latency: number): string {
if (latency < 100) return 'Excellent';
if (latency < 300) return 'Good';
if (latency < 1000) return 'Fair';
return 'Poor';
}
async function copyResults() {
if (!results) return;
let text = `HTTP Ping Results for ${results.url}\n`;
text += `Generated at: ${new Date().toISOString()}\n\n`;
text += `Configuration:\n`;
text += ` Method: ${results.method}\n`;
text += ` Count: ${results.count}\n`;
text += ` Timeout: ${timeout}ms\n\n`;
text += `Summary:\n`;
text += ` Successful: ${results.successful}\n`;
text += ` Failed: ${results.failed}\n`;
text += ` Success Rate: ${((results.successful / results.count) * 100).toFixed(1)}%\n\n`;
if (results.statistics && results.successful > 0) {
text += `Latency Statistics:\n`;
text += ` Min: ${results.statistics.min}ms\n`;
text += ` Max: ${results.statistics.max}ms\n`;
text += ` Average: ${results.statistics.avg}ms\n`;
text += ` Median: ${results.statistics.median}ms\n`;
text += ` 95th Percentile: ${results.statistics.p95}ms\n\n`;
}
if (results.latencies?.length > 0) {
text += `Individual Results:\n`;
results.latencies.forEach((latency: number, i: number) => {
text += ` Request ${i + 1}: ${latency}ms\n`;
});
}
if (results.errors?.length > 0) {
text += `\nErrors:\n`;
results.errors.forEach((err: string, i: number) => {
text += ` ${i + 1}: ${err}\n`;
});
}
await navigator.clipboard.writeText(text);
copiedState = true;
setTimeout(() => copiedState = false, 1500);
}
</script>
<div class="card">
<header class="card-header">
<h1>HTTP Ping</h1>
<p>Measure HTTP/HTTPS response latency by sending repeated requests and analyzing timing statistics. Alternative to ICMP ping for web services and APIs.</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>HTTP Ping Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Ping ${example.url} using ${example.method} method`}
>
<h5>{example.description}</h5>
<div class="example-details">
<span class="example-url mono">{example.url}</span>
<span class="example-method">{example.method}</span>
</div>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>HTTP Ping Configuration</h3>
</div>
<div class="card-content">
<div class="form-row">
<div class="form-group">
<label for="url" use:tooltip={"Enter a complete HTTP or HTTPS URL"}>
Target URL
<input
id="url"
type="url"
bind:value={url}
placeholder="https://example.com"
class:invalid={url && !isUrlValid}
onchange={() => { clearExampleSelection(); if (isInputValid) httpPing(); }}
/>
{#if url && !isUrlValid}
<span class="error-text">Must be a valid HTTP or HTTPS URL</span>
{/if}
</label>
</div>
</div>
<!-- HTTP Method Selection -->
<div class="form-row">
<div class="form-group">
<label>HTTP Method</label>
<div class="method-options">
{#each httpMethods as methodOption}
<button
type="button"
class="method-btn"
class:active={method === methodOption.value}
onclick={() => setMethod(methodOption.value)}
use:tooltip={methodOption.description}
>
{methodOption.label}
</button>
{/each}
</div>
</div>
</div>
<div class="form-row two-columns">
<div class="form-group">
<label for="count" use:tooltip={"Number of requests to send (1-20)"}>
Request Count
<input
id="count"
type="number"
bind:value={count}
min="1"
max="20"
onchange={() => { clearExampleSelection(); if (isInputValid) httpPing(); }}
/>
</label>
</div>
<div class="form-group">
<label for="timeout" use:tooltip={"Timeout per request in milliseconds"}>
Timeout (ms)
<input
id="timeout"
type="number"
bind:value={timeout}
min="1000"
max="30000"
step="1000"
onchange={() => { clearExampleSelection(); if (isInputValid) httpPing(); }}
/>
</label>
</div>
</div>
<div class="action-section">
<button class="lookup-btn" onclick={httpPing} disabled={loading || !isInputValid}>
{#if loading}
<Icon name="loader-2" size="sm" animate="spin" />
Pinging...
{:else}
<Icon name="activity" size="sm" />
Start HTTP Ping
{/if}
</button>
</div>
</div>
</div>
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header row">
<h3>HTTP Ping Results</h3>
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" />
{copiedState ? "Copied!" : "Copy Results"}
</button>
</div>
<div class="card-content">
<!-- Summary -->
<div class="status-overview">
<div class="status-item success">
<Icon name="check-circle" size="sm" />
<div>
<span class="status-title">{results.successful}/{results.count}</span>
<p class="status-desc">Successful requests</p>
</div>
</div>
{#if results.statistics?.avg}
<div class="status-item {getLatencyClass(results.statistics.avg)}">
<Icon name="zap" size="sm" />
<div>
<span class="status-title">{results.statistics.avg}ms</span>
<p class="status-desc">Average latency ({getLatencyDescription(results.statistics.avg)})</p>
</div>
</div>
{/if}
{#if results.failed > 0}
<div class="status-item error">
<Icon name="x-circle" size="sm" />
<div>
<span class="status-title">{results.failed}</span>
<p class="status-desc">Failed requests</p>
</div>
</div>
{/if}
</div>
{#if results.statistics && results.successful > 0}
<!-- Statistics -->
<div class="stats-section">
<h4>Latency Statistics</h4>
<div class="stats-grid">
<div class="stat-item">
<span class="stat-label">Minimum:</span>
<span class="stat-value">{results.statistics.min}ms</span>
</div>
<div class="stat-item">
<span class="stat-label">Maximum:</span>
<span class="stat-value">{results.statistics.max}ms</span>
</div>
<div class="stat-item">
<span class="stat-label">Average:</span>
<span class="stat-value">{results.statistics.avg}ms</span>
</div>
<div class="stat-item">
<span class="stat-label">Median:</span>
<span class="stat-value">{results.statistics.median}ms</span>
</div>
<div class="stat-item">
<span class="stat-label">95th Percentile:</span>
<span class="stat-value">{results.statistics.p95}ms</span>
</div>
<div class="stat-item">
<span class="stat-label">Range:</span>
<span class="stat-value">{results.statistics.max - results.statistics.min}ms</span>
</div>
</div>
</div>
<!-- Individual Results -->
{#if results.latencies?.length > 0}
<div class="results-section">
<h4>Individual Request Results</h4>
<div class="requests-list">
{#each results.latencies as latency, i}
<div class="request-item {getLatencyClass(latency)}">
<span class="request-number">#{i + 1}</span>
<span class="request-latency">{latency}ms</span>
<span class="request-status">{getLatencyDescription(latency)}</span>
</div>
{/each}
</div>
</div>
{/if}
{/if}
<!-- Errors -->
{#if results.errors?.length > 0}
<div class="errors-section">
<h4>Request Errors ({results.errors.length})</h4>
<div class="errors-list">
{#each results.errors as error, i}
<div class="error-item">
<span class="error-number">#{i + results.successful + 1}</span>
<span class="error-message">{error}</span>
</div>
{/each}
</div>
</div>
{/if}
<!-- Connection Info -->
<div class="info-section">
<h4>Request Information</h4>
<div class="detail-grid">
<div class="detail-item">
<span class="detail-label">URL:</span>
<span class="detail-value mono">{results.url}</span>
</div>
<div class="detail-item">
<span class="detail-label">Method:</span>
<span class="detail-value">{results.method}</span>
</div>
<div class="detail-item">
<span class="detail-label">Success Rate:</span>
<span class="detail-value">{((results.successful / results.count) * 100).toFixed(1)}%</span>
</div>
</div>
</div>
</div>
</div>
{/if}
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>HTTP Ping Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
<!-- Educational Content -->
<div class="card info-card">
<div class="card-header">
<h3>Understanding HTTP Ping</h3>
</div>
<div class="card-content">
<div class="info-grid">
<div class="info-section">
<h4>HTTP vs ICMP Ping</h4>
<ul>
<li><strong>HTTP:</strong> Tests application layer connectivity</li>
<li><strong>ICMP:</strong> Tests network layer connectivity</li>
<li>HTTP ping better reflects real user experience</li>
<li>Works through firewalls that block ICMP</li>
</ul>
</div>
<div class="info-section">
<h4>Request Methods</h4>
<ul>
<li><strong>HEAD:</strong> Headers only, fastest and most efficient</li>
<li><strong>GET:</strong> Full response, more realistic timing</li>
<li><strong>OPTIONS:</strong> Check allowed methods and CORS</li>
</ul>
</div>
<div class="info-section">
<h4>Latency Guidelines</h4>
<ul>
<li><strong>&lt; 100ms:</strong> Excellent response time</li>
<li><strong>100-300ms:</strong> Good for most applications</li>
<li><strong>300-1000ms:</strong> Acceptable but noticeable</li>
<li><strong>&gt; 1000ms:</strong> Poor, may impact user experience</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<style lang="scss">
.example-details {
display: flex;
flex-direction: column;
gap: var(--spacing-xs);
margin-top: var(--spacing-xs);
}
.example-url {
background: var(--bg-tertiary);
padding: 2px var(--spacing-xs);
border-radius: var(--radius-xs);
font-size: var(--font-size-xs);
color: var(--text-secondary);
word-break: break-all;
}
.example-method {
font-size: var(--font-size-xs);
padding: 2px var(--spacing-xs);
background: var(--color-primary);
color: var(--bg-primary);
border-radius: var(--radius-xs);
align-self: flex-start;
font-weight: 500;
}
.method-options {
display: flex;
gap: var(--spacing-xs);
margin-top: var(--spacing-xs);
}
.method-btn {
padding: var(--spacing-xs) var(--spacing-md);
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-sm);
color: var(--text-primary);
cursor: pointer;
transition: all var(--transition-fast);
&:hover, &.active {
background: var(--color-primary);
color: var(--bg-primary);
border-color: var(--color-primary);
}
}
.status-title {
font-weight: 600;
color: var(--text-primary);
}
.status-desc {
font-size: var(--font-size-xs);
margin: 2px 0 0 0;
opacity: 0.8;
}
.stats-section {
margin: var(--spacing-lg) 0;
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: var(--spacing-md);
}
.stat-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--spacing-sm) var(--spacing-md);
background: var(--bg-secondary);
border-radius: var(--radius-sm);
border: 1px solid var(--border-primary);
}
.stat-label {
font-size: var(--font-size-sm);
color: var(--text-secondary);
}
.stat-value {
font-weight: 600;
color: var(--text-primary);
font-family: var(--font-mono);
}
.results-section {
margin: var(--spacing-lg) 0;
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.requests-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: var(--spacing-sm);
}
.request-item {
display: flex;
flex-direction: column;
gap: 2px;
padding: var(--spacing-sm);
border-radius: var(--radius-sm);
border: 1px solid var(--border-primary);
text-align: center;
&.excellent {
background: color-mix(in srgb, var(--color-success), transparent 95%);
border-color: var(--color-success);
}
&.good {
background: color-mix(in srgb, var(--color-success), transparent 90%);
border-color: var(--color-success);
}
&.fair {
background: color-mix(in srgb, var(--color-warning), transparent 95%);
border-color: var(--color-warning);
}
&.poor {
background: color-mix(in srgb, var(--color-error), transparent 95%);
border-color: var(--color-error);
}
}
.request-number {
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.request-latency {
font-weight: 600;
color: var(--text-primary);
font-family: var(--font-mono);
}
.request-status {
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.errors-section {
margin: var(--spacing-lg) 0;
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.errors-list {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.error-item {
display: flex;
gap: var(--spacing-sm);
padding: var(--spacing-sm);
background: color-mix(in srgb, var(--color-error), transparent 95%);
border: 1px solid var(--color-error);
border-radius: var(--radius-sm);
}
.error-number {
font-size: var(--font-size-xs);
color: var(--color-error);
font-weight: 500;
flex-shrink: 0;
}
.error-message {
font-size: var(--font-size-sm);
color: var(--text-primary);
font-family: var(--font-mono);
}
.info-section {
margin-top: var(--spacing-lg);
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.detail-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--spacing-md);
}
.detail-item {
display: flex;
flex-direction: column;
gap: var(--spacing-xs);
}
.detail-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-weight: 500;
}
.detail-value {
color: var(--text-primary);
font-weight: 500;
word-break: break-all;
}
.mono {
font-family: var(--font-mono);
}
</style>
@@ -0,0 +1,549 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let targets = $state('google.com:443\ngithub.com:443\nstackoverflow.com:443');
let timeout = $state(5000);
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let copiedState = $state(false);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{
targets: 'google.com:443\ngithub.com:443\nstackoverflow.com:443',
description: 'Common HTTPS ports'
},
{
targets: 'smtp.gmail.com:587\nsmtp.gmail.com:465\nsmtp.gmail.com:25',
description: 'Gmail SMTP ports'
},
{
targets: 'dns.google:53\n1.1.1.1:53\n8.8.8.8:53',
description: 'DNS server ports'
},
{
targets: 'reddit.com:80\nreddit.com:443\napi.reddit.com:443',
description: 'HTTP vs HTTPS ports'
},
{
targets: 'localhost:22\nlocalhost:80\nlocalhost:443\nlocalhost:3306\nlocalhost:5432',
description: 'Local development ports'
},
{
targets: 'microsoft.com:443\noffice.com:443\noutlook.com:443',
description: 'Microsoft services'
}
];
const commonPorts = [
{ port: '22', service: 'SSH', description: 'Secure Shell' },
{ port: '80', service: 'HTTP', description: 'Web traffic' },
{ port: '443', service: 'HTTPS', description: 'Secure web traffic' },
{ port: '25', service: 'SMTP', description: 'Email sending' },
{ port: '587', service: 'SMTP', description: 'Email submission' },
{ port: '993', service: 'IMAPS', description: 'Secure IMAP' },
{ port: '995', service: 'POP3S', description: 'Secure POP3' },
{ port: '53', service: 'DNS', description: 'Domain resolution' }
];
// Reactive validation
const targetsList = $derived(() => {
return targets.split('\n')
.map(t => t.trim())
.filter(t => t)
.slice(0, 50); // Limit to 50 targets
});
const isInputValid = $derived(() => {
return targetsList.length > 0 &&
targetsList.every(target => /^[a-zA-Z0-9.-]+:\d+$/.test(target));
});
async function checkPorts() {
loading = true;
error = null;
results = null;
// Calculate targets list at function call time
const currentTargets = targets.split('\n')
.map(t => t.trim())
.filter(t => t)
.slice(0, 50);
try {
console.log('Sending targets:', currentTargets); // Debug log
const response = await fetch('/api/internal/diagnostics/network', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'tcp-port-check',
targets: currentTargets,
timeout
})
});
if (!response.ok) {
const errorText = await response.text();
try {
const errorData = JSON.parse(errorText);
throw new Error(errorData.message || `Port check failed (${response.status})`);
} catch (parseError) {
// If JSON parsing fails, use the raw error text or status
throw new Error(errorText || `Port check failed (${response.status})`);
}
}
results = await response.json();
} catch (err: any) {
error = err.message;
} finally {
loading = false;
}
}
function loadExample(example: typeof examples[0], index: number) {
targets = example.targets;
timeout = 5000;
selectedExampleIndex = index;
checkPorts();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function addCommonPort(port: string) {
const currentTargets = targets.trim();
const newTarget = `example.com:${port}`;
targets = currentTargets ? `${currentTargets}\n${newTarget}` : newTarget;
clearExampleSelection();
}
function getPortStatus(result: any): { icon: string, class: string, text: string } {
if (result.open) {
return {
icon: 'check-circle',
class: 'success',
text: `Open (${result.latency}ms)`
};
} else {
return {
icon: 'x-circle',
class: 'error',
text: result.error || 'Closed'
};
}
}
async function copyResults() {
if (!results) return;
let text = `TCP Port Check Results\n`;
text += `Generated at: ${new Date().toISOString()}\n\n`;
text += `Summary:\n`;
text += ` Total ports: ${results.summary.total}\n`;
text += ` Open: ${results.summary.open}\n`;
text += ` Closed: ${results.summary.closed}\n`;
if (results.summary.avgLatency) {
text += ` Average latency: ${results.summary.avgLatency}ms\n`;
}
text += `\nResults:\n`;
results.results.forEach((result: any) => {
const status = result.open ? `OPEN (${result.latency}ms)` : `CLOSED${result.error ? ` - ${result.error}` : ''}`;
text += ` ${result.host}:${result.port} - ${status}\n`;
});
await navigator.clipboard.writeText(text);
copiedState = true;
setTimeout(() => copiedState = false, 1500);
}
</script>
<div class="card">
<header class="card-header">
<h1>TCP Port Checker</h1>
<p>Test TCP connectivity to one or more host:port combinations. Attempts direct TCP connections to check if ports are open and measures connection latency.</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>Port Check Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Test ports: ${example.targets.split('\n').join(', ')}`}
>
<h5>{example.description}</h5>
<div class="example-targets">
{#each example.targets.split('\n').slice(0, 3) as target}
<span class="target-item mono">{target}</span>
{/each}
{#if example.targets.split('\n').length > 3}
<span class="more-targets">+{example.targets.split('\n').length - 3} more</span>
{/if}
</div>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>Port Check Configuration</h3>
</div>
<div class="card-content">
<div class="form-row">
<div class="form-group">
<label for="targets" use:tooltip={"Enter host:port combinations, one per line (max 50)"}>
Target Hosts & Ports
<textarea
id="targets"
bind:value={targets}
placeholder="google.com:443&#10;github.com:22&#10;example.com:80"
rows="6"
class:invalid={targets && !isInputValid}
onchange={() => { clearExampleSelection(); if (isInputValid) checkPorts(); }}
></textarea>
<div class="input-help">
<span class="target-count">{targetsList.length}/50 targets</span>
{#if targets && !isInputValid}
<span class="error-text">Use format: hostname:port (one per line)</span>
{/if}
</div>
</label>
</div>
</div>
<!-- Common Ports -->
<div class="form-row">
<div class="form-group">
<label>Common Ports</label>
<div class="port-shortcuts">
{#each commonPorts as port}
<button
type="button"
class="port-btn"
onclick={() => addCommonPort(port.port)}
use:tooltip={`${port.service}: ${port.description}`}
>
{port.port} ({port.service})
</button>
{/each}
</div>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="timeout" use:tooltip={"Connection timeout in milliseconds"}>
Timeout (ms)
<input
id="timeout"
type="number"
bind:value={timeout}
min="1000"
max="30000"
step="1000"
onchange={() => { clearExampleSelection(); if (isInputValid) checkPorts(); }}
/>
</label>
</div>
</div>
<div class="action-section">
<button class="lookup-btn" onclick={checkPorts} disabled={loading || !isInputValid}>
{#if loading}
<Icon name="loader-2" size="sm" animate="spin" />
Checking Ports...
{:else}
<Icon name="activity" size="sm" />
Check Ports
{/if}
</button>
</div>
</div>
</div>
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header row">
<h3>Port Check Results</h3>
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" />
{copiedState ? "Copied!" : "Copy Results"}
</button>
</div>
<div class="card-content">
<!-- Summary -->
<div class="status-overview">
<div class="status-item success">
<Icon name="check-circle" size="sm" />
<div>
<span class="status-title">{results.summary.open} Open</span>
<p class="status-desc">Ports accepting connections</p>
</div>
</div>
<div class="status-item error">
<Icon name="x-circle" size="sm" />
<div>
<span class="status-title">{results.summary.closed} Closed</span>
<p class="status-desc">Ports not responding</p>
</div>
</div>
{#if results.summary.avgLatency}
<div class="status-item">
<Icon name="zap" size="sm" />
<div>
<span class="status-title">{results.summary.avgLatency}ms</span>
<p class="status-desc">Average latency</p>
</div>
</div>
{/if}
</div>
<!-- Detailed Results -->
<div class="ports-section">
<h4>Port Status ({results.results.length} targets)</h4>
<div class="ports-list">
{#each results.results as result}
{@const status = getPortStatus(result)}
<div class="port-result {status.class}">
<div class="port-header">
<div class="port-target">
<Icon name={status.icon} size="sm" />
<span class="host-port mono">{result.host}:{result.port}</span>
</div>
<span class="port-status">{status.text}</span>
</div>
{#if result.error && !result.open}
<div class="port-error">
<span class="error-detail">{result.error}</span>
</div>
{/if}
</div>
{/each}
</div>
</div>
</div>
</div>
{/if}
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>Port Check Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
<!-- Educational Content -->
<div class="card info-card">
<div class="card-header">
<h3>Understanding TCP Port Connectivity</h3>
</div>
<div class="card-content">
<div class="info-grid">
<div class="info-section">
<h4>Port States</h4>
<ul>
<li><strong>Open:</strong> Port accepts connections and responds</li>
<li><strong>Closed:</strong> Port actively refuses connections</li>
<li><strong>Filtered:</strong> Port blocked by firewall (appears as timeout)</li>
<li><strong>Timeout:</strong> No response within timeout period</li>
</ul>
</div>
<div class="info-section">
<h4>Common Ports</h4>
<ul>
<li><strong>SSH (22):</strong> Secure remote access</li>
<li><strong>HTTP (80):</strong> Web traffic</li>
<li><strong>HTTPS (443):</strong> Secure web traffic</li>
<li><strong>SMTP (25/587):</strong> Email sending</li>
</ul>
</div>
<div class="info-section">
<h4>Troubleshooting Tips</h4>
<ul>
<li>Timeouts often indicate firewall blocking</li>
<li>Connection refused means service is not running</li>
<li>Check both client and server firewalls</li>
<li>Verify service is listening on expected port</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<style lang="scss">
.example-targets {
display: flex;
flex-direction: column;
gap: 2px;
margin-top: var(--spacing-xs);
}
.target-item {
background: var(--bg-tertiary);
padding: 2px var(--spacing-xs);
border-radius: var(--radius-xs);
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.more-targets {
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-style: italic;
}
.input-help {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: var(--spacing-xs);
}
.target-count {
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.port-shortcuts {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-xs);
margin-top: var(--spacing-xs);
}
.port-btn {
font-size: var(--font-size-xs);
padding: var(--spacing-xs) var(--spacing-sm);
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-sm);
color: var(--text-primary);
cursor: pointer;
transition: all var(--transition-fast);
&:hover {
background: var(--color-primary);
color: var(--bg-primary);
border-color: var(--color-primary);
}
}
.status-title {
font-weight: 600;
color: var(--text-primary);
}
.status-desc {
font-size: var(--font-size-xs);
margin: 2px 0 0 0;
opacity: 0.8;
}
.ports-section {
margin: var(--spacing-lg) 0;
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.ports-list {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.port-result {
border: 1px solid var(--border-primary);
border-radius: var(--radius-sm);
padding: var(--spacing-md);
&.success {
border-left: 4px solid var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 97%);
}
&.error {
border-left: 4px solid var(--color-error);
background: color-mix(in srgb, var(--color-error), transparent 97%);
}
}
.port-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-xs);
}
.port-target {
display: flex;
align-items: center;
gap: var(--spacing-sm);
}
.host-port {
font-weight: 600;
color: var(--text-primary);
}
.port-status {
font-size: var(--font-size-sm);
font-weight: 500;
color: var(--text-primary);
}
.port-error {
margin-top: var(--spacing-xs);
padding: var(--spacing-xs);
background: color-mix(in srgb, var(--color-error), transparent 90%);
border-radius: var(--radius-xs);
border-left: 3px solid var(--color-error);
}
.error-detail {
font-size: var(--font-size-xs);
color: var(--text-primary);
font-family: var(--font-mono);
}
.mono {
font-family: var(--font-mono);
}
textarea {
resize: vertical;
min-height: 120px;
}
</style>
@@ -0,0 +1,623 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let host = $state('google.com:443');
let servername = $state('');
let useCustomServername = $state(false);
let protocols = $state('h2,http/1.1');
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let copiedState = $state(false);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ host: 'google.com:443', protocols: 'h2,http/1.1', description: 'Google HTTP/2 support' },
{ host: 'github.com:443', protocols: 'h2,http/1.1', description: 'GitHub ALPN negotiation' },
{ host: 'cloudflare.com:443', protocols: 'h2,http/1.1,h3', description: 'Cloudflare HTTP/3 support' },
{ host: 'wikipedia.org:443', protocols: 'h2,http/1.1', description: 'Wikipedia HTTP/2 support' },
{ host: 'cdn.jsdelivr.net:443', protocols: 'h2,http/1.1', description: 'CDN ALPN support' },
{ host: 'api.github.com:443', protocols: 'h2,http/1.1', description: 'API server ALPN' }
];
const commonProtocols = [
{ value: 'h2,http/1.1', label: 'HTTP/2 + HTTP/1.1', description: 'Standard web protocols' },
{ value: 'h3,h2,http/1.1', label: 'HTTP/3 + HTTP/2 + HTTP/1.1', description: 'Including experimental HTTP/3' },
{ value: 'h2', label: 'HTTP/2 only', description: 'Test HTTP/2 exclusively' },
{ value: 'http/1.1', label: 'HTTP/1.1 only', description: 'Fallback protocol only' }
];
// Reactive validation
const isInputValid = $derived(() => {
const trimmedHost = host.trim();
if (!trimmedHost) return false;
return /^[a-zA-Z0-9.-]+(?::\d+)?$/.test(trimmedHost);
});
const protocolsArray = $derived(() => {
return protocols.split(',').map(p => p.trim()).filter(p => p);
});
async function probeALPN() {
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/tls', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'alpn',
host: host.trim(),
protocols: protocolsArray,
servername: useCustomServername && servername ? servername.trim() : undefined
})
});
if (!response.ok) {
const errorText = await response.text();
try {
const errorData = JSON.parse(errorText);
throw new Error(errorData.message || `ALPN probe failed (${response.status})`);
} catch {
throw new Error(`ALPN probe failed (${response.status})`);
}
}
results = await response.json();
} catch (err: any) {
error = err.message;
} finally {
loading = false;
}
}
function loadExample(example: typeof examples[0], index: number) {
host = example.host;
protocols = example.protocols;
servername = '';
useCustomServername = false;
selectedExampleIndex = index;
probeALPN();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function setCommonProtocols(protocolSet: string) {
protocols = protocolSet;
clearExampleSelection();
if (isInputValid) probeALPN();
}
function getProtocolInfo(protocol: string): { name: string, description: string, version: string } {
switch (protocol) {
case 'h3':
return { name: 'HTTP/3', description: 'Latest HTTP version over QUIC', version: 'HTTP/3' };
case 'h2':
return { name: 'HTTP/2', description: 'Binary, multiplexed HTTP protocol', version: 'HTTP/2' };
case 'http/1.1':
return { name: 'HTTP/1.1', description: 'Traditional HTTP protocol', version: 'HTTP/1.1' };
case 'http/1.0':
return { name: 'HTTP/1.0', description: 'Legacy HTTP protocol', version: 'HTTP/1.0' };
default:
return { name: protocol, description: 'Custom or unknown protocol', version: protocol };
}
}
function getNegotiationStatus(): { status: string, icon: string, class: string, description: string } {
if (!results) return { status: 'Unknown', icon: 'help-circle', class: 'secondary', description: 'No results available' };
if (results.success && results.negotiatedProtocol) {
const protocol = getProtocolInfo(results.negotiatedProtocol);
return {
status: 'Successful',
icon: 'check-circle',
class: 'success',
description: `Server selected ${protocol.name}`
};
} else if (!results.success) {
return {
status: 'Failed',
icon: 'x-circle',
class: 'error',
description: 'No protocol was negotiated'
};
} else {
return {
status: 'No Selection',
icon: 'minus-circle',
class: 'warning',
description: 'Server did not select any protocol'
};
}
}
async function copyALPNInfo() {
if (!results) return;
let text = `ALPN Negotiation Results for ${host}\n`;
text += `Generated at: ${new Date().toISOString()}\n\n`;
text += `Requested Protocols: ${results.requestedProtocols.join(', ')}\n`;
text += `Negotiated Protocol: ${results.negotiatedProtocol || 'None'}\n`;
text += `TLS Version: ${results.tlsVersion || 'Unknown'}\n`;
text += `Success: ${results.success ? 'Yes' : 'No'}\n`;
const status = getNegotiationStatus();
text += `\nNegotiation Status: ${status.status}\n`;
text += `Description: ${status.description}\n`;
if (results.negotiatedProtocol) {
const protocolInfo = getProtocolInfo(results.negotiatedProtocol);
text += `\nSelected Protocol Info:\n`;
text += ` Name: ${protocolInfo.name}\n`;
text += ` Description: ${protocolInfo.description}\n`;
}
await navigator.clipboard.writeText(text);
copiedState = true;
setTimeout(() => copiedState = false, 1500);
}
</script>
<div class="card">
<header class="card-header">
<h1>TLS ALPN Negotiation</h1>
<p>Test Application-Layer Protocol Negotiation (ALPN) to see which protocol a server selects from your offered list. Commonly used to negotiate HTTP/2, HTTP/3, or other application protocols during TLS handshake.</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>ALPN Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Test ALPN for ${example.host} (${example.description})`}
>
<h5>{example.host}</h5>
<p>{example.description}</p>
<div class="example-protocols mono">{example.protocols}</div>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>ALPN Negotiation Configuration</h3>
</div>
<div class="card-content">
<div class="form-row">
<div class="form-group">
<label for="host" use:tooltip={"Enter hostname:port (e.g., google.com:443)"}>
Host:Port
<input
id="host"
type="text"
bind:value={host}
placeholder="google.com:443"
class:invalid={host && !isInputValid}
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
/>
{#if host && !isInputValid}
<span class="error-text">Invalid host:port format</span>
{/if}
</label>
</div>
</div>
<!-- Protocol Selection -->
<div class="form-row">
<div class="form-group">
<label for="protocols" use:tooltip={"Comma-separated list of protocols to offer (e.g., h2,http/1.1)"}>
ALPN Protocols
<input
id="protocols"
type="text"
bind:value={protocols}
placeholder="h2,http/1.1"
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
/>
</label>
<div class="protocol-presets">
<span class="preset-label">Quick select:</span>
{#each commonProtocols as preset}
<button
type="button"
class="preset-btn"
onclick={() => setCommonProtocols(preset.value)}
use:tooltip={preset.description}
>
{preset.label}
</button>
{/each}
</div>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="checkbox-group">
<input
type="checkbox"
bind:checked={useCustomServername}
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
/>
Use custom SNI servername
</label>
{#if useCustomServername}
<input
type="text"
bind:value={servername}
placeholder="example.com"
use:tooltip={"Custom servername for SNI (Server Name Indication)"}
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
/>
{/if}
</div>
</div>
<div class="action-section">
<button class="lookup-btn" onclick={probeALPN} disabled={loading || !isInputValid}>
{#if loading}
<Icon name="loader-2" size="sm" class="animate-spin" />
Testing ALPN...
{:else}
<Icon name="shuffle" size="sm" />
Test ALPN Negotiation
{/if}
</button>
</div>
</div>
</div>
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header row">
<h3>ALPN Negotiation Results</h3>
<button class="copy-btn" onclick={copyALPNInfo} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" />
{copiedState ? "Copied!" : "Copy Results"}
</button>
</div>
<div class="card-content">
<!-- Negotiation Overview -->
{#if results}
{@const status = getNegotiationStatus()}
<div class="status-overview">
<div class="status-item {status.class}">
<Icon name={status.icon} size="sm" />
<div>
<span class="status-title">Negotiation: {status.status}</span>
<p class="status-desc">{status.description}</p>
</div>
</div>
{#if results.tlsVersion}
<div class="status-item success">
<Icon name="shield-check" size="sm" />
<div>
<span class="status-title">TLS Version: {results.tlsVersion}</span>
<p class="status-desc">Connection established successfully</p>
</div>
</div>
{/if}
</div>
{/if}
<!-- Protocol Details -->
<div class="protocols-section">
<h4>Protocol Negotiation Details</h4>
<div class="protocol-details">
<div class="detail-section">
<h5>Requested Protocols</h5>
<div class="protocol-list">
{#each results.requestedProtocols as protocol, i}
{@const protocolInfo = getProtocolInfo(protocol)}
<div class="protocol-item requested">
<div class="protocol-header">
<span class="protocol-name">{protocolInfo.name}</span>
<span class="protocol-id mono">({protocol})</span>
<span class="protocol-priority">Priority {i + 1}</span>
</div>
<p class="protocol-desc">{protocolInfo.description}</p>
</div>
{/each}
</div>
</div>
{#if results.negotiatedProtocol}
{@const selectedProtocol = getProtocolInfo(results.negotiatedProtocol)}
<div class="detail-section">
<h5>Selected Protocol</h5>
<div class="selected-protocol">
<div class="protocol-item selected">
<div class="protocol-header">
<Icon name="check-circle" size="sm" class="success-icon" />
<span class="protocol-name">{selectedProtocol.name}</span>
<span class="protocol-id mono">({results.negotiatedProtocol})</span>
</div>
<p class="protocol-desc">{selectedProtocol.description}</p>
</div>
</div>
</div>
{:else}
<div class="detail-section">
<h5>Selected Protocol</h5>
<div class="no-selection">
<Icon name="x-circle" size="sm" />
<span>No protocol was selected by the server</span>
</div>
</div>
{/if}
</div>
</div>
<!-- Connection Info -->
{#if results.servername || results.tlsVersion}
<div class="connection-section">
<h4>Connection Information</h4>
<div class="detail-grid">
<div class="detail-item">
<span class="detail-label">Server Name:</span>
<span class="detail-value mono">{results.servername}</span>
</div>
{#if results.tlsVersion}
<div class="detail-item">
<span class="detail-label">TLS Version:</span>
<span class="detail-value">{results.tlsVersion}</span>
</div>
{/if}
</div>
</div>
{/if}
</div>
</div>
{/if}
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>ALPN Negotiation Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
<!-- Educational Content -->
<div class="card info-card">
<div class="card-header">
<h3>Understanding ALPN</h3>
</div>
<div class="card-content">
<div class="info-grid">
<div class="info-section">
<h4>What is ALPN?</h4>
<p>Application-Layer Protocol Negotiation (ALPN) is a TLS extension that allows the client and server to negotiate which application protocol to use during the TLS handshake.</p>
</div>
<div class="info-section">
<h4>Common Protocols</h4>
<ul>
<li><strong>h2:</strong> HTTP/2 - Binary, multiplexed protocol</li>
<li><strong>h3:</strong> HTTP/3 - Latest HTTP over QUIC</li>
<li><strong>http/1.1:</strong> Traditional HTTP/1.1</li>
<li><strong>spdy/3.1:</strong> Legacy SPDY protocol</li>
</ul>
</div>
<div class="info-section">
<h4>Protocol Priority</h4>
<p>Protocols are offered in preference order. The server selects the first protocol from your list that it supports. Order matters!</p>
</div>
</div>
</div>
</div>
</div>
<style lang="scss">
.example-protocols {
font-size: var(--font-size-xs);
color: var(--text-secondary);
margin-top: var(--spacing-xs);
background: var(--bg-tertiary);
padding: 2px var(--spacing-xs);
border-radius: var(--radius-xs);
}
.protocol-presets {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--spacing-xs);
margin-top: var(--spacing-xs);
}
.preset-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
margin-right: var(--spacing-xs);
}
.preset-btn {
font-size: var(--font-size-xs);
padding: 2px var(--spacing-xs);
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-xs);
color: var(--text-primary);
cursor: pointer;
transition: all var(--transition-fast);
&:hover {
background: var(--color-primary);
color: var(--bg-primary);
border-color: var(--color-primary);
}
}
.status-title {
font-weight: 600;
color: var(--text-primary);
}
.status-desc {
font-size: var(--font-size-xs);
margin: 2px 0 0 0;
opacity: 0.8;
}
.protocols-section {
margin: var(--spacing-lg) 0;
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.protocol-details {
display: flex;
flex-direction: column;
gap: var(--spacing-lg);
}
.detail-section {
h5 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
font-size: var(--font-size-md);
}
}
.protocol-list {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.protocol-item {
border: 1px solid var(--border-primary);
border-radius: var(--radius-sm);
padding: var(--spacing-md);
&.requested {
background: var(--bg-secondary);
}
&.selected {
background: color-mix(in srgb, var(--color-success), transparent 95%);
border-color: var(--color-success);
}
}
.protocol-header {
display: flex;
align-items: center;
gap: var(--spacing-sm);
margin-bottom: var(--spacing-xs);
}
.protocol-name {
font-weight: 600;
color: var(--text-primary);
}
.protocol-id {
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.protocol-priority {
font-size: var(--font-size-xs);
background: var(--bg-tertiary);
padding: 2px var(--spacing-xs);
border-radius: var(--radius-xs);
color: var(--text-secondary);
margin-left: auto;
}
.protocol-desc {
margin: 0;
font-size: var(--font-size-xs);
color: var(--text-secondary);
line-height: 1.4;
}
.selected-protocol {
.success-icon {
color: var(--color-success);
}
}
.no-selection {
display: flex;
align-items: center;
gap: var(--spacing-sm);
padding: var(--spacing-md);
background: color-mix(in srgb, var(--color-error), transparent 95%);
border: 1px solid var(--color-error);
border-radius: var(--radius-sm);
color: var(--color-error);
}
.connection-section {
margin-top: var(--spacing-lg);
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.detail-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--spacing-md);
}
.detail-item {
display: flex;
flex-direction: column;
gap: var(--spacing-xs);
}
.detail-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-weight: 500;
}
.detail-value {
color: var(--text-primary);
font-weight: 500;
}
.mono {
font-family: var(--font-mono);
}
</style>
@@ -0,0 +1,503 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let host = $state('google.com:443');
let servername = $state('');
let useCustomServername = $state(false);
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let copiedState = $state(false);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ host: 'google.com:443', description: 'Google TLS certificate' },
{ host: 'github.com:443', description: 'GitHub certificate chain' },
{ host: 'cloudflare.com:443', description: 'Cloudflare certificate' },
{ host: 'wikipedia.org:443', description: 'Wikipedia certificate' },
{ host: 'stackoverflow.com:443', description: 'Stack Overflow certificate' },
{ host: 'microsoft.com:443', description: 'Microsoft certificate' }
];
// Reactive validation
const isInputValid = $derived(() => {
const trimmedHost = host.trim();
if (!trimmedHost) return false;
// Basic host:port validation
return /^[a-zA-Z0-9.-]+(?::\d+)?$/.test(trimmedHost);
});
async function analyzeCertificate() {
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/tls', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'certificate',
host: host.trim(),
servername: useCustomServername && servername ? servername.trim() : undefined
})
});
if (!response.ok) {
const errorText = await response.text();
try {
const errorData = JSON.parse(errorText);
throw new Error(errorData.message || `Certificate analysis failed (${response.status})`);
} catch {
throw new Error(`Certificate analysis failed (${response.status})`);
}
}
results = await response.json();
} catch (err: any) {
error = err.message;
} finally {
loading = false;
}
}
function loadExample(example: typeof examples[0], index: number) {
host = example.host;
servername = '';
useCustomServername = false;
selectedExampleIndex = index;
analyzeCertificate();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function getExpiryStatus(cert: any): { status: string, icon: string, class: string } {
if (cert.isExpired) {
return { status: 'Expired', icon: 'x-circle', class: 'error' };
}
if (cert.daysUntilExpiry <= 7) {
return { status: `Expires in ${cert.daysUntilExpiry} days`, icon: 'alert-triangle', class: 'error' };
}
if (cert.daysUntilExpiry <= 30) {
return { status: `Expires in ${cert.daysUntilExpiry} days`, icon: 'alert-triangle', class: 'warning' };
}
return { status: `Valid for ${cert.daysUntilExpiry} days`, icon: 'check-circle', class: 'success' };
}
async function copyCertificateInfo() {
if (!results?.peerCertificate) return;
const cert = results.peerCertificate;
let text = `TLS Certificate Analysis for ${host}\n`;
text += `Generated at: ${new Date().toISOString()}\n\n`;
text += `Subject: ${cert.subject.CN}\n`;
text += `Issuer: ${cert.issuer.CN}\n`;
text += `Valid From: ${cert.validFrom}\n`;
text += `Valid To: ${cert.validTo}\n`;
text += `Days Until Expiry: ${cert.daysUntilExpiry}\n`;
text += `Serial Number: ${cert.serialNumber}\n`;
text += `Fingerprint (SHA1): ${cert.fingerprint}\n`;
text += `Fingerprint (SHA256): ${cert.fingerprint256}\n`;
if (cert.subjectAltNames.length > 0) {
text += `\nSubject Alternative Names:\n`;
cert.subjectAltNames.forEach((san: string) => {
text += ` ${san}\n`;
});
}
await navigator.clipboard.writeText(text);
copiedState = true;
setTimeout(() => copiedState = false, 1500);
}
</script>
<div class="card">
<header class="card-header">
<h1>TLS Certificate Analyzer</h1>
<p>Analyze TLS certificates, view certificate chains, check expiration dates, and examine Subject Alternative Names (SANs). Supports custom SNI servername for multi-domain certificates.</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>Certificate Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Analyze certificate for ${example.host} (${example.description})`}
>
<h5>{example.host}</h5>
<p>{example.description}</p>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>Certificate Analysis Configuration</h3>
</div>
<div class="card-content">
<div class="form-row">
<div class="form-group">
<label for="host" use:tooltip={"Enter hostname:port (e.g., google.com:443)"}>
Host:Port
<input
id="host"
type="text"
bind:value={host}
placeholder="google.com:443"
class:invalid={host && !isInputValid}
onchange={() => { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }}
/>
{#if host && !isInputValid}
<span class="error-text">Invalid host:port format</span>
{/if}
</label>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="checkbox-group">
<input
type="checkbox"
bind:checked={useCustomServername}
onchange={() => { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }}
/>
Use custom SNI servername
</label>
{#if useCustomServername}
<input
type="text"
bind:value={servername}
placeholder="example.com"
use:tooltip={"Custom servername for SNI (Server Name Indication)"}
onchange={() => { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }}
/>
{/if}
</div>
</div>
<div class="action-section">
<button class="lookup-btn" onclick={analyzeCertificate} disabled={loading || !isInputValid}>
{#if loading}
<Icon name="loader-2" size="sm" class="animate-spin" />
Analyzing Certificate...
{:else}
<Icon name="shield-check" size="sm" />
Analyze Certificate
{/if}
</button>
</div>
</div>
</div>
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header row">
<h3>Certificate Analysis Results</h3>
<button class="copy-btn" onclick={copyCertificateInfo} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" />
{copiedState ? "Copied!" : "Copy Certificate Info"}
</button>
</div>
<div class="card-content">
<!-- Certificate Overview -->
{#if results.peerCertificate}
{@const cert = results.peerCertificate}
{@const expiryStatus = getExpiryStatus(cert)}
<div class="cert-overview">
<div class="status-overview">
<div class="status-item {expiryStatus.class}">
<Icon name={expiryStatus.icon} size="sm" />
<span>{expiryStatus.status}</span>
</div>
<div class="status-item {cert.isNotYetValid ? 'warning' : 'success'}">
<Icon name={cert.isNotYetValid ? "clock" : "calendar"} size="sm" />
<span>{cert.isNotYetValid ? 'Not yet valid' : 'Currently valid'}</span>
</div>
</div>
<!-- Certificate Details -->
<div class="cert-details">
<div class="detail-section">
<h4>Certificate Information</h4>
<div class="detail-grid">
<div class="detail-item">
<span class="detail-label">Common Name:</span>
<span class="detail-value mono">{cert.subject.CN}</span>
</div>
<div class="detail-item">
<span class="detail-label">Organization:</span>
<span class="detail-value">{cert.subject.O || 'N/A'}</span>
</div>
<div class="detail-item">
<span class="detail-label">Issuer:</span>
<span class="detail-value">{cert.issuer.CN}</span>
</div>
<div class="detail-item">
<span class="detail-label">Serial Number:</span>
<span class="detail-value mono">{cert.serialNumber}</span>
</div>
<div class="detail-item">
<span class="detail-label">Valid From:</span>
<span class="detail-value">{new Date(cert.validFrom).toLocaleString()}</span>
</div>
<div class="detail-item">
<span class="detail-label">Valid To:</span>
<span class="detail-value">{new Date(cert.validTo).toLocaleString()}</span>
</div>
</div>
</div>
<!-- Subject Alternative Names -->
{#if cert.subjectAltNames?.length > 0}
<div class="detail-section">
<h4>Subject Alternative Names</h4>
<div class="san-list">
{#each cert.subjectAltNames as san}
<span class="san-item mono">{san}</span>
{/each}
</div>
</div>
{/if}
<!-- Fingerprints -->
<div class="detail-section">
<h4>Fingerprints</h4>
<div class="detail-grid">
<div class="detail-item">
<span class="detail-label">SHA1:</span>
<span class="detail-value mono">{cert.fingerprint}</span>
</div>
<div class="detail-item">
<span class="detail-label">SHA256:</span>
<span class="detail-value mono">{cert.fingerprint256}</span>
</div>
</div>
</div>
</div>
</div>
{/if}
<!-- Certificate Chain -->
{#if results.chain?.length > 0}
<div class="chain-section">
<h4>Certificate Chain ({results.chain.length} certificates)</h4>
<div class="chain-list">
{#each results.chain as chainCert, i}
<div class="chain-item">
<div class="chain-header">
<span class="chain-level">Level {i}</span>
<span class="chain-cn mono">{chainCert.subject.CN}</span>
</div>
<div class="chain-details">
<span>Issuer: {chainCert.issuer.CN}</span>
<span>Expires: {new Date(chainCert.validTo).toLocaleDateString()}</span>
</div>
</div>
{/each}
</div>
</div>
{/if}
<!-- Connection Details -->
{#if results.protocol || results.cipher || results.alpnProtocol}
<div class="connection-section">
<h4>Connection Details</h4>
<div class="detail-grid">
{#if results.protocol}
<div class="detail-item">
<span class="detail-label">TLS Version:</span>
<span class="detail-value">{results.protocol}</span>
</div>
{/if}
{#if results.cipher}
<div class="detail-item">
<span class="detail-label">Cipher Suite:</span>
<span class="detail-value">{results.cipher.name}</span>
</div>
{/if}
{#if results.alpnProtocol}
<div class="detail-item">
<span class="detail-label">ALPN Protocol:</span>
<span class="detail-value">{results.alpnProtocol}</span>
</div>
{/if}
</div>
</div>
{/if}
</div>
</div>
{/if}
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>Certificate Analysis Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
</div>
<style lang="scss">
.cert-overview {
display: flex;
flex-direction: column;
gap: var(--spacing-lg);
}
.cert-details {
display: flex;
flex-direction: column;
gap: var(--spacing-lg);
}
.detail-section {
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.detail-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: var(--spacing-md);
}
.detail-item {
display: flex;
flex-direction: column;
gap: var(--spacing-xs);
}
.detail-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-weight: 500;
}
.detail-value {
color: var(--text-primary);
word-break: break-all;
&.mono {
font-family: var(--font-mono);
}
}
.san-list {
display: flex;
flex-wrap: wrap;
gap: var(--spacing-xs);
}
.san-item {
background: var(--bg-secondary);
padding: var(--spacing-xs) var(--spacing-sm);
border-radius: var(--radius-sm);
border: 1px solid var(--border-primary);
font-size: var(--font-size-xs);
color: var(--text-primary);
}
.chain-section {
margin-top: var(--spacing-lg);
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.chain-list {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.chain-item {
background: var(--bg-secondary);
border: 1px solid var(--border-primary);
border-radius: var(--radius-sm);
padding: var(--spacing-md);
}
.chain-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-xs);
}
.chain-level {
background: var(--color-primary);
color: var(--bg-primary);
padding: 2px var(--spacing-xs);
border-radius: var(--radius-xs);
font-size: var(--font-size-xs);
font-weight: 500;
}
.chain-cn {
font-weight: 500;
color: var(--text-primary);
}
.chain-details {
display: flex;
flex-direction: column;
gap: 2px;
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.connection-section {
margin-top: var(--spacing-lg);
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.error-text {
color: var(--color-error);
font-size: var(--font-size-xs);
margin-top: var(--spacing-xs);
}
.mono {
font-family: var(--font-mono);
}
</style>
@@ -0,0 +1,544 @@
<script lang="ts">
import { tooltip } from '$lib/actions/tooltip.js';
import Icon from '$lib/components/global/Icon.svelte';
import '../../../../styles/diagnostics-pages.scss';
let host = $state('google.com:443');
let servername = $state('');
let useCustomServername = $state(false);
let loading = $state(false);
let results = $state<any>(null);
let error = $state<string | null>(null);
let copiedState = $state(false);
let selectedExampleIndex = $state<number | null>(null);
const examples = [
{ host: 'google.com:443', description: 'Google TLS version support' },
{ host: 'github.com:443', description: 'GitHub TLS versions' },
{ host: 'cloudflare.com:443', description: 'Cloudflare TLS support' },
{ host: 'microsoft.com:443', description: 'Microsoft TLS versions' },
{ host: 'amazon.com:443', description: 'Amazon TLS configuration' },
{ host: 'facebook.com:443', description: 'Facebook TLS versions' }
];
const tlsVersions = [
{ version: 'TLSv1', name: 'TLS 1.0', deprecated: true },
{ version: 'TLSv1.1', name: 'TLS 1.1', deprecated: true },
{ version: 'TLSv1.2', name: 'TLS 1.2', deprecated: false },
{ version: 'TLSv1.3', name: 'TLS 1.3', deprecated: false }
];
// Reactive validation
const isInputValid = $derived(() => {
const trimmedHost = host.trim();
if (!trimmedHost) return false;
return /^[a-zA-Z0-9.-]+(?::\d+)?$/.test(trimmedHost);
});
async function probeTLSVersions() {
loading = true;
error = null;
results = null;
try {
const response = await fetch('/api/internal/diagnostics/tls', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'versions',
host: host.trim(),
servername: useCustomServername && servername ? servername.trim() : undefined
})
});
if (!response.ok) {
const errorText = await response.text();
try {
const errorData = JSON.parse(errorText);
throw new Error(errorData.message || `TLS versions probe failed (${response.status})`);
} catch {
throw new Error(`TLS versions probe failed (${response.status})`);
}
}
results = await response.json();
} catch (err: any) {
error = err.message;
} finally {
loading = false;
}
}
function loadExample(example: typeof examples[0], index: number) {
host = example.host;
servername = '';
useCustomServername = false;
selectedExampleIndex = index;
probeTLSVersions();
}
function clearExampleSelection() {
selectedExampleIndex = null;
}
function getVersionStatus(version: string, supported: boolean, deprecated: boolean): { status: string, icon: string, class: string } {
if (!supported) {
return { status: 'Not Supported', icon: 'x-circle', class: 'error' };
}
if (deprecated) {
return { status: 'Supported (Deprecated)', icon: 'alert-triangle', class: 'warning' };
}
return { status: 'Supported', icon: 'check-circle', class: 'success' };
}
function getOverallSecurity(): { level: string, class: string, icon: string, description: string } {
if (!results) return { level: 'Unknown', class: 'secondary', icon: 'help-circle', description: 'No results available' };
const supportedVersions = results.supportedVersions || [];
const hasDeprecated = supportedVersions.some((v: string) => v === 'TLSv1' || v === 'TLSv1.1');
const hasModern = supportedVersions.includes('TLSv1.3');
const hasSecure = supportedVersions.includes('TLSv1.2');
if (hasModern && hasSecure && !hasDeprecated) {
return { level: 'Excellent', class: 'success', icon: 'shield-check', description: 'Only modern TLS versions supported' };
}
if (hasSecure && !hasDeprecated) {
return { level: 'Good', class: 'success', icon: 'shield', description: 'Secure TLS versions only' };
}
if (hasDeprecated && hasSecure) {
return { level: 'Warning', class: 'warning', icon: 'shield-alert', description: 'Deprecated versions still supported' };
}
if (supportedVersions.length === 0) {
return { level: 'Critical', class: 'error', icon: 'shield-off', description: 'No TLS versions detected' };
}
return { level: 'Poor', class: 'error', icon: 'shield-x', description: 'Only deprecated versions supported' };
}
async function copyVersionsInfo() {
if (!results) return;
let text = `TLS Versions Analysis for ${host}\n`;
text += `Generated at: ${new Date().toISOString()}\n\n`;
text += `Supported Versions (${results.totalSupported}):\n`;
tlsVersions.forEach(tlsVer => {
const supported = results.supported[tlsVer.version];
text += ` ${tlsVer.name} (${tlsVer.version}): ${supported ? 'Supported' : 'Not Supported'}`;
if (supported && tlsVer.deprecated) {
text += ' (DEPRECATED)';
}
text += '\n';
});
const security = getOverallSecurity();
text += `\nSecurity Level: ${security.level}\n`;
text += `Description: ${security.description}\n`;
if (results.minVersion || results.maxVersion) {
text += `\nVersion Range:\n`;
text += ` Minimum: ${results.minVersion || 'Unknown'}\n`;
text += ` Maximum: ${results.maxVersion || 'Unknown'}\n`;
}
await navigator.clipboard.writeText(text);
copiedState = true;
setTimeout(() => copiedState = false, 1500);
}
</script>
<div class="card">
<header class="card-header">
<h1>TLS Versions Probe</h1>
<p>Test which TLS protocol versions a server supports by attempting connections with different TLS version constraints. Identify deprecated versions and assess overall TLS security posture.</p>
</header>
<!-- Examples -->
<div class="card examples-card">
<details class="examples-details">
<summary class="examples-summary">
<Icon name="chevron-right" size="xs" />
<h4>TLS Version Examples</h4>
</summary>
<div class="examples-grid">
{#each examples as example, i}
<button
class="example-card"
class:selected={selectedExampleIndex === i}
onclick={() => loadExample(example, i)}
use:tooltip={`Probe TLS versions for ${example.host} (${example.description})`}
>
<h5>{example.host}</h5>
<p>{example.description}</p>
</button>
{/each}
</div>
</details>
</div>
<!-- Input Form -->
<div class="card input-card">
<div class="card-header">
<h3>TLS Versions Probe Configuration</h3>
</div>
<div class="card-content">
<div class="form-row">
<div class="form-group">
<label for="host" use:tooltip={"Enter hostname:port (e.g., google.com:443)"}>
Host:Port
<input
id="host"
type="text"
bind:value={host}
placeholder="google.com:443"
class:invalid={host && !isInputValid}
onchange={() => { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }}
/>
{#if host && !isInputValid}
<span class="error-text">Invalid host:port format</span>
{/if}
</label>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label class="checkbox-group">
<input
type="checkbox"
bind:checked={useCustomServername}
onchange={() => { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }}
/>
Use custom SNI servername
</label>
{#if useCustomServername}
<input
type="text"
bind:value={servername}
placeholder="example.com"
use:tooltip={"Custom servername for SNI (Server Name Indication)"}
onchange={() => { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }}
/>
{/if}
</div>
</div>
<div class="action-section">
<button class="lookup-btn" onclick={probeTLSVersions} disabled={loading || !isInputValid}>
{#if loading}
<Icon name="loader-2" size="sm" class="animate-spin" />
Probing TLS Versions...
{:else}
<Icon name="search" size="sm" />
Probe TLS Versions
{/if}
</button>
</div>
</div>
</div>
<!-- Results -->
{#if results}
<div class="card results-card">
<div class="card-header row">
<h3>TLS Versions Probe Results</h3>
<button class="copy-btn" onclick={copyVersionsInfo} disabled={copiedState}>
<Icon name={copiedState ? "check" : "copy"} size="xs" />
{copiedState ? "Copied!" : "Copy Results"}
</button>
</div>
<div class="card-content">
<!-- Security Overview -->
{#if results.supported}
{@const security = getOverallSecurity()}
<div class="security-overview">
<div class="status-overview">
<div class="status-item {security.class}">
<Icon name={security.icon} size="sm" />
<div>
<span class="status-title">Security Level: {security.level}</span>
<p class="status-desc">{security.description}</p>
</div>
</div>
<div class="status-item success">
<Icon name="check-square" size="sm" />
<div>
<span class="status-title">{results.totalSupported} Versions Supported</span>
<p class="status-desc">Out of {tlsVersions.length} tested</p>
</div>
</div>
</div>
</div>
<!-- Version Details -->
<div class="versions-section">
<h4>TLS Version Support</h4>
<div class="versions-grid">
{#each tlsVersions as tlsVer}
{@const supported = results.supported[tlsVer.version]}
{@const status = getVersionStatus(tlsVer.version, supported, tlsVer.deprecated)}
<div class="version-item {status.class}">
<div class="version-header">
<div class="version-info">
<Icon name={status.icon} size="sm" />
<div>
<span class="version-name">{tlsVer.name}</span>
<span class="version-code mono">({tlsVer.version})</span>
</div>
</div>
<span class="version-status">{status.status}</span>
</div>
{#if !supported && results.errors[tlsVer.version]}
<div class="version-error">
<span class="error-detail">{results.errors[tlsVer.version]}</span>
</div>
{/if}
{#if tlsVer.deprecated}
<div class="version-warning">
<Icon name="alert-triangle" size="xs" />
<span>This version is deprecated and should not be used</span>
</div>
{/if}
</div>
{/each}
</div>
</div>
<!-- Version Range Summary -->
{#if results.minVersion || results.maxVersion}
<div class="range-section">
<h4>Supported Version Range</h4>
<div class="range-info">
<div class="range-item">
<span class="range-label">Minimum Version:</span>
<span class="range-value mono">{results.minVersion || 'Unknown'}</span>
</div>
<div class="range-item">
<span class="range-label">Maximum Version:</span>
<span class="range-value mono">{results.maxVersion || 'Unknown'}</span>
</div>
</div>
</div>
{/if}
{/if}
</div>
</div>
{/if}
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>TLS Versions Probe Failed</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
<!-- Educational Content -->
<div class="card info-card">
<div class="card-header">
<h3>Understanding TLS Versions</h3>
</div>
<div class="card-content">
<div class="info-grid">
<div class="info-section">
<h4>TLS Version Security</h4>
<ul>
<li><strong>TLS 1.3:</strong> Latest version with improved security and performance</li>
<li><strong>TLS 1.2:</strong> Widely supported, secure when properly configured</li>
<li><strong>TLS 1.1:</strong> Deprecated, should not be used</li>
<li><strong>TLS 1.0:</strong> Deprecated, contains security vulnerabilities</li>
</ul>
</div>
<div class="info-section">
<h4>Best Practices</h4>
<ul>
<li>Enable TLS 1.2 and 1.3 only</li>
<li>Disable deprecated versions (TLS 1.0, 1.1)</li>
<li>Regularly update TLS implementations</li>
<li>Use strong cipher suites</li>
</ul>
</div>
<div class="info-section">
<h4>Compliance Requirements</h4>
<p>Many compliance standards (PCI DSS, HIPAA) require disabling deprecated TLS versions. Check your specific requirements.</p>
</div>
</div>
</div>
</div>
</div>
<style lang="scss">
.security-overview {
margin-bottom: var(--spacing-lg);
}
.status-title {
font-weight: 600;
color: var(--text-primary);
}
.status-desc {
font-size: var(--font-size-xs);
margin: 2px 0 0 0;
opacity: 0.8;
}
.versions-section {
margin-bottom: var(--spacing-lg);
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.versions-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: var(--spacing-md);
}
.version-item {
border: 2px solid;
border-radius: var(--radius-md);
padding: var(--spacing-md);
&.success {
border-color: var(--color-success);
background: color-mix(in srgb, var(--color-success), transparent 95%);
}
&.warning {
border-color: var(--color-warning);
background: color-mix(in srgb, var(--color-warning), transparent 95%);
}
&.error {
border-color: var(--color-error);
background: color-mix(in srgb, var(--color-error), transparent 95%);
}
}
.version-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-xs);
}
.version-info {
display: flex;
align-items: center;
gap: var(--spacing-sm);
div {
display: flex;
flex-direction: column;
gap: 2px;
}
}
.version-name {
font-weight: 600;
color: var(--text-primary);
}
.version-code {
font-size: var(--font-size-xs);
color: var(--text-secondary);
}
.version-status {
font-size: var(--font-size-sm);
font-weight: 500;
color: var(--text-primary);
}
.version-error {
margin-top: var(--spacing-xs);
padding: var(--spacing-xs);
background: color-mix(in srgb, var(--color-error), transparent 90%);
border-radius: var(--radius-xs);
border-left: 3px solid var(--color-error);
}
.error-detail {
font-size: var(--font-size-xs);
color: var(--text-primary);
font-family: var(--font-mono);
}
.version-warning {
display: flex;
align-items: center;
gap: var(--spacing-xs);
margin-top: var(--spacing-xs);
padding: var(--spacing-xs);
background: color-mix(in srgb, var(--color-warning), transparent 90%);
border-radius: var(--radius-xs);
font-size: var(--font-size-xs);
color: var(--text-primary);
}
.range-section {
margin-bottom: var(--spacing-lg);
h4 {
color: var(--text-primary);
margin: 0 0 var(--spacing-md) 0;
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--spacing-xs);
}
}
.range-info {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: var(--spacing-md);
}
.range-item {
display: flex;
flex-direction: column;
gap: var(--spacing-xs);
padding: var(--spacing-md);
background: var(--bg-secondary);
border-radius: var(--radius-sm);
border: 1px solid var(--border-primary);
}
.range-label {
font-size: var(--font-size-xs);
color: var(--text-secondary);
font-weight: 500;
}
.range-value {
color: var(--text-primary);
font-weight: 600;
}
.error-text {
color: var(--color-error);
font-size: var(--font-size-xs);
margin-top: var(--spacing-xs);
}
.mono {
font-family: var(--font-mono);
}
</style>
+9 -2
View File
@@ -242,15 +242,22 @@
gap: var(--spacing-sm);
}
.record-section {
margin: var(--spacing-md) 0;
h4 {
margin: 0 0 var(--spacing-md) 0;
color: var(--color-primary);
}
}
.record-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: var(--spacing-md);
background: var(--bg-secondary);
background: var(--bg-primary);
border-radius: var(--radius-md);
border: 1px solid var(--border-primary);
@media (max-width: 768px) {
flex-direction: column;
align-items: flex-start;