mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 22:23:21 -04:00
DNS is slow, check if host is IP to bypass dns check
This commit is contained in:
parent
e94876d30a
commit
cc4b11992e
@ -154,13 +154,13 @@ Client.prototype.setSocket = function(socket) {
|
|||||||
|
|
||||||
Client.prototype.connect = function(port, host) {
|
Client.prototype.connect = function(port, host) {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (port == 25565) {
|
if (port == 25565 && net.isIP(host) === 0) {
|
||||||
dns.resolveSrv("_minecraft._tcp." + host, function(err, addresses) {
|
dns.resolveSrv("_minecraft._tcp." + host, function(err, addresses) {
|
||||||
if (addresses && addresses.length > 0) {
|
if (addresses && addresses.length > 0) {
|
||||||
self.setSocket(net.connect(addresses[0].port, addresses[0].name));
|
self.setSocket(net.connect(addresses[0].port, addresses[0].name));
|
||||||
} else {
|
} else {
|
||||||
self.setSocket(net.connect(port, host));
|
self.setSocket(net.connect(port, host));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.setSocket(net.connect(port, host));
|
self.setSocket(net.connect(port, host));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user