[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

    Aox

    Thanks, Maeyanie! I'm in winders, but should be able to hermogulate your instructions over to ole BillyBobGatesWorld. I'll give it a shot!!!!

    -Aox
     
  3. Offline

    Maeyanie

    Most of it should be the same, except maybe the javac line, the "com/raphfrk/*/*.java" bit might have to be changed.

    In a pinch, Cygwin can give you a UNIX environment in Windows, where all that should work as written (except if javac isn't in your %PATH%, might have to do something like "/cygdrive/c/Program\ Files/Java/jdk_whatever/bin/javac" instead.)
     
  4. Offline

    Jdbye

    One thing I noticed with CraftProxy is that any people connecting using it will be seen as connecting from 127.0.0.1 ingame, this destroys the functionality of EssentialsGeoIP plus stops IP banning from working. Is there any way you could solve that?

    http://tempcraft.net/MinecraftDownload/CraftProxyLiter.jar There you go :)
    I had it already uploaded there for players on my server.
     
  5. Offline

    Raphfrk

    The only way would be for some system whereby the proxy can tell the server what the player's IP was. Ideally, it would be part of the Bukkit server, so that plugins could still access the IP in the same manner.
     
  6. Offline

    Maeyanie

    Well, if it's running as a Bukkit plugin, it would be possible to modify what the server thinks is the player's address. Taking a look through the code, it'd need some reflection trickery (the variable with the address is both private and final) but it could be done.
     
  7. Offline

    Raphfrk

    You cannot consistently change final fields. The compiler is allowed change final fields to be constants. That is why I think the best situation would be to have Bukkit do it.

    For example, there could be a

    public void overrideAddress(InetSocketAddress address);

    This method would cause the getAddress() method to return the new address. If you call the method with null, it will revert back to the original address.

    However, that still wouldn't work for things like IP bans, since the proxy would have to send a command to update their IP address.
     
  8. Offline

    Maeyanie

    In this case the compiler can't change it to a constant, because it's set in the constructor, rather than statically. And different for each connecting client.

    Yeah, that's true. I guess it depends on if it checks for IP bans before or after the pre-login event, since that's probably the earliest cue to change it... haven't checked that one. The proxy itself could handle IP bans, though.
     
  9. Offline

    Jdbye


    As far as I know all IP bans have to be handled in the pre-login event, because the login event doesn't expose the IP address and the join event can't be cancelled (and a kick will still show the join and leave). So CraftProxy could hook the pre login event with the highest priority and call overrideAddress in that event, changing the address before any other plugins would read it. Of course ban plugins are likely to use the highest priority too, so it might be tricky to make certain it will be the first hook to run...

    As for the overrideAddress function, the most likely way it would be implemented is probably to implement it yourself and make a pull request. You could also then release the server mod in this topic (also in case the pull request is denied) so people don't have to wait for the pull request to be accepted, which it isn't even guaranteed to be. It should be a rather simple mod, so keeping it up to date with the latest RB shouldn't be much of a problem. I don't know how likely the pull request would be to be accepted, since not many plugins would have use of that feature, but in the end you'd still have a server mod you could release that would be useful to everyone using CraftProxy.

    The proxy could handle IP bans, but the problem with that is that it wouldn't support alternate ban systems (like my custom MySQL banning plugin that's tied to website accounts). Speaking of which, if you added a function to get the actual IP address of a CraftProxy user (and one to check if someone is using CraftProxy) I could implement that into my plugin and it would mostly solve the problem for me :) (except for EssentialsGeoIP). Most likely some other plugins would implement it too since CraftProxy is rather popular.
     
  10. Offline

    Maeyanie

    Yeah, I was mostly referring to the built-in IP bans there. Plugins will rely on the pre-login event, and replacing the IP should work fine for them. Unless, as you pointed out, they check before it's changed... but the built-in IP bans, they might be checked even before a pre-login is fired, which would make any kind of plugin-based IP override not work.
     
  11. Offline

    Raphfrk

    One issue with this is that the plugin wouldn't actually know what the IP was supposed to be at that stage.

    Also, looking at the code, the pre-login event doesn't seem to trigger at all when in offline mode.

    One option would be to trigger a fake preLogin event. If some plugin cancels it, then kick the player.

    That could cause issues, however, if the server is in offline mode, then there wouldn't have been any real one anyway.

    Yeah, been there.

    Ok, I implemented it. What happens is that you connect and only a few chunks around the player are actually sent?

    There is something strange going on.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 14, 2016
  12. Offline

    Simanova

    i tried to use craftproxy with 1.8 and vanilla - doesnt seem to work ( "took too long to login" )
     
  13. Offline

    Raphfrk

    I just had a look at the packet changes. There looks to be a fair few of them, but are all pretty low complexity.

    I will wait until 1.8 is actually out before updating.
     
  14. Offline

    Simanova

    Okay, thanks!
     
  15. Offline

    disturbed13

    looking forward to the update :D
     
  16. Offline

    Simanova

    could you release a craftproxy pre?
     
  17. Offline

    ssechaud

    All of a sudden I have been getting these errors and players dropping:
    Code:
    Buffer mis-calculation for length??
    Buffer mis-calculation for length??
    IO ERROR
    
    And this in the server log:
    Code:
    23:31:49 [INFO] Connection reset
    23:31:49 [SEVERE] java.net.SocketException: Broken pipe
    23:31:49 [SEVERE] 	at java.net.SocketOutputStream.socketWrite0(Native Method)
    23:31:49 [SEVERE] 	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
    23:31:49 [SEVERE] 	at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    23:31:49 [SEVERE] 	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    23:31:49 [SEVERE] 	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    23:31:49 [SEVERE] 	at java.io.DataOutputStream.flush(DataOutputStream.java:123)
    23:31:49 [SEVERE] 	at net.minecraft.server.NetworkWriterThread.run(SourceFile:116)
    23:31:49 [SEVERE] java.net.SocketException: Broken pipe
    23:31:49 [SEVERE] 	at java.net.SocketOutputStream.socketWrite0(Native Method)
    23:31:49 [SEVERE] 	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
    23:31:49 [SEVERE] 	at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    23:31:49 [SEVERE] 	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    23:31:49 [SEVERE] 	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    23:31:49 [SEVERE] 	at java.io.DataOutputStream.flush(DataOutputStream.java:123)
    23:31:49 [SEVERE] 	at net.minecraft.server.NetworkWriterThread.run(SourceFile:116)
    
     
  18. Offline

    Simanova

    1.8 is out - testing craftproxy 116 asap for 1.8 ( but i think it wont work ) - please update!

    PS: Dont work :), as expected
     
  19. Offline

    Guenael

    Yes very usefull plugin , hope you update it soon
     
  20. Offline

    Raider

    Same. I feel that this plugin is a must on any server. =)
     
  21. Offline

    Simanova

    Raphfrk

    was last seen on Monday - 5 days ago - hopefully he has enough time to update this plugin
     
  22. Offline

    Guenael

    Yes and hope strongly that he never abandon to update this plugin :)
     
  23. Offline

    KlaasT

    Any new information about this? I've got quite a slow connection and I wanted to test if I can play Minecraft in multiplayer when using Craftproxy :)
     
  24. Offline

    Raphfrk

    I updated. This assumes that the protocol info is correct from here.

    Also, it assumes that I correctly copied it.
     
    cind3r69 likes this.
  25. Offline

    Simanova

    Its working great, except some minor issues:

    You are awesome!
     
  26. Offline

    Raphfrk

    Was there any error in the proxy logs?

    Also, do you know what actions are required to trigger the error?
     
  27. Offline

    LEOcab

    Seconded! :D

    Works fine for me, except for one minor detail: it won't let me connect due to flood protection unless I disable it with disable_flood. This is possibly due to the initial packet it sends to check server status and number of players before you even connect. :)
     
  28. Offline

    cind3r69

    Hey Guys, Raphfrk.


    I love this program as its part of my server's DDOS Protection scheme. (also stops join floods and has other benefits) .
    I noticed with this new version that after a player dies twice, they wont be able to log back in and click "respawn". At the same time there is an Error that repeats in the Craftproxy console :

    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large

    Players are able to connect, but cannot make it past the "respawn, title menu" screen. The issue is associated with a player death and you cannot click respawn.

    If I restart CraftProxy the players can again connect, but clicking respawn allows them to respawn as normal.

    Deleting the Players data file also corrects the issue.

    being used with MC Vanilla 1.8 (621,639 bytes)

    Hope this helps. I will be more then happy to perform any troubleshooting and provide any information for feedback in the ongoing development of this plugin. My server doesn't run unless it runs with craftproxyliter. That being said where would I send a donation to...
     
  29. Offline

    Simanova

    Unfortunately, dont know how to ... sorry :)
     
  30. Offline

    LEOcab

    @Raphfrk: Another bug when I try to teleport between worlds while using CraftProxy, I get disconnected instantly and this shows up on the client:
    Code:
    Internal exception: java.io.IOException: Received string length is less than zero! Weird string!
     
  31. Offline

    cind3r69

    Hey Guys.

    I have verified that this bad packet 67 is assocaited with the Respawn issue. Heres how it works. When you die the first time, you will see the respawn screen. You click respawn but instead of respawning you are given this error :

    packetr67.png

    You reconnect and you respawn normally. The NEXT TIME you die, you get the respawn screen but clicking respawn results in no change to the screen, and you cannot actually join the game. At the same time the "Item stack array to large" message repeats over and over in the Craftproxy Console. :

    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large
    Item stack array to large

    So the two are related for sure. and those are the actions needed to reproduce it the following command lines produce this issue :

    java -jar CraftProxyLiter.jar lo.ca.l.ip:25565 remote.server.ip:25565 auth_off disable_flood
    java -jar CraftProxyLiter.jar lo.ca.l.ip:25565 remote.server.ip:25565 auth_off

    Additionally disable_flood has to be used with 1.8. even when mc didn't have the server list, more then 1 connection tolerance should have been allowed. noobs who try to reconnect over and over at reboot time can never get back on. at the moment i'd say the proper setting should be 3 connection attempts within 30 seconds. Ultimately a way to specify X number of connections during Y period of time via a parameter would be the best way to set this up.

    **PS does local_cache work for anyone? ive tried it through multiple versions and I am never able to connect when its enabled.
    eg java -jar CraftProxyLiter.jar lo.ca.l.ip:25565 remote.server.ip:25565 auth_off local_cache

    Results in :

    Server listening on: /lo.ca.l.ip:25565
    Connection from my.ip.addy/41039
    [6:38:47 AM] my.ip.addy/41039: Forwarding ping
    Connection from my.ip.addy/43552
    [6:38:48 AM] my.ip.addy/43552 (cind3r69): Connecting to : remote.server.ip 25565
    [6:38:48 AM] my.ip.addy/43552 (cind3r69): Attempting to connect to: remote.server.ip:25565
    [6:38:48 AM] my.ip.addy/43552 (cind3r69): Connection successful
    [6:38:48 AM] my.ip.addy/43552 (cind3r69): Connecting using proxy to server connection format
    [6:38:50 AM] my.ip.addy/43552 (cind3r69): Server login successful
    IO ERROR
    [6:38:50 AM] my.ip.addy/43552 (cind3r69): Unable to flush output stream
    [6:38:50 AM] my.ip.addy/43552 (cind3r69): Closed connection to server
    [6:38:50 AM] my.ip.addy/43552 (cind3r69): Closed connection to client

    Do I need to be using Craftproxy authentication for caching to be working? not sure but I would love to be able to utilize caching as well, but my primary concern is the "respawn" issue and bad packet 67/ "Item Stack Array to Large"


    I hope this information helps you narrow down the problem. Thanks so much for all your hard work on this program, My players and I appreciate it.
     

Share This Page