Fix naming and typos

This commit is contained in:
Senad Uka
2021-09-20 13:30:35 +02:00
parent c6102ec199
commit 58f003ec99
7 changed files with 13 additions and 19 deletions

View File

@@ -5,18 +5,13 @@ A tool for testing xmpp servers load
| 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 | 120000000000 - 2 mins | 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 online presence message loop |
| | | |

View File

@@ -9,16 +9,14 @@ func Load() {
AppConfig = Config{ AppConfig = Config{
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
} }

3
go.mod
View File

@@ -2,9 +2,10 @@ 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
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
) )

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))
} }

View File

@@ -194,10 +194,10 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
} }
log.Printf("<%v> received following message: %v", msg.To, msg.Body) log.Printf("<%v> received following message: %v", msg.To, msg.Body)
statusMesageDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.StatusMessageDelay)) commandReplyDelay := int64(rand.Intn(appConfig.AppConfig.GeneralOptions.CommandReplyDelay))
log.Printf("DELAYING FOR: %v", statusMesageDelay*1000000000) log.Printf("Waiting FOR: %v", commandReplyDelay*1000000000)
// Delay For two seccond to allow all clients to connect // 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"}`} reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: `{"status": "OK"}`}
err := s.Send(reply) err := s.Send(reply)

BIN
xmpploadtesting Executable file

Binary file not shown.