SSH port forwarding #330
Replies: 1 comment 1 reply
-
Hi, you're missing a few parts. Currently, your program can only handle a single connection. You need to To save yourself some trouble, you can turn a The |
Beta Was this translation helpful? Give feedback.
-
Hi
I want to implement SSH port forwarding scenario. For typical administrative tasks, where you must connect to some service through jump host and to do it expose it as local port. Here is my working (yay!) code so far. I'm fairly new to Rust so I've created flow deliberately stripped of any abstractions to understand it better.
Questions:
tcpip_forward
described asRequests the server to open a TCP/IP forward channel
andchannel_open_direct_tcpip
described asOpen a TCP/IP forwarding channel
.data
callback inClient::Handler
trait?break
when local socket read size is 0 (otherwise it's always selectable handle fortokio::select
) so I never actually receiveChannelMsg::ExitStatus
. That's why I added explicitclose
after loop. But this feels hacky.local_port
though? Will Client distinguish where data from the same originator should go?server_channel_open_forwarded_tcpip
/server_channel_open_direct_tcpip
methods for inClient::Handler
trait? If I implement them for Client they never get called.Thank you in advance for reviewing this code (and pushing me in right direction if I messed something up). And thank you for your time and effort creating this module.
Beta Was this translation helpful? Give feedback.
All reactions