From 4aa7f05630f31fbce03aa4f06d5720c5d39f4a66 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 27 Aug 2020 08:10:44 -0700 Subject: [PATCH] slightly more debugging --- src/comm/comm.go | 2 ++ src/croc/croc.go | 3 ++- src/tcp/tcp.go | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/comm/comm.go b/src/comm/comm.go index b7af955..85ed464 100644 --- a/src/comm/comm.go +++ b/src/comm/comm.go @@ -25,9 +25,11 @@ func NewConnection(address string, timelimit ...time.Duration) (c *Comm, err err } connection, err := net.DialTimeout("tcp", address, tlimit) if err != nil { + err = fmt.Errorf("comm.NewConnection failed: %w", err) return } c = New(connection) + log.Debugf("connected to '%s'", address) return } diff --git a/src/croc/croc.go b/src/croc/croc.go index 992168b..a652ac6 100644 --- a/src/croc/croc.go +++ b/src/croc/croc.go @@ -351,17 +351,18 @@ func (c *Client) Send(options TransferOptions) (err error) { if port == "" { port = "9009" } + log.Debugf("got host '%v' and port '%v'", host, port) c.Options.RelayAddress = net.JoinHostPort(host, port) log.Debugf("establishing connection to %s", c.Options.RelayAddress) var banner string conn, banner, ipaddr, err := tcp.ConnectToTCPServer(c.Options.RelayAddress, c.Options.RelayPassword, c.Options.SharedSecret[:3], 5*time.Second) - log.Debugf("banner: %s", banner) if err != nil { err = fmt.Errorf("could not connect to %s: %w", c.Options.RelayAddress, err) log.Debug(err) errchan <- err return } + log.Debugf("banner: %s", banner) log.Debugf("connection established: %+v", conn) for { log.Debug("waiting for bytes") diff --git a/src/tcp/tcp.go b/src/tcp/tcp.go index c687f19..8572681 100644 --- a/src/tcp/tcp.go +++ b/src/tcp/tcp.go @@ -94,7 +94,7 @@ func (s *server) run() (err error) { for { connection, err := server.Accept() if err != nil { - return fmt.Errorf( "problem accepting connection: %w", err) + return fmt.Errorf("problem accepting connection: %w", err) } log.Debugf("client %s connected", connection.RemoteAddr().String()) go func(port string, connection net.Conn) {