@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use React\Dns\Resolver\Resolver; |
| 6 | 6 | use React\EventLoop\LoopInterface; |
| 7 | 7 | use React\Promise\Promise; |
| 8 | -use React\Promise\RejectedPromise; |
|
| 9 | 8 | use React\Socket\Connection; |
| 10 | 9 | use React\SocketClient\TcpConnector; |
| 11 | 10 | use React\Stream\Stream; |
@@ -4,10 +4,8 @@ |
||
| 4 | 4 | namespace SamIT\Proxy; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -use React\Dns\Resolver\Factory; |
|
| 8 | 7 | use React\Dns\Resolver\Resolver; |
| 9 | 8 | use React\EventLoop\LoopInterface; |
| 10 | -use React\Socket\Connection; |
|
| 11 | 9 | use React\Stream\Stream; |
| 12 | 10 | |
| 13 | 11 | /** |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | namespace SamIT\Proxy; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -use React\Dns\Resolver\Factory; |
|
| 8 | 7 | use React\Dns\Resolver\Resolver; |
| 9 | 8 | use React\EventLoop\LoopInterface; |
| 10 | 9 | |
@@ -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 | |