11 Commits

12 changed files with 339 additions and 40 deletions

2
.gitignore vendored
View File

@@ -1,2 +1,2 @@
.vscode .vscode/
input.json input.json

View File

@@ -1,4 +0,0 @@
{
"go.gopath": "/home/nedim/go",
"go.useLanguageServer": true
}

View File

@@ -4,19 +4,15 @@ A tool for testing xmpp servers load
## Environment variables ## Environment variables
| Variable | Required | Default Value | Description | | Variable | Required | Default Value | Description |
| ------------------------------------------------- | -------- | --------------------------------- | ---------------------------------------------- | | ------------------------------------------------- | -------- | --------------------------------- | -----------------------------------------------------------|
| **Service:** |
| OPENFIRE_PORT | NO | 5222 | Port for openfire server |
| OPENFIRE_ADRESS | YES | | Openfire server address |
| OPENFIRE_DOMAIN | YES | | Domain |
| |
| **Credentials:** | | **Credentials:** |
| | | |
| CREDENTIALS_FILE_LOCATION | NO | input.json | Database username | | CREDENTIALS_FILE_LOCATION | NO | input.json | Database username |
| | | |
| **GeneralOptions:** | | **GeneralOptions:** |
| | | |
| MASSAGE_DELAY | NO | 120000000000 - 2 mins | Delay for online presence message loop | | PRESENCE_STATUS_DELAY | NO | 2 min | Delay for online presence message loop |
| STATUS_MASSAGE_DELAY | NO | 10 sec | 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|
| | | |

View File

@@ -10,15 +10,13 @@ func Load() {
Service: Service{ Service: Service{
Port: getEnv("OPENFIRE_PORT", "5222"), Port: getEnv("OPENFIRE_PORT", "5222"),
Address: mustGetEnv("OPENFIRE_ADRESS"),
Domain: mustGetEnv("OPENFIRE_DOMAIN"),
}, },
Credentials: Credentials{ Credentials: Credentials{
CredentialsFileLocation: getEnv("CREDENTIALS_FILE_LOCATION", "input.json"), CredentialsFileLocation: getEnv("CREDENTIALS_FILE_LOCATION", "input.json"),
}, },
GeneralOptions: GeneralOptions{ GeneralOptions: GeneralOptions{
DelayBetweenMassages: int64(getEnvInt("MASSAGE_DELAY", 120000000000)), PresenceStatusDelay: int64(getEnvInt("PRESENCE_STATUS_DELAY", 2) * 60),
StatusMessageDelay: getEnvInt("STATUS_MASSAGE_DELAY", 10), CommandReplyDelay: getEnvInt("COMMAND_REPLY_DELAY", 10),
}, },
} }
} }

View File

@@ -21,6 +21,6 @@ type Credentials struct {
// GeneralOptions contains information for general configuration options // GeneralOptions contains information for general configuration options
type GeneralOptions struct { type GeneralOptions struct {
DelayBetweenMassages int64 PresenceStatusDelay int64
StatusMessageDelay int CommandReplyDelay int
} }

4
go.mod
View File

@@ -2,9 +2,11 @@ module github.com/xmpploadtesting
go 1.17 go 1.17
require gosrc.io/xmpp v0.5.1
require ( require (
github.com/google/uuid v1.1.1 // indirect 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 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 // indirect
gosrc.io/xmpp v0.5.1 // indirect
nhooyr.io/websocket v1.6.5 // indirect nhooyr.io/websocket v1.6.5 // indirect
) )

2
go.sum
View File

@@ -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.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 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/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= 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.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= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=

3
just1.json Normal file
View File

@@ -0,0 +1,3 @@
[
{"username": "DEVICE1", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7905efdb805e"}
]

View File

@@ -36,7 +36,7 @@ func main() {
} }
// Delay before sending another message // Delay before sending another message
time.Sleep(time.Duration(appConfig.AppConfig.GeneralOptions.DelayBetweenMassages)) time.Sleep(time.Duration(appConfig.AppConfig.GeneralOptions.PresenceStatusDelay * 1000000000))
} }

202
over9000.json Normal file
View File

@@ -0,0 +1,202 @@
[
{"username": "DEVICE1", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7905efdb805e"},
{"username": "DEVICE2", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "716eb3a58957"},
{"username": "DEVICE3", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7cdfc56e9910"},
{"username": "DEVICE4", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "2a5170a39bd8"},
{"username": "DEVICE5", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "927c8c380d8b"},
{"username": "DEVICE6", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "8ad93c625414"},
{"username": "DEVICE7", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e1f0eb824d74"},
{"username": "DEVICE8", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "cdb72f142f82"},
{"username": "DEVICE9", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "520b958a2133"},
{"username": "DEVICE10", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5b362edb2ed4"},
{"username": "DEVICE11", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "85b9eace1d22"},
{"username": "DEVICE12", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5e2f8e01ea3d"},
{"username": "DEVICE13", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "1b08b61cb4ed"},
{"username": "DEVICE14", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c4178cf4cbed"},
{"username": "DEVICE15", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "2fbfbec71f98"},
{"username": "DEVICE16", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "21288b5d9f7a"},
{"username": "DEVICE17", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "cbf0dceed251"},
{"username": "DEVICE18", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "8556c3d6bcea"},
{"username": "DEVICE19", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "402d9eb9ca99"},
{"username": "DEVICE20", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b952297f0948"},
{"username": "DEVICE21", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5382ef122155"},
{"username": "DEVICE22", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b6010769064f"},
{"username": "DEVICE23", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c764861f2044"},
{"username": "DEVICE24", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "ddbc95a1292c"},
{"username": "DEVICE25", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b19224fa2daa"},
{"username": "DEVICE26", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0b52b83a1ece"},
{"username": "DEVICE27", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "d6efb959650a"},
{"username": "DEVICE28", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7750a46a2437"},
{"username": "DEVICE29", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "384583371916"},
{"username": "DEVICE30", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "18aceda2113b"},
{"username": "DEVICE31", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "1fed62f247ca"},
{"username": "DEVICE32", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "02034ed69a3d"},
{"username": "DEVICE33", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "1582c9874811"},
{"username": "DEVICE34", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "94766c6a7726"},
{"username": "DEVICE35", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b478bcc1c61d"},
{"username": "DEVICE36", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "851e7d547732"},
{"username": "DEVICE37", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "fb39e94cfd8b"},
{"username": "DEVICE38", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "cfe92f2b545b"},
{"username": "DEVICE39", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "719d7c0060cb"},
{"username": "DEVICE40", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c48be94af4cc"},
{"username": "DEVICE41", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "fd8ac8487dac"},
{"username": "DEVICE42", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0447a6eacef1"},
{"username": "DEVICE43", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "065f2af793f9"},
{"username": "DEVICE44", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "308dfc28b2c5"},
{"username": "DEVICE45", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "269574f50066"},
{"username": "DEVICE46", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "21cdf7098a19"},
{"username": "DEVICE47", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "79388b21fadd"},
{"username": "DEVICE48", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "666dfb4abc73"},
{"username": "DEVICE49", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "8665b5ed8205"},
{"username": "DEVICE50", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "3f4e520ac5dd"},
{"username": "DEVICE51", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "4d8eb88e3896"},
{"username": "DEVICE52", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "42255979f368"},
{"username": "DEVICE53", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "adf6098ae179"},
{"username": "DEVICE54", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "152207e865a6"},
{"username": "DEVICE55", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "27d2065f2f3d"},
{"username": "DEVICE56", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c06a0a5c93fb"},
{"username": "DEVICE57", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c3c447a82383"},
{"username": "DEVICE58", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "3f19a6bc3b4f"},
{"username": "DEVICE59", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e02f32821ea6"},
{"username": "DEVICE60", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "078f0aa4e17b"},
{"username": "DEVICE61", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5430cd6fbf4e"},
{"username": "DEVICE62", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "8934d927a5bd"},
{"username": "DEVICE63", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "3c38caf6d03d"},
{"username": "DEVICE64", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "aa351c58adc8"},
{"username": "DEVICE65", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6bf412cedcc4"},
{"username": "DEVICE66", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6abce540b471"},
{"username": "DEVICE67", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "d6bf79a42bbe"},
{"username": "DEVICE68", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "3cc6f936baf6"},
{"username": "DEVICE69", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "2cb325f70c23"},
{"username": "DEVICE70", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "66f7f8694095"},
{"username": "DEVICE71", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "58901e1416de"},
{"username": "DEVICE72", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "586c1f2e892b"},
{"username": "DEVICE73", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "901e5e78f4f3"},
{"username": "DEVICE74", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "874aad37b21f"},
{"username": "DEVICE75", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "4dbcb6c593d7"},
{"username": "DEVICE76", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6739f40b14f2"},
{"username": "DEVICE77", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "aac2f72f554b"},
{"username": "DEVICE78", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e085b16095a4"},
{"username": "DEVICE79", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "a01d525e23e7"},
{"username": "DEVICE80", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "fd81c379eb3b"},
{"username": "DEVICE81", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0d7a0ba32cec"},
{"username": "DEVICE82", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "fc76a94ef7e6"},
{"username": "DEVICE83", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "8fa4c6b7300f"},
{"username": "DEVICE84", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "d81db5e1bc6b"},
{"username": "DEVICE85", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f69e6e563276"},
{"username": "DEVICE86", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b444321cb6a6"},
{"username": "DEVICE87", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "904339b43525"},
{"username": "DEVICE88", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "a1633067ae90"},
{"username": "DEVICE89", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "25a90368d901"},
{"username": "DEVICE90", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "8d0bf5906412"},
{"username": "DEVICE91", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "ae65df71ed25"},
{"username": "DEVICE92", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "85637453a310"},
{"username": "DEVICE93", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b0a96a6d3954"},
{"username": "DEVICE94", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "fc58fbf2f917"},
{"username": "DEVICE95", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e189361df065"},
{"username": "DEVICE96", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6c5624226d92"},
{"username": "DEVICE97", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "4d3c9eb1404c"},
{"username": "DEVICE98", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "bc9d0a5e0085"},
{"username": "DEVICE99", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "97c25b47f2e8"},
{"username": "DEVICE100", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "470d9f53bba2"},
{"username": "DEVICE101", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7cee917756fd"},
{"username": "DEVICE102", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9f6cadd6f88c"},
{"username": "DEVICE103", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e609231d2354"},
{"username": "DEVICE104", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "1f632e849e9a"},
{"username": "DEVICE105", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "bc12accc802f"},
{"username": "DEVICE106", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9106f01ad123"},
{"username": "DEVICE107", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c1a2143e4819"},
{"username": "DEVICE108", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "16398f9f7d4a"},
{"username": "DEVICE109", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0f35e5bd8bcf"},
{"username": "DEVICE110", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6c1e35f3abb2"},
{"username": "DEVICE111", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "49b73c2e5aec"},
{"username": "DEVICE112", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "179ac1ec8195"},
{"username": "DEVICE113", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9923af6408b1"},
{"username": "DEVICE114", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5dee926d2f1b"},
{"username": "DEVICE115", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "a9e8fe3d81df"},
{"username": "DEVICE116", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b29e1b00c904"},
{"username": "DEVICE117", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "224bf53e4668"},
{"username": "DEVICE118", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5f2c48f50526"},
{"username": "DEVICE119", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "28c57c848956"},
{"username": "DEVICE120", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f98e6803be78"},
{"username": "DEVICE121", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b3186b7cbd08"},
{"username": "DEVICE122", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0abc8c50bbb3"},
{"username": "DEVICE123", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "441707363719"},
{"username": "DEVICE124", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b38dacaa3471"},
{"username": "DEVICE125", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0d2d47294939"},
{"username": "DEVICE126", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "d2df06196df8"},
{"username": "DEVICE127", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "196c935af938"},
{"username": "DEVICE128", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e76e15c03f8a"},
{"username": "DEVICE129", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "a482ffed3c22"},
{"username": "DEVICE130", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "d183d5d0af94"},
{"username": "DEVICE131", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5481e33e6a11"},
{"username": "DEVICE132", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "fa40f3361a90"},
{"username": "DEVICE133", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "4498d287b6e2"},
{"username": "DEVICE134", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f2f02e086bf1"},
{"username": "DEVICE135", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "35e828ae8c97"},
{"username": "DEVICE136", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "01247ff293f3"},
{"username": "DEVICE137", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6134711642bf"},
{"username": "DEVICE138", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7b8f33081112"},
{"username": "DEVICE139", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "68dc51b2f78b"},
{"username": "DEVICE140", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "ac0c8c631ce8"},
{"username": "DEVICE141", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6dad160705db"},
{"username": "DEVICE142", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "be080b717160"},
{"username": "DEVICE143", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "955c5b253fdc"},
{"username": "DEVICE144", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5b1d07269840"},
{"username": "DEVICE145", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9dcd71a227de"},
{"username": "DEVICE146", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b8bf4d570b3b"},
{"username": "DEVICE147", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f72218eb337b"},
{"username": "DEVICE148", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "4e77f4b854bc"},
{"username": "DEVICE149", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "e1505fe70e51"},
{"username": "DEVICE150", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "d61997b7130a"},
{"username": "DEVICE151", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "09e939aa02ce"},
{"username": "DEVICE152", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b7ed742d7d02"},
{"username": "DEVICE153", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "286b44285eea"},
{"username": "DEVICE154", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "76b4461ed767"},
{"username": "DEVICE155", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9fce033d93bf"},
{"username": "DEVICE156", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "607f392c26a8"},
{"username": "DEVICE157", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "80e58a645c69"},
{"username": "DEVICE158", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "ccc61377ff2b"},
{"username": "DEVICE159", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f7192fef6789"},
{"username": "DEVICE160", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "830fc427409e"},
{"username": "DEVICE161", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b15be14b6423"},
{"username": "DEVICE162", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9f44ccd4b415"},
{"username": "DEVICE163", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b13ab64261e1"},
{"username": "DEVICE164", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "daf1d9807ba7"},
{"username": "DEVICE165", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "74a5c420154a"},
{"username": "DEVICE166", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "b751ce4f3051"},
{"username": "DEVICE167", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f7b20f3ec577"},
{"username": "DEVICE168", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "81414f2b1952"},
{"username": "DEVICE169", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f1d949c2d093"},
{"username": "DEVICE170", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "628e9986478a"},
{"username": "DEVICE171", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "358b02a5b485"},
{"username": "DEVICE172", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "64fe3b6acb21"},
{"username": "DEVICE173", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "242a5e9564a2"},
{"username": "DEVICE174", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "a703b9ec7863"},
{"username": "DEVICE175", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0d286a8c55a7"},
{"username": "DEVICE176", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "3da227b0ca1c"},
{"username": "DEVICE177", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "21bad7705f5c"},
{"username": "DEVICE178", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "9eddbe2fb042"},
{"username": "DEVICE179", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "abc131958a7b"},
{"username": "DEVICE180", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7c6fe6ae2641"},
{"username": "DEVICE181", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "26484015c269"},
{"username": "DEVICE182", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "cc6cee1c162d"},
{"username": "DEVICE183", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "7fa0b60c9a00"},
{"username": "DEVICE184", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "f6823c2c7740"},
{"username": "DEVICE185", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "024815369af8"},
{"username": "DEVICE186", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "2f548c69a99c"},
{"username": "DEVICE187", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "5197f42ed201"},
{"username": "DEVICE188", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "987c8a4c9565"},
{"username": "DEVICE189", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "1156677279df"},
{"username": "DEVICE190", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "14f508646b46"},
{"username": "DEVICE191", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "dd9798b5aa10"},
{"username": "DEVICE192", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "3e4af4f238ba"},
{"username": "DEVICE193", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "0dd66ec41c16"},
{"username": "DEVICE194", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "07adfec0affc"},
{"username": "DEVICE195", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "22943aeb8f41"},
{"username": "DEVICE196", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "6e74f9b7a215"},
{"username": "DEVICE197", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "a32c695ccde9"},
{"username": "DEVICE198", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "c93f60d35d51"},
{"username": "DEVICE199", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "ddf4d41f846f"},
{"username": "DEVICE200", "host": "rolling-stock-sandbox2-openfire.onsmartengineering.com", "port": 5222, "ping": 15, "password": "07fd03b6fce0"}
]

View File

@@ -9,8 +9,10 @@ import (
"math/rand" "math/rand"
"os" "os"
"strconv" "strconv"
"sync"
"time" "time"
"github.com/twinj/uuid"
appConfig "github.com/xmpploadtesting/config" appConfig "github.com/xmpploadtesting/config"
"gosrc.io/xmpp" "gosrc.io/xmpp"
"gosrc.io/xmpp/stanza" "gosrc.io/xmpp/stanza"
@@ -43,6 +45,61 @@ const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE
"digiID": "digi-00000000-00000000-0040FFFF-FF801D30" "digiID": "digi-00000000-00000000-0040FFFF-FF801D30"
}` }`
const commandMessageExample = `{"device_jid":"device1@rolling-stock-sandbox2-openfire.onsmartengineering.com",
"message_id":"df26acfa-bdd4-40f4-a980-0638bbdb096e-1632473349400",
"api_version":1,
"from_id":"agent@rolling-stock-sandbox2-openfire.onsmartengineering.com",
"commands":[{"name":"demo_command","uuid":"0388ffd0-3f69-4600-b545-ed19f6378a0a",
"params":{"user_id":"21","api_version":1,"command":"demo_command","player_id":"8","arg":"senad.uka@toptal.com help"}}]}`
const commandResponse = `{"api_version": 1,
"message_id": "766318f3-d1d3-4359-bf2d-e69d508733f4-1632410186320",
"responses": [{"params": {"message": "Unsupported command. Type help for the list of supported commands", "response_code": "SUCCESS"},
"uuid": "5a041416-4184-4529-a7d3-7bfdd9fc1739",
"name": "demo_command"}],
"player_id": "3"}`
// CommandMessage -
type CommandMessage struct {
APIVersion int `json:"api_version"`
MessageID string `json:"message_id"`
Commands []Command `json:"commands"`
}
// Command -
type Command struct {
Params CommandParams `json:"params"`
UUID string `json:"uuid"`
Name string `json:"name"`
}
// CommandParams -
type CommandParams struct {
Command string `json:"message"`
PlayerID string `json:"player_id"`
}
// CommandMessageResponse -
type CommandMessageResponse struct {
APIVersion int `json:"api_version"`
MessageID string `json:"message_id"`
Responses []Response `json:"responses"`
PlayerID string `json:"player_id"`
}
// Response -
type Response struct {
Params ResponseParams `json:"params"`
UUID string `json:"uuid"`
Name string `json:"name"`
}
// ResponseParams -
type ResponseParams struct {
Message string `json:"message"`
ResponseCode string `json:"response_code"`
}
// XMPPService - struct containing // XMPPService - struct containing
type XMPPService struct { type XMPPService struct {
Router *xmpp.Router Router *xmpp.Router
@@ -91,8 +148,10 @@ func Init() {
log.Printf("Client credentials length %v", len(clientCredentials)) log.Printf("Client credentials length %v", len(clientCredentials))
xmppService.XMPPClients = make([]XMPPClient, 0) xmppService.XMPPClients = make([]XMPPClient, 0)
var wg sync.WaitGroup
for _, credential := range clientCredentials { for _, credential := range clientCredentials {
wg.Add(1)
log.Printf("Host %v", credential.Host+":"+strconv.Itoa(credential.Port)) log.Printf("Host %v", credential.Host+":"+strconv.Itoa(credential.Port))
log.Printf("Jid %v", credential.Jid+"@"+credential.Host) log.Printf("Jid %v", credential.Jid+"@"+credential.Host)
log.Printf("Port %v", credential.Port) log.Printf("Port %v", credential.Port)
@@ -114,6 +173,11 @@ func Init() {
} }
go func() { go func() {
defer wg.Done()
statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.CommandReplyDelay))
log.Printf("Delaying client connection for: %v secconds", statusMesageDelay)
// Delay For two seccond to allow all clients to connect
time.Sleep(time.Duration(statusMesageDelay * 1000000000))
client, err := xmpp.NewClient(&xmppClient.Config, xmppService.Router, errorHandler) client, err := xmpp.NewClient(&xmppClient.Config, xmppService.Router, errorHandler)
@@ -133,13 +197,19 @@ func Init() {
}() }()
} }
// Delay For two seccond to allow all clients to connect // Wait untill all client connections are open sucessfuly
time.Sleep(time.Duration(2000000000)) wg.Wait()
} }
// SendOnlinePresenceStanza - send online presence stnza with data, to server // SendOnlinePresenceStanza - send online presence stnza with data, to server
func SendOnlinePresenceStanza(client *xmpp.Client, jid string) error { func SendOnlinePresenceStanza(client *xmpp.Client, jid string) error {
statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.CommandReplyDelay))
log.Printf("Delaying online stanza presence message for: %v, secconds", statusMesageDelay*1000000000)
// Delay For two seccond to allow all clients to connect
time.Sleep(time.Duration(statusMesageDelay * 1000000000))
onlinePresencePacket := stanza.NewPresence(stanza.Attrs{From: jid, Type: stanza.StanzaType(stanza.PresenceShowChat)}) onlinePresencePacket := stanza.NewPresence(stanza.Attrs{From: jid, Type: stanza.StanzaType(stanza.PresenceShowChat)})
onlinePresencePacket.Status = rolingStockPresenceMessage onlinePresencePacket.Status = rolingStockPresenceMessage
@@ -181,6 +251,13 @@ func getClientConfigsFromFile(filePath string) ([]ClientCredentials, error) {
func handleMessage(s xmpp.Sender, p stanza.Packet) { func handleMessage(s xmpp.Sender, p stanza.Packet) {
commandMessageResponse := CommandMessageResponse{}
err := json.Unmarshal([]byte(commandResponse), &commandMessageResponse)
if err != nil {
log.Printf("unable to unmarshal Command Meassage Response: %v", commandResponse)
}
msg, ok := p.(stanza.Message) msg, ok := p.(stanza.Message)
if !ok { if !ok {
log.Printf(" message not OK") log.Printf(" message not OK")
@@ -193,14 +270,37 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
return return
} }
log.Printf("<%v> received following message: %v", msg.To, msg.Body) commandMessage := CommandMessage{}
statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.StatusMessageDelay)) err = json.Unmarshal([]byte(msg.Body), &commandMessage)
log.Printf("DELAYING FOR: %v", statusMesageDelay*1000000000)
// Delay For two seccond to allow all clients to connect
time.Sleep(time.Duration(statusMesageDelay * 1000000000))
reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: `{"status": "OK"}`} if err != nil {
err := s.Send(reply) log.Printf("<%v> unable to unmarshal Command Meassage: %v", msg.To, msg.Body)
}
if len(commandMessageResponse.Responses) > 0 || len(commandMessage.Commands) > 0 {
// messageIDUUID := uuid.NewV4().String()
commandMessageUUID := uuid.NewV4().String()
commandMessageResponse.Responses[0].UUID = commandMessageUUID
commandMessageResponse.PlayerID = commandMessage.Commands[0].Params.PlayerID
commandMessageResponse.MessageID = commandMessage.MessageID
} else {
log.Printf("<%v> There are no commands inside command message : %v", msg.To, commandMessage)
}
m, err := json.Marshal(commandMessageResponse)
if err != nil {
log.Printf("<%v> unable to marshal Command Meassage response : %v", msg.To, commandMessageResponse)
}
log.Printf("<%v> received following message: %v", msg.To, msg.Body)
commandReplyDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.CommandReplyDelay))
log.Printf("Waiting FOR: %v", commandReplyDelay*1000000000)
// Delay For two seccond to allow all clients to connect
time.Sleep(time.Duration(commandReplyDelay * 1000000000))
reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: string(m)}
err = s.Send(reply)
if err != nil { if err != nil {
log.Printf("Error sending to %v message %v", msg.From, err) log.Printf("Error sending to %v message %v", msg.From, err)

BIN
xmpploadtesting Executable file

Binary file not shown.