Skip to content

gotd/teled

Repository files navigation

teled

WIP Testing Telegram (MTProto) Server in Go, based on gotd.

Documentation is in progress.

Do not use Telegram name or branding for custom clients.

Private keys

Generate new RSA private key and save armored keys to some file. You will need to vendor public keys to your clients.

Testing key

-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAwX3W9oxq8FdwkMOA/HNeeDJOx8pF6fIw4MrtbfsYPhc5yTs0
lg6H3ia4SmUTnpbJ+NhGxQX2nhDR6911SETBIq1Iz0OUuOPyDVhVhyZzF+vzBukU
E75slPy3UzAzAyruOT5iCoX7mCDhRHWh9Rhm2HHVC02LAKM7RYx6u3WyjI4LV1a1
FplaD0wTh1ElJQcHkRsCVJzfD2fCSrkO/F2QNuOdEe9uoyIFGZjTX82GJNd/H6DX
KB4XQ158yJifZBwZohH9q/7IYrTEGUreQyMjeL1CiROwYKSEmHOaDnLWqq4u8KSm
jhqNeQnhbTFuwG958vSX1zJOqkDkXlue/1XeMQIDAQABAoIBAQCzEzIV8JMwaNyn
Pilse6HdAEJlKdFW2W1fPrBLb25aWMiEcyUSE9SvR4qcX7uutMOsaQ3mXsSGOe7u
qoFXJzrQSyvtlxBXpa9ppm1RrcYrR5YeuSx5sW1w3gsVFLDBp8Peetvl/WaCvzt9
Tplb6v+UJpYT5epV5rx+e6tDP4TGCzr8aWqM+dA1Pz6eahu9YgRQCUrKogRGqKoM
187Mf5r7IpM0YdXgSnFQ8Pk2+JGYuqR8cjbf+KO/NSfxDWrzNY5jtz1sB7oUhzSV
5ySV1cLNNvrSViiZ/lMjaNd5IclLsJogKdQX6zFJY4uZUuvXi7WY4mJMAudRjcMl
HpQtLAABAoGBAMxDwCfWhGvR3KTl9N4AxmzQfSru7leq+DKFGlwqiQAmCm8SHPsH
ZMLUgOy1nVIP4ZsmSuPCou36CI4EVLHg0ODIeLpp5XHxcnITGNaTajji2ZBKiMDN
n9O7bnHEwUjR0onAPBG13QCA6YW4qa08Wdrc/hqfatjMMpxK8BzBaBYxAoGBA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q/7IYrTEGUreQyMjeL1CiROwYKSEmHOaDnLWqq4u8KSmjhqN\n\
eQnhbTFuwG958vSX1zJOqkDkXlue/1XeMQIDAQAB\n\
-----END RSA PUBLIC KEY-----" };
go install ./cmd/teled
teled --key _testdata/test.key.pem

tdesktop

Update following files:

  • Telegram/SourceFiles/mtproto/details/mtproto_domain_resolver.cpp
  • Telegram/SourceFiles/mtproto/mtp_instance.cpp
  • Telegram/SourceFiles/mtproto/mtp_instance.h
  • Telegram/SourceFiles/mtproto/mtproto_dc_options.cpp

Instead, you can use gotd/tdesktop fork.

Building docker image for fork

pip install poetry

git clone --recursive https://github.com/gotd/tdesktop.git
cd tdesktop/Telegram/build/docker/centos_env
poetry install
poetry run gen_dockerfile | docker build -t tdesktop:centos_env -

Building fork

From tdesktop root directory:

docker run --user $(id -u "$USER") --rm -it \
    -v $PWD:/usr/src/tdesktop \
    -e DEBUG=1 \
    tdesktop:centos_env \
    /usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
    -D TDESKTOP_API_ID=17349 \
    -D TDESKTOP_API_HASH=344583e45741c457fe1862106095a5eb \
    -D DESKTOP_APP_USE_PACKAGED=OFF