mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
add https and pem files (for anyone to use, fast setup)
This commit is contained in:
+8
-2
@@ -3,6 +3,7 @@ import { NestFactory } from '@nestjs/core';
|
||||
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
||||
import * as bitcoinjs from 'bitcoinjs-lib';
|
||||
import { useContainer } from 'class-validator';
|
||||
import { readFileSync } from 'fs';
|
||||
import * as ecc from 'tiny-secp256k1';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
@@ -14,8 +15,12 @@ async function bootstrap() {
|
||||
return;
|
||||
}
|
||||
|
||||
const httpsOptions = {
|
||||
key: readFileSync('./secrets/key.pem'),
|
||||
cert: readFileSync('./secrets/cert.pem'),
|
||||
};
|
||||
|
||||
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
|
||||
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter({ https: httpsOptions }));
|
||||
app.setGlobalPrefix('api')
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
@@ -28,11 +33,12 @@ async function bootstrap() {
|
||||
app.enableCors();
|
||||
useContainer(app.select(AppModule), { fallbackOnErrors: true });
|
||||
|
||||
|
||||
//Taproot
|
||||
bitcoinjs.initEccLib(ecc);
|
||||
|
||||
await app.listen(process.env.PORT, '0.0.0.0', () => {
|
||||
console.log(`http listening on port ${process.env.PORT}`);
|
||||
console.log(`https listening on port ${process.env.PORT}`);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -436,8 +436,8 @@ export class StratumV1Client extends EasyUnsubscribe {
|
||||
submission.id,
|
||||
eStratumErrorCode.LowDifficultyShare,
|
||||
'Difficulty too low').response();
|
||||
console.error(err);
|
||||
console.log(`Header: ${header.toString('hex')}`);
|
||||
// console.error(err);
|
||||
// console.log(`Header: ${header.toString('hex')}`);
|
||||
try {
|
||||
await this.promiseSocket.write(err);
|
||||
} catch (e) {
|
||||
|
||||
@@ -66,7 +66,7 @@ export class StratumV1Service implements OnModuleInit {
|
||||
|
||||
|
||||
|
||||
console.log(`Client disconnected: ${promiseSocket.socket.remoteAddress}, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||
console.log(`Client disconnected, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||
|
||||
|
||||
});
|
||||
@@ -78,7 +78,7 @@ export class StratumV1Service implements OnModuleInit {
|
||||
await this.clientService.delete(client.extraNonceAndSessionId);
|
||||
|
||||
const clientCount = await this.clientService.connectedClientCount();
|
||||
console.log(`Client disconnected, socket error: ${promiseSocket.socket.remoteAddress}, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||
console.log(`Client disconnected, socket error, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
|
||||
|
||||
console.error(error);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user