SSH::LibSSH::Tunnel - establish remote forwarding SSH tunnel
use SSH::LibSSH::Tunnel;
my SSH::LibSSH::Tunnel:D $ssh-tunnel .= new: :tunnel-host<intermediary>,
:tunnel-user<useratintermediary>,
:tunnel-port(22), # default is 22 (ssh)
:local-host<127.0.0.1>, # default is 127.0.0.1 (localhost)
:local-port<33333>, # default (zero) means "let the OS choose"
:remote-host<finaldestination>,
:remote-port<3306>,
:private-key-file($*HOME.add: '.ssh/some_key'),
:timeout(30); # default is 30s -- passed to SSH::LibSSH
my $connection = $ssh-tunnel.connect;
# at this point, the tunnel is already connected
my $port-to-connect = $ssh-tunnel.local-port; # useful if passed the default
SSH::LibSSH::Tunnel is a library (based on SSH::LibSSH) to simplify the setup of forwarding SSH tunnels.
address that will listen locally for the tunnel
port that will listen locally for the tunnel
intermediary host (will connect on it via ssh)
intermediary SSH service port
SSH user on the intermediary host
SSH private key file for connection (no password, for now)
destination tunnel host
destination tunnel port
destination tunnel port
method connect() returns SSH::LibSSH::Tunnel
Establish the connection, synchronously. Returns self.
Humberto Massa humbertomassa@gmail.com
Copyright © 2023 - 2024 Humberto Massa
This library is free software; you can redistribute it and/or modify it under either the Artistic License 2.0 or the LGPL v3.0, at your convenience.