@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | protected function getAddresses() |
133 | 133 | { |
134 | - return $this->encodeAddress($this->sourceAddress, $this->protocol) . ($this->version == 1 ? " " : "") .$this->encodeAddress($this->targetAddress, $this->protocol); |
|
134 | + return $this->encodeAddress($this->sourceAddress, $this->protocol) . ($this->version == 1 ? " " : "") . $this->encodeAddress($this->targetAddress, $this->protocol); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | protected function encodePort($port, $protocol) { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function parseHeader(&$data) |
222 | 222 | { |
223 | - foreach(self::$signatures as $version => $signature) { |
|
223 | + foreach (self::$signatures as $version => $signature) { |
|
224 | 224 | // Match. |
225 | 225 | if (strncmp($data, $signature, strlen($signature)) === 0) { |
226 | 226 | if ($version === 1) { |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | $protocol = substr($data, 13, 1); |
264 | 264 | |
265 | 265 | $pos = 16; |
266 | - $sourceAddress = self::decodeAddress($version, substr($data, $pos, self::$lengths[$protocol] / 2 - 2), $protocol); |
|
267 | - $pos += self::$lengths[$protocol] / 2 - 2; |
|
268 | - $targetAddress = self::decodeAddress($version, substr($data, $pos, self::$lengths[$protocol] / 2 - 2), $protocol); |
|
269 | - $pos += self::$lengths[$protocol] / 2 - 2; |
|
266 | + $sourceAddress = self::decodeAddress($version, substr($data, $pos, self::$lengths[$protocol] / 2 - 2), $protocol); |
|
267 | + $pos += self::$lengths[$protocol] / 2 - 2; |
|
268 | + $targetAddress = self::decodeAddress($version, substr($data, $pos, self::$lengths[$protocol] / 2 - 2), $protocol); |
|
269 | + $pos += self::$lengths[$protocol] / 2 - 2; |
|
270 | 270 | $sourcePort = unpack('n', substr($data, $pos, 2))[1]; |
271 | 271 | $targetPort = unpack('n', substr($data, $pos + 2, 2))[1]; |
272 | 272 |
@@ -4,8 +4,6 @@ |
||
4 | 4 | namespace SamIT\Proxy; |
5 | 5 | |
6 | 6 | |
7 | -use React\Dns\Resolver\Factory; |
|
8 | -use React\Dns\Resolver\Resolver; |
|
9 | 7 | use React\EventLoop\LoopInterface; |
10 | 8 | use React\Socket\Connection; |
11 | 9 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | public function forwardAll(ServerInterface $server, $forwardAddress, $forwardPort) |
57 | 57 | { |
58 | 58 | $server->on('connection', function(ConnectionInterface $connection) use ($forwardAddress, $forwardPort) { |
59 | - $this->forward($connection, $forwardAddress, $forwardPort); |
|
59 | + $this->forward($connection, $forwardAddress, $forwardPort); |
|
60 | 60 | }); |
61 | 61 | } |
62 | 62 |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace SamIT\Proxy; |
4 | 4 | |
5 | 5 | use React\Promise\Promise; |
6 | -use React\Socket\Connection; |
|
7 | 6 | use React\Socket\ConnectionInterface; |
8 | 7 | use React\Socket\ServerInterface; |
9 | 8 | use React\SocketClient\TcpConnector; |