fix(core): update
This commit is contained in:
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@serve.zone/remoteingress',
|
||||
version: '1.0.2',
|
||||
description: 'a remoteingress service for serve.zone'
|
||||
}
|
26
ts/connector.private.ts
Normal file
26
ts/connector.private.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import * as tls from 'tls';
|
||||
|
||||
export class ConnectorPrivate {
|
||||
private targetHost: string;
|
||||
private targetPort: number;
|
||||
|
||||
constructor(targetHost: string, targetPort: number) {
|
||||
this.targetHost = targetHost;
|
||||
this.targetPort = targetPort;
|
||||
this.connectToPublicRemoteConnector();
|
||||
}
|
||||
|
||||
private connectToPublicRemoteConnector(): void {
|
||||
const options = {
|
||||
// If your server requires client certificate authentication, you can specify key and cert here as well
|
||||
};
|
||||
|
||||
const tunnel = tls.connect({ port: 4000, ...options }, () => {
|
||||
console.log('Connected to PublicRemoteConnector on port 4000');
|
||||
});
|
||||
|
||||
tunnel.on('data', (data: Buffer) => {
|
||||
// Similar logic for forwarding data to and from the target
|
||||
});
|
||||
}
|
||||
}
|
32
ts/connector.public.ts
Normal file
32
ts/connector.public.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import * as tls from 'tls';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class ConnectorPublic {
|
||||
private tunnel: tls.TLSSocket | null = null;
|
||||
|
||||
constructor() {
|
||||
this.createTunnel();
|
||||
this.listenOnPorts();
|
||||
}
|
||||
|
||||
private createTunnel(): void {
|
||||
const options = {
|
||||
key: fs.readFileSync('path/to/key.pem'),
|
||||
cert: fs.readFileSync('path/to/cert.pem')
|
||||
};
|
||||
|
||||
const server = tls.createServer(options, (socket: tls.TLSSocket) => {
|
||||
this.tunnel = socket;
|
||||
console.log('Tunnel established with LocalConnector');
|
||||
});
|
||||
|
||||
server.listen(4000, () => {
|
||||
console.log('PublicRemoteConnector listening for tunnel on port 4000');
|
||||
});
|
||||
}
|
||||
|
||||
private listenOnPorts(): void {
|
||||
// Implement similar logic for listening on ports 80 and 443
|
||||
// Keep in mind you may need to adjust how you handle secure and non-secure traffic
|
||||
}
|
||||
}
|
3
ts/index.ts
Normal file
3
ts/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import * as plugins from './remoteingress.plugins.js';
|
||||
|
||||
export let demoExport = 'Hi there! :) This is an exported string';
|
4
ts/remoteingress.plugins.ts
Normal file
4
ts/remoteingress.plugins.ts
Normal file
@ -0,0 +1,4 @@
|
||||
const removeme = {};
|
||||
export {
|
||||
removeme
|
||||
}
|
Reference in New Issue
Block a user