Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yosebyte authored Dec 6, 2024
1 parent 51965a5 commit ba91b5c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/tunnel/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ func Client(parsedURL *url.URL) error {
}()
}
if string(buffer[:n]) == "[PASSPORT]<UDP>\n" {
remoteConn, err := net.DialTCP("tcp", nil, linkAddr)
if err != nil {
log.Error("Unable to dial target address: [%v]", linkAddr)
return err
}
defer remoteConn.Close()
log.Info("Remote connection established: [%v]", linkAddr)
go func(remoteConn *net.TCPConn) {
go func() {
remoteConn, err := net.DialTCP("tcp", nil, linkAddr)
if err != nil {
log.Error("Unable to dial target address: [%v] %v", linkAddr, err)
return
}
defer remoteConn.Close()
log.Info("Remote connection established: [%v]", linkAddr)
buffer := make([]byte, 8192)
n, err := remoteConn.Read(buffer)
if err != nil {
Expand Down Expand Up @@ -104,7 +104,7 @@ func Client(parsedURL *url.URL) error {
return
}
log.Info("Transfer completed successfully")
}(remoteConn)
}()
}
}
return nil
Expand Down

0 comments on commit ba91b5c

Please sign in to comment.