Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #44 from Dakumo/master
Browse files Browse the repository at this point in the history
Allow also assigning a public ip for ssh tunnel
  • Loading branch information
Julian Kleinhans authored Nov 10, 2016
2 parents f972ea8 + cf77285 commit 4f533ba
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/AwsInspector/Ssh/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,18 @@ public function connect()
*/
public function tunnel($configuration)
{
list($localPort, $remoteHost, $remotePort) = explode(':', $configuration);
$configurationData = explode(':', $configuration);

if (count($configurationData) == 4) {
list($localIp, $localPort, $remoteHost, $remotePort) = $configurationData;

if (empty($localIp)) {
throw new \InvalidArgumentException('Invalid local host');
}
} else {
list($localPort, $remoteHost, $remotePort) = $configurationData;
}

if (!ctype_digit($localPort)) {
throw new \InvalidArgumentException('Invalid local port');
}
Expand Down Expand Up @@ -206,4 +217,4 @@ public function getJumpHost()
return $this->jumpHost;
}

}
}

0 comments on commit 4f533ba

Please sign in to comment.