Fix naming and typos
This commit is contained in:
@@ -5,18 +5,13 @@ A tool for testing xmpp servers load
|
||||
|
||||
| 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_FILE_LOCATION | NO | input.json | Database username |
|
||||
| |
|
||||
| **GeneralOptions:** |
|
||||
| |
|
||||
| MASSAGE_DELAY | NO | 120000000000 - 2 mins | Delay for online presence message loop |
|
||||
| STATUS_MASSAGE_DELAY | NO | 10 sec | Delay for online presence message loop |
|
||||
| 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 |
|
||||
| |
|
||||
|
||||
|
||||
@@ -9,16 +9,14 @@ func Load() {
|
||||
AppConfig = Config{
|
||||
|
||||
Service: Service{
|
||||
Port: getEnv("OPENFIRE_PORT", "5222"),
|
||||
Address: mustGetEnv("OPENFIRE_ADRESS"),
|
||||
Domain: mustGetEnv("OPENFIRE_DOMAIN"),
|
||||
Port: getEnv("OPENFIRE_PORT", "5222"),
|
||||
},
|
||||
Credentials: Credentials{
|
||||
CredentialsFileLocation: getEnv("CREDENTIALS_FILE_LOCATION", "input.json"),
|
||||
},
|
||||
GeneralOptions: GeneralOptions{
|
||||
DelayBetweenMassages: int64(getEnvInt("MASSAGE_DELAY", 120000000000)),
|
||||
StatusMessageDelay: getEnvInt("STATUS_MASSAGE_DELAY", 10),
|
||||
PresenceStatusDelay: int64(getEnvInt("PRESENCE_STATUS_DELAY", 2) * 60),
|
||||
CommandReplyDelay: getEnvInt("COMMAND_REPLY_DELAY", 10),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ type Credentials struct {
|
||||
|
||||
// GeneralOptions contains information for general configuration options
|
||||
type GeneralOptions struct {
|
||||
DelayBetweenMassages int64
|
||||
StatusMessageDelay int
|
||||
PresenceStatusDelay int64
|
||||
CommandReplyDelay int
|
||||
}
|
||||
|
||||
3
go.mod
3
go.mod
@@ -2,9 +2,10 @@ module github.com/xmpploadtesting
|
||||
|
||||
go 1.17
|
||||
|
||||
require gosrc.io/xmpp v0.5.1
|
||||
|
||||
require (
|
||||
github.com/google/uuid v1.1.1 // 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
|
||||
)
|
||||
|
||||
2
main.go
2
main.go
@@ -36,7 +36,7 @@ func main() {
|
||||
|
||||
}
|
||||
// Delay before sending another message
|
||||
time.Sleep(time.Duration(appConfig.AppConfig.GeneralOptions.DelayBetweenMassages))
|
||||
time.Sleep(time.Duration(appConfig.AppConfig.GeneralOptions.PresenceStatusDelay))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -211,10 +211,10 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
|
||||
}
|
||||
|
||||
log.Printf("<%v> received following message: %v", msg.To, msg.Body)
|
||||
statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.StatusMessageDelay))
|
||||
log.Printf("DELAYING FOR: %v", statusMesageDelay*1000000000)
|
||||
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(statusMesageDelay * 1000000000))
|
||||
time.Sleep(time.Duration(commandReplyDelay * 1000000000))
|
||||
|
||||
reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: `{"status": "OK"}`}
|
||||
err := s.Send(reply)
|
||||
|
||||
BIN
xmpploadtesting
Executable file
BIN
xmpploadtesting
Executable file
Binary file not shown.
Reference in New Issue
Block a user