mirror of https://github.com/schollz/croc.git
slightly more debugging
This commit is contained in:
parent
3a805f8be3
commit
4aa7f05630
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue