Code Monkey home page Code Monkey logo

minekube / gate Goto Github PK

View Code? Open in Web Editor NEW
583.0 9.0 50.0 183.25 MB

High-Performance, Low-Memory, Lightweight, Extensible Minecraft Reverse Proxy with Excellent Multi-Protocol Version Support - Velocity/Bungee Replacement - Ready for dev and large deploy!

Home Page: https://gate.minekube.com

License: Apache License 2.0

Dockerfile 0.08% Makefile 0.13% Go 97.39% TypeScript 1.16% Vue 0.72% CSS 0.51% JavaScript 0.02%
minecraft-proxy minecraft minecraft-network minecraft-server proxy go forge server-proxy minecraft-forge minecraft-server-proxy

gate's People

Contributors

danielgran avatar dependabot[bot] avatar eyjhb avatar gmax79 avatar iam4722202468 avatar janotlelapin avatar kasefuchs avatar laysdragon avatar luiz-otavio avatar necrossit avatar nixnux123 avatar nuriofernandez avatar r167 avatar renovate[bot] avatar robinbraemer avatar viasnake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gate's Issues

Connection to the server frozen when player's game mode changed

I was testing this proxy implementation when I discover something strange. The server connection gets frozen when you change your game mode.

I have tested this issue with Survival to Creative and Creative to Survival.

How to replicate:

  • Clone this repository
  • Start the extension example with the example servers
  • Connect yourself to the server
  • Execute de /gamemode creative {username} command.

You will see everything frozen and the player bar will appear like you are in survival mode.
You will be able to fly but not even open the inventory (since it is in survival mode)

In a few seconds, you will get kicked by timeout

Question about command aliases.

I tried to make a command with alot of aliases such as:

  1. /hub
  2. /l
  3. /lobby

But, it looks like there's no way to introduce aliases in one command. (Maybe I didn't understand in docs)
How could I do this?

Send Player a packet

When listening to events, it would be useful to send have access to the *minecraftConn object to send arbitrary packets.

To allow for this, I propose exporting connectedPlayer to ConnectedPlayer so someone writing a plugin can cast:

player, ok := e.Player().(*proxy.ConnectedPlayer)
if ok {
	player.WritePacket( /* some packet */ )
}

I can make a PR if this looks good.

Integrate Opentelemetry

To measure and debug and collect metrics on Gate, however, the deployment looks like, we should support tracing and metrics using https://opentelemetry.io/ SDK such that other tooling like Grafana Tempo, Prometheus, Jaeger, etc. can receive data from a running Gate process. This will help users to gain more visibility into their Gate deployment, measure and help fix latency issues, track player sessions over time, ...

Users can also opt in to anonymous data collection to help us understand usage and performance bottlenecks.

Support Bedrock edition?

This issue is for discussion about Bedrock edition support and other future plans.

For development for bringing full Bedrock edition support to the Gate proxy please see the bedrock branch for all changes and feel free to comment your thoughts here and/or if you want to contribute!

Other plans:

  • Distant future? A proxy for Java & Bedrock edition to mix and match players & servers of all kinds.
    (protocol translation back and forth...)

  • Players can always join and will never be kicked if there is
    no available server to connect to, or the network is too full.
    Instead, players will be moved to an empty virtual room simulated
    by the proxy to queue players to wait.

Add option to enabling writing logs to a file

I have two suggestions regarding the logging of the Gate proxy:

  • It would be nice to have the possibility to choose what we want in the logs. For example, in production I don't think the path of the file and the line from which the logger was called is any useful information. Maybe the ability to choose the format of the date would be interesting too, for instance if we want to be able to process the logs with an other application... which leads us to the second point.
  • Save the logs to a file, like any regular Minecraft proxy or server. For now, the only way I found to do that is to redirect manually the program outputs to a file like so: ./gate > logs.txt 2>&1, but color codes are not supported and render like this: �[34m.

Thanks for your reading

Advanced and smart player fallback

Further improve the existing algorithm for redirecting players to available servers (match protocol versions, mark unresponsive servers, don't retry moving a player to previously failed connections), and add API to add and remove try/fallback servers.

Forge handshack deadlock

It stuck at the middle of fml hand shacking. I found there is a deadlock.
The gate is waiting for join server packet then will report SuccessConnectionStatus result to loginSessionHandler and turn to newInitialConnectSessionHandler to deal next client packet and forward to server.
but the fml handshacking isn't finish yet,and need client proxy to pass the fml handshacking packet to server to complete the fml handshacking.but proxy side still wait for result.

player.setSessionHandler(newInitialConnectSessionHandler(player))
l.event().Fire(&PostLoginEvent{player: player})
l.connectToInitialServer(player)

Its looks like it would never return from the connectToInitialServer until complete join server packet arrived. I spent several days to
playing with wireshark and writing custom dissector, trying to figure out what going on. The ConnectWithIndication is designed to blocked the proxy until a totally complete joined server. I wanted to make a PR in first place, but it seems like a flow design problem so I have no idea how to fix it without slightly refactor the current login -> join server flow. :/
Need to find a workaround to unblock the proxy side goroutine earily while the first fml handshake appear.

Forge Version: 1.12.2 14.23.5.2855

I'm curious,is there few people setup with forge server?

Support for scripting languages as plugins

This issue is there to discuss the support for scripting languages in Gate.

To simplify and accelerate customization Gate should add support for popular scripting languages like:

Which language should we target first?

Specifically Lua has being requested under Gate's reddit post.
Please up-vote this issue whether this scripting should be added and/or comment some thoughts on this.

Switching worlds does not refresh everything in chunks

What is the bug:

When the player is switching between different servers some chunk errors (just Client Side) can happen:
Wrong chunks in Minecraft
When the player is coming near the chunks these will disappear, but it is still a little bit annoying.

These are the chunks that are from the previous world the player was in.

This is especially the case with entities as they are just standing there as if nothing happened and the player cannot interact with them:
Animals in the air in Minecraft

Setup:

It was not tested in other setups so here is the setup:

It is the examples/simple-network but with the modification that the servers are 1.17.1 paper servers and not 1.16 paper server.

Tested versions:

  • Server:
    • Two paper-1.17.1-333 servers
    • gate_0.14.1_windows_amd64.exe
  • Client:
    • Optifine 1.17.1
    • Minecraft 1.17.1 (So that nobody can say that it is an Optifine Bug)

This was tested on Windows.

Footnote

I hope this helps a little bit and if I have overlooked another issue with the same topic you can close it 😄.

Internal server connection error when player is a server operator

I was testing this proxy implementation when I discover something strange. I get an Internal server connection when I make myself a server operator.

Here is the log:

2021-07-26T04:09:42.710+0200	INFO	gate.java.client.player	proxy/switch.go:307	Player was kicked from server	{"name": "xXNurioXx", "id": "6136bbb2-2d67-4fb3-b200-d0a5cb28f385", "server": "server1", "reason": "Internal server connection error"}

How to replicate:

  • Clone this repository
  • Start the extension example with the example servers
  • Connect yourself to the server
  • Execute de /op {username} command.

You will get kicked from the server and you will not be able to reconnect to it.

Configurable authentication server URL

The official Minecraft authentication URL is https://sessionserver.mojang.com/session/minecraft/xxx. However, in some cases, the server can use its own authentication service (implementing Mojang's authentication API).

For example: https://my.authentication.site/api/xxx.

I know of some proven solutions to implement this authentication service: authlib-injector works on servers and clients, and Blessing-Skin is a web service.


By making the variable mojangURL in gate/pkg/edition/java/auth/authenticator.go configurable, Gate will be able to implement third-party authentication.

This can be cool :)

Player list name is empty even I already updated it

Recently I was working with Gate as my proxy-server, but for some reason, when the player join on another server their tab-names didn't update.

First authentication server:
image

First hub server:
image

I'm running a private fork from Gate for my network for that, but it's still on latest version of Gate and I didn't made any changes for Scoreboard Teams packet.

fix ClientBound PlayerListItem decoder

Player gets disconnected when changing the tab list name.

2021-07-21T11:17:52.531+0200    DEBUG   gate.java.server        proxy/connection.go:408 Update compression      {"threshold": 512}
2021-07-21T11:17:52.567+0200    INFO    gate.java.client.player.serverConn.backendTransitionSession     proxy/session_backend_transition.go:203 Player joining initial server   {"name": "shawshark", "id": "be7ef425-f3a4-4b83-b676-71b2274ec577", "serverName": "server", "serverAddr": "127.0.0.1:21289"}
2021-07-21T11:17:53.654+0200    DEBUG   gate.java.server        proxy/connection.go:148 silentErr: error reading next packet, unrecoverable and closing connection      {"err": "error decoding packet (type: *packet.PlayerListItem, id: 32, protocol: 754, direction: ClientBound): unknown PlayerListItemAction 3"}
2021-07-21T11:17:53.654+0200    DEBUG   gate.java.server        proxy/connection.go:112 Error reading packet, closing connection        {"err": "error decoding packet (type: *packet.PlayerListItem, id: 32, protocol: 754, direction: ClientBound): unknown PlayerListItemAction 3"}
2021-07-21T11:17:53.654+0200    INFO    gate.java.client.player proxy/switch.go:307     Player was kicked from server   {"name": "shawshark", "id": "be7ef425-f3a4-4b83-b676-71b2274ec577", "server": "server", "reason": "Internal server connection error"}
2021-07-21T11:17:53.654+0200    DEBUG   gate.java.client        proxy/connection.go:112 Error reading packet, closing connection        {"err": "error reading varint frame: error reading varint: read tcp #:25565->#:50598: use of closed network connection"}
2021-07-21T11:17:53.655+0200    INFO    gate.java.client.player proxy/player.go:421     Player has been disconnected    {"name": "shawshark", "id": "be7ef425-f3a4-4b83-b676-71b2274ec577", "reason": "§cKicked from \"server\": Internal server connection error"}

Cannot register new packet in `states.go`

Currently, I'm working on a different session handler after login state to listen incoming Flying packets.
But for some reason, I cannot register some packets in Server and Client bounds due to duplicate packet id.

I made a FallStatus packet which is designed with ID 0x03 in Play state for Protocol Version 47 (1.8.8), but when I try to register it, gate crashs and a panic message is sent with a specific message about a duplicate ID from Protocol Version 335 (1.12) of Packet.Chat.
Can not register packet type packet.Chat with id 0x33 for protocol 335 because another packet is already registered
I'm registering those packets like that:

Play.ServerBound.Register(&p.FallStatus{},
  m(0x03, version.Minecraft_1_8))

Scripting language support

Add more plugin support with script languages: lua and tengo (this is for the general folks that just want to get startet quick and easy)

Add Title APIs

Add APIs for more player interaction -> boss bar, player tab list, action bar, titles, maybe even scoreboards

Roadmap to v1.0

What are the features that need to be implemented on this project to be a mature project?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.