Docker auto-scale and asleep motd status (#488)

This commit is contained in:
Lenart Kos
2025-12-20 20:31:34 +01:00
committed by GitHub
parent b67d0985dc
commit 4dff00dda9
18 changed files with 885 additions and 165 deletions
+23 -1
View File
@@ -58,7 +58,29 @@ func ReadPacket(reader *bufio.Reader, addr net.Addr, state State) (*Packet, erro
return nil, err
}
packet.Data = remainder.Bytes()
// For status state, decode based on packet ID:
// - 0x00 Status Request: no payload
// - 0x01 Ping: 8-byte long payload
if state == StateStatus {
switch packet.PacketID {
case PacketIdStatusRequest:
// no payload
packet.Data = nil
case PacketIdPingRequest:
timestamp, err := ReadLong(remainder)
if err != nil {
return nil, err
}
packet.Data = &PingPayload{
Timestamp: timestamp,
}
default:
// unknown in status state; keep raw
packet.Data = remainder.Bytes()
}
} else {
packet.Data = remainder.Bytes()
}
logrus.
WithField("client", addr).