41 lines
719 B
JavaScript
41 lines
719 B
JavaScript
|
"use strict";
|
||
|
|
||
|
import sysinfo from 'systeminformation';
|
||
|
|
||
|
import Agent from './agent/Agent.mjs';
|
||
|
|
||
|
class SystemQuery {
|
||
|
constructor(config) {
|
||
|
this.config = config;
|
||
|
}
|
||
|
|
||
|
async init() {
|
||
|
///
|
||
|
// 1: Create agent
|
||
|
///
|
||
|
this.agent = new Agent(this.config);
|
||
|
await this.agent.init();
|
||
|
|
||
|
///
|
||
|
// 2: Attach listeners
|
||
|
///
|
||
|
this.agent.on("message-query", this.handle_query.bind(this));
|
||
|
this.agent.on("message-query-response", this.handle_query_response.bind(this));
|
||
|
}
|
||
|
|
||
|
async handle_query(peer, msg) {
|
||
|
|
||
|
}
|
||
|
async handle_query_response(peer, msg) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
SystemQuery.Create = async function(config) {
|
||
|
let result = new SystemQuery(config);
|
||
|
await result.init();
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
export default SystemQuery;
|