fix ipv6 (#96)

This commit is contained in:
Saeed Vaziry
2024-01-27 21:34:36 +01:00
committed by GitHub
parent 0420babdef
commit 55bf8b8ecf
4 changed files with 9 additions and 5 deletions

View File

@ -64,11 +64,15 @@ public function setLog(string $logType, $siteId = null): void
*/
public function connect(bool $sftp = false): void
{
$ip = $this->server->ip;
if (str($ip)->contains(':')) {
$ip = '['.$ip.']';
}
try {
if ($sftp) {
$this->connection = new SFTP($this->server->ip, $this->server->port);
$this->connection = new SFTP($ip, $this->server->port);
} else {
$this->connection = new SSH2($this->server->ip, $this->server->port);
$this->connection = new SSH2($ip, $this->server->port);
}
$login = $this->connection->login($this->user, $this->privateKey);