Файл:Imbox deletion.png Внимание! Начат процесс обновления Wiki до версии игры 10.x. Если у Вас есть желание принять участие, то Вы можете найти больше информации в нашем ECO Contribution Wiki Discord.

RCON

Материал из Eco - Русская Wiki
Перейти к:навигация, поиск

Протокол Eco RCON (Remote Console)

Eco RCON это TCP протокол обмена основанный на стандарте RCON. Позволяет использовать команды Администратора Сервера удаленно. Чаще всего RCON используется для того, чтобы владельцы могли управлять серверами, не находясь в игре, для упрощения администрирования или автоматизации процессов.

Руководство для Владельца/Администратора Сервера

Использование Eco RCON

По умолчанию реализация RCON для Eco прослушивает TCP-порт 3002. Этот параметр можно изменить в параметрах конфигурации сервера, а также указать IP адрес сервера. Для использования RCON необходимо установить пароль в конфигурации сервера. Серверы без пароля отклоняют все входящие запросы аутентификации.

При выполнении команды через ECO RCON вам не нужно использовать косую черту (/), как это требуется делать в чате игры. Ниже приведен пример удаленного выполнения команды для Бана игрока с использованием инструмента mcrcon, ссылка на который приведена ниже.

С списком доступных команд, которые можно использовать с RCON или в игре, можно изучить тут.

Общедоступные инструменты и библиотеки

Большинство стандартных инструментов для стандарта RCON будут работать и с Eco RCON.

Инструменты


All command requests sent through RCON are executed with server admin permissions. For best practice its advised you keep your RCON information secure and only let trusted users or trusted programs access your RCON server.

Руководство Разработчика

Установление соединения

To establish a TCP connection to an Eco RCON server you need to know the server's configured RCON port and the server's configured password and connect via a standard TCP client. Once connected you must authenticate your selves by sending a SERVERDATA_AUTH packet. Failure to do so will result in no response. If your authentication request was successful you should receive back a SERVERDATA_AUTH_RESPONSE packet with a matching id of the authentication request packet. Receiving an packet id of -1 means the authentication request has failed. An authentication request can fail if the password is incorrect, misconfigured, or if there is already an active RCON client connection.

Структура пакета

Basic Packet Structure

All Eco RCON packets payloads follow this basic structure and are sent over a TCP socket

Field Type Value
Size 32-bit little-endian Signed Integer Varies, see below.
ID 32-bit little-endian Signed Integer Varies, see below.
Type 32-bit little-endian Signed Integer Varies, see below.
Body Null-terminated ASCII String Varies, see below.
Empty String Null-terminated ASCII String 0x00

Размер пакета

The RCON packet size field is represented by a 32-bit little endian integer, It represents the total length of the request in bytes. Note that the packet size field itself is not included when determining the size of the packet, so the value of this field is always 4 less than the packet's actual length. The minimum possible value for packet size is 14.

Size Containing
4 Bytes ID Field
4 Bytes Type Field
At least 1 Byte Packet body (potentially empty)
1 Bytes Empty string terminator

ID пакета

The packet id field is a 32-bit little endian integer which is specified by the requesting client for each request. Its value can be any positive integer. When the server responds to a client request it will send back the same packet id it received for that command request allowing you match the original request to the server response.

Тип пакета

The packet type field is represented by a 32-bit little endian integer. It the intended purpose of the packet.

Value String Descriptor
3 SERVERDATA_AUTH
2 SERVERDATA_AUTH_RESPONSE
2 SERVERDATA_EXECCOMMAND
0 SERVERDATA_RESPONSE_VALUE

Тело пакета

The packet body field is a null-terminated ASCII encoded string. The contents of the packet body vary by the executed request.

Типы пакетов=

SERVERDATA_AUTH

SERVERDATA_AUTH is the first packet to be sent by a newly connected client. It is used to authenticate with the RCON server and gain access to the SERVERDATA_EXECCOMMAND request. The values of this packet type's fields are as follows:

Field Contains
ID any positive integer, chosen by the client (will be mirrored back in the server's response)
Type 3
Body the RCON password of the server (If this field matches the password set in the Network configuration the auth request will succeed)

Note: If the password is not properly configured on the server all SERVERDATA_AUTH requests will be refused.

SERVERDATA_AUTH_RESPONSE

SERVERDATA_AUTH_RESPONSE is the response notification packet of a client's SERVERDATA_AUTH request and contains the results of its authentication attempt. The status is represented by the id of the packet. A -1 value denotes a failed authentication request. If authentication was a success it matches the packet id provided in the original authentication request.

Field Contains
ID The ID of the original authentication request if it was successful, otherwise -1 on failure.
Type 2
Body Empty string (0x00)
SERVERDATA_EXECCOMMAND

SERVERDATA_EXECCOMMAND represents a command issued to the server by a client. This can be any valid player or admin command that does not require a physical player in the world to execute. The response will vary depending on the command issued.

Field Contains
ID any positive integer, chosen by the client (will be mirrored back in the server's response)
Type 2
Body the command to be executed on the server
SERVERDATA_RESPONSE_VALUE

SERVERDATA_RESPONSE_VALUE is sent when a command had finished executing from a SERVERDATA_EXECCOMMAND request and contains the chat displayed results of the requested command.

Field Contains
ID The ID assigned by the original request
Type 0
Body The server's response to the original command.