grishka / libtgvoip

VoIP library for Telegram clients
The Unlicense
387 stars 156 forks source link

Please, make a release #39

Closed vitlav closed 6 years ago

vitlav commented 6 years ago

Please, make a release with version.

grishka commented 6 years ago

This is a library that is intended to be used by a Telegram client. It's pretty much useless on its own.

vitlav commented 6 years ago

I doubt that it is in your competence to decide where it useful or useless. I need pack the lib, and packaging procedure needs a version of a package. See https://pkgs.org/download/libtgvoip If the repo will have version never, it is an answer too.

grishka commented 6 years ago

Ah ok, I misunderstood you then. If you just need the version number for the library, it's actually been versioned since the very beginning and you can always find the current version number in the LIBTGVOIP_VERSION define, with the current being 1.0.1.

vitlav commented 6 years ago

No, I really asked about make a release. Well, i just will use a version from LIBTGVOIP_VERSION, thank you!

stek29 commented 6 years ago

@grishka @vitlav probably wants you to bump LIBTGVOIP_VERSION and make a git tag :)

grishka commented 6 years ago

Ok, I've added a tag. I didn't realize that Github treats tags as releases and shows them on a dedicated page, so I had no idea what @vitlav was actually talking about.

(вообще, конечно, забавно, что мы вроде бы все говорим по-русски, но общаемся на английском)

vitlav commented 6 years ago

Ну мы общаемся для тех, кто нас читает, а не для себя :)

bump LIBTGVOIP_VERSION and make a git tag

Я был бы просто счастлив, если бы значимые релизы получали тег версии, а версия бы менялась. Спасибо!

vitlav commented 6 years ago

Если вы не против, я бы обсудил такой момент: эта библиотека включается в основной проект через submodules. Без указания требуемой версии/коммита, естественно. Я собираю libtgvoip отдельно, в динамическом варианте. Это удобно для пересборки и с зависимостями: в библиотеке реализована идиома PIMPL, она не заставляет основную программу знать о тех библиотеках, которые использует и пр.

Так я вот я сейчас собрал последнюю версию библиотеки libtgvoip и попробовал её с ранее собранным tdesktop 1.1.23, и у меня SegFault при звонке.

Я пока сомневаюсь, что достаточно пересобрать 1.1.23 с последней версией libtgvoip и всё заработает. Подозреваю, что проблема в потере обратной совместимости.

Вопрос: так и задумано (можно собирать только последнюю версию tdesktop с последним тегом libtgvoip, а всё остальное — лесом), или будем разбираться?

grishka commented 6 years ago

По идее да, предполагается, что библиотека поставляется статически слинкованной с клиентом, публичный API пока что иногда незначительно меняется и поэтому конкретная версия клиента будет гарантированно работать только с той версией библиотеки, которая у него в сабмодуле.

Так что пока так и задумано. На самом деле, я в следующей версии вообще полностью сломал обратную совместимость ради добавления новых фич :)

Но, думаю, после неё больше таких ломающих изменений не будет... Если добавление методов в классы и полей в структуры не считаются ломающими изменениями.

vitlav commented 6 years ago

Если добавление методов в классы и полей в структуры не считаются ломающими изменениями.

Размер объекта изменится, и если он будет создаваться не в вашем коде, то всё сломается. И ведь ещё же можно в середину структуры добавлять поля, чтобы никто не нашёл :) Но я всё понял. Если будет возможность, меняйте версию. В соответствии с семантическим версионированием: https://semver.org/lang/ru/. Как я понимаю, при любом изменении структур и прочих несовместимых изменениях, нужно будет менять мажорную версию.

А до меня же наконец дошло, что надо обязательно смотреть на commit id сабмодуля.

devxpy commented 6 years ago

@grishka, you do realize that people have google translate nowadays? xD.

Anyways, @vitlav, were you successful in compiling this separately from telegram, I really want to use this for a project, because of this lib's excellent performance in the telegram apps.

I've never seen such incredible performance on internet calls or even cellular calls. It would be awesome if we could use it on other stuff.

vitlav commented 6 years ago

@devxpy, I build libtgvoip separately, there is no problem: https://github.com/Etersoft/libtgvoip/blob/master/.gear/libtgvoip.spec

@grishka, what about make a tag on every release (change version)?

grishka commented 6 years ago

Sorry I've been forgetting about tags lately :(

I'll push a new version with even more of those endless fixes in the coming days, and I promise I won't forget to tag it.

devxpy commented 6 years ago

@grishka totally unrelated, but can you please point me to the code where you do udp hole punching?

That you be a great favour, I've been trying to do p2p comm for a while and have had little success.

grishka commented 6 years ago

@devxpy of course. https://github.com/grishka/libtgvoip/blob/public/VoIPController.cpp#L2278 - this is where the public endpoints request is sent to the relay server https://github.com/grishka/libtgvoip/blob/public/VoIPController.cpp#L950 - this is where the response is parsed and the p2p endpoint is added Basically, that's all there is to it. The "hole punching" part itself occurs sometime later after the endpoint is added by sending pings back and forth while I loop over all the available endpoints and send pings through them. Then, after pinging, if the RTT is smaller than that via the relay (+some margin), the connection follows the same logic used for switching between relays and drops to p2p.

Also, read this http://www.brynosaurus.com/pub/net/p2pnat/ to understand the way p2p through NAT works.

devxpy commented 6 years ago

http://www.brynosaurus.com/pub/net/p2pnat/

Man, I feel like this is the ONLY resource out there for effectively implementing this thing. I searched and searched, but this was the only meaningful piece of writing I found on the internet.

Maybe I've had little success (it works only sometimes) because I'm behind multiple NATs. BitTorrent still seems to work somehow though.

Thanks for pointing me to the exact code, I'll compare it to my thingy (in Python) and see if there's some room for improvement.

It's about time we had a standard, easy-to-use implementation for UDP hole punching.

P.S. Is there any way I can inspect whether telegram is using the relay server or p2p?

Thanks again!

grishka commented 6 years ago

BitTorrent still seems to work somehow though.

It mostly uses TCP, and in my experience torrent clients also forward ports for themselves using NAT-PMP/PCP/whatever more protocols there are. Some routers let you view the list of these port forwards.

devxpy commented 6 years ago

TCP

Wait, I thought it used uTP?

NAT-PMP/PCP

Literally wrote an implementation (in Python) for both these protocols.

The 3 routers I tried it on, don't support it :/

grishka commented 6 years ago

It's about time we had a standard, easy-to-use implementation for UDP hole punching.

That's what IPv6 is for. Every device gets a public address so there's no need for NATs and everything related to them.

devxpy commented 6 years ago

That's what IPv6 is for

Yeah, but its really hard upgrading that old Infrastructure. I don't know about Russia, but here in India, I've never once, witnessed an ISP using IPv6*.

grishka commented 6 years ago

Wait, I thought it used uTP?

IIRC that's a relatively new invention and its support is also entirely optional.