App-ReslirpTunnel

 view release on metacpan or  search on metacpan

bin/reslirp-tunnel  view on Meta::CPAN

if ($ssh_host =~ /^(?:(.*?)@)?([^:@]*?)(?::(\d+))?$/) {
    $ssh_host = $2 if defined $2;
    $ssh_user = $1 if defined $1;
    $ssh_port = $3 if defined $3;
}

$log_level =~ /^(debug|info|warn|error)$/ or die "Invalid log level: $log_level\n";

if (defined $device) {
    $device = "tap$device" if $device =~ /^\d+$/;
}

my $tunnel = App::ReslirpTunnel->new(app_name => $app_name,
                                     ssh_port => $ssh_port,
                                     ssh_host => $ssh_host,
                                     ssh_user => $ssh_user,
                                     remote_os => $remote_os,
                                     remote_network => $remote_network,
                                     remote_netmask => $remote_netmask,
                                     remote_gw => $remote_gw,
                                     remote_dns => $remote_dns,
                                     local_ip => $local_ip,
                                     ssh_command => $ssh_command,
                                     more_ssh_args => \@more_ssh_args,
                                     more_reslirp_args => \@more_reslirp_args,
                                     reslirp_command => $reslirp_command,
                                     forward_dns_ssh => \@forward_dns_ssh,
                                     route_nets => \@route_nets,
                                     route_hosts => \@route_hosts,
                                     route_hosts_local => \@route_hosts_local,
                                     route_hosts_dns => \@route_hosts_dns,
                                     route_hosts_ssh => \@route_hosts_ssh,
                                     log_to_stderr => $log_to_stderr,
                                     log_file => $log_file,
                                     log_level => $log_level,
                                     run_in_foreground => $run_in_foreground,
                                     dont_close_stdio => $dont_close_stdio,
                                     device => $device);

$tunnel->go;

=pod

=head1 NAME

reslirp-tunnel - A script to set up a reSLIRP tunnel over SSH for remote connections

=head1 SYNOPSIS

reslirp-tunnel [options] ssh_target

=head1 DESCRIPTION

C<reslirp-tunnel> establishes a reSLIRP tunnel to a specified remote
host using SSH. It enables users to configure various networking
options and manages IP routing rules along with DNS resolution
configuration, greatly simplifying the setup process for a reSLIRP
tunnel.

The program is designed to be executed by a non-root user. It
automatically invokes sudo in the background, which typically prompts
the user for a password to perform privileged operations.

=head1 OPTIONS

=over 8

=item B<-C>, B<--reslirp-command> I<command>

Specify command to be use on the remote host to run reSLIRP.

By default, it uses C<C:\Program Files\reSLIRP\reslirp.exe> for
Windows systems and C<reslirp> otherwise.

=item B<-r>, B<--reslirp-arg> I<arg>

Specify additional reslirp arguments.

=item B<-s>, B<--ssh-command> I<command>

Specify the SSH command to be used locally.

=item B<-l>, B<--ssh-user> I<user>

Specify the remote user used for logging in.

=item B<-p>, B<--ssh-port> I<port>

Specify the remote port (defaults to 22).

=item B<-s>, B<--ssh-arg> I<arg>

Specify additional SSH arguments.

=item B<-R>, B<--remote-os> I<os>

Specify the remote operating system.

When not given, C<reslirp-tunnel> would try to autodetect the remote
Operating System running some commands over the SSH channel.

=item B<-S>, B<--remote-shell> I<shell>

Specify the remote shell.

C<reslirp-tunnel> also tries to autodetect the remote shell when it is
not given using this flag explicitly.

=item B<-n>, B<--remote-network> I<network>/I<mask>

Specify the remote network (defaults to 10.0.2.0/24).

=item B<-m>, B<--remote-gw> I<ip>

Specify the remote gateway (defaults to 10.0.2.2).

=item B<-d>, B<--remote-dns> I<dns>

Specify the remote DNS (defaults to 10.0.2.3).

=item B<-a>, B<--local-ip> I<ip>



( run in 1.988 second using v1.01-cache-2.11-cpan-d80b1682f3f )