MacOS P2P

This commit is contained in:
Gorochu
2026-10-20 15:33:53 -07:00
parent 75224df058
commit 51b52f788e
8 changed files with 50 additions and 18 deletions

View File

@ -1591,9 +1591,13 @@ namespace WebSocketWrapper {
return result;
}
#else
// TODO: SHA1
kinc_log(KINC_LOG_LEVEL_WARNING, "WebSocket: SHA1 not implemented for this platform");
return std::vector<uint8_t>(20, 0);
std::vector<uint8_t> result(SHA_DIGEST_LENGTH, 0);
SHA1(reinterpret_cast<const unsigned char*>(data.data()),
data.size(), result.data());
#ifdef DEBUG_NETWORK
kinc_log(KINC_LOG_LEVEL_INFO, "WebSocket: SHA1 hash computed successfully");
#endif
return result;
#endif
}
@ -1666,12 +1670,24 @@ namespace WebSocketWrapper {
#endif
return true;
#else
if (ssl_initialized_) {
return true;
ssl_socket_ = sock;
if (!initWSL()) {
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: Failed to initialize SSL context");
return false;
}
// TODO: OpenSSL
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL not supported on this platform");
return false;
if (!performWSLHandshake(sock, host)) {
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL handshake failed");
cleanupWSL();
return false;
}
ssl_initialized_ = true;
#ifdef DEBUG_NETWORK
kinc_log(KINC_LOG_LEVEL_INFO, "WebSocket: SSL/TLS initialized successfully");
#endif
return true;
#endif
#else
kinc_log(KINC_LOG_LEVEL_ERROR, "WebSocket: SSL not compiled in");