This commit is contained in:
Mateusz Gruszczyński committed 2026-11-24 09:26:09 +01:00
1 parent 934d748ea2
commit 8d15429560
13 files changed
+171 -17

No files matched your search

+6 -4
View File
@@ -86,21 +86,22 @@
};
return { read, sync };
}
const h3Defaults = { alt_svc_max_age: 3600, max_concurrent_connections: 512, max_concurrent_bidistream: 100, max_concurrent_unistream: 100, max_idle_timeout: 10, udp_receive_buffer_bytes: 4194304, udp_send_buffer_bytes: 4194304 };
const h3Defaults = { alt_svc_max_age: 3600, max_concurrent_connections: 512, max_concurrent_bidistream: 100, max_concurrent_unistream: 100, max_idle_timeout: 10, keep_alive_interval: 0, keep_alive_mode: "active_requests", udp_receive_buffer_bytes: 4194304, udp_send_buffer_bytes: 4194304 };
function http3SettingsControls(parent, binding) {
const box = el("div", undefined, "h3-editor vh-wide"); parent.append(box);
const grid = el("div", undefined, "vh-grid"); box.append(grid); const inputs = {};
for (const [name, min, max] of [["alt_svc_max_age", 0, 604800], ["max_concurrent_connections", 1, 4096], ["max_concurrent_bidistream", 1, 1024], ["max_concurrent_unistream", 3, 1024], ["max_idle_timeout", 0, 86400]]) inputs[name] = field(grid, name, `h3_${name}`, binding.http3?.[name] ?? h3Defaults[name], "number", { min, max, required: true });
for (const [name, min, max] of [["alt_svc_max_age", 0, 604800], ["max_concurrent_connections", 1, 4096], ["max_concurrent_bidistream", 1, 1024], ["max_concurrent_unistream", 3, 1024], ["max_idle_timeout", 0, 86400], ["keep_alive_interval", 0, 3600]]) inputs[name] = field(grid, name, `h3_${name}`, binding.http3?.[name] ?? h3Defaults[name], "number", { min, max, required: true });
const keepAliveMode = field(grid, "keep_alive_mode", "h3_keep_alive_mode", binding.http3?.keep_alive_mode ?? h3Defaults.keep_alive_mode, "select", { values: [["active_requests", "h3KeepAliveActiveRequests"], ["always", "h3KeepAliveAlways"]] });
for (const direction of ["receive", "send"]) {
const name = `udp_${direction}_buffer_bytes`;
const mib = (binding.http3?.[name] ?? h3Defaults[name]) / 1048576;
inputs[name] = field(grid, name, `h3_udp_${direction}_buffer_mib`, mib, "number", { min: 0, max: 16, step: "any", required: true });
}
box.append(label("p", "h3TuningHelp", "fine"));
const sync = (blocked = false) => { for (const input of Object.values(inputs)) input.disabled = blocked; };
const sync = (blocked = false) => { for (const input of Object.values(inputs)) input.disabled = blocked; keepAliveMode.disabled = blocked; };
sync(false);
const read = () => {
const value = {};
const value = { keep_alive_mode: keepAliveMode.value };
for (const [name, input] of Object.entries(inputs)) {
let number = Number(input.value);
if (!input.value.trim() || !Number.isFinite(number)) throw fieldError(input, t("vhJsonInvalid"));
@@ -111,6 +112,7 @@
if (!Number.isSafeInteger(number)) throw fieldError(input, t("vhJsonInvalid"));
value[name] = number;
}
if (value.keep_alive_interval > 0 && value.max_idle_timeout > 0 && value.keep_alive_interval >= value.max_idle_timeout) throw fieldError(inputs.keep_alive_interval, t("h3KeepAliveTooLong"));
return value;
};
return { read, sync };