0.7.1-SNAPSHOT: small improvements to make it more universal and easy to use
This commit is contained in:
parent
2829bcfecd
commit
7bebbf7bd7
1
.gitignore
vendored
1
.gitignore
vendored
@ -46,3 +46,4 @@ out/
|
|||||||
/.idea/workspace.xml
|
/.idea/workspace.xml
|
||||||
/.gigaide/gigaide.properties
|
/.gigaide/gigaide.properties
|
||||||
local.properties
|
local.properties
|
||||||
|
/kotlin-js-store/yarn.lock
|
||||||
|
|||||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
|
|||||||
@ -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
|
* You may use, distribute and modify this code under the
|
||||||
* terms of the private license, which you must obtain from the author
|
* terms of the private license, which you must obtain from the author
|
||||||
@ -19,7 +19,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "net.sergeych"
|
group = "net.sergeych"
|
||||||
version = "0.7.0-SNAPSHOT"
|
version = "0.7.1-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -98,6 +98,7 @@ kotlin {
|
|||||||
implementation("io.ktor:ktor-server-core:$ktor_version")
|
implementation("io.ktor:ktor-server-core:$ktor_version")
|
||||||
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
|
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
|
||||||
implementation("io.ktor:ktor-server-websockets-jvm:$ktor_version")
|
implementation("io.ktor:ktor-server-websockets-jvm:$ktor_version")
|
||||||
|
implementation("io.ktor:ktor-server-websockets:${ktor_version}")
|
||||||
implementation("io.ktor:ktor-server-netty:$ktor_version")
|
implementation("io.ktor:ktor-server-netty:$ktor_version")
|
||||||
api("io.ktor:ktor-client-cio:$ktor_version")
|
api("io.ktor:ktor-client-cio:$ktor_version")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
* You may use, distribute and modify this code under the
|
||||||
* terms of the private license, which you must obtain from the author
|
* 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.flow.Flow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import net.sergeych.crypto2.SigningKey
|
import net.sergeych.crypto2.SigningKey
|
||||||
import net.sergeych.kiloparsec.adapter.InetTransportDevice
|
|
||||||
import net.sergeych.mp_logger.LogTag
|
import net.sergeych.mp_logger.LogTag
|
||||||
import net.sergeych.mp_logger.debug
|
import net.sergeych.mp_logger.debug
|
||||||
import net.sergeych.mp_logger.exception
|
import net.sergeych.mp_logger.exception
|
||||||
@ -113,7 +112,7 @@ private val instances = AtomicCounter()
|
|||||||
*/
|
*/
|
||||||
class KiloServer<S>(
|
class KiloServer<S>(
|
||||||
private val clientInterface: KiloInterface<S>,
|
private val clientInterface: KiloInterface<S>,
|
||||||
private val connections: Flow<InetTransportDevice>,
|
private val connections: Flow<Transport.Device>,
|
||||||
private val serverSecretKey: SigningKey? = null,
|
private val serverSecretKey: SigningKey? = null,
|
||||||
private val sessionBuilder: () -> S,
|
private val sessionBuilder: () -> S,
|
||||||
) : LogTag("KS:${instances.incrementAndGet()}") {
|
) : 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
|
* You may use, distribute and modify this code under the
|
||||||
* terms of the private license, which you must obtain from the author
|
* terms of the private license, which you must obtain from the author
|
||||||
@ -62,11 +62,17 @@ fun websocketTransportDevice(
|
|||||||
install(WebSockets)
|
install(WebSockets)
|
||||||
},
|
},
|
||||||
): Transport.Device {
|
): Transport.Device {
|
||||||
|
|
||||||
|
val log = LogTag("WSTD")
|
||||||
var u = Url(path)
|
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 {
|
u = URLBuilder(u).apply {
|
||||||
encodedPath = "/kp"
|
encodedPath = "/kp"
|
||||||
}.build()
|
}.build()
|
||||||
|
}
|
||||||
|
log.debug { "Url to process is $u" }
|
||||||
|
|
||||||
val input = Channel<UByteArray>()
|
val input = Channel<UByteArray>()
|
||||||
val output = Channel<UByteArray>()
|
val output = Channel<UByteArray>()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user