Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy change domain destination to ip v4 #3543

Closed
1 task done
2sweetheart2 opened this issue Jan 6, 2025 · 2 comments
Closed
1 task done

Proxy change domain destination to ip v4 #3543

2sweetheart2 opened this issue Jan 6, 2025 · 2 comments
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f

Comments

@2sweetheart2
Copy link

  • The FAQ doesn't contain a resolution to my issue

Versions

  • mineflayer: latest
  • server: 1.16.5
  • node: 10.8.2

Detailed description of a problem

When connected via proxy to a literal domain, the game server kicks with the words "Noprotect.net . This domain is not registered at our services or has no backends! If you are an administrator check the 'domains' tab at the server settings.". This means that the bot is trying to connect to the server using a different domain name through a proxy, which is why it is allowed on the server.

Code

from javascript import require, On

mineflayer = require('mineflayer')
socks = require('socks').SocksClient

PROXY_IP = ...
PROXY_PORT = ...
PROXY_USERNAME = ...
PROXY_PASSWORD = ...

MC_SERVER_IP = 'play.funtime.su'  # Адрес Minecraft сервера
MC_SERVER_PORT = 25565

def connect_cb(client):
    info = socks.createConnection({
        'proxy': {
            'host': PROXY_IP,
            'port': PROXY_PORT,
            'type': 5,  
            'userId': PROXY_USERNAME,  
            'password': PROXY_PASSWORD  
        },
        'command': 'connect',
        'destination': {

            'host': MC_SERVER_IP,
            'port': MC_SERVER_PORT
        }
    })
    client.setSocket(info.socket)
    client.emit('connect')

data = {
    'username': 'TylorSmith01',
    "version": '1.16.5',
    'connect':connect_cb
}
bot = mineflayer.createBot(data)


@On(bot, 'connect')
def on_connect(this):
    print('Бот подключился к серверу!')


@On(bot, 'login')
def on_login(this):
    print('success login')


@On(bot, 'kicked')
def on_kicked(this, l1, l2):
    print(l2)
    print(l1)


@On(bot, 'end')
def on_end(this, reason):
    print('Бот отключился от сервера.', reason)


@On(bot, 'message')
def on_message(this, username, message, *args):
    data = username['json']
    text = data['text']
    if len(text) == 0 and 'extra' in data:
        text = ''.join(extra['text'] for extra in data['extra'])

    print(f'Сообщение: {text}')

If you know how to get the proxy to connect to the server by domain name, I would appreciate an explanation.

@2sweetheart2 2sweetheart2 added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Jan 6, 2025
@2sweetheart2
Copy link
Author

i add fakeHost in option and all work fine

data = {
    'username': 'TylorSmith01',
    "version": '1.16.5',
    'fakeHost':'play.funtime.su',
    'connect':connect_cb
}

@Pix3lPirat3
Copy link
Contributor

Resolved via DMs, this is similar to servers using TCPShield where the server doesn't want you using their IPv4 to connect to the server, passing fakeHost will fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Projects
None yet
Development

No branches or pull requests

2 participants