From 7dc36b02c9e7a99a7e31b7693f9e5c751062b4be Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 23 Mar 2024 18:34:27 +0100 Subject: [PATCH 1/2] markdown lint issues, spelling issues and other small fixes --- CONTRIBUTING.md | 70 ++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4682e34..a260d86 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,8 @@ Contributing to Argus Engine is pretty straightforward ## Contributing to building ARGUS Client Libraries ( Langauge Specific ) -Building ARGUS client libraries invloves 3 straight simple steps. +Building ARGUS client libraries involves 3 simple steps. + - Connecting to ARGUS Engine - Authenticating the connection - Listening for events and messages @@ -21,7 +22,7 @@ A simple TCP/IP dial/connect to the IP and Port is enough to do the trick. ```go import ( - "net" + "net" ) conn, err := net.Dial("tcp", "localhost:1337") @@ -46,7 +47,7 @@ If authentication is turned on from the ARGUS Engine, it means clients connectin The client has to send a prompt message to the engine immediately after connecting, if authentication is successful, the Engine adds it to the list of trusted clients which it would send events to. -The authentication message is a connection string in the formart `"Username:Password"`, where the `Username` and `Password` are the placeholders for the ARGUS Engine auth credentials. +The authentication message is a connection string in the format `"Username:Password"`, where the `Username` and `Password` are the placeholders for the ARGUS Engine auth credentials. ```go connectionString := fmt.Sprintf("%s:%s", "testusername", "testpassword") @@ -73,33 +74,33 @@ The authentication message is a connection string in the formart `"Us ### Listening for events and messages -In order to listen for events and messages you have to continously listen on the TCP stream for incoming data and then deserialize into an identifiable object ( for events), or log out messages for ordinary application messages. +In order to listen for events and messages you have to continously listen on the TCP stream for incoming data and then deserialize into an identifiable object (for events), or log out messages for ordinary application messages. ```go - buffer := make([]byte, 1024) - for { - // Read data from the client - n, err := conn.Read(buffer) - if err != nil { - argus.Errors <- err - } - - data := string(buffer[:n]) - - if len(data) > 0 { - - isJson, event, str := utils.IsJsonString(data) - - if isJson { - // Push event to event channel - argus.Events <- event - } else { - - argus.Messages <- fmt.Sprintf("Received: %s\n", str) - } - } - - } + buffer := make([]byte, 1024) + for { + // Read data from the client + n, err := conn.Read(buffer) + if err != nil { + argus.Errors <- err + } + + data := string(buffer[:n]) + + if len(data) > 0 { + + isJson, event, str := utils.IsJsonString(data) + + if isJson { + // Push event to event channel + argus.Events <- event + } else { + + argus.Messages <- fmt.Sprintf("Received: %s\n", str) + } + } + + } ``` ```c# @@ -132,11 +133,10 @@ Return the fetched event to the user. Note: The Json string expected from the ARGUS Engine is as below: ```json - { - "Action" : "string", - "ActionDescription: "string", - "Name": "string", - "Timestamp": datetime - } + { + "Action" : "string", + "ActionDescription: "string", + "Name": "string", + "Timestamp": datetime + } ``` - From 054357c660f1d9bf0880045231395d14efeef1bf Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 23 Mar 2024 18:38:10 +0100 Subject: [PATCH 2/2] eliminate empty line --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a260d86..fa0d213 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,7 +95,6 @@ In order to listen for events and messages you have to continously listen on the // Push event to event channel argus.Events <- event } else { - argus.Messages <- fmt.Sprintf("Received: %s\n", str) } }