forwardStream

suspend fun forwardStream(readChannel: ByteReadChannel, writeChannel: ByteWriteChannel, remoteHost: String, remotePort: Int, originAddr: String = LOCALHOST, originPort: Int = 0): StreamForwarder?(source)

Forward a pair of streams through an SSH direct-tcpip channel.

Opens a direct-tcpip channel to remoteHost:remotePort and copies data bidirectionally between the provided Ktor channels and the SSH channel.

Return

StreamForwarder handle, or null if the channel could not be opened

Parameters

readChannel

Source of data to send through SSH

writeChannel

Destination for data received from SSH

remoteHost

Remote host to connect to through SSH

remotePort

Remote port to connect to through SSH

originAddr

Originator address reported to the server

originPort

Originator port reported to the server