* Handle authentication response
()
| 10751 | * Handle authentication response |
| 10752 | */ |
| 10753 | handleAuthResponse() { |
| 10754 | if (this.buffer.length < 2) { |
| 10755 | return; |
| 10756 | } |
| 10757 | const version = this.buffer[0]; |
| 10758 | const status = this.buffer[1]; |
| 10759 | if (version !== 1) { |
| 10760 | throw new Socks5ProxyError(`Invalid auth sub-negotiation version: ${version}`, "UND_ERR_SOCKS5_AUTH_VERSION"); |
| 10761 | } |
| 10762 | if (status !== 0) { |
| 10763 | throw new Socks5ProxyError("Authentication failed", "UND_ERR_SOCKS5_AUTH_FAILED"); |
| 10764 | } |
| 10765 | this.buffer = this.buffer.subarray(2); |
| 10766 | debug("authentication successful"); |
| 10767 | this.markAuthenticated(); |
| 10768 | } |
| 10769 | /** |
| 10770 | * Send CONNECT command |
| 10771 | * @param {string} address - Target address (IP or domain) |
no test coverage detected