From 480768e33eafce0b2500401b23bd6ea2cb0925e8 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 26 May 2019 00:27:15 -0700 Subject: [PATCH] closer to generating new tokens Signed-off-by: Jeff Carr --- main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 7cfc2ad..3fab52a 100644 --- a/main.go +++ b/main.go @@ -42,6 +42,7 @@ var BUILDTIME string // this is passed in as an ldflag // DNS over TLS plugin for coredns // uses protobuf's and gRPC in pb/dns.proto // https://github.com/coredns/coredns/tree/master/plugin/tls +// https://github.com/coredns/coredns/blob/master/pb/dns.proto func onExit(err error) { log.Println("Sleep for 1 second") @@ -204,6 +205,12 @@ func mainMouseClick(b *gui.ButtonMap) { } else if (b.Action == "LOGIN") { log.Println("\tTRIGGER LOGIN ACCOUNT") gui.Data.State = "SEND LOGIN" + + // TODO: move this into a seperate goroutine + event := pb.MakeLoginEvent() + event.Account = b.Account + prepareAndSend(event) + count := 0 for { log.Println("\tSleep() in buttonClick() gui.Data.State =", gui.Data.State) @@ -301,7 +308,7 @@ func prepareAndSend(event *pb.Event) { event.Username = gui.Data.Current.Username event.Password = gui.Data.Current.Password } - log.Println("\tpb.MakeLoginEvent() event.Token =", event.Token) + log.Println("\tmain.prepareAndSend() event.Token =", event.Token) gorillaSendProtobuf(event) gui.Data.State = "READ PROTOBUF" } @@ -323,11 +330,13 @@ func watchGUI() { event := pb.MakeGetEvent() prepareAndSend(event) } +/* if (gui.Data.State == "SEND LOGIN") { log.Println("\tTRIGGERING LOGIN") event := pb.MakeLoginEvent() prepareAndSend(event) } +*/ if (gui.Data.State == "CREATE") { log.Println("\tTRIGGERING CREATE") event := pb.MakeAddVmEvent() @@ -337,7 +346,7 @@ func watchGUI() { log.Println("gui.State = kill") log.Println("gui.State = kill") log.Println("gui.State = kill") - os.Exit(0) + onExit(nil) } if (gui.Data.State == "splash") { for key, _ := range config.Accounts {