mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
slightly more debugging
This commit is contained in:
parent
3a805f8be3
commit
4aa7f05630
3 changed files with 5 additions and 2 deletions
|
@ -25,9 +25,11 @@ func NewConnection(address string, timelimit ...time.Duration) (c *Comm, err err
|
||||||
}
|
}
|
||||||
connection, err := net.DialTimeout("tcp", address, tlimit)
|
connection, err := net.DialTimeout("tcp", address, tlimit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = fmt.Errorf("comm.NewConnection failed: %w", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c = New(connection)
|
c = New(connection)
|
||||||
|
log.Debugf("connected to '%s'", address)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,17 +351,18 @@ func (c *Client) Send(options TransferOptions) (err error) {
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = "9009"
|
port = "9009"
|
||||||
}
|
}
|
||||||
|
log.Debugf("got host '%v' and port '%v'", host, port)
|
||||||
c.Options.RelayAddress = net.JoinHostPort(host, port)
|
c.Options.RelayAddress = net.JoinHostPort(host, port)
|
||||||
log.Debugf("establishing connection to %s", c.Options.RelayAddress)
|
log.Debugf("establishing connection to %s", c.Options.RelayAddress)
|
||||||
var banner string
|
var banner string
|
||||||
conn, banner, ipaddr, err := tcp.ConnectToTCPServer(c.Options.RelayAddress, c.Options.RelayPassword, c.Options.SharedSecret[:3], 5*time.Second)
|
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 {
|
if err != nil {
|
||||||
err = fmt.Errorf("could not connect to %s: %w", c.Options.RelayAddress, err)
|
err = fmt.Errorf("could not connect to %s: %w", c.Options.RelayAddress, err)
|
||||||
log.Debug(err)
|
log.Debug(err)
|
||||||
errchan <- err
|
errchan <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log.Debugf("banner: %s", banner)
|
||||||
log.Debugf("connection established: %+v", conn)
|
log.Debugf("connection established: %+v", conn)
|
||||||
for {
|
for {
|
||||||
log.Debug("waiting for bytes")
|
log.Debug("waiting for bytes")
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (s *server) run() (err error) {
|
||||||
for {
|
for {
|
||||||
connection, err := server.Accept()
|
connection, err := server.Accept()
|
||||||
if err != nil {
|
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())
|
log.Debugf("client %s connected", connection.RemoteAddr().String())
|
||||||
go func(port string, connection net.Conn) {
|
go func(port string, connection net.Conn) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue