tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

need help to change the server destination of the library #2482

Closed arashammm closed 1 year ago

arashammm commented 1 year ago

hello to all I have a hard time finding where I can change the server address inside the code to which the packets are sending. I intend to use this library to connect to a different server which is using Mtproto and I need to use this library as client. Can anyone guide me where can I alter server destiantion and ports to connect to the server?

levlam commented 1 year ago

It is not that simple. The server's API must be fully compatible with the latest Telegram API, which is very unlikely.

arashammm commented 1 year ago

you're probably right but since I'm sure that the protocol is mtproto, changing the server address and protocol is the first step which I need guidance on where I can find these settings in the code

levlam commented 1 year ago

It would be no different from sending requests to telegram.org insted of github.com. Both use HTTPS protocol, but changing the address makes no sense. You definitely can change the IP address and some other required data, but it would be just a waste of time.

arashammm commented 1 year ago

can you guide me which part of the code I can replace thes erver ip or server address?

levlam commented 1 year ago

First you must replace the certificate at https://github.com/tdlib/td/blob/e8ee1c51498c060c6f9b8511bf25a6c025e72adf/td/telegram/net/PublicRsaKeyShared.cpp#L20. Then you may change datacenter configuration at https://github.com/tdlib/td/blob/e8ee1c51498c060c6f9b8511bf25a6c025e72adf/td/telegram/net/ConnectionCreator.cpp#L1176.