pull/110/head
Azalea 2025-01-17 06:17:32 -05:00
parent a374f7a44b
commit 2b6c283cd1
2 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,11 @@ fun ActiveClient.handle(msg: Msg) {
lastHeartbeat = millis()
send(ctlMsg(Command.CTL_HEARTBEAT))
}
Command.DATA_BROADCAST -> {
// Broadcast to all clients. This is only used in UDP so SID is always 0
if (msg.proto != Proto.UDP) return log.warn("TCP Broadcast received, something is wrong.")
clients.values.forEach { it.send(msg.copy(src = stubIp)) }
}
Command.DATA_SEND -> {
target ?: return log.warn("Send: Target not found: ${msg.dst}")

View File

@ -8,9 +8,11 @@ import ext.str
object Command {
// Control plane
const val CTL_START = 1u
const val CTL_BIND = 2u
const val CTL_HEARTBEAT = 3u
const val CTL_TCP_CONNECT = 4u // Accept a new multiplexed TCP stream
const val CTL_TCP_ACCEPT = 5u
const val CTL_TCP_ACCEPT_ACK = 6u
const val CTL_TCP_CLOSE = 7u
// Data plane