"use client" import { useEffect, useState } from "react" import Link from "next/link" import TunnelConfig, { type TunnelConfig as TunnelConfigType, type Server } from "@/components/tunnel-config" import { authClient } from "@/lib/auth-client" import SiteHeader from "@/components/site-header" import SiteFooter from "@/components/site-footer" const defaultConfig: TunnelConfigType = { type: "http", serverPort: 443, localPort: 8000, } type ActiveConnection = { id: string name: string serverLabel: string protocol: TunnelConfigType["type"] localPort: number serverPort: number remote: string status: "connected" | "pending" | "error" latencyMs: number | null dataInOut: string startedAgo: string } export default function DashboardPage() { const [selectedServer, setSelectedServer] = useState(null) const [tunnelConfig, setTunnelConfig] = useState(defaultConfig) const [statusMessage, setStatusMessage] = useState(null) const [activeConnections, setActiveConnections] = useState([ { id: "conn-1", name: "Frontend Preview", serverLabel: "Singapore", protocol: "http", localPort: 3000, serverPort: 443, remote: "https://sgp.tunnl.live", status: "connected", latencyMs: 34, dataInOut: "1.2 GB", startedAgo: "3h 12m", }, { id: "conn-2", name: "Game TCP", serverLabel: "Frankfurt", protocol: "tcp", localPort: 25565, serverPort: 20555, remote: "tcp://eu.tunnl.live:20555", status: "connected", latencyMs: 120, dataInOut: "320 MB", startedAgo: "54m", }, ]) type SessionResponse = Awaited> const [session, setSession] = useState(null) useEffect(() => { const fetchSession = async () => { try { const result = await authClient.getSession() if (result.data) { setSession(result.data) } } catch (error) { console.error("Error fetching session", error) } } fetchSession() }, []) const stopConnection = (id: string) => { setActiveConnections((prev) => prev.filter((conn) => conn.id !== id)) setStatusMessage("Connection stopped") } return (

Active Forwarding

Live tunnels for this session.

{statusMessage && (
{statusMessage}
)}

Active Connections

Monitor and manage your running tunnels

View logs
{activeConnections.length === 0 ? (
No active connections yet. Configure a tunnel to see it here.
) : (
{activeConnections.map((connection) => (
{connection.name} {connection.status === "connected" ? "Connected" : connection.status === "pending" ? "Reconnecting" : "Error"}

{connection.protocol.toUpperCase()} · {connection.serverLabel}

{connection.remote}

Local {connection.localPort} → Server {connection.serverPort} · {connection.startedAgo}

Latency

{connection.latencyMs ? `${connection.latencyMs}ms` : "—"}

Data

{connection.dataInOut}

))}
)}

Custom Tunnel Configuration

Pick a location, test latency, and shape your tunnel exactly how you need.

View docs
) }