refactor(forwarder): remove CreateForwardedTCPIPPayload method
SonarQube Scan / SonarQube Trigger (push) Successful in 2m32s
SonarQube Scan / SonarQube Trigger (push) Successful in 2m32s
- OpenForwardedChannel now privately calls CreateForwardedTCPIPPayload - Removed an unused function
This commit is contained in:
@@ -18,8 +18,7 @@ type tcp struct {
|
||||
}
|
||||
|
||||
type Forwarder interface {
|
||||
CreateForwardedTCPIPPayload(origin net.Addr) []byte
|
||||
OpenForwardedChannel(ctx context.Context, payload []byte) (ssh.Channel, <-chan *ssh.Request, error)
|
||||
OpenForwardedChannel(ctx context.Context, origin net.Addr) (ssh.Channel, <-chan *ssh.Request, error)
|
||||
HandleConnection(dst io.ReadWriter, src ssh.Channel)
|
||||
}
|
||||
|
||||
@@ -55,10 +54,9 @@ func (tt *tcp) handleTcp(conn net.Conn) {
|
||||
log.Printf("Failed to close connection: %v", err)
|
||||
}
|
||||
}()
|
||||
payload := tt.forwarder.CreateForwardedTCPIPPayload(conn.RemoteAddr())
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||
defer cancel()
|
||||
channel, reqs, err := tt.forwarder.OpenForwardedChannel(ctx, payload)
|
||||
channel, reqs, err := tt.forwarder.OpenForwardedChannel(ctx, conn.RemoteAddr())
|
||||
if err != nil {
|
||||
log.Printf("Failed to open forwarded-tcpip channel: %v", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user