@@ -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 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | $this->forwarder->forward($incoming, $this->forwardAddress, $this->forwardPort)->then(function(Stream $outgoing) use ($incoming) { |
| 49 | 49 | $outgoing->on('init', function() use ($outgoing, $incoming) { |
| 50 | - $this->emit('connection', [$incoming, $this->createConnection($outgoing->stream, false)]); |
|
| 50 | + $this->emit('connection', [$incoming, $this->createConnection($outgoing->stream, false)]); |
|
| 51 | 51 | }); |
| 52 | 52 | }); |
| 53 | 53 | |