Merge pull request #320 from deathcap/clientstream

Add 'stream' option to client, generic stream alternative to TCP/IP host/port options
This commit is contained in:
Romain Beaumont 2016-02-01 10:25:48 +01:00
commit e9d959e219

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));