cleanup: Started cleaning up the commenting format.

This commit is contained in:
James Wells 2023-03-20 07:20:46 -07:00
parent 0de851e0e5
commit b95d3950c5
Signed by: jwells
GPG key ID: 73196D10B8E65666
10 changed files with 94 additions and 70 deletions

View file

@ -9,8 +9,9 @@ import (
gstructs "github.com/dragonheim/gagent/internal/gstructs"
hclsimple "github.com/hashicorp/hcl/v2/hclsimple"
// hclwrite "github.com/hashicorp/hcl/v2/hclwrite"
)
/*
* hclwrite "github.com/hashicorp/hcl/v2/hclwrite"
*/)
type GagentDb struct {
chainRow []*gagentDbRow `hcl:"timestamp,block"`

View file

@ -18,13 +18,13 @@ import (
)
/*
Client mode will send an agent file to a router for processing
Clients do not process the agent files, only send them as
requests to a router. If started without arguments, the client
will contact the router and attempt to retrieve the results
of it's most recent request.
Main is the entrypoint for the client process
*/
* Client mode will send an agent file to a router for processing
* Clients do not process the agent files, only send them as
* requests to a router. If started without arguments, the client
* will contact the router and attempt to retrieve the results
* of it's most recent request.
* Main is the entrypoint for the client process
*/
func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
log.Printf("[INFO] Starting client\n")
defer wg.Done()
@ -102,7 +102,6 @@ func sendAgent(wg *sync.WaitGroup, uuid string, connectString string, agent gstr
status, err := sock.SendMessage(agent)
if err != nil {
log.Printf("[ERROR] Failed to send agent to router\n")
// os.Exit(11)
return
}
log.Printf("[DEBUG] Agent send status: %d\n", status)

View file

@ -1,6 +1,8 @@
package gstructs
// GagentConfig is the primary construct used by all modes
/*
* GagentConfig is the primary construct used by all modes
*/
type GagentConfig struct {
Name string `hcl:"name,optional"`
Mode string `hcl:"mode,attr"`

View file

@ -24,13 +24,13 @@ var (
)
/*
The 'router' processes routing requests from the agent. The router does
not handle any of the agent activities beyond processing the agent's
list of tags and passing the agent and it's storage to either a member
or client node. Tags are used by the agent to give hints as to where
it should be routed.
Main is the entrypoint for the router
*/
* The 'router' processes routing requests from the agent. The router does
* not handle any of the agent activities beyond processing the agent's
* list of tags and passing the agent and it's storage to either a member
* or client node. Tags are used by the agent to give hints as to where
* it should be routed.
* Main is the entrypoint for the router
*/
func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
log.Printf("[INFO] Starting router\n")
defer wg.Done()
@ -139,7 +139,9 @@ func unwrap(msg []string) (head string, tail []string) {
func answerClient(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
opsProcessed.Inc()
// fmt.Fprintf(w, "%v\n", r)
/*
* fmt.Fprintf(w, "%v\n", r)
*/
http.NotFound(w, r)
return
}

View file

@ -12,8 +12,8 @@ import (
)
/*
Main is the entrypoint for the setup process
*/
* Main is the entrypoint for the setup process
*/
func Main(wg *sync.WaitGroup, config gs.GagentConfig) {
log.Printf("[INFO] Starting setup\n")
defer wg.Done()
@ -31,13 +31,15 @@ func Main(wg *sync.WaitGroup, config gs.GagentConfig) {
clientBlock1 := rootBody.AppendNewBlock("client", []string{config.Name})
clientBody1 := clientBlock1.Body()
// clientBody1.AppendUnstructuredTokens(
// hclwrite.TokensForTraversal(hcl.Traversal{
// hcl.TraverseRoot{
// Name: hcl.CommentGenerator("comment"),
// },
// },
// ))
/*
* clientBody1.AppendUnstructuredTokens(
* hclwrite.TokensForTraversal(hcl.Traversal{
* hcl.TraverseRoot{
* Name: hcl.CommentGenerator("comment"),
* },
* },
* ))
*/
clientBody1.SetAttributeValue("clientid", cty.StringVal(config.UUID))
rootBody.AppendNewline()

View file

@ -7,7 +7,9 @@ import (
gstructs "github.com/dragonheim/gagent/internal/gstructs"
// picol "github.com/dragonheim/gagent/src/picol"
/*
* picol "github.com/dragonheim/gagent/src/picol"
*/
prometheus "github.com/prometheus/client_golang/prometheus"
promauto "github.com/prometheus/client_golang/prometheus/promauto"
@ -22,12 +24,12 @@ var (
)
/*
The "worker" processes the agent code. The worker nodes do not know
anything about the network structure. Instead they know only to which
router(s) they are connected. The worker will execute the agent code and
pass the agent and it's results to a router.
Main is the entrypoint for the worker process
*/
* The "worker" processes the agent code. The worker nodes do not know
* anything about the network structure. Instead they know only to which
* router(s) they are connected. The worker will execute the agent code and
* pass the agent and it's results to a router.
* Main is the entrypoint for the worker process
*/
func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
log.Printf("[INFO] Starting worker\n")
defer wg.Done()
@ -46,7 +48,9 @@ func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
wg.Add(1)
go getAgent(wg, config.UUID, connectString)
}
// workerListener := fmt.Sprintf("tcp://%s:%d", config.ListenAddr, config.WorkerPort)
/*
* workerListener := fmt.Sprintf("tcp://%s:%d", config.ListenAddr, config.WorkerPort)
*/
}