Closed Draylar closed 3 years ago
Also, as a question: How is this implementation able to work over multiple versions (so others than 1.16)? Is the limit you've set artificial or necessary?
Fabric does no version abstraction, so the most you can do is hope it just works:tm:. That being said, I tested the mod on 1.14.4, 1.15, and 1.16.5 (the only major versions Fabric supports outside snapshots), and it worked on all 3. This will only break if Mojang changes early networking code.
Hello, I have arrived with Fabric support. This PR has been sanity-checked by at least 2 individuals (one of which was me), and both of us were able to successfully reproduce TCP Shield functionality on a dedicated server with the full DNS setup.
PR Overview
build.gradle
: Fabric does not provide networking hooks as early as the handshake-phase, so I had to pull in Mixin. To use Mixin, I also had to pull in the full Minecraft dependency. I use the Fabric Loom plugin to achieve this (it is essentially a standard Fabric mod buildscript at this point).Initialization
Similar to the startup listeners & initializers in the other modules, the Fabric folder now has an initializer named
TCPShieldFabric
. This class is loaded by thefabric.mod.json
file and sets up the Fabric packet handler.Handshake Handling
To handle handshakes, I placed a mixin in
ServerHandshakeNetworkHandler#onHandshake
, which calls the Fabric packet handler with the abstracted packet & player data.Implementation Notes
Config: Fabric does not ship a standard configuration library, so I wrote a simple custom parser in
FabricConfigImpl
.We have confirmed clients cannot connect to the server IP directly, while the domain setup with TCPShield works great. The server properly identities the clients IP. Finally, I have also confirmed the client does not have access to the server's true IP (but reports being connected to TCPShield instead):
If there are any changes you would like me to make, please let me know. Thank you in advance!