Skip to content

Berikai/middler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

⚠️THE PROJECT IS UNDER HEAVY DEVELOPMENT!

logo

Icons made by DinosoftLabs from www.flaticon.com

Middler | TCP Client-Host Virtualization Bridge

open-source license-mit

Description

Middler is a TCP connection bridge that connects clients and hosts by forwarding their comminucation on virtualized layers. Written in NodeJS.

Purpose

It is created to be used in purposes like how Hamachi or RadminVPN is used for making local servers accessible without port forwarding. Middler makes it easy for clients to connect hosts by just providing a connection address. Clients are not installing any Middler program!

It actually seems like it does what ngrok does, but it's not working the same way.

Usage

There are 3 ways to use Middler.

  • As an host, you have a local server that you want to make clients connected. Set the config up and run the Middler Connector to connect the Middler Tunnel. Once you connected, you recieve an ip. Share it with your clients to make them connect to your local server.

  • As a client, you don't have anything about Middler to be installed! Just connect the host server via the ip Tunnel has given to Connector.

  • As a Tunnel provider, set the config up and run the Middler Tunnel. Make sure your ports are working fine.

To run Middler Tunnel: node src/tunnel start [config_arguments]

To run Middler Connector: node src/connector connect [config_arguments]

How it works

Middler Diagram

It is made of two main layers: Tunnel and Connector. These layers forwarding TCP packets each other. Since it is a bidirectional comminication between Connector and Tunnel; to seperate, determine and process all the different client packets, it uses some prefixes.

Middler Tunnel

Middler Tunnel is a TCP server. It creates a VirtualHost when a new host connects to Tunnel with Connector and creates a new TCP server for it on a port. It forwards the data from connected clients to host's Connector.

Middler Connector

Middler Connector is a TCP client to connect Tunnel for hosts. It creates a VirtualClient when it recieves the information data of a new client is connected to the VirtualHost that represents this host on Tunnel and it makes the VirtualClients that is created on the host's machine with Middler Connector to connect host's local server.

Middler Prefixes

Middler Prefixes are prefixes that are added at the beginning of the TCP packets that is being sent between Connector and Tunnel.

  • HOST_PORT is used to let Connector know which port VirtualHost is listening. (e.g. HOST_PORTtcp.middler.io:54988)
  • NEW_CLIENT is used to let Connector know that a new client is connected to VirtualHost with given id. (e.g. 198739854745NEW_CLIENT)
  • CLIENT_LOST is used to let Connector know that a connection between a client and VirtualHost is lost. (e.g. 198739854745CLIENT_LOST)
  • {ClientID} ClientID is used to let Connector know which client sending the coming data by VirtualHost. (e.g. 198739854745{data_from_client})

Licence

This project is licensed under MIT.

Contrubution

Pull requests are welcome!

Support

If you find this project interesting then consider buying a coffee for me 👇

Buy Me A Coffee

or you can donate in crypto! 💖

Bitcoin

19ZopJi8YGz32XQwWyxhbcAwMt6yDh6Qho

Ethereum

0x3aCdA83c0EAD65033cD532357De3c8B71b1C94d5

Binance Smart Chain

0x3aCdA83c0EAD65033cD532357De3c8B71b1C94d5

Polygon

0x3aCdA83c0EAD65033cD532357De3c8B71b1C94d5

Solana

G92WzULy5D3sA5pBisViEPn5X3umEJnFU59uALaCL69p