NAME

Footprintless::Tunnel - Provides tunneling over ssh

VERSION

version 1.11

SYNOPSIS

# Standard way of creating tunnels
use Footprintless;
my $tunnel = Footprintless->new()->tunnel($coordinate);

eval {
    $tunnel->open();
    my $local_hostname = $tunnel->get_local_hostname();
    my $port = $tunnel->get_local_port();

    # do stuff with tunnel
}
my $error = $@;
eval {$tunnel->close()};
die($error) if ($error);

DESCRIPTION

This module provides tunneling over ssh

ENTITIES

tunnel => {
    ssh => 'ssh -q',
    local_hostname => 'foo',
    local_port => 1234,
    tunnel_hostname => 'bar',
    tunnel_usename => 'fred',
    destination_hostname => 'baz',
    destination_port => 5678,
    control_socket_dir => '/home/me/.ssh/control_socket',
    tries => 10, 
    wait_seconds => 1, 
}

CONSTRUCTORS

new($entity, $coordinate, %options)

Creates a new tunnel configured by $entities.

METHODS

close()

Closes the tunnel.

get_local_hostname()

Returns the hostname used to access the tunnel.

get_local_port()

Returns the port used to access the tunnel.

is_open()

Returns a truthy value if the tunnel is open.

open([%options])

Opens the tunnel. The available options are:

tries <COUNT>

Number of times to check if the connection is open before giving up. Defaults to 10.

wait_seconds <SECONDS>

Number of seconds to wait between each check to see if the connection is open. Defaults to 1.

AUTHOR

Lucas Theisen <lucastheisen@pastdev.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Lucas Theisen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

SEE ALSO

Please see those modules/websites for more information related to this module.