<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="/static/img/favicon.png">
    <script src="/static/js/bootstrap.bundle.min.js"></script>
    <script src="/static/js/vis-network.min.js"></script>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <title>AS215085 Looking Glass</title>
    <meta name="description" content="AS215085 Lookingglas" />
    <link rel="canonical" href="https://lg.as215085.net" />
    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="LG.AS215085.net | PixelHosting" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="LG.AS215085.net | PixelHosting" />
    <meta property="og:description" content="AS215085 Lookingglas" />
    <meta property="og:url" content="https://lg.as215085.net" />
    <link rel="icon" type="image/png" href="/static/img/cropped-Pixelhosting-logo-favicon-32x32.png">
    <style>
        body { background-color: #f8f9fa; }
        .card { margin-bottom: 1.5rem; }
        .output-console {
            background-color: #212529; color: #f8f9fa; font-family: 'Courier New', Courier, monospace;
            padding: 1rem; border-radius: 0.25rem; min-height: 400px;
            white-space: pre-wrap; word-wrap: break-word; overflow-x: auto;
        }
        #mynetwork {
            width: 100%; min-height: 400px; 
            border: 1px solid #dee2e6; border-radius: .25rem;
        }
        .copy-btn { cursor: pointer; }
        header {
            position: relative; background: url('/static/img/background.webp') no-repeat center center;
            background-size: cover; color: white; padding: 40px 20px; text-align: center;
        }
        header::after {
            content: ""; position: absolute; top: 0; left: 0;
            width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1;
        }
        header h1, header p, .header-content { position: relative; z-index: 2; }
        footer {
            background-color: #2D2E43; color: white; text-align: center;
            padding: 10px 0; margin-top: 20px;
        }
        #form-error { min-height: 1.5rem; }
        .asn-highlight { color: #5DADE2; }
        .best-line { color: #58D68D; font-weight: bold; }
        .btn-custom { background-color: #07AAF9; border-color: #07AAF9; color: white; }
        .btn-custom:hover { background-color: #0698e0; border-color: #0698e0; }

        .bgprtv-controls-wrapper {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1rem;
            padding: 0.75rem 1rem; margin-bottom: 1rem; border: 1px solid #dee2e6;
            border-radius: .25rem; background-color: #f8f9fa;
        }
        .bgprtv-legend-group, .bgprtv-filter-group {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 1rem;
            justify-content: center;
        }
        .bgprtv-legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
        .bgprtv-legend-symbol { display: flex; align-items: center; width: 30px; }
        .bgprtv-legend-line { width: 100%; height: 0; }
        .bgprtv-legend-line.best-path { border-top: 3px solid #C0392B; }
        .bgprtv-legend-line.multipath { border-top: 2px solid #F39C12; }
        .bgprtv-legend-line.alt-path { border-top: 2px dashed #2C3E50; }
        .bgprtv-legend-node { width: 15px; height: 15px; border: 1px solid #555; border-radius: 2px; }
        .bgprtv-legend-node.best-path-node { background-color: #FADBD8; }
        .bgprtv-legend-node.multipath-node { background-color: #FDEBD0; }
        .bgprtv-legend-node.alt-path-node { background-color: #D6DBDF; }
        .bgprtv-filter-title { font-weight: bold; margin: 0; font-size: 0.9rem; white-space: nowrap; }
        #bgprtv-filter-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; font-size: 0.9rem; }
        #bgprtv-filter-controls label { margin: 0; cursor: pointer; white-space: nowrap; }
        .bgprtv-filter-separator { border-left: 1px solid #ccc; height: 1.2rem; }
    </style>
</head>
<body>
    <header>
        <div class="header-content">
            <a href="/"> <img src="/static/img/as215085-logo.png" alt="AS215085 Logo" style="height: 120px;"> </a>
            <h2><b>AS215085 Looking Glass</b></h2>
            <p><b>Proudly delivering the backbone for PixelHosting's services</b></p>
        </div>
    </header>

    <nav class="navbar navbar-expand-lg navbar-light py-1" style="background-color: #07AAF9;">
        <div class="container-fluid d-flex justify-content-center">
            <div class="d-flex align-items-center">
                <label for="main-location-selector" class="form-label mb-0 me-2 text-white"><b>Locatie:</b></label>
                <select class="form-select form-select-sm w-auto" id="main-location-selector"></select>
            </div>
        </div>
    </nav>

    <div class="container my-5">
        <div class="card">
            <div class="card-header">Network</div>
            <div class="card-body">
                <div class="row align-items-center">
                    <div class="col-lg-6 mb-3 mb-lg-0">
                        <label class="form-label">Location</label>
                        <div class="input-group">
                            <input type="text" id="location-name-display" class="form-control" readonly>
                            <a id="map-link-btn" href="#" target="_blank" class="btn btn-outline-secondary">Map</a>
                        </div>
                    </div>
                    <div class="col-lg-6">
                        <label class="form-label">Facility</label>
                        <div class="input-group">
                            <input type="text" id="facility-name-display" class="form-control" readonly>
                            <a id="peeringdb-link-btn" href="#" target="_blank" class="btn btn-outline-secondary">PeeringDB</a>
                        </div>
                    </div>
                </div>
                <div class="row mt-4 align-items-center">
                    <div class="col-lg-2 col-md-6 mb-3 mb-lg-0">
                        <label class="form-label">Looking Glass IPv4</label>
                        <div class="input-group">
						    <input type="text" id="lg-ipv4" class="form-control" readonly>
							<span class="input-group-text copy-btn" onclick="copyToClipboard('lg-ipv4')">Copy</span>
						</div>
                    </div>
                    <div class="col-lg-4 col-md-6 mb-3 mb-lg-0">
                        <label class="form-label">Looking Glass IPv6</label>
                        <div class="input-group">
                            <input type="text" id="lg-ipv6" class="form-control" readonly>
                            <span class="input-group-text copy-btn" onclick="copyToClipboard('lg-ipv6')">Copy</span>
                        </div>
                    </div>
                    <div class="col-lg-2 col-md-6 mb-3 mb-md-0">
                        <label class="form-label">Your IPv4</label>
                        <div class="input-group">
                            <input type="text" id="client-ipv4" class="form-control" placeholder="Detecting..." readonly>
                            <span class="input-group-text copy-btn" onclick="copyToClipboard('client-ipv4')">Copy</span>
                        </div>
                    </div>
                    <div class="col-lg-4 col-md-6">
                        <label class="form-label">Your IPv6</label>
                        <div class="input-group">
                            <input type="text" id="client-ipv6" class="form-control" placeholder="Detecting..." readonly>
                            <span class="input-group-text copy-btn" onclick="copyToClipboard('client-ipv6')">Copy</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="card">
            <div class="card-header">Looking Glass</div>
            <div class="card-body">
                <form id="lg-form">
                    <div class="row align-items-end">
                        <div class="col-md-6 mb-3">
                            <label for="target" class="form-label">Target IP address or host</label>
                            <input type="text" class="form-control" id="target" required>
                        </div>
                        <div class="col-md-4 mb-3">
                            <label for="method" class="form-label">Method</label>
                            <select class="form-select" id="method">
                                <option value="ping">Ping</option>
                                <option value="ping6">Ping6</option>
                                <option value="mtr">MTR</option>
                                <option value="mtr6">MTR6</option>
                                <option value="traceroute">Traceroute</option>
                                <option value="traceroute6">Traceroute6</option>
                                <option value="bgp_raw">BGP Raw Lookup</option>
                                <option value="visualize">BGP Route Visualizer</option>
                            </select>
                        </div>
                        <div class="col-md-2 mb-3">
                            <button type="submit" id="execute-btn" class="btn btn-custom w-100">Execute</button>
                        </div>
                    </div>
                </form>
                <div id="form-error" class="text-danger fw-bold mt-2"></div>
            </div>
        </div>

        <div class="card">
            <div class="card-header">Output</div>
            <div class="card-body">
                <pre id="output-console" class="output-console">Output will appear here...</pre>
                <div id="visualizer-container" style="display:none;">
                    <div class="bgprtv-controls-wrapper">
                        <div class="bgprtv-legend-group">
                            <div class="bgprtv-legend-item">
                                <div class="bgprtv-legend-symbol"><div class="bgprtv-legend-line best-path"></div></div>
                                <span><b>Best path</b></span>
                            </div>
                            <div class="bgprtv-legend-item">
                                <div class="bgprtv-legend-symbol"><div class="bgprtv-legend-line multipath"></div></div>
                                <span><b>Multipath</b></span>
                            </div>
                            <div class="bgprtv-legend-item">
                                <div class="bgprtv-legend-symbol"><div class="bgprtv-legend-line alt-path"></div></div>
                                <span><b>Alternate path</b></span>
                            </div>
                            <div class="bgprtv-legend-item">
                                <div class="bgprtv-legend-symbol"><div class="bgprtv-legend-node best-path-node"></div></div>
                                <span>Best path node</span>
                            </div>
                            <div class="bgprtv-legend-item">
                                <div class="bgprtv-legend-symbol"><div class="bgprtv-legend-node multipath-node"></div></div>
                                <span>Multipath node</span>
                            </div>
                            <div class="bgprtv-legend-item">
                                <div class="bgprtv-legend-symbol"><div class="bgprtv-legend-node alt-path-node"></div></div>
                                <span>Alternate path node</span>
                            </div>
                        </div>
                        <div class="bgprtv-filter-group">
                            <h4 class="bgprtv-filter-title">Filter:</h4>
                            <div id="bgprtv-filter-controls">
                                <label><input type="checkbox" name="bgprtv-filter" value="active"> Active paths</label>
                                <span class="bgprtv-filter-separator"></span>
                                <label><input type="checkbox" name="bgprtv-filter" value="all" checked> All paths</label>
                                <label><input type="checkbox" name="bgprtv-filter" value="transit"> Transit</label>
                                <label><input type="checkbox" name="bgprtv-filter" value="ix"> IX</label>
                                <label><input type="checkbox" name="bgprtv-filter" value="customer"> Customer</label>
                                <label><input type="checkbox" name="bgprtv-filter" value="other"> Other</label>
                            </div>
                        </div>
                    </div>
                    <div id="mynetwork"></div>
                    <div id="visualizer-loader" style="display:none; text-align: center; padding: 20px;">Loading visualization...</div>
                </div>
            </div>
        </div>
        
        <div class="card">
            <div class="card-header">Speedtest</div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <h5>iPerf3 Incoming</h5>
                        <div class="input-group mb-3">
                            <input type="text" id="iperf-in" class="form-control" readonly>
                            <span class="input-group-text copy-btn" onclick="copyToClipboard('iperf-in')">Copy</span>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <h5>iPerf3 Outgoing</h5>
                        <div class="input-group mb-3">
                            <input type="text" id="iperf-out" class="form-control" readonly>
                            <span class="input-group-text copy-btn" onclick="copyToClipboard('iperf-out')">Copy</span>
                        </div>
                    </div>
                </div>
                <div class="mt-3">
                    <h5>Download Test Files</h5>
                    <div id="speedtest-links" class="speedtest-links d-flex flex-wrap justify-content-between gap-2"></div>
                    <a id="web-speedtest-btn" href="#" target="_blank" class="btn btn-custom mt-3" style="display: none;">AS215085 web speedtest</a>
                </div>
            </div>
        </div>
    </div>
    
    <footer>
        <p>&copy; 2020 - <span id="year"></span> AS215085 (PixelHosting). All rights reserved.</p>
        <script> document.getElementById("year").textContent = new Date().getFullYear(); </script>
    </footer>

    <script src="/static/js/materialize.min.js"></script>
    <script src="/static/js/looking_glass.js"></script>
</body>
</html>