mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
29 lines
730 B
TypeScript
29 lines
730 B
TypeScript
import { Injectable, OnModuleInit } from '@nestjs/common';
|
|
import { Server, Socket } from 'net';
|
|
|
|
import { ProxyClient } from '../models/ProxyClient';
|
|
|
|
@Injectable()
|
|
export class ProxyService implements OnModuleInit {
|
|
|
|
constructor() {
|
|
|
|
}
|
|
|
|
async onModuleInit(): Promise<void> {
|
|
if (process.env.ENABLE_PROXY == 'true') {
|
|
console.log('Connecting to braiins');
|
|
|
|
|
|
const proxyServer = new Server(async (socket: Socket) => {
|
|
const proxyClient = new ProxyClient(socket);
|
|
});
|
|
|
|
proxyServer.listen(process.env.PROXY_PORT, () => {
|
|
console.log(`Proxy server is listening on port ${process.env.PROXY_PORT}`);
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
} |