Annihilate

This commit is contained in:
0loli 2022-03-17 02:07:46 +00:00 committed by GitHub
parent b2b0ecee81
commit d5d93317f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 100 deletions

View File

@ -1,66 +0,0 @@
import os from 'os';
class Defaults{
constructor(){
}
appspace='app.';
socketRoot='/tmp/';
id=os.hostname();
encoding='utf8';
rawBuffer=false;
sync=false;
unlink=true;
delimiter='\f';
silent=false;
logDepth=5;
logInColor=true;
logger=console.log.bind(console);
maxConnections=100;
retry=500;
maxRetries=Infinity;
stopRetrying=false;
IPType=getIPType();
tls=false;
networkHost = (this.IPType == 'IPv6') ? '::1' : '127.0.0.1';
networkPort = 8000;
readableAll = false;
writableAll = false;
interface={
localAddress:false,
localPort:false,
family:false,
hints:false,
lookup:false
}
}
function getIPType() {
const networkInterfaces = os.networkInterfaces();
let IPType = '';
if (networkInterfaces
&& Array.isArray(networkInterfaces)
&& networkInterfaces.length > 0) {
// getting the family of first network interface available
IPType = networkInterfaces [
Object.keys( networkInterfaces )[0]
][0].family;
}
return IPType;
}
export {
Defaults as default,
Defaults
}

View File

@ -1,34 +0,0 @@
import Defaults from './Defaults.js';
class Parser{
constructor(config){
if(!config){
config=new Defaults;
}
this.delimiter=config.delimiter;
}
format(message){
if(!message.data && message.data!==false && message.data!==0){
message.data={};
}
if(message.data['_maxListeners']){
message.data={};
}
message=message.JSON+this.delimiter;
return message;
}
parse(data){
let events=data.split(this.delimiter);
events.pop();
return events;
}
}
export {
Parser as default,
Parser
};