0.7.1-SNAPSHOT: small improvements to make it more universal and easy to use

This commit is contained in:
sergeych committed 2026-05-31 00:12:35 +03:00
1 parent 2829bcfecd
commit 7bebbf7bd7
5 files changed
+14 -8

No files matched your search

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved
* Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved
*
* You may use, distribute and modify this code under the
* terms of the private license, which you must obtain from the author
@@ -14,7 +14,6 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import net.sergeych.crypto2.SigningKey
import net.sergeych.kiloparsec.adapter.InetTransportDevice
import net.sergeych.mp_logger.LogTag
import net.sergeych.mp_logger.debug
import net.sergeych.mp_logger.exception
@@ -113,7 +112,7 @@ private val instances = AtomicCounter()
*/
class KiloServer<S>(
private val clientInterface: KiloInterface<S>,
private val connections: Flow<InetTransportDevice>,
private val connections: Flow<Transport.Device>,
private val serverSecretKey: SigningKey? = null,
private val sessionBuilder: () -> S,
) : LogTag("KS:${instances.incrementAndGet()}") {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved
* Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved
*
* You may use, distribute and modify this code under the
* terms of the private license, which you must obtain from the author
@@ -62,11 +62,17 @@ fun websocketTransportDevice(
install(WebSockets)
},
): Transport.Device {
val log = LogTag("WSTD")
var u = Url(path)
if (u.encodedPath.length <= 1)
log.debug { "Creating websocket transport device at $u" }
if (u.encodedPath.length <= 1) {
log.debug {"Correcting path as up = ${u.encodedPath}" }
u = URLBuilder(u).apply {
encodedPath = "/kp"
}.build()
}
log.debug { "Url to process is $u" }
val input = Channel<UByteArray>()
val output = Channel<UByteArray>()