I would recommend reading up on
Hole Punching and use the UDP version, not the TCP version.
This can be done in pure pascal, since e.g. the original Skype used it in Delphi code and Telegram uses it.
The most important bits are to send keepalive messages and to allow redirects. Note that it does
NOT work on some corporate networks: symmetric traffic may not always be allowed.
https://en.wikipedia.org/wiki/UDP_hole_punchingThe technique is rather intricate and apart from commercial implementations* I have not seen proper open source Object Pascal code for it.
* We implemented and used it at my employer Alex, later BinckBank, later Saxbank but by then I had already left, code is closed source. Sorry.( But we just used a version of synapse for it, maybe even just UDPSocket, nothing more). I gave enough pointers on how to do it. It is not for beginners, not even intermediates. You have to have a thorough understanding about network protocols and sockets.