Packet information for masterlist?

Started by EK.IceFlake, Feb 18, 2015, 01:34 PM

Previous topic - Next topic

.

.

Stormeus

Quote from: NE.CrystalBlue on Feb 20, 2015, 10:11 AM
Quote from: S.L.C on Feb 20, 2015, 09:50 AM
Quote from: NE.CrystalBlue on Feb 20, 2015, 09:46 AMI am making a masterlist server to can on it when official masterlist is down etc. Maybe also release the masterlist

LMFAO. I'm very confident when I say that yours will probably have more downtime then the official one. Mainly because you plan on hosting it on your PC since you obviously have no idea about Linux or servers in general. Or maybe you have Windows server. Who knows. But I highly doubt it.
I dont care about it. I just want to know how to make my masterlist server.

In order to host a masterlist, you'll need a database to store servers that are online, and a method of verifying that these servers are actually online, such as querying servers as they announce themselves.

Here's an introduction to JSON. Here are the PHP functions for JSON. Here is a JSON framework for .NET languages like Visual Basic. This is a description of the 0.4 server query protocol, and linked within that article is a PHP class I wrote that handles query calls.

These are the accepted endpoints for the masterlist:

Quote/announce.php
Endpoint for servers to announce their existence to the masterlist. From here, the masterlist takes the information provided by the server to determine if it is online, if it is of the right version (0.4), and other factors such as if it has been banned from announcing.

Parameters
port (POST) - the port that the server is listening on; provided by the server and expected to exist
The IP address is implicitly provided as the IP address the HTTP request came from.

Expected Output
HTTP code of 200 OK if the masterlist approves the server. No other output is expected or parsed.

Errors
400 Bad Request if:
  • The announcing server does not specify a port.
  • The server uses a bad magic code (other than VCMP).
  • The server responds to the masterlist query, but the IP or port in the query response does not match the server making the masterlist query.

403 Forbidden if the user agent of the querying server is not VCMP/0.4.
405 Method Not Allowed if the server uses GET instead of POST for the port request.
408 Request Timeout if the masterlist timed out trying to query the VC:MP server.
500 Internal Server Error if any other error occurs trying to add the server to the masterlist.



/servers
Endpoint for the browser to retrieve a list of servers, in JSON format.

Parameters
None.

Expected Output
A JSON object with a "success" field set to true and a "servers" field with an array of objects containing "ip", "port", and "is_official" fields.

Example:
{
    "success": true,
    "servers": [
        {
            "ip":"127.0.0.1",
            "port":8192,
            "is_official":false
        }
    ]
}

Errors
A JSON object with a "success" field set to false, an "errorCode" field with a numeric error code, and an "error" field with a string representation of the error.

Example:
{
    "success": false,
    "errorCode": 2,
    "error": "Failed to query the masterlist database"
}



/official
Identical to /servers, except it only retrieves a list of servers marked as official.

Anything beyond this would be holding your hand through the programming process, as anyone with the proper programming background and this post would have more than enough information to create an alternative masterlist.