* Add a command `forwardPort' to forward a TCP port on the host to a

TCP port on the guest.  Useful during testing (e.g. to access a web
  server in the guest through a web browser on the host).

svn path=/nixos/trunk/; revision=26987
This commit is contained in:
Eelco Dolstra 2011-04-27 09:54:17 +00:00
parent 043159ff25
commit 0f544f1ea8

View File

@ -519,4 +519,14 @@ sub sleep {
} }
# Forward a TCP port on the host to a TCP port on the guest. Useful
# during interactive testing.
sub forwardPort {
my ($self, $hostPort, $guestPort) = @_;
$hostPort = 8080 unless defined $hostPort;
$guestPort = 80 unless defined $guestPort;
$self->sendMonitorCommand("hostfwd_add tcp::$hostPort-:$guestPort");
}
1; 1;