()
| 94 | } |
| 95 | |
| 96 | async _run() { |
| 97 | assert(await this._authenticate()); |
| 98 | const { command, host, port } = await this._parseRequest(); |
| 99 | if (command !== SocksCommand.CONNECT) { |
| 100 | this._writeBytes(Buffer.from([ |
| 101 | 0x05, |
| 102 | SocksReply.CommandNotSupported, |
| 103 | 0x00, // RSV |
| 104 | 0x01, // IPv4 |
| 105 | 0x00, 0x00, 0x00, 0x00, // Address |
| 106 | 0x00, 0x00 // Port |
| 107 | ])); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | this._socket.off('data', this._boundOnData); |
| 112 | this._client.onSocketRequested({ uid: this._uid, host, port }); |
| 113 | } |
| 114 | |
| 115 | async _authenticate(): Promise<boolean> { |
| 116 | // Request: |
no test coverage detected