From b393655a5e326898ee842f388bd559cee1c46740 Mon Sep 17 00:00:00 2001 From: "nedim.uka" Date: Mon, 27 Sep 2021 10:23:31 +0200 Subject: [PATCH] Added uuid to message_id, and uiid params in command message reply --- README.md | 23 ++++++++++---------- go.mod | 1 + go.sum | 2 ++ services/{xmppsService.go => xmppService.go} | 7 ++++-- 4 files changed, 20 insertions(+), 13 deletions(-) rename services/{xmppsService.go => xmppService.go} (97%) diff --git a/README.md b/README.md index 9c3cd01..4ea15ea 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,16 @@ A tool for testing xmpp servers load ## Environment variables -| Variable | Required | Default Value | Description | -| ------------------------------------------------- | -------- | --------------------------------- | ---------------------------------------------- | -| **Credentials:** | -| | -| CREDENTIALS_FILE_LOCATION | NO | input.json | Database username | -| | -| **GeneralOptions:** | -| | -| PRESENCE_STATUS_DELAY | NO | 120000000000 - 2 mins | Delay for online presence message loop | -| COMMAND_REPLY_DELAY | NO | 10 sec | Delay for online presence message loop | -| | +| Variable | Required | Default Value | Description | +| ------------------------------------------------- | -------- | --------------------------------- | -----------------------------------------------------------| +| **Credentials:** | +| | +| CREDENTIALS_FILE_LOCATION | NO | input.json | Database username | +| | +| **GeneralOptions:** | +| | +| PRESENCE_STATUS_DELAY | NO | 2 min | Delay for online presence message loop | +| COMMAND_REPLY_DELAY | NO | 10 sec | Delay for command message reply | +| EXECUTE_SIGLE_STATUS_MESSAGE | NO | false | Send one presence stanza message for clients and terminate| +| | diff --git a/go.mod b/go.mod index c19d7c4..bc487d3 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require gosrc.io/xmpp v0.5.1 require ( github.com/google/uuid v1.1.1 // indirect + github.com/twinj/uuid v1.0.0 // indirect golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 // indirect nhooyr.io/websocket v1.6.5 // indirect ) diff --git a/go.sum b/go.sum index d188290..65cfea8 100644 --- a/go.sum +++ b/go.sum @@ -57,6 +57,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/twinj/uuid v1.0.0 h1:fzz7COZnDrXGTAOHGuUGYd6sG+JMq+AoE7+Jlu0przk= +github.com/twinj/uuid v1.0.0/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY= github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc/go.mod h1:NoCfSFWosfqMqmmD7hApkirIK9ozpHjxRnRxs1l413A= go.coder.com/go-tools v0.0.0-20190317003359-0c6a35b74a16/go.mod h1:iKV5yK9t+J5nG9O3uF6KYdPEz3dyfMyB15MN1rbQ8Qw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= diff --git a/services/xmppsService.go b/services/xmppService.go similarity index 97% rename from services/xmppsService.go rename to services/xmppService.go index a4db424..550113f 100644 --- a/services/xmppsService.go +++ b/services/xmppService.go @@ -12,6 +12,7 @@ import ( "sync" "time" + "github.com/twinj/uuid" appConfig "github.com/xmpploadtesting/config" "gosrc.io/xmpp" "gosrc.io/xmpp/stanza" @@ -278,9 +279,11 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) { log.Printf("<%v> unable to unmarshal Command Meassage: %v", msg.To, msg.Body) } if len(commandMessageResponse.Responses) > 0 || len(commandMessage.Commands) > 0 { - commandMessageResponse.Responses[0].UUID = commandMessage.Commands[0].UUID + messageIDUUID := uuid.NewV4().String() + commandMessageUUID := uuid.NewV4().String() + commandMessageResponse.Responses[0].UUID = commandMessageUUID commandMessageResponse.PlayerID = commandMessage.Commands[0].Params.PlayerID - commandMessageResponse.MessageID = commandMessage.MessageID + commandMessageResponse.MessageID = messageIDUUID } else { log.Printf("<%v> There are no commands inside command message : %v", msg.To, commandMessage)