I have a Minecraft server, but since the players are coming from all over the world, the latency of the server for different players from different regions of the world is quite different due to the complex network. So I want to develop a tool or a system to set up those edge servers for the users to connect to help them to reduce the latency.
What it does
The concept of this project is similar to a reverse proxy, or CDN (not exactly, since CDN is trying to cache the static content on the edge servers while this my project is trying to re-route the traffic through the edge server to the main game server).
The project can be deployed in hundreds of edge servers which are close to the players around the world. These edge servers will receive the games' data packets from the players, then re-route these data packets back to the actual game server through the faster backbone network, and bring these benefits:
Reduce Latency. Because of the complex network we have, the data packets might not be able to be delivered to the server in the most direct route. Instead, those data packets might be routed to different data centers before they were actually handed to our servers due to network congestion, ISP policies, and many other reasons. With this project, we can deploy hundreds of edge servers around the world, optimize the routing to make all the traffic between players and servers are through the fast backbone network.
Prevent DDoS attacks (Not Implement Yet). The game servers are hidden behind the edge servers, so the players' and the attack traffic reaches the edge servers first. Then we can build a monitor system upon this project to set up alerts and respond quickly when the servers are facing a DDoS attack. And our game server that behinds the edge servers would remain safe all the time.
High Scalability. This project is based on Node.JS, which means it could be easily deployed as a docker application, and use the infrastructures that have already been built by the ISPs, such as Microsoft Azure, AWS, Digital Ocean, and so on.
Seamless. Since it's re-routing the data packets, the players do not need to install any plugins or VPN software, so it's friendly to the players. For example, with Minecraft Servers, the only thing they need to do is to change the servers' IP address.
In this case, I used it to work with Minecraft because it's the game that's using TCP to communicate with the servers. Technically, this project can work with any games that are using TCP so far. But in the future, the support of UDP will be added to it.
During the development, I was using Azure to deploy my project and do testings.
How I built it
I used Node.JS and its built-in net library to set up TCP servers and TCP clients to re-route the traffic.
Challenges I ran into
- How TCP and UDP protocol work
- To parse Minecraft's HandShake protocol
Accomplishments that I'm proud of
- Successfully made it worked
What's next for Fusion
Project Fusion now is still a prototype and in the future, more features, such as a monitor panel, will be added to it. Also, a plugin system will be added to it since it will support most of the games in the future.
The code and more details are available in GitHub under MIT License, go check it out on GitHub - Y2Nk4 / Fusion if you are interested in it.