BREAKING CHANGE(forwarding): Refactor unified forwarding API and remove redundant documentation. Removed docs/forwarding-system.md (its content is migrated into readme.md) and updated helper functions (e.g. replacing sniPassthrough with httpsPassthrough) to accept configuration objects. Legacy fields in domain configurations (allowedIPs, blockedIPs, useNetworkProxy, networkProxyPort, connectionTimeout) have been removed in favor of forwarding.security and advanced options. Tests and examples have been updated accordingly.
This commit is contained in:
@ -1,26 +1,26 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
import type {
|
||||
IForwardConfig as ILegacyForwardConfig,
|
||||
IDomainOptions
|
||||
import type {
|
||||
IForwardConfig as ILegacyForwardConfig,
|
||||
IDomainOptions
|
||||
} from './types.js';
|
||||
|
||||
import type {
|
||||
IForwardConfig as INewForwardConfig
|
||||
import type {
|
||||
IForwardConfig
|
||||
} from '../smartproxy/types/forwarding.types.js';
|
||||
|
||||
/**
|
||||
* Converts a new forwarding configuration target to the legacy format
|
||||
* Converts a forwarding configuration target to the legacy format
|
||||
* for Port80Handler
|
||||
*/
|
||||
export function convertToLegacyForwardConfig(
|
||||
forwardConfig: INewForwardConfig
|
||||
forwardConfig: IForwardConfig
|
||||
): ILegacyForwardConfig {
|
||||
// Determine host from the target configuration
|
||||
const host = Array.isArray(forwardConfig.target.host)
|
||||
? forwardConfig.target.host[0] // Use the first host in the array
|
||||
: forwardConfig.target.host;
|
||||
|
||||
|
||||
return {
|
||||
ip: host,
|
||||
port: forwardConfig.target.port
|
||||
@ -32,7 +32,7 @@ export function convertToLegacyForwardConfig(
|
||||
*/
|
||||
export function createPort80HandlerOptions(
|
||||
domain: string,
|
||||
forwardConfig: INewForwardConfig
|
||||
forwardConfig: IForwardConfig
|
||||
): IDomainOptions {
|
||||
// Determine if we should redirect HTTP to HTTPS
|
||||
let sslRedirect = false;
|
||||
|
Reference in New Issue
Block a user