first commit

This commit is contained in:
monjack
2025-06-20 18:01:48 +08:00
commit 6daa6d65c1
24611 changed files with 2512443 additions and 0 deletions

758
app_vue/node_modules/@achrinza/node-ipc/README.md generated vendored Normal file
View File

@ -0,0 +1,758 @@
# @achrinza/node-ipc
> **NOTE:** This is a maintenance fork of `node-ipc` This is intended for
> packages that directly or indirectly depend on `node-ipc` where maintainers
> need a drop-in replacement.
>
> See https://github.com/achrinza/node-ipc/issues/1 for more details.
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
[![Coverage Status](https://coveralls.io/repos/github/achrinza/node-ipc/badge.svg?branch=main)](https://coveralls.io/github/achrinza/node-ipc?branch=main)
_a nodejs module for local and remote Inter Process Communication_ with full support for Linux, Mac and Windows. It also supports all forms of socket communication from low level unix and windows sockets to UDP and secure TLS and TCP sockets.
A great solution for complex multiprocess **Neural Networking** in Node.JS
**npm install @achrinza/node-ipc**
#### Older versions of node
the latest versions of `@achrinza/node-ipc` may work with the --harmony flag. Officially though, we support node v4 and newer with es5 and es6
#### Testing
`npm test` will run the jasmine tests with istanbul for @achrinza/node-ipc and generate a coverage report in the spec folder.
You may want to install jasmine and istanbul globally with `sudo npm install -g jasmine istanbul`
---
#### Contents
1. [Types of IPC Sockets and Supporting OS](#types-of-ipc-sockets)
1. [IPC Config](#ipc-config)
1. [IPC Methods](#ipc-methods)
1. [log](#log)
2. [connectTo](#connectto)
3. [connectToNet](#connecttonet)
4. [disconnect](#disconnect)
5. [serve](#serve)
6. [serveNet](#servenet)
1. [IPC Stores and Default Variables](#ipc-stores-and-default-variables)
1. [IPC Events](#ipc-events)
1. [Multiple IPC instances](#multiple-ipc-instances)
1. [Basic Examples](#basic-examples)
1. [Server for Unix||Windows Sockets & TCP Sockets](#server-for-unix-sockets-windows-sockets--tcp-sockets)
2. [Client for Unix||Windows Sockets & TCP Sockets](#client-for-unix-sockets--tcp-sockets)
3. [Server & Client for UDP Sockets](#server--client-for-udp-sockets)
4. [Raw Buffers, Real Time and / or Binary Sockets](#raw-buffer-or-binary-sockets)
1. [Working with TLS/SSL Socket Servers & Clients](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket)
1. [Node Code Examples](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example)
---
#### Types of IPC Sockets
| Type | Stability | Definition |
| ----------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Unix Socket or Windows Socket | Stable | Gives Linux, Mac, and Windows lightning fast communication and avoids the network card to reduce overhead and latency. [Local Unix and Windows Socket examples ](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/unixWindowsSocket/ "Unix and Windows Socket Node IPC examples") |
| TCP Socket | Stable | Gives the most reliable communication across the network. Can be used for local IPC as well, but is slower than #1's Unix Socket Implementation because TCP sockets go through the network card while Unix Sockets and Windows Sockets do not. [Local or remote network TCP Socket examples ](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TCPSocket/ "TCP Socket Node IPC examples") |
| TLS Socket | Stable | Configurable and secure network socket over SSL. Equivalent to https. [TLS/SSL documentation](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket) |
| UDP Sockets | Stable | Gives the **fastest network communication**. UDP is less reliable but much faster than TCP. It is best used for streaming non critical data like sound, video, or multiplayer game data as it can drop packets depending on network connectivity and other factors. UDP can be used for local IPC as well, but is slower than #1's Unix Socket or Windows Socket Implementation because UDP sockets go through the network card while Unix and Windows Sockets do not. [Local or remote network UDP Socket examples ](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/UDPSocket/ "UDP Socket Node IPC examples") |
| OS | Supported Sockets |
| ----- | -------------------------- |
| Linux | Unix, Posix, TCP, TLS, UDP |
| Mac | Unix, Posix, TCP, TLS, UDP |
| Win | Windows, TCP, TLS, UDP |
---
#### IPC Config
`ipc.config`
Set these variables in the `ipc.config` scope to overwrite or set default values.
```javascript
{
appspace : 'app.',
socketRoot : '/tmp/',
id : os.hostname(),
networkHost : 'localhost', //should resolve to 127.0.0.1 or ::1 see the table below related to this
networkPort : 8000,
readableAll : false,
writableAll : false,
encoding : 'utf8',
rawBuffer : false,
delimiter : '\f',
sync : false,
silent : false,
logInColor : true,
logDepth : 5,
logger : console.log,
maxConnections : 100,
retry : 500,
maxRetries : false,
stopRetrying : false,
unlink : true,
interfaces : {
localAddress: false,
localPort : false,
family : false,
hints : false,
lookup : false
}
}
```
| variable | documentation |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| appspace | used for Unix Socket (Unix Domain Socket) namespacing. If not set specifically, the Unix Domain Socket will combine the socketRoot, appspace, and id to form the Unix Socket Path for creation or binding. This is available in case you have many apps running on your system, you may have several sockets with the same id, but if you change the appspace, you will still have app specic unique sockets. |
| socketRoot | the directory in which to create or bind to a Unix Socket |
| id | the id of this socket or service |
| networkHost | the local or remote host on which TCP, TLS or UDP Sockets should connect |
| networkPort | the default port on which TCP, TLS, or UDP sockets should connect |
| readableAll | makes the pipe readable for all users including windows services |
| writableAll | makes the pipe writable for all users including windows services |
| encoding | the default encoding for data sent on sockets. Mostly used if rawBuffer is set to true. Valid values are : ` ascii` `utf8` ` utf16le` ` ucs2` ` base64` `hex` . |
| rawBuffer | if true, data will be sent and received as a raw node `Buffer` **NOT** an `Object` as JSON. This is great for Binary or hex IPC, and communicating with other processes in languages like C and C++ |
| delimiter | the delimiter at the end of each data packet. |
| sync | synchronous requests. Clients will not send new requests until the server answers. |
| silent | turn on/off logging default is false which means logging is on |
| logInColor | turn on/off util.inspect colors for ipc.log |
| logDepth | set the depth for util.inspect during ipc.log |
| logger | the function which receives the output from ipc.log; should take a single string argument |
| maxConnections | this is the max number of connections allowed to a socket. It is currently only being set on Unix Sockets. Other Socket types are using the system defaults. |
| retry | this is the time in milliseconds a client will wait before trying to reconnect to a server if the connection is lost. This does not effect UDP sockets since they do not have a client server relationship like Unix Sockets and TCP Sockets. |
| maxRetries | if set, it represents the maximum number of retries after each disconnect before giving up and completely killing a specific connection |
| stopRetrying | Defaults to false meaning clients will continue to retry to connect to servers indefinitely at the retry interval. If set to any number the client will stop retrying when that number is exceeded after each disconnect. If set to true in real time it will immediately stop trying to connect regardless of maxRetries. If set to 0, the client will **_NOT_** try to reconnect. |
| unlink | Defaults to true meaning that the module will take care of deleting the IPC socket prior to startup. If you use `@achrinza/node-ipc` in a clustered environment where there will be multiple listeners on the same socket, you must set this to `false` and then take care of deleting the socket in your own code. |
| interfaces | primarily used when specifying which interface a client should connect through. see the [socket.connect documentation in the node.js api](https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener) |
---
#### IPC Methods
These methods are available in the IPC Scope.
---
##### log
`ipc.log(a,b,c,d,e...);`
ipc.log will accept any number of arguments and if `ipc.config.silent` is not set, it will concat them all with a single space ' ' between them and then log them to the console. This is fast because it prevents any concatenation from happening if the ipc.config.silent is set `true`. That way if you leave your logging in place it should have almost no effect on performance.
The log also uses util.inspect You can control if it should log in color, the log depth, and the destination via `ipc.config`
```javascript
ipc.config.logInColor = true; //default
ipc.config.logDepth = 5; //default
ipc.config.logger = console.log.bind(console); // default
```
---
##### connectTo
`ipc.connectTo(id,path,callback);`
Used for connecting as a client to local Unix Sockets and Windows Sockets. **_This is the fastest way for processes on the same machine to communicate_** because it bypasses the network card which TCP and UDP must both use.
| variable | required | definition |
| -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| id | required | is the string id of the socket being connected to. The socket with this id is added to the ipc.of object when created. |
| path | optional | is the path of the Unix Domain Socket File, if the System is Windows, this will automatically be converted to an appropriate pipe with the same information as the Unix Domain Socket File. If not set this will default to `ipc.config.socketRoot`+`ipc.config.appspace`+`id` |
| callback | optional | this is the function to execute when the socket has been created. |
**examples** arguments can be ommitted so long as they are still in order.
```javascript
ipc.connectTo("world");
```
or using just an id and a callback
```javascript
ipc.connectTo("world", function () {
ipc.of.world.on("hello", function (data) {
ipc.log(data.debug);
//if data was a string, it would have the color set to the debug style applied to it
});
});
```
or explicitly setting the path
```javascript
ipc.connectTo("world", "myapp.world");
```
or explicitly setting the path with callback
```javascript
ipc.connectTo(
'world',
'myapp.world',
function(){
...
}
);
```
---
##### connectToNet
`ipc.connectToNet(id,host,port,callback)`
Used to connect as a client to a TCP or [TLS socket](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket) via the network card. This can be local or remote, if local, it is recommended that you use the Unix and Windows Socket Implementaion of `connectTo` instead as it is much faster since it avoids the network card altogether.
For TLS and SSL Sockets see the [@achrinza/node-ipc TLS and SSL docs](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example/TLSSocket). They have a few additional requirements, and things to know about and so have their own doc.
| variable | required | definition |
| -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id | required | is the string id of the socket being connected to. For TCP & TLS sockets, this id is added to the `ipc.of` object when the socket is created with a reference to the socket. |
| host | optional | is the host on which the TCP or TLS socket resides. This will default to `ipc.config.networkHost` if not specified. |
| port | optional | the port on which the TCP or TLS socket resides. |
| callback | optional | this is the function to execute when the socket has been created. |
**examples** arguments can be ommitted so long as they are still in order.
So while the default is : (id,host,port,callback), the following examples will still work because they are still in order (id,port,callback) or (id,host,callback) or (id,port) etc.
```javascript
ipc.connectToNet("world");
```
or using just an id and a callback
```javascript
ipc.connectToNet(
'world',
function(){
...
}
);
```
or explicitly setting the host and path
```javascript
ipc.connectToNet(
'world',
'myapp.com',serve(path,callback)
3435
);
```
or only explicitly setting port and callback
```javascript
ipc.connectToNet(
'world',
3435,
function(){
...
}
);
```
---
##### disconnect
`ipc.disconnect(id)`
Used to disconnect a client from a Unix, Windows, TCP or TLS socket. The socket and its refrence will be removed from memory and the `ipc.of` scope. This can be local or remote. UDP clients do not maintain connections and so there are no Clients and this method has no value to them.
| variable | required | definition |
| -------- | -------- | -------------------------------------------------------- |
| id | required | is the string id of the socket from which to disconnect. |
**examples**
```javascript
ipc.disconnect("world");
```
---
##### serve
`ipc.serve(path,callback);`
Used to create local Unix Socket Server or Windows Socket Server to which Clients can bind. The server can `emit` events to specific Client Sockets, or `broadcast` events to all known Client Sockets.
| variable | required | definition |
| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| path | optional | This is the path of the Unix Domain Socket File, if the System is Windows, this will automatically be converted to an appropriate pipe with the same information as the Unix Domain Socket File. If not set this will default to `ipc.config.socketRoot`+`ipc.config.appspace`+`id` |
| callback | optional | This is a function to be called after the Server has started. This can also be done by binding an event to the start event like `ipc.server.on('start',function(){});` |
**_examples_** arguments can be omitted so long as they are still in order.
```javascript
ipc.serve();
```
or specifying callback
```javascript
ipc.serve(
function(){...}
);
```
or specify path
```javascript
ipc.serve("/tmp/myapp.myservice");
```
or specifying everything
```javascript
ipc.serve(
'/tmp/myapp.myservice',
function(){...}
);
```
---
##### serveNet
`serveNet(host,port,UDPType,callback)`
Used to create TCP, TLS or UDP Socket Server to which Clients can bind or other servers can send data to. The server can `emit` events to specific Client Sockets, or `broadcast` events to all known Client Sockets.
| variable | required | definition |
| -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| host | optional | If not specified this defaults to the first address in os.networkInterfaces(). For TCP, TLS & UDP servers this is most likely going to be 127.0.0.1 or ::1 |
| port | optional | The port on which the TCP, UDP, or TLS Socket server will be bound, this defaults to 8000 if not specified |
| UDPType | optional | If set this will create the server as a UDP socket. 'udp4' or 'udp6' are valid values. This defaults to not being set. When using udp6 make sure to specify a valid IPv6 host, like `::1` |
| callback | optional | Function to be called when the server is created |
**_examples_** arguments can be ommitted solong as they are still in order.
default tcp server
```javascript
ipc.serveNet();
```
default udp server
```javascript
ipc.serveNet("udp4");
```
or specifying TCP server with callback
```javascript
ipc.serveNet(
function(){...}
);
```
or specifying UDP server with callback
```javascript
ipc.serveNet(
'udp4',
function(){...}
);
```
or specify port
```javascript
ipc.serveNet(3435);
```
or specifying everything TCP
```javascript
ipc.serveNet(
'MyMostAwesomeApp.com',
3435,
function(){...}
);
```
or specifying everything UDP
```javascript
ipc.serveNet(
'MyMostAwesomeApp.com',
3435,
'udp4',
function(){...}
);
```
---
### IPC Stores and Default Variables
| variable | definition |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ipc.of | This is where socket connection refrences will be stored when connecting to them as a client via the `ipc.connectTo` or `iupc.connectToNet`. They will be stored based on the ID used to create them, eg : ipc.of.mySocket |
| ipc.server | This is a refrence to the server created by `ipc.serve` or `ipc.serveNet` |
---
### IPC Server Methods
| method | definition |
| ------ | --------------------------------------------------------------------------- |
| start | start serving need to call `serve` or `serveNet` first to set up the server |
| stop | close the server and stop serving |
---
### IPC Events
| event name | params | definition |
| --------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| error | err obj | triggered when an error has occured |
| connect | | triggered when socket connected |
| disconnect | | triggered by client when socket has disconnected from server |
| socket.disconnected | socket destroyedSocketID | triggered by server when a client socket has disconnected |
| destroy | | triggered when socket has been totally destroyed, no further auto retries will happen and all references are gone. |
| data | buffer | triggered when ipc.config.rawBuffer is true and a message is received. |
| **_your event type_** | **_your event data_** | triggered when a JSON message is received. The event name will be the type string from your message and the param will be the data object from your message eg : `{ type:'myEvent',data:{a:1}}` |
### Multiple IPC Instances
Sometimes you might need explicit and independent instances of @achrinza/node-ipc. Just for such scenarios we have exposed the core IPC class on the IPC singleton.
```javascript
const RawIPC = require("@achrinza/node-ipc").IPC;
const ipc = new RawIPC();
const someOtherExplicitIPC = new RawIPC();
//OR
const ipc = require("@achrinza/node-ipc");
const someOtherExplicitIPC = new ipc.IPC();
//setting explicit configs
//keep one silent and the other verbose
ipc.config.silent = true;
someOtherExplicitIPC.config.silent = true;
//make one a raw binary and the other json based ipc
ipc.config.rawBuffer = false;
someOtherExplicitIPC.config.rawBuffer = true;
someOtherExplicitIPC.config.encoding = "hex";
```
---
### Basic Examples
You can find [Advanced Examples](https://github.com/RIAEvangelist/@achrinza/node-ipc/tree/master/example) in the examples folder. In the examples you will find more complex demos including multi client examples.
#### Server for Unix Sockets, Windows Sockets & TCP Sockets
The server is the process keeping a socket for IPC open. Multiple sockets can connect to this server and talk to it. It can also broadcast to all clients or emit to a specific client. This is the most basic example which will work for local Unix and Windows Sockets as well as local or remote network TCP Sockets.
```javascript
var ipc = require("@achrinza/node-ipc");
ipc.config.id = "world";
ipc.config.retry = 1500;
ipc.serve(function () {
ipc.server.on("message", function (data, socket) {
ipc.log("got a message : ".debug, data);
ipc.server.emit(
socket,
"message", //this can be anything you want so long as
//your client knows.
data + " world!"
);
});
ipc.server.on("socket.disconnected", function (socket, destroyedSocketID) {
ipc.log("client " + destroyedSocketID + " has disconnected!");
});
});
ipc.server.start();
```
#### Client for Unix Sockets & TCP Sockets
The client connects to the servers socket for Inter Process Communication. The socket will receive events emitted to it specifically as well as events which are broadcast out on the socket by the server. This is the most basic example which will work for both local Unix Sockets and local or remote network TCP Sockets.
```javascript
var ipc = require("@achrinza/node-ipc");
ipc.config.id = "hello";
ipc.config.retry = 1500;
ipc.connectTo("world", function () {
ipc.of.world.on("connect", function () {
ipc.log("## connected to world ##".rainbow, ipc.config.delay);
ipc.of.world.emit(
"message", //any event or message type your server listens for
"hello"
);
});
ipc.of.world.on("disconnect", function () {
ipc.log("disconnected from world".notice);
});
ipc.of.world.on(
"message", //any event or message type your server listens for
function (data) {
ipc.log("got a message from world : ".debug, data);
}
);
});
```
#### Server & Client for UDP Sockets
UDP Sockets are different than Unix, Windows & TCP Sockets because they must be bound to a unique port on their machine to receive messages. For example, A TCP, Unix, or Windows Socket client could just connect to a separate TCP, Unix, or Windows Socket sever. That client could then exchange, both send and receive, data on the servers port or location. UDP Sockets can not do this. They must bind to a port to receive or send data.
This means a UDP Client and Server are the same thing because in order to receive data, a UDP Socket must have its own port to receive data on, and only one process can use this port at a time. It also means that in order to `emit` or `broadcast` data the UDP server will need to know the host and port of the Socket it intends to broadcast the data to.
This is the most basic example which will work for both local and remote UDP Sockets.
##### UDP Server 1 - "World"
```javascript
var ipc = require("../../../@achrinza/node-ipc");
ipc.config.id = "world";
ipc.config.retry = 1500;
ipc.serveNet("udp4", function () {
console.log(123);
ipc.server.on("message", function (data, socket) {
ipc.log(
"got a message from ".debug,
data.from.variable,
" : ".debug,
data.message.variable
);
ipc.server.emit(socket, "message", {
from: ipc.config.id,
message: data.message + " world!",
});
});
console.log(ipc.server);
});
ipc.server.start();
```
##### UDP Server 2 - "Hello"
_note_ we set the port here to 8001 because the world server is already using the default ipc.config.networkPort of 8000. So we can not bind to 8000 while world is using it.
```javascript
ipc.config.id = "hello";
ipc.config.retry = 1500;
ipc.serveNet(8001, "udp4", function () {
ipc.server.on("message", function (data) {
ipc.log("got Data");
ipc.log(
"got a message from ".debug,
data.from.variable,
" : ".debug,
data.message.variable
);
});
ipc.server.emit(
{
address: "127.0.0.1", //any hostname will work
port: ipc.config.networkPort,
},
"message",
{
from: ipc.config.id,
message: "Hello",
}
);
});
ipc.server.start();
```
#### Raw Buffer or Binary Sockets
Binary or Buffer sockets can be used with any of the above socket types, however the way data events are emit is **_slightly_** different. These may come in handy if working with embedded systems or C / C++ processes. You can even make sure to match C or C++ string typing.
When setting up a rawBuffer socket you must specify it as such :
```javascript
ipc.config.rawBuffer = true;
```
You can also specify its encoding type. The default is `utf8`
```javascript
ipc.config.encoding = "utf8";
```
emit string buffer :
```javascript
//server
ipc.server.emit(socket, "hello");
//client
ipc.of.world.emit("hello");
```
emit byte array buffer :
```javascript
//hex encoding may work best for this.
ipc.config.encoding = "hex";
//server
ipc.server.emit(socket, [10, 20, 30]);
//client
ipc.server.emit([10, 20, 30]);
```
emit binary or hex array buffer, this is best for real time data transfer, especially whan connecting to C or C++ processes, or embedded systems :
```javascript
ipc.config.encoding = "hex";
//server
ipc.server.emit(socket, [0x05, 0x6d, 0x5c]);
//client
ipc.server.emit([0x05, 0x6d, 0x5c]);
```
Writing explicit buffers, int types, doubles, floats etc. as well as big endian and little endian data to raw buffer nostly valuable when connecting to C or C++ processes, or embedded systems (see more detailed info on buffers as well as UInt, Int, double etc. here)[https://nodejs.org/api/buffer.html]:
```javascript
ipc.config.encoding = "hex";
//make a 6 byte buffer for example
const myBuffer = Buffer.alloc(6).fill(0);
//fill the first 2 bytes with a 16 bit (2 byte) short unsigned int
//write a UInt16 (2 byte or short) as Big Endian
myBuffer.writeUInt16BE(
2, //value to write
0 //offset in bytes
);
//OR
myBuffer.writeUInt16LE(0x2, 0);
//OR
myBuffer.writeUInt16LE(0x02, 0);
//fill the remaining 4 bytes with a 32 bit (4 byte) long unsigned int
//write a UInt32 (4 byte or long) as Big Endian
myBuffer.writeUInt32BE(
16772812, //value to write
2 //offset in bytes
);
//OR
myBuffer.writeUInt32BE(0xffeecc, 0);
//server
ipc.server.emit(socket, myBuffer);
//client
ipc.server.emit(myBuffer);
```
#### Server with the `cluster` Module
`@achrinza/node-ipc` can be used with Node.js' [cluster module](https://nodejs.org/api/cluster.html) to provide the ability to have multiple readers for a single socket. Doing so simply requires you to set the `unlink` property in the config to `false` and take care of unlinking the socket path in the master process:
##### Server
```javascript
const fs = require("fs");
const ipc = require("../../../@achrinza/node-ipc");
const cpuCount = require("os").cpus().length;
const cluster = require("cluster");
const socketPath = "/tmp/ipc.sock";
ipc.config.unlink = false;
if (cluster.isMaster) {
if (fs.existsSync(socketPath)) {
fs.unlinkSync(socketPath);
}
for (let i = 0; i < cpuCount; i++) {
cluster.fork();
}
} else {
ipc.serve(socketPath, function () {
ipc.server.on("currentDate", function (data, socket) {
console.log(`pid ${process.pid} got: `, data);
});
});
ipc.server.start();
console.log(`pid ${process.pid} listening on ${socketPath}`);
}
```
##### Client
```javascript
const fs = require("fs");
const ipc = require("../../@achrinza/node-ipc");
const socketPath = "/tmp/ipc.sock";
//loop forever so you can see the pid of the cluster sever change in the logs
setInterval(function () {
ipc.connectTo("world", socketPath, connecting);
}, 2000);
function connecting(socket) {
ipc.of.world.on("connect", function () {
ipc.of.world.emit("currentDate", {
message: new Date().toISOString(),
});
ipc.disconnect("world");
});
}
```
#### Licensed under MIT license
See the [MIT license](https://github.com/RIAEvangelist/@achrinza/node-ipc/blob/master/license) file.

256
app_vue/node_modules/@achrinza/node-ipc/dao/client.js generated vendored Normal file
View File

@ -0,0 +1,256 @@
'use strict';
const net = require('net'),
tls = require('tls'),
EventParser = require('../entities/EventParser.js'),
Message = require('js-message'),
fs = require('fs'),
Queue = require('@node-ipc/js-queue'),
Events = require('event-pubsub');
let eventParser = new EventParser();
class Client extends Events{
constructor(config,log){
super();
Object.assign(
this,
{
Client : Client,
config : config,
queue : new Queue,
socket : false,
connect : connect,
emit : emit,
log : log,
retriesRemaining:config.maxRetries||0,
explicitlyDisconnected: false
}
);
eventParser=new EventParser(this.config);
}
}
function emit(type,data){
this.log('dispatching event to ', this.id, this.path, ' : ', type, ',', data);
let message=new Message;
message.type=type;
message.data=data;
if(this.config.rawBuffer){
message=Buffer.from(type,this.config.encoding);
}else{
message=eventParser.format(message);
}
if(!this.config.sync){
this.socket.write(message);
return;
}
this.queue.add(
syncEmit.bind(this,message)
);
}
function syncEmit(message){
this.log('dispatching event to ', this.id, this.path, ' : ', message);
this.socket.write(message);
}
function connect(){
//init client object for scope persistance especially inside of socket events.
let client=this;
client.log('requested connection to ', client.id, client.path);
if(!this.path){
client.log('\n\n######\nerror: ', client.id ,' client has not specified socket path it wishes to connect to.');
return;
}
const options={};
if(!client.port){
client.log('Connecting client on Unix Socket :', client.path);
options.path=client.path;
if (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
options.path = options.path.replace(/^\//, '');
options.path = options.path.replace(/\//g, '-');
options.path= `\\\\.\\pipe\\${options.path}`;
}
client.socket = net.connect(options);
}else{
options.host=client.path;
options.port=client.port;
if(client.config.interface.localAddress){
options.localAddress=client.config.interface.localAddress;
}
if(client.config.interface.localPort){
options.localPort=client.config.interface.localPort;
}
if(client.config.interface.family){
options.family=client.config.interface.family;
}
if(client.config.interface.hints){
options.hints=client.config.interface.hints;
}
if(client.config.interface.lookup){
options.lookup=client.config.interface.lookup;
}
if(!client.config.tls){
client.log('Connecting client via TCP to', options);
client.socket = net.connect(options);
}else{
client.log('Connecting client via TLS to', client.path ,client.port,client.config.tls);
if(client.config.tls.private){
client.config.tls.key=fs.readFileSync(client.config.tls.private);
}
if(client.config.tls.public){
client.config.tls.cert=fs.readFileSync(client.config.tls.public);
}
if(client.config.tls.trustedConnections){
if(typeof client.config.tls.trustedConnections === 'string'){
client.config.tls.trustedConnections=[client.config.tls.trustedConnections];
}
client.config.tls.ca=[];
for(let i=0; i<client.config.tls.trustedConnections.length; i++){
client.config.tls.ca.push(
fs.readFileSync(client.config.tls.trustedConnections[i])
);
}
}
Object.assign(client.config.tls,options);
client.socket = tls.connect(
client.config.tls
);
}
}
client.socket.setEncoding(this.config.encoding);
client.socket.on(
'error',
function(err){
client.log('\n\n######\nerror: ', err);
client.publish('error', err);
}
);
client.socket.on(
'connect',
function connectionMade(){
client.publish('connect');
client.retriesRemaining=client.config.maxRetries;
client.log('retrying reset');
}
);
client.socket.on(
'close',
function connectionClosed(){
client.log('connection closed' ,client.id , client.path,
client.retriesRemaining, 'tries remaining of', client.config.maxRetries
);
if(
client.config.stopRetrying ||
client.retriesRemaining<1 ||
client.explicitlyDisconnected
){
client.publish('disconnect');
client.log(
(client.config.id),
'exceeded connection rety amount of',
' or stopRetrying flag set.'
);
client.socket.destroy();
client.publish('destroy');
client=undefined;
return;
}
setTimeout(
function retryTimeout(){
if (client.explicitlyDisconnected) {
return;
}
client.retriesRemaining--;
client.connect();
}.bind(null,client),
client.config.retry
);
client.publish('disconnect');
}
);
client.socket.on(
'data',
function(data) {
client.log('## received events ##');
if(client.config.rawBuffer){
client.publish(
'data',
Buffer.from(data,client.config.encoding)
);
if(!client.config.sync){
return;
}
client.queue.next();
return;
}
if(!this.ipcBuffer){
this.ipcBuffer='';
}
data=(this.ipcBuffer+=data);
if(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
client.log('Messages are large, You may want to consider smaller messages.');
return;
}
this.ipcBuffer='';
const events = eventParser.parse(data);
const eCount = events.length;
for(let i=0; i<eCount; i++){
let message=new Message;
message.load(events[i]);
client.log('detected event', message.type, message.data);
client.publish(
message.type,
message.data
);
}
if(!client.config.sync){
return;
}
client.queue.next();
}
);
}
module.exports=Client;

View File

@ -0,0 +1,399 @@
'use strict';
const net = require('net'),
tls = require('tls'),
fs = require('fs'),
dgram = require('dgram'),
EventParser = require('../entities/EventParser.js'),
Message = require('js-message'),
Events = require('event-pubsub');
let eventParser = new EventParser();
class Server extends Events{
constructor(path,config,log,port){
super();
Object.assign(
this,
{
config : config,
path : path,
port : port,
udp4 : false,
udp6 : false,
log : log,
server : false,
sockets : [],
emit : emit,
broadcast : broadcast
}
);
eventParser=new EventParser(this.config);
this.on(
'close',
serverClosed.bind(this)
);
}
onStart(socket){
this.trigger(
'start',
socket
);
}
stop(){
this.server.close();
}
start(){
if(!this.path){
this.log('Socket Server Path not specified, refusing to start');
return;
}
if(this.config.unlink){
fs.unlink(
this.path,
startServer.bind(this)
);
}else{
startServer.bind(this)();
}
}
}
function emit(socket, type, data){
this.log('dispatching event to socket', ' : ', type, data);
let message=new Message;
message.type=type;
message.data=data;
if(this.config.rawBuffer){
this.log(this.config.encoding)
message=Buffer.from(type,this.config.encoding);
}else{
message=eventParser.format(message);
}
if(this.udp4 || this.udp6){
if(!socket.address || !socket.port){
this.log('Attempting to emit to a single UDP socket without supplying socket address or port. Redispatching event as broadcast to all connected sockets');
this.broadcast(type,data);
return;
}
this.server.write(
message,
socket
);
return;
}
socket.write(message);
}
function broadcast(type,data){
this.log('broadcasting event to all known sockets listening to ', this.path,' : ', ((this.port)?this.port:''), type, data);
let message=new Message;
message.type=type;
message.data=data;
if(this.config.rawBuffer){
message=Buffer.from(type,this.config.encoding);
}else{
message=eventParser.format(message);
}
if(this.udp4 || this.udp6){
for(let i=1, count=this.sockets.length; i<count; i++){
this.server.write(message,this.sockets[i]);
}
}else{
for(let i=0, count=this.sockets.length; i<count; i++){
this.sockets[i].write(message);
}
}
}
function serverClosed(){
for(let i=0, count=this.sockets.length; i<count; i++){
let socket=this.sockets[i];
let destroyedSocketId=false;
if(socket){
if(socket.readable){
continue;
}
}
if(socket.id){
destroyedSocketId=socket.id;
}
this.log('socket disconnected',destroyedSocketId.toString());
if(socket && socket.destroy){
socket.destroy();
}
this.sockets.splice(i,1);
this.publish('socket.disconnected', socket, destroyedSocketId);
return;
}
}
function gotData(socket,data,UDPSocket){
let sock=((this.udp4 || this.udp6)? UDPSocket : socket);
if(this.config.rawBuffer){
data=Buffer.from(data,this.config.encoding);
this.publish(
'data',
data,
sock
);
return;
}
if(!sock.ipcBuffer){
sock.ipcBuffer='';
}
data=(sock.ipcBuffer+=data);
if(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
this.log('Messages are large, You may want to consider smaller messages.');
return;
}
sock.ipcBuffer='';
data=eventParser.parse(data);
while(data.length>0){
let message=new Message;
message.load(data.shift());
// Only set the sock id if it is specified.
if (message.data && message.data.id){
sock.id=message.data.id;
}
this.log('received event of : ',message.type,message.data);
this.publish(
message.type,
message.data,
sock
);
}
}
function socketClosed(socket){
this.publish(
'close',
socket
);
}
function serverCreated(socket) {
this.sockets.push(socket);
if(socket.setEncoding){
socket.setEncoding(this.config.encoding);
}
this.log('## socket connection to server detected ##');
socket.on(
'close',
socketClosed.bind(this)
);
socket.on(
'error',
function(err){
this.log('server socket error',err);
this.publish('error',err);
}.bind(this)
);
socket.on(
'data',
gotData.bind(this,socket)
);
socket.on(
'message',
function(msg,rinfo) {
if (!rinfo){
return;
}
this.log('Received UDP message from ', rinfo.address, rinfo.port);
let data;
if(this.config.rawSocket){
data=Buffer.from(msg,this.config.encoding);
}else{
data=msg.toString();
}
socket.emit('data',data,rinfo);
}.bind(this)
);
this.publish(
'connect',
socket
);
if(this.config.rawBuffer){
return;
}
}
function startServer() {
this.log(
'starting server on ',this.path,
((this.port)?`:${this.port}`:'')
);
if(!this.udp4 && !this.udp6){
this.log('starting TLS server',this.config.tls);
if(!this.config.tls){
this.server=net.createServer(
serverCreated.bind(this)
);
}else{
startTLSServer.bind(this)();
}
}else{
this.server=dgram.createSocket(
((this.udp4)? 'udp4':'udp6')
);
this.server.write=UDPWrite.bind(this);
this.server.on(
'listening',
function UDPServerStarted() {
serverCreated.bind(this)(this.server);
}.bind(this)
);
}
this.server.on(
'error',
function(err){
this.log('server error',err);
this.publish(
'error',
err
);
}.bind(this)
);
this.server.maxConnections=this.config.maxConnections;
if(!this.port){
this.log('starting server as', 'Unix || Windows Socket');
if (process.platform ==='win32'){
this.path = this.path.replace(/^\//, '');
this.path = this.path.replace(/\//g, '-');
this.path= `\\\\.\\pipe\\${this.path}`;
}
this.server.listen({
path: this.path,
readableAll: this.config.readableAll,
writableAll: this.config.writableAll
}, this.onStart.bind(this));
return;
}
if(!this.udp4 && !this.udp6){
this.log('starting server as', (this.config.tls?'TLS':'TCP'));
this.server.listen(
this.port,
this.path,
this.onStart.bind(this)
);
return;
}
this.log('starting server as',((this.udp4)? 'udp4':'udp6'));
this.server.bind(
this.port,
this.path
);
this.onStart(
{
address : this.path,
port : this.port
}
);
}
function startTLSServer(){
this.log('starting TLS server',this.config.tls);
if(this.config.tls.private){
this.config.tls.key=fs.readFileSync(this.config.tls.private);
}else{
this.config.tls.key=fs.readFileSync(`${__dirname}/../local-node-ipc-certs/private/server.key`);
}
if(this.config.tls.public){
this.config.tls.cert=fs.readFileSync(this.config.tls.public);
}else{
this.config.tls.cert=fs.readFileSync(`${__dirname}/../local-node-ipc-certs/server.pub`);
}
if(this.config.tls.dhparam){
this.config.tls.dhparam=fs.readFileSync(this.config.tls.dhparam);
}
if(this.config.tls.trustedConnections){
if(typeof this.config.tls.trustedConnections === 'string'){
this.config.tls.trustedConnections=[this.config.tls.trustedConnections];
}
this.config.tls.ca=[];
for(let i=0; i<this.config.tls.trustedConnections.length; i++){
this.config.tls.ca.push(
fs.readFileSync(this.config.tls.trustedConnections[i])
);
}
}
this.server=tls.createServer(
this.config.tls,
serverCreated.bind(this)
);
}
function UDPWrite(message,socket){
let data=Buffer.from(message, this.config.encoding);
this.server.send(
data,
0,
data.length,
socket.port,
socket.address,
function(err, bytes) {
if(err){
this.log('error writing data to socket',err);
this.publish(
'error',
function(err){
this.publish('error',err);
}
);
}
}
);
}
module.exports=Server;

View File

@ -0,0 +1,83 @@
'use strict';
/*eslint no-magic-numbers: ["error", { "ignore": [ 0] }]*/
/**
* @module entities
*/
const os = require('os');
/**
* @class Defaults
* @description Defaults Entity
*/
class Defaults{
/**
* @constructor
* @method constructor
* @return {void}
*/
constructor(){
this.appspace='app.';
this.socketRoot='/tmp/';
this.id=os.hostname();
this.encoding='utf8';
this.rawBuffer=false;
this.sync=false;
this.unlink=true;
this.delimiter='\f';
this.silent=false;
this.logDepth=5;
this.logInColor=true;
this.logger=console.log.bind(console);
this.maxConnections=100;
this.retry=500;
this.maxRetries=Infinity;
this.stopRetrying=false;
this.IPType=getIPType();
this.tls=false;
this.networkHost = (this.IPType == 'IPv6') ? '::1' : '127.0.0.1';
this.networkPort = 8000;
this.readableAll = false;
this.writableAll = false;
this.interface={
localAddress:false,
localPort:false,
family:false,
hints:false,
lookup:false
}
}
}
/**
* method to get ip type
*
* @method getIPType
* @return {string} ip type
*/
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;
}
module.exports=Defaults;

View File

@ -0,0 +1,32 @@
'use strict';
const Defaults = require('./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;
}
}
module.exports=Parser;

21
app_vue/node_modules/@achrinza/node-ipc/licence generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Brandon Nozaki Miller
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIID+zCCAuOgAwIBAgIJAKUVVihb00q/MA0GCSqGSIb3DQEBCwUAMIGTMQswCQYD
VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNVGhvdXNhbmQg
T2FrczEUMBIGA1UECgwLRGlnaU5vdyBpbmMxDDAKBgNVBAsMA1JuRDEQMA4GA1UE
AwwHRGlnaU5vdzEhMB8GCSqGSIb3DQEJARYSYnJhbmRvbkBkaWdpbm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Mvef94cCIRsph+Vjisf7OQxnx65s+aPYcjrba+Kks3
58ANS3VkbXXzB3MeNGoB
-----END CERTIFICATE-----

View File

@ -0,0 +1,352 @@
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
# Extra OBJECT IDENTIFIER info:
#oid_file = $ENV::HOME/.oid
oid_section = new_oids
# To use this configuration file with the "-extfile" option of the
# "openssl x509" utility, name here the section containing the
# X.509v3 extensions to use:
# extensions =
# (Alternatively, use a configuration file that has only
# X.509v3 extensions in its main [= default] section.)
[ new_oids ]
# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
# Add a simple OID like this:
# testoid1=1.2.3.4
# Or use config file substitution like this:
# testoid2=${testoid1}.5.6
# Policies used by the TSA examples.
tsa_policy1 = 1.2.3.4.1
tsa_policy2 = 1.2.3.4.5.6
tsa_policy3 = 1.2.3.4.5.7
####################################################################
[ ca ]
default_ca = CA_default # The default ca section
####################################################################
[ CA_default ]
dir = ./demoCA # Where everything is kept
certs = $dir/certs # Where the issued certs are kept
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
#unique_subject = no # Set to 'no' to allow creation of
# several ctificates with same subject.
new_certs_dir = $dir/newcerts # default place for new certs.
certificate = $dir/cacert.pem # The CA certificate
serial = $dir/serial # The current serial number
crlnumber = $dir/crlnumber # the current crl number
# must be commented out to leave a V1 CRL
crl = $dir/crl.pem # The current CRL
private_key = $dir/private/cakey.pem# The private key
RANDFILE = $dir/private/.rand # private random number file
x509_extensions = usr_cert # The extentions to add to the cert
# Comment out the following two lines for the "traditional"
# (and highly broken) format.
name_opt = ca_default # Subject Name options
cert_opt = ca_default # Certificate field options
# Extension copying option: use with caution.
# copy_extensions = copy
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
# so this is commented out by default to leave a V1 CRL.
# crlnumber must also be commented out to leave a V1 CRL.
# crl_extensions = crl_ext
default_days = 365 # how long to certify for
default_crl_days= 30 # how long before next CRL
default_md = default # use public key default MD
preserve = no # keep passed DN ordering
# A few difference way of specifying how similar the request should look
# For type CA, the listed attributes must be the same, and the optional
# and supplied fields are just that :-)
policy = policy_match
# For the CA policy
[ policy_match ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
# For the 'anything' policy
# At this point in time, you must list all acceptable 'object'
# types.
[ policy_anything ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
####################################################################
[ req ]
default_bits = 2048
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
x509_extensions = v3_ca # The extentions to add to the self signed cert
# Passwords for private keys if not present they will be prompted for
# input_password = secret
# output_password = secret
# This sets a mask for permitted string types. There are several options.
# default: PrintableString, T61String, BMPString.
# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
# MASK:XXXX a literal mask value.
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
string_mask = utf8only
req_extensions = v3_req # The extensions to add to a certificate request
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
countryName_default = AU
countryName_min = 2
countryName_max = 2
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = Some-State
localityName = Locality Name (eg, city)
0.organizationName = Organization Name (eg, company)
0.organizationName_default = Internet Widgits Pty Ltd
# we can do this but it is not needed normally :-)
#1.organizationName = Second Organization Name (eg, company)
#1.organizationName_default = World Wide Web Pty Ltd
organizationalUnitName = Organizational Unit Name (eg, section)
#organizationalUnitName_default =
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_max = 64
emailAddress = Email Address
emailAddress_max = 64
# SET-ex3 = SET extension number 3
[ req_attributes ]
challengePassword = A challenge password
challengePassword_min = 4
challengePassword_max = 20
unstructuredName = An optional company name
[ usr_cert ]
# These extensions are added when 'ca' signs a request.
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints=CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "OpenSSL Generated Certificate"
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
# Copy subject details
# issuerAltName=issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
# This is required for TSA certificates.
# extendedKeyUsage = critical,timeStamping
[ v3_req ]
subjectAltName="DNS:localhost,IP:127.0.0.1"
# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
[ v3_ca ]
# Extensions for a typical CA
# PKIX recommendation.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer
# This is what PKIX recommends but some broken software chokes on critical
# extensions.
#basicConstraints = critical,CA:true
# So we do this instead.
basicConstraints = CA:true
# Key usage: this is typical for a CA certificate. However since it will
# prevent it being used as an test self-signed certificate it is best
# left out by default.
# keyUsage = cRLSign, keyCertSign
# Some might want this also
# nsCertType = sslCA, emailCA
# Include email address in subject alt name: another PKIX recommendation
# subjectAltName=email:copy
# Copy issuer details
# issuerAltName=issuer:copy
# DER hex encoding of an extension: beware experts only!
# obj=DER:02:03
# Where 'obj' is a standard or added object
# You can even override a supported extension:
# basicConstraints= critical, DER:30:03:01:01:FF
[ crl_ext ]
# CRL extensions.
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
# issuerAltName=issuer:copy
authorityKeyIdentifier=keyid:always
[ proxy_cert_ext ]
# These extensions should be added when creating a proxy certificate
# This goes against PKIX guidelines but some CAs do it and some software
# requires this to avoid interpreting an end user certificate as a CA.
basicConstraints=CA:FALSE
# Here are some examples of the usage of nsCertType. If it is omitted
# the certificate can be used for anything *except* object signing.
# This is OK for an SSL server.
# nsCertType = server
# For an object signing certificate this would be used.
# nsCertType = objsign
# For normal client use this is typical
# nsCertType = client, email
# and for everything including object signing:
# nsCertType = client, email, objsign
# This is typical in keyUsage for a client certificate.
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
# This will be displayed in Netscape's comment listbox.
nsComment = "OpenSSL Generated Certificate"
# PKIX recommendations harmless if included in all certificates.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
# This stuff is for subjectAltName and issuerAltname.
# Import the email address.
# subjectAltName=email:copy
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
# Copy subject details
# issuerAltName=issuer:copy
#nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
#nsBaseUrl
#nsRevocationUrl
#nsRenewalUrl
#nsCaPolicyUrl
#nsSslServerName
# This really needs to be in place for it to be a proxy certificate.
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
####################################################################
[ tsa ]
default_tsa = tsa_config1 # the default TSA section
[ tsa_config1 ]
# These are used by the TSA reply generation only.
dir = ./demoCA # TSA root directory
serial = $dir/tsaserial # The current serial number (mandatory)
crypto_device = builtin # OpenSSL engine to use for signing
signer_cert = $dir/tsacert.pem # The TSA signing certificate
# (optional)
certs = $dir/cacert.pem # Certificate chain to include in reply
# (optional)
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
default_policy = tsa_policy1 # Policy if request did not specify it
# (optional)
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
digests = md5, sha1 # Acceptable message digests (mandatory)
accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
clock_precision_digits = 0 # number of digits after dot. (optional)
ordering = yes # Is ordering defined for timestamps?
# (optional, default: no)
tsa_name = yes # Must the TSA name be included in the reply?
# (optional, default: no)
ess_cert_id_chain = no # Must the ESS cert id chain be included?
# (optional, default: no)

View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAqzR1m22jL5citxDXr2Hm/suYFrTn+U/B0uZNBO37m/I1OH+I
+6aMYbwGIGjHrlFIoEd2GTkhnNzfMlxSxa61PFkMiuygMFnMlL6liu5r4+nUADbZ
xr55LfqtqYzDtZ8VT7l4KL9BiGlh3O4C+K37qIQXLepW8Tl2lMVh3hW0KFpasbPp
WGjTCDJ+z4DcDwyDaCXgAypFRV5TRvf2J0+Y+00HoJsxcQQXZKPBDVvGPdURvv2B
4bRD8inkBq5tzbZfOSaJE/xlLFFH1I15LiqybKy4cDFSzw9t7nMuycwXHnNFYKbv
fQZLOdcP3aOn/NKyJQISPonrGZTyY6QyGIZhFwIDAQABAoIBAHpxZ1dE/zuvFLXm
xsr48vLxexFqSqnEv/NsoFLRPWzXufZxR+/qumW/yoXtSjpCifWPhkgd0wtT8BEd
dFlLTPUfHthQyXQrFSSggNavE9yJxARvNits2E/pA8DKGsJPRzeghu5lcqHz9HjE
hL2D+QMZjVZaTdnx5fwaepcR4KomYTUupci0HoMWyoKPhIfItVueiHVo4d60dIRz
OpkSGCAZ/Czv5CJrmK/5e+roKti4ChF/n28hUu7OGzvkG+qYep08tf48MyZCPHgO
Vj+kuxMRkjIP0iXLmiF32lZXzpOFvjtXovI46dYiINCE9tNyKqDWYUJf9qNqwAsm
OuOfXtkCgYEA18Ywabu/Z4vYUhWtTFrP6iSLVcXd0rZuWud7kwv/G4DMrNh7oi1s
0AVvphaEqEn8Osgcuy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L5e6qCkbhZ
tP5xuTjQlY38oJxDmMHmIxholxCxQtnEVTpKn0lp2diPMXU9qbsTuZ9eYTwZabSk
+CXrtjYtaZPkHGDSldWdMdbHw/+81ViMA3CA2f61aqTcIYyAZz8o9b+4IghLLicZ
C84hYbMbCAz0rp6bt+PJ
-----END CERTIFICATE-----

21
app_vue/node_modules/@achrinza/node-ipc/node-ipc.js generated vendored Normal file
View File

@ -0,0 +1,21 @@
'use strict';
const IPC = require('./services/IPC.js');
class IPCModule extends IPC{
constructor(){
super();
//include IPC to make extensible
Object.defineProperty(
this,
'IPC',
{
enumerable:true,
writable:false,
value:IPC
}
)
}
}
module.exports=new IPCModule;

66
app_vue/node_modules/@achrinza/node-ipc/package.json generated vendored Normal file
View File

@ -0,0 +1,66 @@
{
"name": "@achrinza/node-ipc",
"version": "9.2.9",
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",
"main": "node-ipc.js",
"directories": {
"example": "example"
},
"engines": {
"node": "8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22"
},
"dependencies": {
"@node-ipc/js-queue": "2.0.3",
"event-pubsub": "4.3.0",
"js-message": "1.0.7"
},
"devDependencies": {
"istanbul": "0.4.1",
"jasmine": "2.4.1",
"lockfile-lint": "^4.7.4",
"node-cmd": "2.0.0"
},
"scripts": {
"istanbul": "istanbul cover -x ./spec/**",
"test-windows": "npm run-script istanbul -- ./node_modules/jasmine/bin/jasmine.js",
"test": "npm run-script istanbul -- jasmine"
},
"keywords": [
"IPC",
"Neural Networking",
"Machine Learning",
"inter",
"process",
"communication",
"unix",
"windows",
"win",
"socket",
"TCP",
"UDP",
"domain",
"sockets",
"threaded",
"communication",
"multi",
"process",
"shared",
"memory"
],
"author": "Brandon Nozaki Miller",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/achrinza/node-ipc.git"
},
"bugs": {
"url": "https://github.com/achrinza/node-ipc/issues"
},
"files": [
"dao",
"entities",
"local-node-ipc-certs",
"services"
],
"homepage": "https://github.com/achrinza/node-ipc"
}

338
app_vue/node_modules/@achrinza/node-ipc/services/IPC.js generated vendored Normal file
View File

@ -0,0 +1,338 @@
'use strict';
const Defaults = require('../entities/Defaults.js'),
Client = require('../dao/client.js'),
Server = require('../dao/socketServer.js'),
util = require('util');
class IPC{
constructor(){
Object.defineProperties(
this,
{
config : {
enumerable:true,
writable:true,
value:new Defaults
},
connectTo : {
enumerable:true,
writable:false,
value:connect
},
connectToNet: {
enumerable:true,
writable:false,
value:connectNet
},
disconnect : {
enumerable:true,
writable:false,
value:disconnect
},
serve : {
enumerable:true,
writable:false,
value:serve
},
serveNet : {
enumerable:true,
writable:false,
value:serveNet
},
of : {
enumerable:true,
writable:true,
value:{}
},
server : {
enumerable:true,
writable:true,
configurable:true,
value:false
},
log : {
enumerable:true,
writable:false,
value:log
}
}
);
}
}
function log(...args){
if(this.config.silent){
return;
}
for(let i=0, count=args.length; i<count; i++){
if(typeof args[i] != 'object'){
continue;
}
args[i]=util.inspect(
args[i],
{
depth:this.config.logDepth,
colors:this.config.logInColor
}
);
}
this.config.logger(
args.join(' ')
);
}
function disconnect(id){
if(!this.of[id]){
return;
}
this.of[id].explicitlyDisconnected=true;
this.of[id].off('*','*');
if(this.of[id].socket){
if(this.of[id].socket.destroy){
this.of[id].socket.destroy();
}
}
delete this.of[id];
}
function serve(path,callback){
if(typeof path=='function'){
callback=path;
path=false;
}
if(!path){
this.log(
'Server path not specified, so defaulting to',
'ipc.config.socketRoot + ipc.config.appspace + ipc.config.id',
this.config.socketRoot+this.config.appspace+this.config.id
);
path=this.config.socketRoot+this.config.appspace+this.config.id;
}
if(!callback){
callback=emptyCallback;
}
this.server=new Server(
path,
this.config,
log
);
this.server.on(
'start',
callback
);
}
function emptyCallback(){
//Do Nothing
}
function serveNet(host,port,UDPType,callback){
if(typeof host=='number'){
callback=UDPType;
UDPType=port;
port=host;
host=false;
}
if(typeof host=='function'){
callback=host;
UDPType=false;
host=false;
port=false;
}
if(!host){
this.log(
'Server host not specified, so defaulting to',
'ipc.config.networkHost',
this.config.networkHost
);
host=this.config.networkHost;
}
if(host.toLowerCase()=='udp4' || host.toLowerCase()=='udp6'){
callback=port;
UDPType=host.toLowerCase();
port=false;
host=this.config.networkHost;
}
if(typeof port=='string'){
callback=UDPType;
UDPType=port;
port=false;
}
if(typeof port=='function'){
callback=port;
UDPType=false;
port=false;
}
if(!port){
this.log(
'Server port not specified, so defaulting to',
'ipc.config.networkPort',
this.config.networkPort
);
port=this.config.networkPort;
}
if(typeof UDPType=='function'){
callback=UDPType;
UDPType=false;
}
if(!callback){
callback=emptyCallback;
}
this.server=new Server(
host,
this.config,
log,
port
);
if(UDPType){
this.server[UDPType]=true;
if(UDPType === "udp4" && host === "::1") {
// bind udp4 socket to an ipv4 address
this.server.path = "127.0.0.1";
}
}
this.server.on(
'start',
callback
);
}
function connect(id,path,callback){
if(typeof path == 'function'){
callback=path;
path=false;
}
if(!callback){
callback=emptyCallback;
}
if(!id){
this.log(
'Service id required',
'Requested service connection without specifying service id. Aborting connection attempt'
);
return;
}
if(!path){
this.log(
'Service path not specified, so defaulting to',
'ipc.config.socketRoot + ipc.config.appspace + id',
(this.config.socketRoot+this.config.appspace+id).data
);
path=this.config.socketRoot+this.config.appspace+id;
}
if(this.of[id]){
if(!this.of[id].socket.destroyed){
this.log(
'Already Connected to',
id,
'- So executing success without connection'
);
callback();
return;
}
this.of[id].socket.destroy();
}
this.of[id] = new Client(this.config,this.log);
this.of[id].id = id;
this.of[id].path = path;
this.of[id].connect();
callback(this);
}
function connectNet(id,host,port,callback){
if(!id){
this.log(
'Service id required',
'Requested service connection without specifying service id. Aborting connection attempt'
);
return;
}
if(typeof host=='number'){
callback=port;
port=host;
host=false;
}
if(typeof host=='function'){
callback=host;
host=false;
port=false;
}
if(!host){
this.log(
'Server host not specified, so defaulting to',
'ipc.config.networkHost',
this.config.networkHost
);
host=this.config.networkHost;
}
if(typeof port=='function'){
callback=port;
port=false;
}
if(!port){
this.log(
'Server port not specified, so defaulting to',
'ipc.config.networkPort',
this.config.networkPort
);
port=this.config.networkPort;
}
if(typeof callback == 'string'){
UDPType=callback;
callback=false;
}
if(!callback){
callback=emptyCallback;
}
if(this.of[id]){
if(!this.of[id].socket.destroyed){
this.log(
'Already Connected to',
id,
'- So executing success without connection'
);
callback();
return;
}
this.of[id].socket.destroy();
}
this.of[id] = new Client(this.config,this.log);
this.of[id].id = id;
(this.of[id].socket)? this.of[id].socket.id=id:null;
this.of[id].path = host;
this.of[id].port = port;
this.of[id].connect();
callback(this);
}
module.exports=IPC;