feat(IPTablesProxy): Introduce IPTablesProxy class for managing iptables NAT rules

This commit is contained in:
2025-02-24 23:27:48 +00:00
parent 63ebad06ea
commit ff4f44d6fc
5 changed files with 100 additions and 4 deletions

View File

@ -6,7 +6,7 @@ export interface IDomainConfig {
targetIP?: string; // Optional target IP for this domain
}
export interface IProxySettings extends plugins.tls.TlsOptions {
export interface IPortProxySettings extends plugins.tls.TlsOptions {
fromPort: number;
toPort: number;
toHost?: string; // Target host to proxy to, defaults to 'localhost'
@ -89,7 +89,7 @@ interface IConnectionRecord {
export class PortProxy {
netServer: plugins.net.Server;
settings: IProxySettings;
settings: IPortProxySettings;
// Unified record tracking each connection pair.
private connectionRecords: Set<IConnectionRecord> = new Set();
private connectionLogger: NodeJS.Timeout | null = null;
@ -102,7 +102,7 @@ export class PortProxy {
outgoing: {},
};
constructor(settings: IProxySettings) {
constructor(settings: IPortProxySettings) {
this.settings = {
...settings,
toHost: settings.toHost || 'localhost',