refactor: move CreateForwardedTCPIPPayload to forwarder interface

This commit is contained in:
2025-12-05 13:49:33 +07:00
parent 7a31047bb9
commit 659f6c3ee7
7 changed files with 36 additions and 82 deletions

View File

@ -298,8 +298,7 @@ func Handler(conn net.Conn) {
}
func forwardRequest(cw *CustomWriter, initialRequest *RequestHeaderFactory, sshSession *session.SSHSession) {
originHost, originPort := ParseAddr(cw.RemoteAddr.String())
payload := createForwardedTCPIPPayload(originHost, uint16(originPort), sshSession.Forwarder.GetForwardedPort())
payload := sshSession.Forwarder.CreateForwardedTCPIPPayload(cw.RemoteAddr)
channel, reqs, err := sshSession.Lifecycle.GetConnection().OpenChannel("forwarded-tcpip", payload)
if err != nil {
log.Printf("Failed to open forwarded-tcpip channel: %v", err)