@ankorcs/protocol 0.0.0-stage → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/LICENSE +202 -0
- package/README.md +72 -2
- package/dist/agent-config.d.ts +101 -0
- package/dist/agent-config.js +144 -0
- package/dist/agent-image.d.ts +12 -0
- package/dist/agent-image.js +12 -0
- package/dist/agent-socket.d.ts +3927 -0
- package/dist/agent-socket.js +1764 -0
- package/dist/agent-yml.d.ts +21 -0
- package/dist/agent-yml.js +71 -0
- package/dist/agent-yml.schema.json +160 -0
- package/dist/asyncapi.yaml +10569 -0
- package/dist/checks.d.ts +19 -0
- package/dist/checks.js +40 -0
- package/dist/container.d.ts +190 -0
- package/dist/container.js +144 -0
- package/dist/event-batch.d.ts +857 -0
- package/dist/event-batch.js +90 -0
- package/dist/game-events.d.ts +2137 -0
- package/dist/game-events.js +1082 -0
- package/dist/helpers.d.ts +176 -0
- package/dist/helpers.js +362 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/launch.d.ts +316 -0
- package/dist/launch.js +287 -0
- package/dist/limits.d.ts +381 -0
- package/dist/limits.js +277 -0
- package/dist/paths.d.ts +73 -0
- package/dist/paths.js +73 -0
- package/dist/plugin-socket.d.ts +1946 -0
- package/dist/plugin-socket.js +160 -0
- package/dist/session.d.ts +127 -0
- package/dist/session.js +114 -0
- package/dist/values.d.ts +186 -0
- package/dist/values.js +230 -0
- package/node-setup.sh +1061 -0
- package/package.json +57 -4
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire's version: the `major.minor` of this package. Every request a node makes to the
|
|
3
|
+
* controller, its demo uploads, the node-setup request and the plugin's connection to the agent
|
|
4
|
+
* carry it in {@link PROTOCOL_HEADER}. A peer whose version is not compatible answers
|
|
5
|
+
* `426 Upgrade Required`, and no frame is exchanged. [Versioning](https://docs.ankor.sh/protocol/versioning/) says
|
|
6
|
+
* which versions are.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PROTOCOL_VERSION = "0.6";
|
|
9
|
+
/**
|
|
10
|
+
* The header that carries {@link PROTOCOL_VERSION} on every request a node, its plugin or the setup
|
|
11
|
+
* script makes.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PROTOCOL_HEADER = "Ankor-Protocol";
|
|
14
|
+
/**
|
|
15
|
+
* The agent socket's default path, which the agent dials with `Authorization: Bearer <node token>`.
|
|
16
|
+
* `controller.socket_path` in `agent.yml` overrides it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_SOCKET_PATH = "/ws/agent";
|
|
19
|
+
/**
|
|
20
|
+
* The default path the agent posts an {@link EventBatch} to, with its bearer token.
|
|
21
|
+
*
|
|
22
|
+
* The controller answers `200` with an {@link EventBatchReceipt} once every frame is stored or
|
|
23
|
+
* quarantined, or `409` with an {@link EventBatchRejection}. Any other answer keeps the frames on
|
|
24
|
+
* the node for a retry. `controller.events_path` in `agent.yml` overrides the path.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_EVENTS_PATH = "/api/node/events";
|
|
27
|
+
/**
|
|
28
|
+
* The name of a demo file, `<yyyyMMdd-HHmmss>_<matchId>_<map>.dem`. `<matchId>` is empty for a
|
|
29
|
+
* match without a `match_id`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEMO_NAME: RegExp;
|
|
32
|
+
/**
|
|
33
|
+
* The headers a demo upload carries besides {@link PROTOCOL_HEADER} and the target's configured
|
|
34
|
+
* header.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEMO_HEADERS: {
|
|
37
|
+
readonly fileName: "Ankor-File-Name";
|
|
38
|
+
/** The demo's `match_id`. Omitted for a match launched without one. */
|
|
39
|
+
readonly matchId: "Ankor-Match-Id";
|
|
40
|
+
/** The `allocation_id` of the server that recorded the demo. */
|
|
41
|
+
readonly allocationId: "Ankor-Allocation-Id";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The path the setup script `POST`s to for a node's `agent.yml`, with
|
|
45
|
+
* `Authorization: Bearer <node token>`, {@link PROTOCOL_HEADER} and no body.
|
|
46
|
+
*
|
|
47
|
+
* The answer is that node's `agent.yml` as `text/yaml`, and errors stay JSON. An unknown token is
|
|
48
|
+
* refused with `401`. The file's `slots` may be empty, for slots that
|
|
49
|
+
* {@link ControllerSetConfig | set_config} adds once the node connects.
|
|
50
|
+
*
|
|
51
|
+
* The path is the setup script's default, `DEFAULT_SETUP_PATH` in the script. Operators can set
|
|
52
|
+
* another with `--setup-path`.
|
|
53
|
+
*/
|
|
54
|
+
export declare const NODE_SETUP_PATH = "/api/node/setup";
|
|
55
|
+
/**
|
|
56
|
+
* The path of the node-setup script, which a `GET` returns as the file. ankor.sh serves it for
|
|
57
|
+
* every controller, which operators name with `--controller`.
|
|
58
|
+
*/
|
|
59
|
+
export declare const SETUP_SCRIPT_PATH = "/node-setup.sh";
|
|
60
|
+
/**
|
|
61
|
+
* The controller the setup script fetches `agent.yml` from when `--controller` is absent. It is
|
|
62
|
+
* `DEFAULT_CONTROLLER_URL` in the script.
|
|
63
|
+
*/
|
|
64
|
+
export declare const DEFAULT_CONTROLLER_URL = "https://ankor.sh";
|
|
65
|
+
/**
|
|
66
|
+
* Where the setup script downloads itself from to re-run as root. It is `SETUP_SCRIPT_URL` in the
|
|
67
|
+
* script.
|
|
68
|
+
*/
|
|
69
|
+
export declare const SETUP_SCRIPT_URL = "https://ankor.sh/node-setup.sh";
|
|
70
|
+
/**
|
|
71
|
+
* The environment variable the setup script reads the node token from instead of prompting for it.
|
|
72
|
+
*/
|
|
73
|
+
export declare const NODE_TOKEN_VARIABLE = "ANKOR_NODE_TOKEN";
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire's version: the `major.minor` of this package. Every request a node makes to the
|
|
3
|
+
* controller, its demo uploads, the node-setup request and the plugin's connection to the agent
|
|
4
|
+
* carry it in {@link PROTOCOL_HEADER}. A peer whose version is not compatible answers
|
|
5
|
+
* `426 Upgrade Required`, and no frame is exchanged. [Versioning](https://docs.ankor.sh/protocol/versioning/) says
|
|
6
|
+
* which versions are.
|
|
7
|
+
*/
|
|
8
|
+
export const PROTOCOL_VERSION = '0.6';
|
|
9
|
+
/**
|
|
10
|
+
* The header that carries {@link PROTOCOL_VERSION} on every request a node, its plugin or the setup
|
|
11
|
+
* script makes.
|
|
12
|
+
*/
|
|
13
|
+
export const PROTOCOL_HEADER = 'Ankor-Protocol';
|
|
14
|
+
/**
|
|
15
|
+
* The agent socket's default path, which the agent dials with `Authorization: Bearer <node token>`.
|
|
16
|
+
* `controller.socket_path` in `agent.yml` overrides it.
|
|
17
|
+
*/
|
|
18
|
+
export const DEFAULT_SOCKET_PATH = '/ws/agent';
|
|
19
|
+
/**
|
|
20
|
+
* The default path the agent posts an {@link EventBatch} to, with its bearer token.
|
|
21
|
+
*
|
|
22
|
+
* The controller answers `200` with an {@link EventBatchReceipt} once every frame is stored or
|
|
23
|
+
* quarantined, or `409` with an {@link EventBatchRejection}. Any other answer keeps the frames on
|
|
24
|
+
* the node for a retry. `controller.events_path` in `agent.yml` overrides the path.
|
|
25
|
+
*/
|
|
26
|
+
export const DEFAULT_EVENTS_PATH = '/api/node/events';
|
|
27
|
+
/**
|
|
28
|
+
* The name of a demo file, `<yyyyMMdd-HHmmss>_<matchId>_<map>.dem`. `<matchId>` is empty for a
|
|
29
|
+
* match without a `match_id`.
|
|
30
|
+
*/
|
|
31
|
+
export const DEMO_NAME = /^(\d{8}-\d{6})_([A-Za-z0-9-]*)_([A-Za-z0-9_-]+)\.dem$/;
|
|
32
|
+
/**
|
|
33
|
+
* The headers a demo upload carries besides {@link PROTOCOL_HEADER} and the target's configured
|
|
34
|
+
* header.
|
|
35
|
+
*/
|
|
36
|
+
export const DEMO_HEADERS = {
|
|
37
|
+
fileName: 'Ankor-File-Name',
|
|
38
|
+
/** The demo's `match_id`. Omitted for a match launched without one. */
|
|
39
|
+
matchId: 'Ankor-Match-Id',
|
|
40
|
+
/** The `allocation_id` of the server that recorded the demo. */
|
|
41
|
+
allocationId: 'Ankor-Allocation-Id',
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The path the setup script `POST`s to for a node's `agent.yml`, with
|
|
45
|
+
* `Authorization: Bearer <node token>`, {@link PROTOCOL_HEADER} and no body.
|
|
46
|
+
*
|
|
47
|
+
* The answer is that node's `agent.yml` as `text/yaml`, and errors stay JSON. An unknown token is
|
|
48
|
+
* refused with `401`. The file's `slots` may be empty, for slots that
|
|
49
|
+
* {@link ControllerSetConfig | set_config} adds once the node connects.
|
|
50
|
+
*
|
|
51
|
+
* The path is the setup script's default, `DEFAULT_SETUP_PATH` in the script. Operators can set
|
|
52
|
+
* another with `--setup-path`.
|
|
53
|
+
*/
|
|
54
|
+
export const NODE_SETUP_PATH = '/api/node/setup';
|
|
55
|
+
/**
|
|
56
|
+
* The path of the node-setup script, which a `GET` returns as the file. ankor.sh serves it for
|
|
57
|
+
* every controller, which operators name with `--controller`.
|
|
58
|
+
*/
|
|
59
|
+
export const SETUP_SCRIPT_PATH = '/node-setup.sh';
|
|
60
|
+
/**
|
|
61
|
+
* The controller the setup script fetches `agent.yml` from when `--controller` is absent. It is
|
|
62
|
+
* `DEFAULT_CONTROLLER_URL` in the script.
|
|
63
|
+
*/
|
|
64
|
+
export const DEFAULT_CONTROLLER_URL = 'https://ankor.sh';
|
|
65
|
+
/**
|
|
66
|
+
* Where the setup script downloads itself from to re-run as root. It is `SETUP_SCRIPT_URL` in the
|
|
67
|
+
* script.
|
|
68
|
+
*/
|
|
69
|
+
export const SETUP_SCRIPT_URL = `${DEFAULT_CONTROLLER_URL}${SETUP_SCRIPT_PATH}`;
|
|
70
|
+
/**
|
|
71
|
+
* The environment variable the setup script reads the node token from instead of prompting for it.
|
|
72
|
+
*/
|
|
73
|
+
export const NODE_TOKEN_VARIABLE = 'ANKOR_NODE_TOKEN';
|