@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | /** |
| 73 | - * @return uint16_t |
|
| 73 | + * @return string|null |
|
| 74 | 74 | */ |
| 75 | 75 | protected function getAddressLength() |
| 76 | 76 | { |
@@ -80,6 +80,10 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | + /** |
|
| 84 | + * @param string $address |
|
| 85 | + * @param string $protocol |
|
| 86 | + */ |
|
| 83 | 87 | protected function encodeAddress($address, $protocol) { |
| 84 | 88 | if ($this->version == 1) { |
| 85 | 89 | return $address; |
@@ -102,6 +106,11 @@ discard block |
||
| 102 | 106 | return $result; |
| 103 | 107 | } |
| 104 | 108 | |
| 109 | + /** |
|
| 110 | + * @param integer $version |
|
| 111 | + * @param string $address |
|
| 112 | + * @param string $protocol |
|
| 113 | + */ |
|
| 105 | 114 | protected static function decodeAddress($version, $address, $protocol) |
| 106 | 115 | { |
| 107 | 116 | if ($version == 1) { |
@@ -134,6 +143,10 @@ discard block |
||
| 134 | 143 | return $this->encodeAddress($this->sourceAddress, $this->protocol) . ($this->version == 1 ? " " : "") .$this->encodeAddress($this->targetAddress, $this->protocol); |
| 135 | 144 | } |
| 136 | 145 | |
| 146 | + /** |
|
| 147 | + * @param integer $port |
|
| 148 | + * @param string $protocol |
|
| 149 | + */ |
|
| 137 | 150 | protected function encodePort($port, $protocol) { |
| 138 | 151 | if ($this->version == 1) { |
| 139 | 152 | return $port; |
@@ -241,6 +254,9 @@ discard block |
||
| 241 | 254 | } |
| 242 | 255 | } |
| 243 | 256 | |
| 257 | + /** |
|
| 258 | + * @param string $data |
|
| 259 | + */ |
|
| 244 | 260 | protected static function parseVersion1($data) |
| 245 | 261 | { |
| 246 | 262 | $parts = explode("\x20", $data); |
@@ -256,6 +272,9 @@ discard block |
||
| 256 | 272 | } |
| 257 | 273 | } |
| 258 | 274 | |
| 275 | + /** |
|
| 276 | + * @param string $data |
|
| 277 | + */ |
|
| 259 | 278 | protected static function parseVersion2($data) |
| 260 | 279 | { |
| 261 | 280 | $version = ord(substr($data, 12, 1)) >> 4; |
@@ -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 | |