fix(typescript): Refactor types and interfaces to use consistent I prefix and update related tests
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import * as plugins from '../../plugins.js';
|
||||
import type {
|
||||
ForwardConfig,
|
||||
IForwardConfig,
|
||||
IForwardingHandler
|
||||
} from '../config/forwarding-types.js';
|
||||
import { ForwardingHandlerEvents } from '../config/forwarding-types.js';
|
||||
@ -13,7 +13,7 @@ export abstract class ForwardingHandler extends plugins.EventEmitter implements
|
||||
* Create a new ForwardingHandler
|
||||
* @param config The forwarding configuration
|
||||
*/
|
||||
constructor(protected config: ForwardConfig) {
|
||||
constructor(protected config: IForwardConfig) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { ForwardingHandler } from './base-handler.js';
|
||||
import type { ForwardConfig } from '../config/forwarding-types.js';
|
||||
import type { IForwardConfig } from '../config/forwarding-types.js';
|
||||
import { ForwardingHandlerEvents } from '../config/forwarding-types.js';
|
||||
|
||||
/**
|
||||
@ -11,14 +11,23 @@ export class HttpForwardingHandler extends ForwardingHandler {
|
||||
* Create a new HTTP forwarding handler
|
||||
* @param config The forwarding configuration
|
||||
*/
|
||||
constructor(config: ForwardConfig) {
|
||||
constructor(config: IForwardConfig) {
|
||||
super(config);
|
||||
|
||||
|
||||
// Validate that this is an HTTP-only configuration
|
||||
if (config.type !== 'http-only') {
|
||||
throw new Error(`Invalid configuration type for HttpForwardingHandler: ${config.type}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the handler
|
||||
* HTTP handler doesn't need special initialization
|
||||
*/
|
||||
public async initialize(): Promise<void> {
|
||||
// Basic initialization from parent class
|
||||
await super.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a raw socket connection
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { ForwardingHandler } from './base-handler.js';
|
||||
import type { ForwardConfig } from '../config/forwarding-types.js';
|
||||
import type { IForwardConfig } from '../config/forwarding-types.js';
|
||||
import { ForwardingHandlerEvents } from '../config/forwarding-types.js';
|
||||
|
||||
/**
|
||||
@ -11,14 +11,23 @@ export class HttpsPassthroughHandler extends ForwardingHandler {
|
||||
* Create a new HTTPS passthrough handler
|
||||
* @param config The forwarding configuration
|
||||
*/
|
||||
constructor(config: ForwardConfig) {
|
||||
constructor(config: IForwardConfig) {
|
||||
super(config);
|
||||
|
||||
|
||||
// Validate that this is an HTTPS passthrough configuration
|
||||
if (config.type !== 'https-passthrough') {
|
||||
throw new Error(`Invalid configuration type for HttpsPassthroughHandler: ${config.type}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the handler
|
||||
* HTTPS passthrough handler doesn't need special initialization
|
||||
*/
|
||||
public async initialize(): Promise<void> {
|
||||
// Basic initialization from parent class
|
||||
await super.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a TLS/SSL socket connection by forwarding it without termination
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { ForwardingHandler } from './base-handler.js';
|
||||
import type { ForwardConfig } from '../config/forwarding-types.js';
|
||||
import type { IForwardConfig } from '../config/forwarding-types.js';
|
||||
import { ForwardingHandlerEvents } from '../config/forwarding-types.js';
|
||||
|
||||
/**
|
||||
@ -14,7 +14,7 @@ export class HttpsTerminateToHttpHandler extends ForwardingHandler {
|
||||
* Create a new HTTPS termination with HTTP backend handler
|
||||
* @param config The forwarding configuration
|
||||
*/
|
||||
constructor(config: ForwardConfig) {
|
||||
constructor(config: IForwardConfig) {
|
||||
super(config);
|
||||
|
||||
// Validate that this is an HTTPS terminate to HTTP configuration
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as plugins from '../../plugins.js';
|
||||
import { ForwardingHandler } from './base-handler.js';
|
||||
import type { ForwardConfig } from '../config/forwarding-types.js';
|
||||
import type { IForwardConfig } from '../config/forwarding-types.js';
|
||||
import { ForwardingHandlerEvents } from '../config/forwarding-types.js';
|
||||
|
||||
/**
|
||||
@ -13,7 +13,7 @@ export class HttpsTerminateToHttpsHandler extends ForwardingHandler {
|
||||
* Create a new HTTPS termination with HTTPS backend handler
|
||||
* @param config The forwarding configuration
|
||||
*/
|
||||
constructor(config: ForwardConfig) {
|
||||
constructor(config: IForwardConfig) {
|
||||
super(config);
|
||||
|
||||
// Validate that this is an HTTPS terminate to HTTPS configuration
|
||||
|
Reference in New Issue
Block a user