BHTTP
This commit is contained in:
@@ -156,6 +156,12 @@ async function loadServerConfig() {
|
||||
document.getElementById("cfgUdpgwRestartGrace").value = u.auto_restart_grace || "";
|
||||
document.getElementById("cfgUdpgwDebug").checked = !!u.debug;
|
||||
|
||||
// BHTTP + BTUN
|
||||
writeBhttpConfig(c);
|
||||
writeBtunConfig(c);
|
||||
loadBhttpHealth();
|
||||
loadBtunHealth();
|
||||
|
||||
// TLS forwarders
|
||||
tlsForwardersState = c.tls_forwarders || [];
|
||||
renderTLSForwarders();
|
||||
@@ -233,6 +239,8 @@ async function saveServerConfig() {
|
||||
auto_restart_grace: document.getElementById("cfgUdpgwRestartGrace").value.trim(),
|
||||
debug: document.getElementById("cfgUdpgwDebug").checked,
|
||||
} : null,
|
||||
bhttp: readBhttpConfig(),
|
||||
btun: readBtunConfig(),
|
||||
tls_forwarders: tlsArr,
|
||||
xray: {
|
||||
enabled: document.getElementById("cfgXrayEnabled").checked,
|
||||
@@ -260,6 +268,8 @@ async function saveServerConfig() {
|
||||
} else {
|
||||
st.textContent = "Saved and applied live.";
|
||||
}
|
||||
loadBhttpHealth();
|
||||
loadBtunHealth();
|
||||
} catch (e) {
|
||||
if (e.message === "auth") doAuthError();
|
||||
else st.textContent = "Error: " + e.message;
|
||||
@@ -692,3 +702,312 @@ async function loadDnsttPubkey() {
|
||||
else st.textContent = "Error: " + e.message;
|
||||
}
|
||||
}
|
||||
|
||||
// ─── BHTTP / BTUN ─────────────────────────────────────────────────────────────
|
||||
// Both transports terminate inside this process: BHTTP hands each session to
|
||||
// the built-in SSH server, and BTUN authenticates against the panel accounts.
|
||||
// Neither uses the system sshd or PAM, so there is nothing host-side to set up
|
||||
// here beyond the listeners and (for BTUN) the TUN/NAT settings.
|
||||
|
||||
function toggleBhttpFields(on) {
|
||||
const el = document.getElementById("bhttpFields");
|
||||
if (!el) return;
|
||||
el.style.opacity = on ? "1" : ".4";
|
||||
el.style.pointerEvents = on ? "" : "none";
|
||||
}
|
||||
function toggleBtunFields(on) {
|
||||
const el = document.getElementById("btunFields");
|
||||
if (!el) return;
|
||||
el.style.opacity = on ? "1" : ".4";
|
||||
el.style.pointerEvents = on ? "" : "none";
|
||||
}
|
||||
|
||||
function readListenLines(id) {
|
||||
const el = document.getElementById(id);
|
||||
if (!el) return [];
|
||||
const seen = new Set();
|
||||
return el.value.split(/\r?\n|,/).map(s => s.trim()).filter(Boolean).filter(s => {
|
||||
if (seen.has(s)) return false;
|
||||
seen.add(s);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// ─── Null-safe field access ───────────────────────────────────────────────────
|
||||
// A browser can hold a cached index.html while loading newer JS. Reading a
|
||||
// field that does not exist there must not throw, because an exception here
|
||||
// aborts loadServerConfig() and blanks the entire settings tab. Missing fields
|
||||
// are simply skipped, so an older panel keeps working against a newer build.
|
||||
function fieldSet(id, value) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.value = value;
|
||||
}
|
||||
function fieldCheck(id, checked) {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.checked = !!checked;
|
||||
}
|
||||
function fieldText(id, fallback = "") {
|
||||
const el = document.getElementById(id);
|
||||
return el ? el.value.trim() : fallback;
|
||||
}
|
||||
function fieldRaw(id, fallback = "") {
|
||||
const el = document.getElementById(id);
|
||||
return el ? el.value : fallback;
|
||||
}
|
||||
function fieldInt(id, fallback = 0) {
|
||||
const el = document.getElementById(id);
|
||||
if (!el) return fallback;
|
||||
const n = parseInt(el.value || "0", 10);
|
||||
return Number.isNaN(n) ? fallback : n;
|
||||
}
|
||||
function fieldBool(id, fallback = false) {
|
||||
const el = document.getElementById(id);
|
||||
return el ? !!el.checked : fallback;
|
||||
}
|
||||
|
||||
function writeBhttpConfig(c) {
|
||||
const hasBhttp = !!c.bhttp;
|
||||
fieldCheck("cfgBhttpEnabled", hasBhttp);
|
||||
toggleBhttpFields(hasBhttp);
|
||||
const b = c.bhttp || {};
|
||||
// Sharing the panel's own ports is the point of enabling BHTTP for most
|
||||
// setups, so a config that has never had a bhttp block starts with it on.
|
||||
fieldCheck("cfgBhttpSharedPorts", hasBhttp ? !!b.shared_ports : true);
|
||||
fieldSet("cfgBhttpListen", (b.listen || []).join("\n"));
|
||||
fieldSet("cfgBhttpSessionTimeout", b.session_timeout || "");
|
||||
fieldSet("cfgBhttpMaxLanes", b.max_v2_lanes || 0);
|
||||
fieldSet("cfgBhttpMaxSessions", b.max_sessions || 0);
|
||||
fieldSet("cfgBhttpMaxConnections", b.max_connections || 0);
|
||||
fieldSet("cfgBhttpAutoRestart", b.auto_restart_interval || "");
|
||||
fieldSet("cfgBhttpRestartGrace", b.auto_restart_grace || "");
|
||||
fieldCheck("cfgBhttpNoConsole", !!b.disable_console_log);
|
||||
fieldCheck("cfgBhttpLogConnections", !!b.log_connections);
|
||||
}
|
||||
|
||||
function readBhttpConfig() {
|
||||
if (!fieldBool("cfgBhttpEnabled")) return null;
|
||||
const listen = readListenLines("cfgBhttpListen");
|
||||
const shared = fieldBool("cfgBhttpSharedPorts");
|
||||
return {
|
||||
// With shared ports on, a dedicated listener is optional; without it there
|
||||
// has to be one or nothing would serve BHTTP at all.
|
||||
listen: listen.length ? listen : (shared ? [] : ["0.0.0.0:8880"]),
|
||||
shared_ports: shared,
|
||||
session_timeout: fieldText("cfgBhttpSessionTimeout"),
|
||||
max_v2_lanes: fieldInt("cfgBhttpMaxLanes"),
|
||||
max_sessions: fieldInt("cfgBhttpMaxSessions"),
|
||||
max_connections: fieldInt("cfgBhttpMaxConnections"),
|
||||
auto_restart_interval: fieldText("cfgBhttpAutoRestart"),
|
||||
auto_restart_grace: fieldText("cfgBhttpRestartGrace"),
|
||||
disable_console_log: fieldBool("cfgBhttpNoConsole"),
|
||||
log_connections: fieldBool("cfgBhttpLogConnections"),
|
||||
};
|
||||
}
|
||||
|
||||
function writeBtunConfig(c) {
|
||||
const hasBtun = !!c.btun;
|
||||
fieldCheck("cfgBtunEnabled", hasBtun);
|
||||
toggleBtunFields(hasBtun);
|
||||
const b = c.btun || {};
|
||||
// Sharing the panel's ports is the least-friction way to reach BTUN, so a
|
||||
// config that has never had a btun block starts with it on.
|
||||
fieldCheck("cfgBtunSharedPorts", hasBtun ? !!b.shared_ports : true);
|
||||
fieldSet("cfgBtunTCPListen", b.tcp_listen || "");
|
||||
fieldSet("cfgBtunUDPListen", b.udp_listen || "");
|
||||
fieldSet("cfgBtunTUNName", b.tun_name || "");
|
||||
fieldSet("cfgBtunSubnet", b.subnet || "");
|
||||
fieldSet("cfgBtunGateway", b.gateway || "");
|
||||
fieldSet("cfgBtunMTU", b.mtu || 0);
|
||||
fieldCheck("cfgBtunManageRouting", !!b.manage_routing);
|
||||
fieldSet("cfgBtunWAN", b.wan_interface || "");
|
||||
fieldSet("cfgBtunHandshakeTimeout", b.handshake_timeout || "");
|
||||
fieldSet("cfgBtunIdleTimeout", b.idle_timeout || "");
|
||||
fieldSet("cfgBtunMaxPacketSize", b.max_packet_size || 0);
|
||||
fieldSet("cfgBtunMaxCoverBytes", b.max_cover_bytes || 0);
|
||||
fieldSet("cfgBtunMaxSessions", b.max_sessions || 0);
|
||||
fieldSet("cfgBtunAutoRestart", b.auto_restart_interval || "");
|
||||
fieldSet("cfgBtunRestartGrace", b.auto_restart_grace || "");
|
||||
fieldCheck("cfgBtunNoConsole", !!b.disable_console_log);
|
||||
fieldCheck("cfgBtunLogConnections", !!b.log_connections);
|
||||
}
|
||||
|
||||
function readBtunConfig() {
|
||||
if (!fieldBool("cfgBtunEnabled")) return null;
|
||||
const tcp = fieldText("cfgBtunTCPListen");
|
||||
const udp = fieldText("cfgBtunUDPListen");
|
||||
const shared = fieldBool("cfgBtunSharedPorts");
|
||||
return {
|
||||
// The server refuses to start with nothing to serve on, so default both
|
||||
// listeners rather than saving a config that cannot come up. With shared
|
||||
// ports on, having neither is a valid TCP-only deployment.
|
||||
tcp_listen: tcp || (udp || shared ? "" : "0.0.0.0:7300"),
|
||||
udp_listen: udp || (tcp || shared ? "" : "0.0.0.0:7300"),
|
||||
shared_ports: shared,
|
||||
tun_name: fieldText("cfgBtunTUNName"),
|
||||
subnet: fieldText("cfgBtunSubnet"),
|
||||
gateway: fieldText("cfgBtunGateway"),
|
||||
mtu: fieldInt("cfgBtunMTU"),
|
||||
manage_routing: fieldBool("cfgBtunManageRouting"),
|
||||
wan_interface: fieldText("cfgBtunWAN"),
|
||||
handshake_timeout: fieldText("cfgBtunHandshakeTimeout"),
|
||||
idle_timeout: fieldText("cfgBtunIdleTimeout"),
|
||||
max_packet_size: fieldInt("cfgBtunMaxPacketSize"),
|
||||
max_cover_bytes: fieldInt("cfgBtunMaxCoverBytes"),
|
||||
max_sessions: fieldInt("cfgBtunMaxSessions"),
|
||||
auto_restart_interval: fieldText("cfgBtunAutoRestart"),
|
||||
auto_restart_grace: fieldText("cfgBtunRestartGrace"),
|
||||
disable_console_log: fieldBool("cfgBtunNoConsole"),
|
||||
log_connections: fieldBool("cfgBtunLogConnections"),
|
||||
};
|
||||
}
|
||||
|
||||
// renderCounterRows fills a two-column counter table, matching the DNSTT health
|
||||
// card so all transports read the same way.
|
||||
function renderCounterRows(bodyId, rows) {
|
||||
const body = document.getElementById(bodyId);
|
||||
if (!body) return;
|
||||
body.innerHTML = "";
|
||||
for (let i = 0; i < rows.length; i += 2) {
|
||||
const a = rows[i];
|
||||
const b = rows[i + 1] || ["", ""];
|
||||
const tr = document.createElement("tr");
|
||||
tr.innerHTML = `<td>${escapeHTML(a[0])}</td><td>${escapeHTML(fmtInt(a[1]))}</td>` +
|
||||
`<td>${escapeHTML(b[0])}</td><td>${b[0] ? escapeHTML(fmtInt(b[1])) : ""}</td>`;
|
||||
body.appendChild(tr);
|
||||
}
|
||||
}
|
||||
|
||||
function setServiceChip(chipId, data) {
|
||||
const chip = document.getElementById(chipId);
|
||||
if (!chip) return;
|
||||
if (!data || data.enabled === false) {
|
||||
chip.textContent = "disabled";
|
||||
chip.className = "chip";
|
||||
return;
|
||||
}
|
||||
chip.textContent = data.running ? "running" : "stopped";
|
||||
chip.className = data.running ? "chip green" : "chip red";
|
||||
}
|
||||
|
||||
async function loadBhttpHealth() {
|
||||
const summary = document.getElementById("bhttpStatusSummary");
|
||||
if (!summary) return;
|
||||
try {
|
||||
const res = await api("/api/bhttp");
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
const d = await res.json();
|
||||
setServiceChip("bhttpStatusChip", d);
|
||||
|
||||
document.getElementById("bhttpActiveSessions").textContent = fmtInt(d.activeSessions);
|
||||
document.getElementById("bhttpActiveConns").textContent = fmtInt(d.activeConnections);
|
||||
document.getElementById("bhttpUploadBytes").textContent = fmtBytes(d.uploadBytes || 0);
|
||||
document.getElementById("bhttpDownloadBytes").textContent = fmtBytes(d.downloadBytes || 0);
|
||||
|
||||
renderCounterRows("bhttpHealthBody", [
|
||||
["Sockets accepted", d.accepted],
|
||||
["Sockets rejected", d.connectionsRejected],
|
||||
["Sessions rejected", d.sessionsRejected],
|
||||
["Sessions expired", d.sessionsExpired],
|
||||
["Probes (BHP1)", (d.probes || 0) - (d.probesV2 || 0)],
|
||||
["Probes (BHP2)", d.probesV2],
|
||||
["HTTP cover upgrades", d.httpUpgrades],
|
||||
["v2 lanes attached", d.lanesAttached],
|
||||
["v2 lanes rejected", d.lanesRejected],
|
||||
["SSH target failures", d.targetFailures],
|
||||
["Protocol errors", d.protocolErrors],
|
||||
]);
|
||||
|
||||
if (d.enabled === false) {
|
||||
summary.textContent = "BHTTP está desativado na configuração.";
|
||||
} else if (!d.running) {
|
||||
summary.textContent = "BHTTP está ativado mas não está rodando. Verifique se a porta está livre nos logs abaixo.";
|
||||
} else {
|
||||
const bad = Number(d.connectionsRejected || 0) + Number(d.sessionsRejected || 0) +
|
||||
Number(d.targetFailures || 0);
|
||||
summary.textContent = bad > 0
|
||||
? `Rodando em ${d.listen || "?"} — atenção: ${fmtInt(bad)} rejeições/falhas acumuladas.`
|
||||
: `Rodando em ${d.listen || "?"} — sem rejeições nem falhas de alvo.`;
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.message === "auth") doAuthError();
|
||||
else summary.textContent = "Erro ao carregar status: " + e.message;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadBhttpLogs() {
|
||||
const box = document.getElementById("bhttpLogs");
|
||||
if (!box) return;
|
||||
box.textContent = "Carregando…";
|
||||
try {
|
||||
const res = await api("/api/bhttp/logs");
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
const lines = await res.json();
|
||||
box.textContent = lines && lines.length ? lines.join("\n") : "Sem logs.";
|
||||
} catch (e) {
|
||||
if (e.message === "auth") doAuthError();
|
||||
else box.textContent = "Erro: " + e.message;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadBtunHealth() {
|
||||
const summary = document.getElementById("btunStatusSummary");
|
||||
if (!summary) return;
|
||||
try {
|
||||
const res = await api("/api/btun");
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
const d = await res.json();
|
||||
setServiceChip("btunStatusChip", d);
|
||||
|
||||
document.getElementById("btunActiveSessions").textContent = fmtInt(d.activeSessions);
|
||||
document.getElementById("btunAuthSucceeded").textContent = fmtInt(d.authSucceeded);
|
||||
document.getElementById("btunClientBytes").textContent = fmtBytes(d.clientBytes || 0);
|
||||
document.getElementById("btunInternetBytes").textContent = fmtBytes(d.internetBytes || 0);
|
||||
|
||||
renderCounterRows("btunHealthBody", [
|
||||
["Handshakes accepted", d.accepted],
|
||||
["Auth rejected", d.authRejected],
|
||||
["Sessions rejected", d.sessionsRejected],
|
||||
["Dropped packets", d.droppedPackets],
|
||||
["Client → net packets", d.clientPackets],
|
||||
["Net → client packets", d.internetPackets],
|
||||
]);
|
||||
|
||||
if (d.enabled === false) {
|
||||
summary.textContent = "BTUN está desativado na configuração.";
|
||||
} else if (!d.running) {
|
||||
summary.textContent = "BTUN está ativado mas não está rodando. Normalmente falta /dev/net/tun, ou a interface/porta já está em uso — veja os logs.";
|
||||
} else {
|
||||
const where = [d.listen, d.tunName, d.subnet].filter(Boolean).join(" · ");
|
||||
summary.textContent = Number(d.droppedPackets || 0) > 0
|
||||
? `Rodando em ${where} — ${fmtInt(d.droppedPackets)} pacotes descartados (confira MTU e rota).`
|
||||
: `Rodando em ${where} — sem pacotes descartados.`;
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.message === "auth") doAuthError();
|
||||
else summary.textContent = "Erro ao carregar status: " + e.message;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadBtunLogs() {
|
||||
const box = document.getElementById("btunLogs");
|
||||
if (!box) return;
|
||||
box.textContent = "Carregando…";
|
||||
try {
|
||||
const res = await api("/api/btun/logs");
|
||||
if (!res.ok) throw new Error(await res.text());
|
||||
const lines = await res.json();
|
||||
box.textContent = lines && lines.length ? lines.join("\n") : "Sem logs.";
|
||||
} catch (e) {
|
||||
if (e.message === "auth") doAuthError();
|
||||
else box.textContent = "Erro: " + e.message;
|
||||
}
|
||||
}
|
||||
|
||||
// Inline onchange/onclick handlers in index.html need these on window.
|
||||
window.toggleBhttpFields = toggleBhttpFields;
|
||||
window.toggleBtunFields = toggleBtunFields;
|
||||
window.loadBhttpHealth = loadBhttpHealth;
|
||||
window.loadBhttpLogs = loadBhttpLogs;
|
||||
window.loadBtunHealth = loadBtunHealth;
|
||||
window.loadBtunLogs = loadBtunLogs;
|
||||
|
||||
+202
-3
@@ -1231,15 +1231,17 @@
|
||||
<section class="page-hero" data-tone="blue"><div class="page-hero-copy"><span class="page-kicker">System studio</span><h2>Configurações</h2><p>Rede, SSH, túneis e TLS organizados em blocos visuais e aplicados ao vivo.</p></div></section>
|
||||
|
||||
<div class="workspace-nav-shell" data-tone="blue">
|
||||
<nav class="workspace-section-nav" id="configSectionNav" aria-label="Áreas de configuração" style="--workspace-nav-columns:5">
|
||||
<nav class="workspace-section-nav" id="configSectionNav" aria-label="Áreas de configuração" style="--workspace-nav-columns:7">
|
||||
<button class="active" type="button" data-workspace="config" data-workspace-section="general"><span>⌁</span> Rede e SSH</button>
|
||||
<button type="button" data-workspace="config" data-workspace-section="slowdns"><span>DNS</span> SlowDNS</button>
|
||||
<button type="button" data-workspace="config" data-workspace-section="udp"><span>⇅</span> UDP Gateway</button>
|
||||
<button type="button" data-workspace="config" data-workspace-section="bhttp"><span>BH</span> BHTTP</button>
|
||||
<button type="button" data-workspace="config" data-workspace-section="btun"><span>BT</span> BTUN</button>
|
||||
<button type="button" data-workspace="config" data-workspace-section="tls"><span>◇</span> TLS</button>
|
||||
<button type="button" data-workspace="config" data-workspace-section="xray"><span>◆</span> Xray</button>
|
||||
</nav>
|
||||
<select id="configSection" class="workspace-section-select" data-workspace-select="config" aria-label="Área de configuração">
|
||||
<option value="general">Rede e SSH</option><option value="slowdns">SlowDNS</option><option value="udp">UDP Gateway</option><option value="tls">TLS</option><option value="xray">Xray</option>
|
||||
<option value="general">Rede e SSH</option><option value="slowdns">SlowDNS</option><option value="udp">UDP Gateway</option><option value="bhttp">BHTTP</option><option value="btun">BTUN</option><option value="tls">TLS</option><option value="xray">Xray</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -1468,8 +1470,205 @@
|
||||
|
||||
</section>
|
||||
|
||||
<section class="workspace-section" data-workspace-panel="config" data-workspace-section-panel="bhttp">
|
||||
<div class="workspace-section-heading"><div><span>04 · BHTTP</span><h3>BHTTP (BHP1 / BHP2)</h3><p>Transporte TCP ofuscado dos apps DTunnel. Cada sessão é entregue ao servidor SSH interno do painel — nunca ao sshd do sistema.</p></div></div>
|
||||
<div class="card" style="margin-top:12px">
|
||||
<div class="card-hdr">
|
||||
<div class="card-title">BHTTP Transport</div>
|
||||
<span class="chip green">live</span>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;margin-left:auto;">
|
||||
<input type="checkbox" id="cfgBhttpEnabled" onchange="toggleBhttpFields(this.checked)"/> Enabled
|
||||
</label>
|
||||
</div>
|
||||
<div id="bhttpFields" class="form-grid" style="opacity:.4;pointer-events:none;">
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBhttpSharedPorts"/> Compartilhar as portas do painel <span class="hint">80/8080 (proxy) e 443 (TLS)</span>
|
||||
</label>
|
||||
<div class="hint" style="grid-column:1/-1;margin-top:-4px;">
|
||||
Os listeners existentes leem os primeiros bytes de cada conexão e entregam ao BHTTP somente quando o quadro é inconfundível — um quadro BHTTP começa com o número do modo (0–5), enquanto SSH começa com <code>S</code> e HTTP com a letra do método. Clientes SSH e de injeção HTTP na mesma porta continuam iguais.
|
||||
<strong>Uma mudança existe:</strong> com o compartilhamento ligado, a porta do proxy espera os primeiros bytes do cliente em vez de responder <code>HTTP/1.1 101</code> imediatamente. Todo cliente conhecido envia na hora, mas desligue isto se algum cliente seu aguardar esse 101 antes de falar.
|
||||
</div>
|
||||
<div class="field" style="grid-column:1/-1">
|
||||
<label>Listen <span class="hint">um endereço por linha; vazio = só portas compartilhadas</span></label>
|
||||
<textarea id="cfgBhttpListen" rows="3" placeholder="0.0.0.0:8880 [::]:8881"></textarea>
|
||||
<span class="hint">Porta dedicada, opcional. As portas 80 e 8080 já pertencem ao proxy HTTP+SSH: para usá-las, marque o compartilhamento acima em vez de listá-las aqui.</span>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Session Timeout <span class="hint">10s..1h</span></label>
|
||||
<input type="text" id="cfgBhttpSessionTimeout" placeholder="2m"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Max v2 Lanes Per Session <span class="hint">0 = 128</span></label>
|
||||
<input type="number" id="cfgBhttpMaxLanes" min="0" placeholder="128"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Max Sessions <span class="hint">0 = default (10000), -1 = unlimited</span></label>
|
||||
<input type="number" id="cfgBhttpMaxSessions" placeholder="10000"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Max Client Sockets <span class="hint">0 = default (10000), -1 = unlimited</span></label>
|
||||
<input type="number" id="cfgBhttpMaxConnections" placeholder="10000"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Auto Restart Interval <span class="hint">0s/off disables</span></label>
|
||||
<input type="text" id="cfgBhttpAutoRestart" placeholder="24h"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Restart Grace Delay</label>
|
||||
<input type="text" id="cfgBhttpRestartGrace" placeholder="2s"/>
|
||||
</div>
|
||||
<div class="hint" style="grid-column:1/-1;margin-top:-4px;">Restart forte: fecha apenas os listeners BHTTP e suas sessões, depois religa. Não reinicia o painel nem a VPS.</div>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBhttpNoConsole"/> Disable Console Log
|
||||
</label>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBhttpLogConnections"/> Verbose Connection Logs
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-top:12px">
|
||||
<div class="card-hdr">
|
||||
<div class="card-title">Status BHTTP</div>
|
||||
<span class="chip" id="bhttpStatusChip">—</span>
|
||||
<button class="btn btn-ghost btn-sm" type="button" onclick="loadBhttpHealth()">Atualizar</button>
|
||||
</div>
|
||||
<div class="metrics">
|
||||
<div class="metric"><div class="m-label">Active Sessions</div><div class="m-val" id="bhttpActiveSessions">--</div></div>
|
||||
<div class="metric"><div class="m-label">Active Sockets</div><div class="m-val" id="bhttpActiveConns">--</div></div>
|
||||
<div class="metric"><div class="m-label">Upload</div><div class="m-val" id="bhttpUploadBytes">--</div></div>
|
||||
<div class="metric"><div class="m-label">Download</div><div class="m-val" id="bhttpDownloadBytes">--</div></div>
|
||||
</div>
|
||||
<div class="tbl-wrap" style="margin-top:10px;">
|
||||
<table>
|
||||
<thead><tr><th>Counter</th><th>Value</th><th>Counter</th><th>Value</th></tr></thead>
|
||||
<tbody id="bhttpHealthBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="statusbar"><span id="bhttpStatusSummary">Salve a configuração para iniciar o transporte.</span><span class="hint">Rejeições e falhas de alvo devem normalmente ficar em 0.</span></div>
|
||||
<div class="card-hdr" style="margin-top:12px">
|
||||
<div class="card-title">Logs BHTTP</div>
|
||||
<button class="btn btn-ghost btn-sm" type="button" onclick="loadBhttpLogs()">Carregar logs</button>
|
||||
</div>
|
||||
<pre id="bhttpLogs" class="log-box">—</pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="workspace-section" data-workspace-panel="config" data-workspace-section-panel="btun">
|
||||
<div class="workspace-section-heading"><div><span>05 · BTUN</span><h3>BTUN (DTUNNEL/1.1)</h3><p>VPN nativa por pacotes IP em TCP e UDP. Autentica nas contas do painel — sem PAM e sem /etc/shadow.</p></div></div>
|
||||
<div class="card" style="margin-top:12px">
|
||||
<div class="card-hdr">
|
||||
<div class="card-title">BTUN Protocol Server</div>
|
||||
<span class="chip green">live</span>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;margin-left:auto;">
|
||||
<input type="checkbox" id="cfgBtunEnabled" onchange="toggleBtunFields(this.checked)"/> Enabled
|
||||
</label>
|
||||
</div>
|
||||
<div id="btunFields" class="form-grid" style="opacity:.4;pointer-events:none;">
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBtunSharedPorts"/> Compartilhar as portas do painel <span class="hint">80/8080 (proxy) e 443 (TLS), só TCP</span>
|
||||
</label>
|
||||
<div class="hint" style="grid-column:1/-1;margin-top:-4px;">
|
||||
Os listeners existentes entregam ao BTUN apenas no marcador fixo <code>DTUNNEL/1.1 CLIENT_HELLO</code>, então SSH, injeção HTTP e BHTTP na mesma porta continuam iguais. Vale somente para TCP — o painel não tem porta UDP compartilhada, então clientes UDP ainda precisam do <strong>UDP Listen</strong>.
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>TCP Listen <span class="hint">vazio desativa; opcional com portas compartilhadas</span></label>
|
||||
<input type="text" id="cfgBtunTCPListen" placeholder="0.0.0.0:7300"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>UDP Listen <span class="hint">empty disables</span></label>
|
||||
<input type="text" id="cfgBtunUDPListen" placeholder="0.0.0.0:7300"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>TUN Interface</label>
|
||||
<input type="text" id="cfgBtunTUNName" placeholder="btun0"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Client Subnet <span class="hint">IPv4 CIDR</span></label>
|
||||
<input type="text" id="cfgBtunSubnet" placeholder="10.77.0.0/16"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Gateway <span class="hint">empty derives from subnet</span></label>
|
||||
<input type="text" id="cfgBtunGateway" placeholder="10.77.0.1/16"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>MTU <span class="hint">576..9000</span></label>
|
||||
<input type="number" id="cfgBtunMTU" min="576" max="9000" placeholder="1400"/>
|
||||
</div>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBtunManageRouting"/> Manage Routing <span class="hint">configura o IP da interface, ip_forward e o NAT</span>
|
||||
</label>
|
||||
<div class="field">
|
||||
<label>WAN Interface <span class="hint">empty auto-detects</span></label>
|
||||
<input type="text" id="cfgBtunWAN" placeholder="eth0"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Handshake Timeout <span class="hint">1s..5m</span></label>
|
||||
<input type="text" id="cfgBtunHandshakeTimeout" placeholder="15s"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Idle Timeout <span class="hint">10s..1h</span></label>
|
||||
<input type="text" id="cfgBtunIdleTimeout" placeholder="2m"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Max Packet Size <span class="hint">0 = 64 KiB</span></label>
|
||||
<input type="number" id="cfgBtunMaxPacketSize" min="0" placeholder="65536"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Max Cover Bytes <span class="hint">0 = 64 KiB</span></label>
|
||||
<input type="number" id="cfgBtunMaxCoverBytes" min="0" placeholder="65536"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Max Sessions <span class="hint">0 = default (10000), -1 = unlimited</span></label>
|
||||
<input type="number" id="cfgBtunMaxSessions" placeholder="10000"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Auto Restart Interval <span class="hint">0s/off disables</span></label>
|
||||
<input type="text" id="cfgBtunAutoRestart" placeholder="24h"/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Restart Grace Delay</label>
|
||||
<input type="text" id="cfgBtunRestartGrace" placeholder="2s"/>
|
||||
</div>
|
||||
<div class="hint" style="grid-column:1/-1;margin-top:-4px;">Cada sessão BTUN conta no <strong>max_connections</strong> da conta, no limite de banda e na cota de dados, junto com as conexões SSH.</div>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBtunNoConsole"/> Disable Console Log
|
||||
</label>
|
||||
<label style="font-size:.73rem;display:flex;align-items:center;gap:5px;cursor:pointer;grid-column:1/-1">
|
||||
<input type="checkbox" id="cfgBtunLogConnections"/> Verbose Connection Logs
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-top:12px">
|
||||
<div class="card-hdr">
|
||||
<div class="card-title">Status BTUN</div>
|
||||
<span class="chip" id="btunStatusChip">—</span>
|
||||
<button class="btn btn-ghost btn-sm" type="button" onclick="loadBtunHealth()">Atualizar</button>
|
||||
</div>
|
||||
<div class="metrics">
|
||||
<div class="metric"><div class="m-label">Active Sessions</div><div class="m-val" id="btunActiveSessions">--</div></div>
|
||||
<div class="metric"><div class="m-label">Authenticated</div><div class="m-val" id="btunAuthSucceeded">--</div></div>
|
||||
<div class="metric"><div class="m-label">Client → Net</div><div class="m-val" id="btunClientBytes">--</div></div>
|
||||
<div class="metric"><div class="m-label">Net → Client</div><div class="m-val" id="btunInternetBytes">--</div></div>
|
||||
</div>
|
||||
<div class="tbl-wrap" style="margin-top:10px;">
|
||||
<table>
|
||||
<thead><tr><th>Counter</th><th>Value</th><th>Counter</th><th>Value</th></tr></thead>
|
||||
<tbody id="btunHealthBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="statusbar"><span id="btunStatusSummary">Salve a configuração para iniciar o servidor.</span><span class="hint">Pacotes descartados indicam MTU ou rota incorreta.</span></div>
|
||||
<div class="card-hdr" style="margin-top:12px">
|
||||
<div class="card-title">Logs BTUN</div>
|
||||
<button class="btn btn-ghost btn-sm" type="button" onclick="loadBtunLogs()">Carregar logs</button>
|
||||
</div>
|
||||
<pre id="btunLogs" class="log-box">—</pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="workspace-section" data-workspace-panel="config" data-workspace-section-panel="tls">
|
||||
<div class="workspace-section-heading"><div><span>04 · Segurança</span><h3>Encaminhadores TLS</h3><p>Gerencie os certificados do servidor e crie listeners TLS com certificado automático, colado ou armazenado em arquivo.</p></div></div>
|
||||
<div class="workspace-section-heading"><div><span>06 · Segurança</span><h3>Encaminhadores TLS</h3><p>Gerencie os certificados do servidor e crie listeners TLS com certificado automático, colado ou armazenado em arquivo.</p></div></div>
|
||||
|
||||
<!-- TLS Certificates -->
|
||||
<div class="card" style="margin-top:12px">
|
||||
|
||||
Reference in New Issue
Block a user