mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2025-05-23 03:17:21 -04:00
fix http proxy
This commit is contained in:
parent
e9ced90a50
commit
cab5a329bf
2 changed files with 2 additions and 0 deletions
|
@ -15,6 +15,7 @@ const req = Http.request({
|
||||||
method: 'CONNECT',
|
method: 'CONNECT',
|
||||||
path: process.argv[2] + ":" + parseInt(process.argv[3])
|
path: process.argv[2] + ":" + parseInt(process.argv[3])
|
||||||
});
|
});
|
||||||
|
req.end();
|
||||||
|
|
||||||
req.on("connect", function(res, stream) {
|
req.on("connect", function(res, stream) {
|
||||||
const client = mc.createClient({
|
const client = mc.createClient({
|
||||||
|
|
|
@ -8,6 +8,7 @@ module.exports = function(client, options) {
|
||||||
options.connect = (client) => {
|
options.connect = (client) => {
|
||||||
if (options.stream) {
|
if (options.stream) {
|
||||||
client.setSocket(options.stream);
|
client.setSocket(options.stream);
|
||||||
|
client.emit('connect');
|
||||||
} else if (options.port == 25565 && net.isIP(options.host) === 0) {
|
} else if (options.port == 25565 && net.isIP(options.host) === 0) {
|
||||||
dns.resolveSrv("_minecraft._tcp." + options.host, function(err, addresses) {
|
dns.resolveSrv("_minecraft._tcp." + options.host, function(err, addresses) {
|
||||||
if(addresses && addresses.length > 0) {
|
if(addresses && addresses.length > 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue