Start work on new telnet server

This commit is contained in:
Bryan Ashby 2020-05-17 20:22:16 -06:00
parent ad2382c1f2
commit 75787b6107
No known key found for this signature in database
GPG key ID: B49EB437951D2542
4 changed files with 58 additions and 2 deletions

View file

@ -0,0 +1,43 @@
// ENiGMA½
const LoginServerModule = require('../../login_server_module');
const Client = require('../../client');
// deps
const net = require('net');
const { TelnetSocket, TelnetSpec } = require('telnet-socket');
const ModuleInfo = exports.moduleInfo = {
name : 'Telnet',
desc : 'Telnet Server',
author : 'NuSkooler',
isSecure : false,
packageName : 'codes.l33t.enigma.telnet.server.v2',
};
class TelnetClient extends Client {
constructor(socket) {
super();
this.setInputOutput(socket, socket);
this.telnetSocket = new TelnetSocket(socket);
// :TODO: banner
}
};
exports.getModule = class TelnetServerModule extends LoginServerModule {
constructor() {
super();
}
createServer(cb) {
this.server = net.createServer( socket => {
const client = new TelnetClient(socket);
this.handleNewClient(client, socket, ModuleInfo);
});
return cb(null);
}
};