Comments (15)
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.
@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.
You can add td_api::addProxy
request on the lines
telegram-bot-api/telegram-bot-api/Client.cpp
Lines 3784 to 3786 in 9692d58
from telegram-bot-api.
@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.
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.
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.
@ipetrovmgn I added code block around the code to fix its appearance.
from telegram-bot-api.
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.
@ipetrovmgn
There was a misprint in the proxy type. You need a proxyTypeHttp
instead of proxyTypeMtproto
.
from telegram-bot-api.
Dear @levlam, now solution with proxyTypeHttp is really works! Thanks for your support!
from telegram-bot-api.
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.
@MoYuYuDe Before the call to setTdlibParameters
.
from telegram-bot-api.
@MoYuYuDe Before the call to
setTdlibParameters
.
It worked, thank you very much for your help
from telegram-bot-api.
@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.
There are no security impacts when using different proxy types.
from telegram-bot-api.
Related Issues (20)
- {"ok":false,"error_code":400,"description":"Logged out"} HOT 1
- bot my_chat_member HOT 1
- /answerInlineQuery weird issue HOT 3
- HELP WITH TELEGRAM-BOT-API HOT 3
- Explain bot limitations please HOT 12
- Inquiry regarding server clustering for improved bot performance
- Limits on deleteMessages HOT 1
- Error while getting api_hash and api_id. HOT 11
- The terminal does not respond after the command is executed HOT 1
- Add support for `channels.toggleForum` (as per documentation) HOT 7
- Connection refused HOT 1
- send a pdf document with sendMessage HOT 9
- Fatal log is already here:
- Let's imagine that we have a ~4gb file, and a premium subscription on the account. So we are trying to upload the file using preliminary wrappers, we do perform the request, wait until the file is loaded, and chunk are saved on the server-side/cdn whatever, close the database, then we open it again, let's say 10 minutes later, we are trying to upload it, but due to the tdlib cache we just run into a weird situation where the filds 'is_uploading_active' are being set as true in the response to the original 'preliminaryUploadFile', even though the file is already uploaded and the uploaded_size matches the size, and expected_size fields values, while 'is_uploading_completed' is being set to false.
- [Question]: Is `ChatJoinRequest.invite_link` always null for public groups? HOT 1
- How legal is using getChannelDifference for public channels HOT 5
- hajaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar
- Does telegram-bot-api still not support uploading files up to 4G? HOT 7
- How to create a service on Ubuntu HOT 1
- Tgram.api
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegram-bot-api.