代理连接超时时,关闭客户端连接。

pull/333/head
王良 2024-08-20 15:45:01 +08:00
parent 5919441bac
commit 2b8acc2507
1 changed files with 4 additions and 0 deletions

View File

@ -86,13 +86,17 @@ function connect (req, cltSocket, head, hostname, port, dnsConfig/* , sniRegexpM
const cost = new Date() - start
const errorMsg = `代理连接超时: ${hostport}, cost: ${cost} ms`
log.error(errorMsg)
cltSocket.destroy()
})
proxySocket.on('error', (e) => {
// 连接失败可能被GFW拦截或者服务端拥挤
const cost = new Date() - start
const errorMsg = `代理连接失败: ${hostport}, cost: ${cost} ms, errorMsg: ${e.message}`
log.error(errorMsg)
cltSocket.destroy()
if (isDnsIntercept && isDnsIntercept.dns && isDnsIntercept.ip !== isDnsIntercept.hostname) {
const { dns, ip, hostname } = isDnsIntercept
dns.count(hostname, ip, true)