Giter VIP home page Giter VIP logo

Comments (15)

levlam avatar levlam commented on July 18, 2024 4
      send_request(make_object<td_api::addProxy>("1.1.1.1", 1111, true,
                                                 make_object<td_api::proxyTypeMtproto>("secret")),
                   td::make_unique<TdOnOkCallback>());

from telegram-bot-api.

levlam avatar levlam commented on July 18, 2024 3

@ipetrovmgn
If the proxy can transparently proxy any TCP connections and not only HTTP requests, it is somethimg like

      send_request(make_object<td_api::addProxy>("1.1.1.1", 1111, true,
                                                 make_object<td_api::proxyTypeHttp>("username", "password", false)),
                   td::make_unique<TdOnOkCallback>());

If it can proxy only HTTP requests, then you can pass true instead of false, but bots are expected to work very bad through such proxy.

from telegram-bot-api.

levlam avatar levlam commented on July 18, 2024

You can add td_api::addProxy request on the lines

std::make_unique<TdOnOkCallback>());
auto parameters = make_object<td_api::tdlibParameters>();
.

from telegram-bot-api.

TheHolyLoli avatar TheHolyLoli commented on July 18, 2024

@levlam thanks for pointing it out.i never used tdlib directly and im not that good at c++ either.can u give me a example with hardcoded parameters on how to do that?

from telegram-bot-api.

ipetrovmgn avatar ipetrovmgn commented on July 18, 2024

Hi! Is it possible to provide a code block of Client.cpp send_request method to work via proxyTypeHttp ? Thanks in advance.

from telegram-bot-api.

ipetrovmgn avatar ipetrovmgn commented on July 18, 2024

Dear @levlam is it possible to show directly where your proxy code block should be placed? Maybe I paste it in wrong place in Client.cpp but unfortunately compilation fails in this case. Thank you!

from telegram-bot-api.

levlam avatar levlam commented on July 18, 2024

@ipetrovmgn I added code block around the code to fix its appearance.

from telegram-bot-api.

ipetrovmgn avatar ipetrovmgn commented on July 18, 2024

Dear @levlam added proxy code block in Client.cpp starting from ln4929 and unfortunately got a compilation error:

[ 98%] Building CXX object CMakeFiles/telegram-bot-api.dir/telegram-bot-api/Client.cpp.o In file included from /opt/telegram-bot-api/td/td/telegram/ClientActor.h:11, from /opt/telegram-bot-api/telegram-bot-api/Client.h:13, from /opt/telegram-bot-api/telegram-bot-api/Client.cpp:7: /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h: In instantiation of ‘td::td_api::object_ptr<Type> td::td_api::make_object(Args&& ...) [with Type = td::td_api::proxyTypeMtproto; Args = {const char (&)[5], const char (&)[9], bool}; td::td_api::object_ptr<Type> = td::tl::unique_ptr<td::td_api::proxyTypeMtproto>]’: /opt/telegram-bot-api/telegram-bot-api/Client.cpp:4958:113: required from here /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:34:27: error: no matching function for call to ‘td::td_api::proxyTypeMtproto::proxyTypeMtproto(const char [5], const char [9], bool)’ return object_ptr<Type>(new Type(std::forward<Args>(args)...)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /opt/telegram-bot-api/td/td/telegram/ClientActor.h:11, from /opt/telegram-bot-api/telegram-bot-api/Client.h:13, from /opt/telegram-bot-api/telegram-bot-api/Client.cpp:7: /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:14739:12: note: candidate: ‘td::td_api::proxyTypeMtproto::proxyTypeMtproto(const string&)’ explicit proxyTypeMtproto(string const &secret_); ^~~~~~~~~~~~~~~~ /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:14739:12: note: candidate expects 1 argument, 3 provided /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:14737:3: note: candidate: ‘td::td_api::proxyTypeMtproto::proxyTypeMtproto()’ proxyTypeMtproto(); ^~~~~~~~~~~~~~~~ /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:14737:3: note: candidate expects 0 arguments, 3 provided /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:14733:7: note: candidate: ‘td::td_api::proxyTypeMtproto::proxyTypeMtproto(td::td_api::proxyTypeMtproto&&)’ class proxyTypeMtproto final : public ProxyType { ^~~~~~~~~~~~~~~~ /opt/telegram-bot-api/td/td/generate/auto/td/telegram/td_api.h:14733:7: note: candidate expects 1 argument, 3 provided gmake[2]: *** [CMakeFiles/telegram-bot-api.dir/build.make:90: CMakeFiles/telegram-bot-api.dir/telegram-bot-api/Client.cpp.o] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:372: CMakeFiles/telegram-bot-api.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2

Can you please advice what is wrong now?

from telegram-bot-api.

levlam avatar levlam commented on July 18, 2024

@ipetrovmgn
There was a misprint in the proxy type. You need a proxyTypeHttp instead of proxyTypeMtproto.

from telegram-bot-api.

ipetrovmgn avatar ipetrovmgn commented on July 18, 2024

Dear @levlam, now solution with proxyTypeHttp is really works! Thanks for your support!

from telegram-bot-api.

MoYuYuDe avatar MoYuYuDe commented on July 18, 2024
      send_request(make_object<td_api::addProxy>("1.1.1.1", 1111, true,
                                                 make_object<td_api::proxyTypeMtproto>("secret")),
                   td::make_unique<TdOnOkCallback>());

Hello, where should I add the code block of the MTProto Proxies now? The code has been modified a lot

from telegram-bot-api.

levlam avatar levlam commented on July 18, 2024

@MoYuYuDe Before the call to setTdlibParameters.

from telegram-bot-api.

MoYuYuDe avatar MoYuYuDe commented on July 18, 2024

@MoYuYuDe Before the call to setTdlibParameters.
It worked, thank you very much for your help

from telegram-bot-api.

MoYuYuDe avatar MoYuYuDe commented on July 18, 2024

@levlam
Is there support for other proxies besides MTProto, like socks5 ? Currently, I am using the golang version of MTProto-go via proxie (socks5), Is there a security impact when using socks5 or MTProto in another language?

from telegram-bot-api.

levlam avatar levlam commented on July 18, 2024

There are no security impacts when using different proxy types.

from telegram-bot-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.