keepalive handshake: device_type + keepalive negotiation in UDP/TCP INIT
- Добавлен device_type (1 байт, CLIENT_TYPE_*) в INIT_REQUEST и INIT_RESPONSE - Добавлен keepalive_interval (2 байта) в INIT_RESPONSE - STCP handshake расширен с 43 до 46 байт (device_type+keepalive) - negotiate_keepalive(): оба desktop/server → min, иначе (есть mobile) → max - keepalive_interval вынесен в UTUN_INSTANCE для использования в handshake - stcp_client_connect() принимает device_type и keepalive_interval - peer_device_type/peer_keepalive_interval передаются через stcp_link в ETCP_LINK
This commit is contained in:
1 parent
43aca4a41b
commit
0f1bd3d120
37 files changed
+535
-309
No files matched your search
@@ -38,6 +38,8 @@ QString AccountList::addrStr(const void* addr, int family) {
|
||||
}
|
||||
if (family == 6) {
|
||||
const uint16_t* a = (const uint16_t*)addr;
|
||||
int zero = 1; for (int i = 0; i < 8; i++) if (a[i]) { zero = 0; break; }
|
||||
if (zero) return "[::]";
|
||||
return QString("%1:%2:%3:%4:%5:%6:%7:%8")
|
||||
.arg(ntohs(a[0]), 0, 16).arg(ntohs(a[1]), 0, 16)
|
||||
.arg(ntohs(a[2]), 0, 16).arg(ntohs(a[3]), 0, 16)
|
||||
@@ -336,8 +338,16 @@ void AccountList::updateDetailDisplay() {
|
||||
QString lc = (lk.linkState == 3 && lk.linkStatus == 1) ? "#4CAF50" : "#E53935";
|
||||
QString left = QString("%1:%2").arg(addrStr(lk.localAddr.constData(), lk.localFamily)).arg(lk.localPort);
|
||||
QString right = QString("%1:%2").arg(addrStr(lk.addr.constData(), lk.family)).arg(lk.port);
|
||||
lines.append(QString("<span style='color:%1;'>●</span> %2 %3 → %4")
|
||||
.arg(lc, proto, left, right));
|
||||
const char* arrow = lk.isServer
|
||||
? "<b style='color:#FF9800;font-size:13pt;'>◀</b>"
|
||||
: "<b style='color:#2196F3;font-size:13pt;'>▶</b>";
|
||||
if (lk.localFamily == 6 || lk.family == 6) {
|
||||
lines.append(QString("<span style='color:%1;'>●</span> %2 %3:%4").arg(lc, proto, addrStr(lk.localAddr.constData(), lk.localFamily)).arg(lk.localPort));
|
||||
lines.append(QString(" %1 %2:%3").arg(arrow, addrStr(lk.addr.constData(), lk.family)).arg(lk.port));
|
||||
} else {
|
||||
lines.append(QString("<span style='color:%1;'>●</span> %2 %3 %4 %5")
|
||||
.arg(lc, proto, left, arrow, right));
|
||||
}
|
||||
}
|
||||
/* DB addresses without live link */
|
||||
for (const auto& a : m_detailAddrs) {
|
||||
|
||||
Reference in new issue
Block a user