PrismarineJS / PrismarineJS/node-minecraft-protocol

Proxy Example returns: Error: Request blocked by CLoudFlare

Open
#801 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.4k
Forks
290
Avg merge
4d 8h
Merged PRs (30d)
7

Description

[ ] The FAQ doesn't contain a resolution to my issue

Versions

  • minecraft-protocol: 1.22.0
  • server: bungeecord 1.8 - 1.16.4 (hypixel.net)
  • node: 12.18.3
  • proxy-agent: 4.0.0

Detailed description of a problem

When running the client_http_proxy example I receive the error that my request has been blocked by CloudFlare. It counts this as an UnhandledPromiseRejection and is traced to node_modules/yggdrasil/lib/utils.js and node_modules/phin/lib/phin.js

Current code

if (process.argv.length < 6 || process.argv.length > 8) {
    console.log('Usage : node client_http_proxy.js <host> <port> <proxyHost> <proxyPort> [<name>] [<password>]')
    process.exit(1)
}

const proxyHost = process.argv[4]
const proxyPort = process.argv[5]

const client = mc.createClient({
    connect: (client) => {
        const req = Http.request({
            host: proxyHost,
            port: proxyPort,
            method: 'CONNECT',
            path: process.argv[2] + ':' + parseInt(process.argv[3])
        })
        req.end()

        req.on('connect', (res, stream) => {
            client.setSocket(stream)
            client.emit('connect')
        })
    },
    agent: new ProxyAgent({ protocol: 'http', host: proxyHost, port: proxyPort }),
    username: process.argv[6] ? process.argv[6] : 'echo',
    password: process.argv[7]
})
client.on('connect', function () {
    console.info('connected')
})

Expected behavior

The client should authenticate with mojang's authentication api, and then log into the server.

Additional context

The proxy used is an http datacentre from proxyscrape.com. Running the proxy through a proxy checker, it is still alive.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the current client_http_proxy example with the listed proxy and trace whether the CloudFlare response occurs during the proxy CONNECT or Mojang authentication. Inspect the reported yggdrasil/lib/utils.js and phin/lib/phin.js paths; done means identifying a repository-side fix or documenting that the response is external to this project.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authentication, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.