BeamMP-Launcher icon indicating copy to clipboard operation
BeamMP-Launcher copied to clipboard

Download mods via HTTP, not custom TCP protocol

Open lionkor opened this issue 2 years ago • 1 comments

The mods need to be downloaded from the server via HTTP(S) GET instead of the current custom TCP protocol.

The reasons for this are:

  1. The current TCP protocol uses multiple sockets, which is not the correct way to speed up download (TCP recv/send window size adjustment is)
  2. The server will switch to hosting the mods in a HTTP server sooner or later, so this has to happen anyways
  3. It will allow remote downloads

To make this work:

Once the launcher sends a request for mod list, it will get back a json array in something like the following format:

[
    {
        "hash": { 
            "sha1": "93406853b9382341379b3965fc7d32fd192f04e9" 
        },
        "name": "My Awesome Mod",
        "local": true,
        "url": "/mods/myawesomemod.zip"
    },
    {
        "hash": {},
        "name": "My Other Mod",
        "local": false,
        "url": "https://awesomemodplace.example/myothermod.zip"
    }
]

Here, each mod specifies a hash (if possible, automatically if local), whether it's local or not (local means it's downloaded from the server's own https server, not-local means it's not), and so on.

The launcher needs to think of a way to store these mods by hash or similar, not by name, and needs to ensure that multiple mods with the same name can exist with different hashes, and be picked out by the launcher appropriately.

This is obviously not a fully fleshed out spec, and needs more work. This issue is the place for that. For the record, this will be implemented on the server in some capacity, there is no way around it.

lionkor avatar Mar 10 '22 12:03 lionkor