G
G
grin_toster2018-07-10 07:51:11
Telegram
grin_toster, 2018-07-10 07:51:11

How to send request through proxy for telegram api(not bot) using nodeJs?

I use this library to connect to the telegram API, but when a request is made to the server, an error pops up that it is impossible to complete the request, etc. because of RComN... So, does anyone know how to bypass this blocking using a proxy and a library (telegram-mtproto)?
The code:

const {MTProto} = require('telegram-mtproto')
const phone = {
    num : '+90555555555', 
    code: '22222'
}

const api = {
    layer          : 57,
    initConnection : 0x69796de9,
    api_id         : 111111
}

const server = {
    dev: true, 
}  
const client = MTProto(server, api)

async function connect(){
    const { phone_code_hash } = await client('auth.sendCode', {
        phone_number  : phone.num,
        sms_type: 5,
        api_id        : 111111,         
        api_hash      : 'fb050b8fjernf323FDFWS2332'
    })
    console.log(phone_code_hash)
    // const { user } = await client('auth.signIn', {
    //     phone_number   : phone.num,
    //     phone_code_hash: phone_code_hash,
    //     phone_code     : phone.code
    // })
    // console.log('signed as ', user);
}
connect();

Error:
23.061] req_pq error connect ETIMEDOUT 149.154.167.51:80
Get networker error { Error: connect ETIMEDOUT 149.154.167.51:80
at Object._errnoException (util.js:1003:13)
at _exceptionWithHostPort (util.js:1024:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1194:14)
...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question