TCPShield / RealIP

The Spigot, Bungee and Velocity plugin that parses client IP addresses passed from the TCPShield network.
https://tcpshield.com
MIT License
145 stars 52 forks source link

Protocol Documentation #79

Open gudenau opened 2 years ago

gudenau commented 2 years ago

I would like to create a Fabric mod to support TCPShield so I could host a Fabric server protected by TCP Shield. I am not familiar very with the Bukkit stack or the plugins that you depend on, it would be easier to create a mod for this from a protocol specification than figuring out how the plugin works.

DylanKeir commented 2 years ago

Why would you need a mod? The server handles validating the connections, not the client.

gudenau commented 2 years ago

The server would need a mod to get the correct IP addresses.

DylanKeir commented 2 years ago

Ah you mean a plugin on the server side, gotcha. You can view how we verify connections here: https://github.com/TCPShield/RealIP/blob/master/src/main/java/net/tcpshield/tcpshield/TCPShieldPacketHandler.java#L89

Essentially, we send a custom hostname from our proxies in the form of "hostname//ip:port//timestamp//signature", the timestamp and signature are used to validate the connection is coming from our proxies to stop IP forging & replay attacks. The IP is then used to replace the TCPShield proxy IP for the player, same with the hostname.

gudenau commented 2 years ago

To be clear because some names are inconsistent between different MC namespaces: You mean the packet that is sent to the server in the first stage of a client connecting?

gudenau commented 2 years ago

https://github.com/TCPShield/RealIP/blob/master/src/main/java/net/tcpshield/tcpshield/TCPShieldPacketHandler.java#L94

Also this shows that you use /// instead of //.

DylanKeir commented 2 years ago

Yes, the hostname packet is how we send the data to the server. Yes, I mean triple slash, not double.

Hostname packet: https://wiki.vg/Protocol#Handshake

gudenau commented 2 years ago

This should be a super quick mod to make then. That is super simple.

gudenau commented 2 years ago

My mod is available here if you would like to verify that it does what it is supposed to do.

Since the protocol is so simple I would recommend documenting it in the README somewhere.

JosTheDude commented 1 year ago

Bumping this issue up, hoping this mod gets added into the README for other users to find since it was a tad difficult for me personally.

Thanks for this excellent mod as well, gudenau <3