[MISC] CraftProxy 0.2.0 - Reduce bandwidth use by caching chunk data [1.6]

Discussion in 'Archived: Plugin Releases' started by Raphfrk, May 1, 2011.

  1. Offline

    Raphfrk

    CraftProxy - Reduce bandwidth use by caching chunk data
    Version: 0.2.0

    Description

    This plugin and local client allows chunk data to be cached locally by players. This reduces the bandwidth required for hosting the server. It also helps users who are on slower connections.

    I am not sure what the status of this system is. It doesn't count as a plugin, since it has 2 parts.

    Even when running the plugin, players who don't use the client proxy can still connect. However, they will use the full bandwidth.

    The system can reduce bandwidth by 70-90% (after the 2nd login).

    Setup

    Server

    Add the plugin file to the plugins folder

    Client

    Start minecraft client and login
    Double click on the client jar file
    Enter login details
    Enter the server location/port in the GUI
    Press start on the GUI
    Connect to localhost on the minecraft client

    Stable Builds

    None yet

    Dev Builds

    Warning: These may not be stable

    Client
    Plugin

    Had it get the compress/decompression gain backwards.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 14, 2016
    Jushy, Martin1704, Nathan C and 24 others like this.
  2. Offline

    lol768

    Hmm, yeah. That's a possibility. There's not a lot of info on the encryption yet unfortunately.

    I'll see if I can do some Wiresharking

    From what I can see, it does appear to be encrypted (or at least compressed in some manner). I ran a simple test, capturing all data with wireshark. First, I connected to a locally run 12w30b snapshot before running /kick on myself from the console. The wiki states a kick command consists of the packet id (0xFF) followed by the reason (as a string). After looking through all packets with wireshark, there are no plain text reasons. This would either suggest the reason was omitted, or encrypted/compressed. The data dump is attached.

    http://www.filedropper.com/conkick

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 17, 2016
  3. Offline

    codename_B

    Yay, AES encryption!
    There's ways around this with a kick still, but it's annoying :p

    I'mma keep looking into shizzle
     
  4. Offline

    lol768

    Good luck!

    Just a thought. If you were to disregard chunk caching, then surely all the proxy would need to do would be to route the packets to the server and back (it doesn't need to bother with encryption, that's all handled by the actual server). Then for redirection, a server side plugin (I'll look into this) could be written that sends a custom, unencrypted series of packets with instructions to the server-side proxy to connect to another, locally hosted server in offline mode. For kicking banned/not whitelisted players, you could kick before the encryption is sorted out between the client and server. I'm really not sure whether this is possible, but it may be something to consider.

    Some example code (in C#, but should help a bit) that deals with authenticating with a server: https://minecraftprotocol.codeplex.com/SourceControl/changeset/view/68979#1204175
     
  5. Offline

    codename_B

    Thanks, but don't worry about that.
    I've already got a fully functional server-server teleportation (sans encryption)
     
  6. Offline

    lol768

    That's great. Have you got somewhere to store the changes? Github perhaps?
     
  7. Offline

    codename_B

    I've got a hard drive, fantastic things!
     
  8. Offline

    lol768

    ;) I love hard drives. They're fantastic till they fail.
     
  9. Offline

    TyrOvC

    Offsite backups are a wonderful thing. Ask Project Zomboid. :rolleyes:
     
  10. Offline

    Raphfrk

    Mostly, md_5 has done a 1.3 version, but it won't be released for a few weeks.

    There are 2 functions that this software server, I don't think caching will be possible, since you can't modify an encrypted stream, but the reconnect stuff should still be possible.
     
  11. Offline

    lol768

    It's great that the reconnection support seems intact. Looking forward to an update.
     
  12. Offline

    Raphfrk

    The 1.3 server doesn't allow unencrypted connections at all. That makes thing more complex. The proxy would have to decrypt, check for reconnect packets and then re-encrypt.

    It would have been easier if there were 3 modes,

    nothing - no checking at all
    encrypt -> encryption but no name checking with MC servers
    encrypt + auth -> encryption with name checking auth
     
  13. Offline

    lol768

    So other than storing the users password, there is no way to do a redirect between servers while ensuring that the players have actually purchased Minecraft?
     
  14. Offline

    Simanova

    Is Craftproxy compatible with 1.3.1 ? (cb 2281)

    > i dont need spout support
    > i dont need server - server teleporting
    > i dont need anything like this crap
     
  15. Offline

    lol768

    This "crap" is actually a useful feature. Although you might not need it, many others do.

    As for 1.3, if you had bothered to read the last few posts you might actually know.

    Show Spoiler

     
  16. Offline

    Simanova


    I read this. But thank you :)
     
  17. Offline

    lol768

    Caching won't be possible in the new version due to encryption. May I ask what you actually want to use this tool for?
     
  18. Offline

    TyrOvC

    It'd be possible to cache still, but would require both an actual server mod and client mod to make it to where only the proxy does encryption. I'm looking into doing this.
     
  19. Offline

    lol768

    Good luck!

    This might be easier with the mod API (when it is released).
     
  20. Offline

    Raphfrk

    md_5 's version is teleport only.

    Chunk caching is much harder now that the data stream has been encrypted.
     
  21. Offline

    lol768

    Does @md_5's version only work when the server is in offline mode?
     
  22. Offline

    Raphfrk

    I am not sure exactly what his plan is. Server to server reconnecting doesn't require any user interaction.

    The server and proxy would probably be running on the same LAN.

    The difficulty with caching is that you need a proxy on the user's computer to reverse the process and you can't do that since encryption does authing. Basically, the proxy can't pretend to be you.

    The only way around it is either to have a separate authing system (so offline mode, but with some way to do verification), or have the user enter their username/pass into the local proxy. It can't be seamless.

    Also, it is much harder to code, the sequence is

    Server -> proxy -> decrypt -> decompress -> scan for caching -> recompress -> reencrypt - Internet -> proxy -> decrypt -> decompress -> replace cached -> recompress -> reencrypt -> Client
     
  23. Offline

    Simanova

    Sounds good and can be combined with the Minecraft login.
    But encryption and decryption would take a lot of cpu resource right?

    But i thought enryption is only needed while logging in ( sending username and password ) ...
     
  24. Offline

    lol768

    Starting in 1.3, everything between the server and client is encrypted.
     
  25. Offline

    Raphfrk

    No, they encrypt the entire stream. Only the first few packets are unencrypted, and they are just for setting up the encryption.

    The reason they did it was to prevent tampering with the data stream.

    This was required to fix an exploit where if you logged into a server, they could connect into another server and pretend to be you.
     
  26. Offline

    TyrOvC

    There's probably other ways the session stealing exploit could have been fixed though. Encrypting the whole protocol is kind of like killing an ant with a tank shell.


    Anyway, progress on updating this:
    Figured out that if the encryption packets aren't sent to the server, and the client connection finished packet is sent to the server, the server won't ever start encryption. Having trouble implementing the serverside encryption in the proxy though.
     
  27. Offline

    Raphfrk

    That is interesting. So, you can just login as normal?
     
  28. Offline

    TyrOvC

    Yes, one can log in as normal. However, there's no way to both not start encryption on the client and check whether the user is authenticated with session.minecraft.net at the same time, hence the need to implement encryption in the proxy then have it de-encrypt the stream before forwarding to the server.

    Clientside will still have to include a small modification to the actual client code to work with a proxy for caching, since there's no way for the proxy to get the SessionID it would need for using http://session.minecraft.net/game/joinserver.jsp

    Sending 0xCD with a byte value of 0 to the minecraft server without any 0xFC or 0xFD packets makes it bypass encryption and behave normally.
    Sending 0x01 from the server to the client without any 0xFC or 0xFD packets makes the client bypass encryption.

    So the proxy needs to:
    Be able to get SessionID from the client
    Be able to perform encryption and authentication with normal clients that aren't using a clientside proxy for caching
    Perform the same encryption as the client would when it comes to the clientside proxy connecting to the serverside proxy



    I think part of my issue with getting the serverside encryption to work is that I haven't gotten the whole packet protocol updated right to match the new version. For some reason, the client disconnects from the server shortly after the world is loaded (you can even view the world for a few seconds) with disconnect.GenericReason. The packet ids all look right leading up to the disconnect, and I think the disconnect comes from the server since it happens in DownstreamBridge. Any ideas on that Raphfrk?
     
  29. Offline

    Raphfrk

    Well, I was thinking of the backend link. It would mean that there is no need to re-encrypt the link.

    I wonder if they plan to keep that as the standard behavior.

    That is interesting. So both sides can decide to ignore encryption. However, as you point out the default client will demand encryption and I think players would want an encrypted link to the server.

    I think easier is to just have the player enter the username/password into their local client. That would mean that the proxy has to encrypt/decrypt.

    I can see that having less resistance than having players download a client mod.

    It could be that the server auto-kicks the client after a certain period of time if there is no encryption enabled.

    It sounds like you have a modified version of CraftProxyLiter? There were changes required to support packets that are different in both directions.

    I don't know how familiar you are with client mods, but another option would be to change how the client logs in. This would at least allow you to see if a hacked client (which should have all the other packets right) is kicked for not doing encryption.
     
  30. Offline

    Simanova

    definitely confirmed
     
  31. Offline

    juan2001pr

    dam this pluggin was one of the most usefull ones out there, ive looked everywhere for something similar, at least the same concept but no luck, Best of luck making it work again, or making something similar, if anyone know any other pluggins or app that can do samething this does and works for latest versions of MC let me know.
     

Share This Page