@mrfakename/multiminer 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @mrfakename/multiminer might be problematic. Click here for more details.

@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "server",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node ./src/index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "body-parser": "^1.19.0",
13
+ "cli-table": "^0.3.9",
14
+ "deepmerge": "^4.2.2",
15
+ "express": "^4.17.1",
16
+ "node-json-db": "^1.4.1",
17
+ "node-os-utils": "^1.3.5",
18
+ "stratum-client": "^1.1.0",
19
+ "winston": "^3.3.3"
20
+ }
21
+ }
@@ -0,0 +1,119 @@
1
+ const path = require('path');
2
+ const express = require('express');
3
+ const bodyParser = require('body-parser');
4
+ const merge = require('deepmerge');
5
+ const Controller = require('./miners.controller');
6
+ const Logger = require('./logger');
7
+
8
+ module.exports = class App {
9
+
10
+ config = {
11
+ productionOnly: false,
12
+ autoStart: true,
13
+ pools: [],
14
+ opencl: {
15
+ enabled: false,
16
+ platform: 'AMD'
17
+ },
18
+ web: {
19
+ enabled: true,
20
+ port: 3000
21
+ },
22
+ log: {
23
+ enabled: true,
24
+ writeToFile: 'xmrlog.txt',
25
+ level: 'debug',
26
+ writeToConsole: true
27
+ }
28
+ };
29
+
30
+ logger = null;
31
+
32
+ _isProduction = (process.env.NODE_ENV || '').toLowerCase().startsWith('prod');
33
+
34
+ _app = null;
35
+
36
+ _controller = null;
37
+
38
+ _initialized = false;
39
+
40
+ get controller() {
41
+ return this._controller;
42
+ }
43
+
44
+ constructor(options) {
45
+
46
+ this.config = merge(this.config, options);
47
+ this.logger = new Logger(this);
48
+
49
+ if (this.config.autoStart) {
50
+ this.start();
51
+ }
52
+ }
53
+
54
+ start() {
55
+ if (!this._initialized) {
56
+ this._init();
57
+ }
58
+
59
+ this._controller.start();
60
+ }
61
+
62
+ stop() {
63
+ this._controller.stop();
64
+ }
65
+
66
+ _init() {
67
+ if (this._initialized) {
68
+ throw new Error('already initialized');
69
+ }
70
+
71
+ if (this.config.wallet) {
72
+ this.logger.error('Depricated eazyminer configuration. Please check https://www.npmjs.com/package/eazyminer for updated config options.');
73
+ this.logger.info('Not starting');
74
+
75
+ return;
76
+ }
77
+
78
+ if (this.config.productionOnly && !this._isProduction) {
79
+ this.logger.info('Eazy Miner config set to productionOnly. Not initializing');
80
+ return;
81
+ }
82
+
83
+ this._controller = new Controller(this);
84
+
85
+ if (this.config.web.enabled) {
86
+ this._setupWebServer();
87
+ }
88
+
89
+ this.controller.loadMiner('xmrig');
90
+
91
+ this._initialized = true;
92
+ }
93
+
94
+ _setupWebServer() {
95
+ this._app = express();
96
+ this._app.use(express.static(path.join(__dirname, '../../public')));
97
+ this._app.use(express.json()); //Used to parse JSON bodies
98
+ this._app.use(bodyParser.urlencoded({ extended: true }));
99
+
100
+ // Public API (status, settings etc)
101
+ this._app.get('/', (req, res) => res.sendFile('index.html'));
102
+
103
+ this._app.get('/status', (req, res) => {
104
+ res.send({
105
+ system: this._controller._system,
106
+ performance: this._controller.status
107
+ });
108
+ });
109
+
110
+ this._app.post('/settings', (req, res) => {
111
+ this._controller.updateSettings(req.body);
112
+ res.sendStatus(200);
113
+ });
114
+
115
+ this._app.listen(this.config.web.port, () => {
116
+ this.logger.info(`Webserver listening on port: ${this.config.web.port}`);
117
+ });
118
+ }
119
+ }
@@ -0,0 +1,3 @@
1
+ const App = require('./app');
2
+
3
+ module.exports = App;
@@ -0,0 +1,58 @@
1
+ const winston = require('winston');
2
+
3
+ module.exports = class Logger {
4
+
5
+ _app = null;
6
+
7
+ _logger = null;
8
+
9
+ constructor(app) {
10
+ this._app = app;
11
+
12
+ this._init();
13
+ }
14
+
15
+ log(value) {
16
+ this._logger.log('debug', value);
17
+ }
18
+
19
+ info(value) {
20
+ this._logger.info(value);
21
+ }
22
+
23
+ warn(value) {
24
+ this._logger.log(value);
25
+ }
26
+
27
+ error(value) {
28
+ this._logger.log('error', value);
29
+ }
30
+
31
+ _init(config) {
32
+ const options = {
33
+ level: 'debug',
34
+ format: winston.format.json(),
35
+ // defaultMeta: { service: 'user-service' },
36
+ transports: [],
37
+ };
38
+
39
+ if (this._app.config.log.writeToFile) {
40
+ options.transports.push(new winston.transports.File({ filename: this._app.config.log.writeToFile }))
41
+ }
42
+
43
+ this._logger = winston.createLogger(options);
44
+
45
+ //
46
+ // If we're not in production then log to the `console` with the format:
47
+ // `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
48
+ //
49
+ if (this._app.config.log.writeToConsole) {
50
+ this._logger.add(new winston.transports.Console({
51
+ format: winston.format.simple(),
52
+ }));
53
+ }
54
+ }
55
+ }
56
+
57
+
58
+
@@ -0,0 +1,423 @@
1
+ {
2
+ "api": {
3
+ "id": null,
4
+ "worker-id": null
5
+ },
6
+ "http": {
7
+ "enabled": false,
8
+ "host": "127.0.0.1",
9
+ "port": 0,
10
+ "access-token": null,
11
+ "restricted": true
12
+ },
13
+ "autosave": true,
14
+ "background": false,
15
+ "colors": true,
16
+ "title": true,
17
+ "randomx": {
18
+ "init": -1,
19
+ "init-avx2": -1,
20
+ "mode": "auto",
21
+ "1gb-pages": false,
22
+ "rdmsr": true,
23
+ "wrmsr": true,
24
+ "cache_qos": false,
25
+ "numa": true,
26
+ "scratchpad_prefetch_mode": 1
27
+ },
28
+ "cpu": {
29
+ "enabled": true,
30
+ "huge-pages": true,
31
+ "huge-pages-jit": false,
32
+ "hw-aes": null,
33
+ "priority": 0,
34
+ "memory-pool": false,
35
+ "yield": true,
36
+ "asm": true,
37
+ "argon2-impl": null,
38
+ "astrobwt-max-size": 550,
39
+ "astrobwt-avx2": false,
40
+ "argon2": [
41
+ 0,
42
+ 1,
43
+ 2,
44
+ 3,
45
+ 4,
46
+ 5,
47
+ 6,
48
+ 7,
49
+ 8,
50
+ 9,
51
+ 10,
52
+ 11
53
+ ],
54
+ "astrobwt": [
55
+ 0,
56
+ 1,
57
+ 2,
58
+ 3,
59
+ 4,
60
+ 5,
61
+ 6,
62
+ 7,
63
+ 8,
64
+ 9,
65
+ 10,
66
+ 11
67
+ ],
68
+ "cn": [
69
+ [
70
+ 1,
71
+ 0
72
+ ],
73
+ [
74
+ 1,
75
+ 1
76
+ ],
77
+ [
78
+ 1,
79
+ 2
80
+ ],
81
+ [
82
+ 1,
83
+ 3
84
+ ],
85
+ [
86
+ 1,
87
+ 4
88
+ ],
89
+ [
90
+ 1,
91
+ 5
92
+ ],
93
+ [
94
+ 1,
95
+ 6
96
+ ],
97
+ [
98
+ 1,
99
+ 7
100
+ ],
101
+ [
102
+ 1,
103
+ 8
104
+ ],
105
+ [
106
+ 1,
107
+ 9
108
+ ],
109
+ [
110
+ 1,
111
+ 10
112
+ ],
113
+ [
114
+ 1,
115
+ 11
116
+ ]
117
+ ],
118
+ "cn-heavy": [
119
+ [
120
+ 1,
121
+ 0
122
+ ],
123
+ [
124
+ 1,
125
+ 2
126
+ ],
127
+ [
128
+ 1,
129
+ 4
130
+ ],
131
+ [
132
+ 1,
133
+ 5
134
+ ],
135
+ [
136
+ 1,
137
+ 6
138
+ ],
139
+ [
140
+ 1,
141
+ 8
142
+ ],
143
+ [
144
+ 1,
145
+ 10
146
+ ],
147
+ [
148
+ 1,
149
+ 11
150
+ ]
151
+ ],
152
+ "cn-lite": [
153
+ [
154
+ 1,
155
+ 0
156
+ ],
157
+ [
158
+ 1,
159
+ 1
160
+ ],
161
+ [
162
+ 1,
163
+ 2
164
+ ],
165
+ [
166
+ 1,
167
+ 3
168
+ ],
169
+ [
170
+ 1,
171
+ 4
172
+ ],
173
+ [
174
+ 1,
175
+ 5
176
+ ],
177
+ [
178
+ 1,
179
+ 6
180
+ ],
181
+ [
182
+ 1,
183
+ 7
184
+ ],
185
+ [
186
+ 1,
187
+ 8
188
+ ],
189
+ [
190
+ 1,
191
+ 9
192
+ ],
193
+ [
194
+ 1,
195
+ 10
196
+ ],
197
+ [
198
+ 1,
199
+ 11
200
+ ]
201
+ ],
202
+ "cn-pico": [
203
+ [
204
+ 2,
205
+ 0
206
+ ],
207
+ [
208
+ 2,
209
+ 1
210
+ ],
211
+ [
212
+ 2,
213
+ 2
214
+ ],
215
+ [
216
+ 2,
217
+ 3
218
+ ],
219
+ [
220
+ 2,
221
+ 4
222
+ ],
223
+ [
224
+ 2,
225
+ 5
226
+ ],
227
+ [
228
+ 2,
229
+ 6
230
+ ],
231
+ [
232
+ 2,
233
+ 7
234
+ ],
235
+ [
236
+ 2,
237
+ 8
238
+ ],
239
+ [
240
+ 2,
241
+ 9
242
+ ],
243
+ [
244
+ 2,
245
+ 10
246
+ ],
247
+ [
248
+ 2,
249
+ 11
250
+ ]
251
+ ],
252
+ "cn/upx2": [
253
+ [
254
+ 2,
255
+ 0
256
+ ],
257
+ [
258
+ 2,
259
+ 1
260
+ ],
261
+ [
262
+ 2,
263
+ 2
264
+ ],
265
+ [
266
+ 2,
267
+ 3
268
+ ],
269
+ [
270
+ 2,
271
+ 4
272
+ ],
273
+ [
274
+ 2,
275
+ 5
276
+ ],
277
+ [
278
+ 2,
279
+ 6
280
+ ],
281
+ [
282
+ 2,
283
+ 7
284
+ ],
285
+ [
286
+ 2,
287
+ 8
288
+ ],
289
+ [
290
+ 2,
291
+ 9
292
+ ],
293
+ [
294
+ 2,
295
+ 10
296
+ ],
297
+ [
298
+ 2,
299
+ 11
300
+ ]
301
+ ],
302
+ "ghostrider": [
303
+ [
304
+ 8,
305
+ 0
306
+ ],
307
+ [
308
+ 8,
309
+ 2
310
+ ],
311
+ [
312
+ 8,
313
+ 4
314
+ ],
315
+ [
316
+ 8,
317
+ 6
318
+ ],
319
+ [
320
+ 8,
321
+ 8
322
+ ],
323
+ [
324
+ 8,
325
+ 10
326
+ ]
327
+ ],
328
+ "rx": [
329
+ 0,
330
+ 1,
331
+ 2,
332
+ 3,
333
+ 4,
334
+ 5,
335
+ 6,
336
+ 7,
337
+ 8,
338
+ 9,
339
+ 10,
340
+ 11
341
+ ],
342
+ "rx/wow": [
343
+ 0,
344
+ 1,
345
+ 2,
346
+ 3,
347
+ 4,
348
+ 5,
349
+ 6,
350
+ 7,
351
+ 8,
352
+ 9,
353
+ 10,
354
+ 11
355
+ ],
356
+ "cn-lite/0": false,
357
+ "cn/0": false,
358
+ "rx/arq": "rx/wow",
359
+ "rx/keva": "rx/wow"
360
+ },
361
+ "opencl": {
362
+ "enabled": false,
363
+ "cache": true,
364
+ "loader": null,
365
+ "platform": "AMD",
366
+ "adl": true,
367
+ "cn-lite/0": false,
368
+ "cn/0": false
369
+ },
370
+ "cuda": {
371
+ "enabled": false,
372
+ "loader": null,
373
+ "nvml": true,
374
+ "cn-lite/0": false,
375
+ "cn/0": false
376
+ },
377
+ "log-file": null,
378
+ "donate-level": 1,
379
+ "donate-over-proxy": 1,
380
+ "pools": [
381
+ {
382
+ "algo": null,
383
+ "coin": "xmr",
384
+ "url": "xmrpool.eu:9999",
385
+ "user": "47D8WQoJKydhTkk26bqZCVF7FaNhzRtNG15u1XiRQ83nfYqogyLjPMnYEKarjAiCz93oV6sETE9kkL3bkbvTX6nMU24CND8",
386
+ "pass": "x",
387
+ "rig-id": null,
388
+ "nicehash": false,
389
+ "enabled": true,
390
+ "keepalive": true,
391
+ "tls": true,
392
+ "tls-fingerprint": null,
393
+ "daemon": false,
394
+ "socks5": null,
395
+ "self-select": null,
396
+ "submit-to-origin": false
397
+ }
398
+ ],
399
+ "retries": 5,
400
+ "retry-pause": 5,
401
+ "print-time": 60,
402
+ "health-print-time": 60,
403
+ "dmi": true,
404
+ "syslog": false,
405
+ "tls": {
406
+ "enabled": false,
407
+ "protocols": null,
408
+ "cert": null,
409
+ "cert_key": null,
410
+ "ciphers": null,
411
+ "ciphersuites": null,
412
+ "dhparam": null
413
+ },
414
+ "dns": {
415
+ "ipv6": false,
416
+ "ttl": 30
417
+ },
418
+ "user-agent": null,
419
+ "verbose": 0,
420
+ "watch": true,
421
+ "pause-on-battery": false,
422
+ "pause-on-active": false
423
+ }
Binary file