WIP: protocol abstraction
Work on abstracting the CollabVMServer so it now calls into a interface for sending/recieving protocol messages. This will allow cleaner bringup of a fully binary protocol, and generally is just cleaner code. Mostly everything is parsd/running through this new layer, although there are some TODO items: - NetworkClient/... should just spit out a Buffer or something that eventually turns into or has one - TCP protocol will need to be revamped so we can support an actual binary protocol on top of it. The current thing is line based - More admin op stuff needs to be handled - The handlers are a bit jumbled around atm - There is still a good amount of code which assumes guacamole which needs to be rewritten dont use this branch fuckers
This commit is contained in:
@@ -16,6 +16,8 @@ import pino from 'pino';
|
||||
import { Database } from './Database.js';
|
||||
import { BanManager } from './BanManager.js';
|
||||
import { QemuVMShim } from './vm/qemu.js';
|
||||
import { TheProtocolManager } from './Protocol.js';
|
||||
import { GuacamoleProtocol } from './GuacamoleProtocol.js';
|
||||
|
||||
let logger = pino();
|
||||
|
||||
@@ -97,17 +99,20 @@ async function start() {
|
||||
process.on('SIGINT', async () => await stop());
|
||||
process.on('SIGTERM', async () => await stop());
|
||||
|
||||
// Register protocol(s)
|
||||
TheProtocolManager.registerProtocol("guacamole", () => new GuacamoleProtocol);
|
||||
|
||||
await VM.Start();
|
||||
// Start up the server
|
||||
var CVM = new CollabVMServer(Config, VM, banmgr, auth, geoipReader);
|
||||
|
||||
var WS = new WSServer(Config, banmgr);
|
||||
WS.on('connect', (client: User) => CVM.addUser(client));
|
||||
WS.on('connect', (client: User) => CVM.connectionOpened(client));
|
||||
WS.start();
|
||||
|
||||
if (Config.tcp.enabled) {
|
||||
var TCP = new TCPServer(Config, banmgr);
|
||||
TCP.on('connect', (client: User) => CVM.addUser(client));
|
||||
TCP.on('connect', (client: User) => CVM.connectionOpened(client));
|
||||
TCP.start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user