Add 'stream' option to client/tcp_dns, alternative to host,port for TCP

This commit is contained in:
deathcap 2016-01-31 15:33:06 -08:00
parent 834170689e
commit 39b7199ec6

View File

@ -6,7 +6,9 @@ module.exports = function(client, options) {
options.host = options.host || 'localhost';
options.connect = (client) => {
if(options.port == 25565 && net.isIP(options.host) === 0) {
if (options.stream) {
client.setSocket(options.stream);
} else if (options.port == 25565 && net.isIP(options.host) === 0) {
dns.resolveSrv("_minecraft._tcp." + options.host, function(err, addresses) {
if(addresses && addresses.length > 0) {
client.setSocket(net.connect(addresses[0].port, addresses[0].name));