Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed Sep 5, 2023
1 parent 8072dd4 commit b81faed
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Socks5TunnelConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function tunnel(
if (isset($username) && isset($password)) {
$methods .= \chr(2);
}
$socket->write(\chr(5).\chr(\strlen($methods)).$methods);
$socket->write(\chr(5) . \chr(\strlen($methods)) . $methods);
$version = \ord($read(1));
if ($version !== 5) {
throw new RuntimeException("Wrong SOCKS5 version: {$version}");
Expand All @@ -62,10 +62,10 @@ public static function tunnel(
if ($method === 2) {
\assert($username !== null && $password !== null);
$socket->write(
\chr(1).
\chr(\strlen($username)).
$username.
\chr(\strlen($password)).
\chr(1) .
\chr(\strlen($username)) .
$username .
\chr(\strlen($password)) .
$password
);
$version = \ord($read(1));
Expand All @@ -86,9 +86,9 @@ public static function tunnel(
$payload = \pack('C3', 0x5, 0x1, 0x0);
$ip = \inet_pton($host);
if ($ip !== false) {
$payload .= \chr(\strlen($ip) === 4 ? 0x1 : 0x4).$ip;
$payload .= \chr(\strlen($ip) === 4 ? 0x1 : 0x4) . $ip;
} else {
$payload .= \chr(0x3).\chr(\strlen($host)).$host;
$payload .= \chr(0x3) . \chr(\strlen($host)) . $host;
}
$payload .= \pack('n', $uri->getPort());
$socket->write($payload);
Expand All @@ -109,7 +109,7 @@ public static function tunnel(
$read(match (\ord($read(1))) {
0x1 => 6,
0x4 => 18,
0x3 => \ord($read(1))+2
0x3 => \ord($read(1)) + 2
});

return $socket;
Expand Down

0 comments on commit b81faed

Please sign in to comment.