mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
Implement basic proxy to connect to stopped instances
This commit is contained in:
8 files changed
+768
No files matched your search
@@ -31,6 +31,8 @@ export interface ControllerConfigFields {
|
||||
"controller.max_subscription_filters": number;
|
||||
"controller.system_metrics_interval": number;
|
||||
"controller.proxy_stream_timeout": number;
|
||||
"controller.player_proxy_port": number | null;
|
||||
"controller.player_proxy_default_instance_id": number | null;
|
||||
"controller.factorio_username": string | null;
|
||||
"controller.factorio_token": string | null;
|
||||
"controller.share_factorio_credentials_with_hosts": boolean;
|
||||
@@ -243,6 +245,20 @@ export class ControllerConfig extends classes.Config<ControllerConfigFields> {
|
||||
initialValue: 15,
|
||||
validator: validators.greaterThanZero,
|
||||
},
|
||||
"controller.player_proxy_port": {
|
||||
title: "Player Proxy Port",
|
||||
description: "UDP port to accept player connections for the controller proxy, set to null to disable.",
|
||||
restartRequired: true,
|
||||
type: "number",
|
||||
optional: true,
|
||||
initialValue: 34197,
|
||||
},
|
||||
"controller.player_proxy_default_instance_id": {
|
||||
title: "Player Proxy Default Instance",
|
||||
description: "Instance ID to route players to when no routing history is available.",
|
||||
type: "number",
|
||||
optional: true,
|
||||
},
|
||||
"controller.factorio_username": {
|
||||
title: "Factorio Username",
|
||||
description: "Username to authenticate with Factorio API with.",
|
||||
|
||||
@@ -935,3 +935,30 @@ export class InstancePlayerUpdateEvent {
|
||||
return new this(json.type, json.name, PlayerStats.fromJSON(json.stats), json.reason);
|
||||
}
|
||||
}
|
||||
|
||||
export class InstancePlayerRouteUpdateEvent {
|
||||
declare ["constructor"]: typeof InstancePlayerRouteUpdateEvent;
|
||||
static type = "event" as const;
|
||||
static src = "instance" as const;
|
||||
static dst = "controller" as const;
|
||||
|
||||
constructor(
|
||||
public name: string,
|
||||
public instanceId: number,
|
||||
public hostId: number,
|
||||
public gamePort: number,
|
||||
public timestampMs: number,
|
||||
) { }
|
||||
|
||||
static jsonSchema = Type.Object({
|
||||
"name": Type.String(),
|
||||
"instanceId": Type.Integer(),
|
||||
"hostId": Type.Integer(),
|
||||
"gamePort": Type.Integer(),
|
||||
"timestampMs": Type.Number(),
|
||||
});
|
||||
|
||||
static fromJSON(json: Static<typeof this.jsonSchema>) {
|
||||
return new this(json.name, json.instanceId, json.hostId, json.gamePort, json.timestampMs);
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,7 @@ export const dataClasses: (RequestClass<unknown, unknown> | EventClass<unknown>)
|
||||
instance.InstanceAdminlistUpdateEvent,
|
||||
instance.InstanceWhitelistUpdateEvent,
|
||||
instance.InstancePlayerUpdateEvent,
|
||||
instance.InstancePlayerRouteUpdateEvent,
|
||||
|
||||
mod.ModPackGetRequest,
|
||||
mod.ModPackGetDefaultRequest,
|
||||
|
||||
Reference in new issue
Block a user