Gamma is a reverse-TCP proxy for Minecraft networks implemented in Python using the Socket
package. Gamma supports multiple client connections to multiple servers. Players are proxied to the respective server depending on the hostname included in the first connection packet.
Join our Discord Server!!
-
Proxy Protocol
- Gamma supports sending the
proxy protocol v1
heading to the server to forward player IPs
- Gamma supports sending the
-
Multiple Players
- Gamma supports multiple player connections simultaneously
-
Multiple Servers
- Gamma supports proxying players to different servers depending on the hostname that they include in their server list
-
Highly Customisable
- In the
Connection
class, there are functions that get called when events happen. Here are a list of the current events that are triggeredon_player_ping
on_invalid_hostname_ping
on_player_connect
on_player_disconnect
on_server_offline
- In the
-
Additionally to all of this, we also have a bandwidth counter,
self.conn_bandwidth
which counts the total amount of bytes sent and received from theupstream
(server) or thedownstream
(player) connection.
I would have to say that the biggest inspiration for this project would have to be infrared by haveachin
- Proxy Protocol
- Please be aware that when
proxy-protocol
is enabled, the server that the players will be proxied to has to be able to understand and read the proxy protocol header. Without this, the server can't understand the packet and drops it. If you're usingWaterfall
, you can turn setproxy-protocol: true
in config.yml. Other server types normally have plugins to parse this kind of data.
- Please be aware that when
- Clone the repo in whatever environment you wish
- Install the following requirements:
requests
,json
- In the same directory as the
main.py
file, runpython3 main.py
and watch the magic happen! - Give yourself a pat on the back :)
Variable | Type | Description |
---|---|---|
self.upstream_conn | Socket Object | The Socket object that contains the connection between the server and the proxy |
self.downstream_conn | Socket Object | The Socket object that contains the connection between the player and the proxy |
self.downstream_address | Tuple | A tuple that contains the players ip and port in the format (ip: str, port: int) |
self.conn_alive | Boolean | Determines whether the connection is active or disconnected, True = Connected , False = Disconnected |
self.upstream_packet_count | Integer | The total number of packets transferred, from Server to Gamma |
self.downstream_packet_count | Integer | The total number of packets transferred from Player to Gamma |
self.downstream_bandwidth | Integer | The total amount of bytes proxied from the downstream connection |
self.upstream_bandwidth | Integer | The total amount of bytes proxied from the upstream connection |
self.conn_hostname | String | The hostname that the player has connected to from their server list |
self.player_username | String | The username of the proxied player, can be None if a username isn't detected |