Modern and powerful asynchronous telegram bot framework.


Keywords
telegram, bot, framework, rocketgram, async, asyncio, rocket, forward, nat, network, networking, pipe, port, proxy, python, socket, tcp, websocket, websockets
License
Other
Install
pip install rocketgram==6.0.4

Documentation

Wultiplexor

What?

Wultiplexor is a reverse proxy server and client that uses websockets to multiplex tcp connections or unix sockets. You can use it to forward connections from one machine to another both behind NAT or firewall.

How?

Diagram

Why?

In the beginning, I had needed to redirect a unix socket for one specific application. Later I implemented this in a general way.

Deploy server using docker compose

docker network create wultiplexor
DOMAIN=wultiplexor.example.com ACME_EMAIL=acme@example.com SECRET=sEcReTkEy docker compose -p wultiplexor -f compose.yaml up --build -d

WARNING: The server is not intended to be used "as is" in a public accessible infrastructure. Use a reverse proxy like Traefik to secure the connection like I did in the compose.yaml file.

Install the client utility

pip install wultiplexor

Usage: Forward tcp port

  • On one machine, called the server or acceptor:
whannel ws://example.com/ acceptor -s sEcReTkEy localhost 8080 sEcReTGaTeWaYnAmeE
nc -l 8080
  • On another machine, called client or requestor:
whannel ws://example.com/ requestor sEcReTGaTeWaYnAmeE 9090
nc localhost 9090

And now you can chat between two machines.

Usage: Forward unix socket file

  • On one machine, called the server or acceptor:
whannel wss://example.com/ sock-acceptor -s sEcReTkEy ./server sEcReTGaTeWaYnAmeE
socat UNIX-LISTEN:./server,fork STDIO
  • On another machine, called client or requestor:
whannel wss://example.com/ sock-requestor sEcReTGaTeWaYnAmeE ./client
socat STDIO UNIX-CONNECT:./client

And now you can chat between two machines.

Mixed usage

You can mix unix sockets and tcp ports. To do that, use tcp-acceptor from one side and sock-requestor from the another. Or vice versa. This is also a way to "convert" a unix socket to a tcp port on the same machine.