in all case of SRV lookup failure, connect directly

solve issues with tcpshield servers
This commit is contained in:
Romain Beaumont 2020-06-21 18:25:23 +02:00
parent 4a20374082
commit d20c1a618b
No known key found for this signature in database
GPG key ID: DB60E388B3BCF286

View file

@ -22,13 +22,8 @@ module.exports = function (client, options) {
// Error resolving domain
if (err) {
// Could not resolve SRV lookup, connect directly
if (['ENODATA', 'ENOTFOUND', 'ESERVFAIL'].indexOf(err.code) !== -1) {
client.setSocket(net.connect(options.port, options.host))
return
} else {
// Something else happened
return client.emit('error', err)
}
client.setSocket(net.connect(options.port, options.host))
return
}
// SRV Lookup resolved conrrectly
@ -37,7 +32,8 @@ module.exports = function (client, options) {
options.port = addresses[0].port
client.setSocket(net.connect(addresses[0].port, addresses[0].name))
} else {
client.emit('error', new Error('Could not resolve hostname'))
// Otherwise, just connect using the provided hostname and port
client.setSocket(net.connect(options.port, options.host))
}
})
} else {