From 1308694711fd3cd2ec0e60409cb35b6db4ae4103 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sun, 22 Apr 2018 23:21:40 -0700 Subject: [PATCH] better ui --- connect.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/connect.go b/connect.go index 3d9c8a4c..97b1433c 100644 --- a/connect.go +++ b/connect.go @@ -181,23 +181,20 @@ func (c *Connection) Run() error { }) if c.IsSender { c.Server = "localhost" - p.Discover() + go p.Discover() - fmt.Println("running relay on local address " + GetLocalIP()) - fmt.Println([]byte(c.Code)) } else { + fmt.Print("finding local croc relay...") discovered, err := p.Discover() if err != nil { return err } - fmt.Println(discovered) if len(discovered) == 0 { return errors.New("could not find server") } c.Server = discovered[0].Address - fmt.Println(discovered[0].Payload) + fmt.Println(discovered[0].Address) c.Code = string(discovered[0].Payload) - time.Sleep(1 * time.Second) } } @@ -275,7 +272,7 @@ func (c *Connection) Run() error { } if c.Local { - fmt.Fprintf(os.Stderr, "Receive with: croc --code %s --server %s --yes\n", c.Code, GetLocalIP()) + fmt.Fprintf(os.Stderr, "Receive with: croc --local\n") } else { fmt.Fprintf(os.Stderr, "Code is: %s\n", c.Code) } @@ -500,7 +497,7 @@ func (c *Connection) runClient() error { return nil // connection was in use, just quit cleanly } - timeSinceStart := time.Since(responses.startTime) / time.Second + timeSinceStart := time.Since(responses.startTime).Nanoseconds() if c.IsSender { if responses.gotTimeout { @@ -577,7 +574,7 @@ func (c *Connection) runClient() error { } } } - fmt.Fprintf(os.Stderr, " (%s/s)\n", humanize.Bytes(uint64(float64(c.File.Size)/float64(timeSinceStart)))) + fmt.Fprintf(os.Stderr, " (%s/s)\n", humanize.Bytes(uint64(float64(1000000000)*float64(c.File.Size)/float64(timeSinceStart)))) return nil }