How remote port forwarding works in Citadel
mainRemote port forwarding follows this lifecycle:
- The Citadel client connects to the SSH server.
- The client requests the server to listen on a specific port (the remote port).
- When a client connects to that port on the remote server, the SSH server opens a
forwarded-tcpipchannel. - The Citadel client receives this connection via a closure and forwards it to a local host and port.
- Data flows bidirectionally:
remote client ↔ SSH tunnel ↔ local service.
Advanced Routing: You can inspect forwardedInfo.originatorAddress or forwardedInfo.listeningPort within the handler closure to implement custom routing logic, such as directing different connections to different local services.