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