send mtu on init

This commit is contained in:
Shuanglei Tao
2025-06-27 18:28:22 +08:00
parent 59a63de6ac
commit 3ddeaeba47
2 changed files with 13 additions and 1 deletions

View File

@@ -314,7 +314,11 @@ function handleNotify(value, idx) {
if (textDecoder == null) textDecoder = new TextDecoder();
const msg = textDecoder.decode(data);
addLog(msg, '⇓');
if (msg.startsWith('t=') && msg.length > 2) {
if (msg.startsWith('mtu=') && msg.length > 4) {
const mtuSize = parseInt(msg.substring(4));
document.getElementById('mtusize').value = mtuSize;
addLog(`MTU 已更新为: ${mtuSize}`);
} else if (msg.startsWith('t=') && msg.length > 2) {
const t = parseInt(msg.substring(2)) + new Date().getTimezoneOffset() * 60;
addLog(`远端时间: ${new Date(t * 1000).toLocaleString()}`);
addLog(`本地时间: ${new Date().toLocaleString()}`);