mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
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:
commit
e9d959e219
1 changed files with 3 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue