nodegin / tglib

TDLib (Telegram Database library) bindings for Node.js
114 stars 16 forks source link

how to set proxy in tglib, in China and Russia #35

Closed bruce6771 closed 5 years ago

bruce6771 commented 6 years ago

socket5 proxy mtproto proxy how can i set proxy in client.connect()? HELP

nodegin commented 6 years ago

this is not supported yet, i will see if have time to implement it this weekend

nodegin commented 6 years ago

Please try the following:

console.log(await client.fetch({
  '@type': 'addProxy',
  'server': '127.0.0.1',
  'port': '9999',
  'enable': true,
  'type': {
    '@type': 'proxyTypeSocks5',
    'username': '',
    'password': '',
  },
}))
nodegin commented 6 years ago

See also:

https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1add_proxy.html https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1edit_proxy.html https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1remove_proxy.html https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1enable_proxy.html https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1disable_proxy.html

ngn999 commented 3 years ago

Please try the following:

console.log(await client.fetch({
  '@type': 'addProxy',
  'server': '127.0.0.1',
  'port': '9999',
  'enable': true,
  'type': {
    '@type': 'proxyTypeSocks5',
    'username': '',
    'password': '',
  },
}))

it works, and I think the `port value should be a number