PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
5.12k stars 923 forks source link

Not working without entering port when using a proxy #2292

Closed XfedeX closed 3 years ago

XfedeX commented 3 years ago

Versions

Detailed description of a problem

If you try using Mineflayer with a proxy, it requires to enter a port, and doesn't let you leave it empty. Some servers use "SERV" domain and if you manually enter port "25565" the SERV domain gets ignored and bot can't connect.

Any example of servers not working with the proxy?

Any Aternos server.

What about your code?

// Copyright 2021 D3LT4-Attack - https://github.com/XfedeX/D3LT4-Attack
options = {
connect: r => {
    socks.createConnection({
        proxy: {
            host: "ProxyHost",
            port: 1080,
            type: 5
        },
        command: "connect",
        destination: {
            host: "example.aternos.me",
            port: 25565
        }
    }, (o, t) => {
        o ? LOG(o) : (r.setSocket(t.socket), r.emit("connect"))
    })
},
username: "D3LT4-Attack"
})
U5B commented 3 years ago

This may help you. https://github.com/PrismarineJS/node-minecraft-protocol/blob/61789bbea9cbb8a746d0460c176067ff4076cfbb/src/client/tcp_dns.js#L21

You will have to resolve it yourself, get the results and pass them to the host and port of the destination.