Configure modular setup for different instructions

This commit is contained in:
raul 2024-06-04 16:09:07 +02:00
parent dc5be6627a
commit 812deb4bdc
1 changed files with 12 additions and 4 deletions

16
main.go
View File

@ -123,13 +123,21 @@ func awaitInstructions(conn net.Conn) error {
if err != nil {
return err
}
if inst.IsHeartbeat == true && inst.Message == "PING" {
resp := Response{
Message: "PONG",
switch {
///////////////////////////////
case inst.IsHeartbeat == true && inst.Message == "PING":
resp := Response{Message: "PONG"}
err := sendMessage(resp, conn)
if err != nil {
return err
}
sendMessage(resp, conn)
return nil
///////////////////////////////
default:
sendMessage(Response{Message: "Unknown order!"}, conn)
}
///////////////////////////////
return nil
}