Remove agent string

The agent string was inspired by the HTTP User-Agent header to serve as
a way to identify what's connecting to the cluster.  While there may
have been vision of other software connecting to a controller than the
Clusterio provided ones this seems highly unlikely to ever happen.

Remove redundant agent string for now.
This commit is contained in:
Hornwitser committed 2024-01-15 03:49:41 +01:00
1 parent 8704a24f26
commit 705fb90740
13 files changed
+6 -37

No files matched your search

-3
View File
@@ -107,7 +107,6 @@ Sent by the controller when the WebSocket connection has been opened.
Host handshake for establishing a new connection session.
- `token: string` - Authentication token.
- `agent: string` - Human readable string of the software connecting.
- `version: string` - The protocol version of the host, e.g. "2.0.0".
- `name: string` - Name of the host.
- `id: integer` - ID of the host.
@@ -119,7 +118,6 @@ Host handshake for establishing a new connection session.
Control handshake for enstablishing a new connection session.
- `token: string` - Authentication token.
- `agent: string` - Human readable string of the software connecting.
- `version: string` - The protocol version of the control, e.g. "2.0.0".
#### `resume`
@@ -243,7 +241,6 @@ Host registering a new connection session.
"type": "register_host",
"data": {
"token": "xyzabc123",
"agent": "Clusterio Host",
"version": "2.0.0",
"name": "Foo",
"id": 123
+1 -3
View File
@@ -24,7 +24,6 @@ const queryLogTime = new lib.Summary(
* @alias module:controller/src/ControlConnection
*/
export default class ControlConnection extends BaseConnection {
private _agent: string;
private _version: string;
logTransport: lib.LinkTransport | null = null;
logSubscriptions = {
@@ -38,7 +37,7 @@ export default class ControlConnection extends BaseConnection {
declare connector: WsServerConnector;
constructor(
registerData: { agent:string, version:string },
registerData: { version: string },
connector: WsServerConnector,
controller: Controller,
public user: ControllerUser, // The user making this connection.
@@ -46,7 +45,6 @@ export default class ControlConnection extends BaseConnection {
) {
super(connector, controller);
this._agent = registerData.agent;
this._version = registerData.version;
this.connector.on("connect", () => {
@@ -16,7 +16,6 @@ import HostInfo from "./HostInfo";
* @alias module:controller/src/HostConnection
*/
export default class HostConnection extends BaseConnection {
private _agent: string;
private _id: number;
private _name: string;
private _version: string;
@@ -29,7 +28,6 @@ export default class HostConnection extends BaseConnection {
) {
super(connector, controller);
this._agent = registerData.agent;
this._id = registerData.id;
this._name = registerData.name;
this._version = registerData.version;
@@ -38,7 +36,6 @@ export default class HostConnection extends BaseConnection {
const previousHostInfo = this._controller.hosts.get(this._id);
const currentHostInfo = new HostInfo(
this._agent,
this._id,
this._name,
this._version,
-6
View File
@@ -6,8 +6,6 @@ import { HostDetails } from "@clusterio/lib";
*/
export default class HostInfo {
constructor(
/** Agent this host last connected with */
public agent: string,
/** Id of this host */
public id: number,
/** Version this host last connected with */
@@ -29,7 +27,6 @@ export default class HostInfo {
) { }
static jsonSchema = Type.Object({
"agent": Type.String(),
"id": Type.Number(),
"name": Type.String(),
"version": Type.String(),
@@ -43,7 +40,6 @@ export default class HostInfo {
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(
json.agent,
json.id,
json.name,
json.version,
@@ -58,7 +54,6 @@ export default class HostInfo {
toJSON(): Static<typeof HostInfo.jsonSchema> {
return {
agent: this.agent,
id: this.id,
name: this.name,
version: this.version,
@@ -73,7 +68,6 @@ export default class HostInfo {
toHostDetails() {
return new HostDetails(
this.agent,
this.version,
this.name,
this.id,
+2 -2
View File
@@ -261,9 +261,9 @@ ${err.stack}`
}
logger.info(
`WsServer | registered host ${data.name} (${data.id}) using agent ${data.agent} ${data.version}`
`WsServer | registered host ${data.name} (${data.id}) using version ${data.version}`
);
if (data.agent === "Clusterio Host" && data.version !== packageVersion) {
if (data.version !== packageVersion) {
logger.warn(
`Host ${data.name} (${data.id}) connected using version ${data.version} which does not match the ` +
`version of the controller is currently running (${packageVersion}). It may not work as expected.`
-1
View File
@@ -38,7 +38,6 @@ class ControlConnector extends lib.WebSocketClientConnector {
new lib.MessageRegisterControl(
new lib.RegisterControlData(
this._token,
"clusterioctl",
version,
)
)
-1
View File
@@ -51,7 +51,6 @@ export class HostConnector extends lib.WebSocketClientConnector {
new lib.MessageRegisterHost(
new lib.RegisterHostData(
this.hostConfig.get("host.controller_token"),
"Clusterio Host",
version,
this.hostConfig.get("host.name"),
this.hostConfig.get("host.id"),
+2 -6
View File
@@ -211,7 +211,6 @@ export class MessageHello extends Message {
export class RegisterHostData {
constructor(
public token: string,
public agent: string,
public version: string,
public name: string,
public id: number,
@@ -221,7 +220,6 @@ export class RegisterHostData {
static jsonSchema = Type.Object({
"token": Type.String(),
"agent": Type.String(),
"version": Type.String(),
"name": Type.String(),
"id": Type.Integer(),
@@ -230,7 +228,7 @@ export class RegisterHostData {
});
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(json.token, json.agent, json.version, json.name, json.id, json.publicAddress, json.plugins);
return new this(json.token, json.version, json.name, json.id, json.publicAddress, json.plugins);
}
}
@@ -254,18 +252,16 @@ export class MessageRegisterHost extends Message {
export class RegisterControlData {
constructor(
public token: string,
public agent: string,
public version: string,
) { }
static jsonSchema = Type.Object({
"token": Type.String(),
"agent": Type.String(),
"version": Type.String(),
});
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(json.token, json.agent, json.version);
return new this(json.token, json.version);
}
}
-3
View File
@@ -4,7 +4,6 @@ import { CollectorResultSerialized } from "../prometheus";
export class HostDetails {
constructor(
public agent: string,
public version: string,
public name: string,
public id: number,
@@ -17,7 +16,6 @@ export class HostDetails {
) { }
static jsonSchema = Type.Object({
"agent": Type.String(),
"version": Type.String(),
"name": Type.String(),
"id": Type.Integer(),
@@ -30,7 +28,6 @@ export class HostDetails {
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(
json.agent,
json.version,
json.name,
json.id,
@@ -83,7 +83,6 @@ export default function HostViewPage() {
<Descriptions.Item label="Memory"><MetricMemoryUsed metrics={metrics} /></Descriptions.Item>
<Descriptions.Item label="Disk Usage"><MetricDiskRatio metrics={metrics} /></Descriptions.Item>
<Descriptions.Item label="Disk"><MetricDiskUsed metrics={metrics} /></Descriptions.Item>
<Descriptions.Item label="Agent">{host["agent"]}</Descriptions.Item>
<Descriptions.Item label="Version">{host["version"]}</Descriptions.Item>
{
host.tokenValidAfter
@@ -251,12 +251,6 @@ export default function HostsPage() {
render: (_, host) => <MetricDiskUsed metrics={metrics.get(host.id)} />,
hidden: !showNumbers,
},
{
title: "Agent",
dataIndex: "agent",
sorter: (a, b) => strcmp(a.agent, b.agent),
responsive: ["lg"],
},
{
title: "Version",
dataIndex: "version",
-1
View File
@@ -30,7 +30,6 @@ export class ControlConnector extends lib.WebSocketClientConnector {
new lib.MessageRegisterControl(
new lib.RegisterControlData(
this.token,
"Clusterio Web UI",
packageJson.version,
)
)
+1 -1
View File
@@ -16,7 +16,7 @@ describe("lib/command", function() {
let testControl = new mock.MockControl(controlConnector);
let testController = new lib.Link(controllerConnector);
testController.handle(
lib.HostListRequest, () => [new lib.HostDetails("test", "0.1", "Test Host", 11, false)]
lib.HostListRequest, () => [new lib.HostDetails("0.1", "Test Host", 11, false)]
);
testController.handle(
lib.InstanceDetailsListRequest, () => [new lib.InstanceDetails("Test Instance", 57, 4, undefined, "stopped")]