BREAKING CHANGE(smartproxy): Remove legacy migration utilities and deprecated forwarding helpers; consolidate route utilities, streamline interface definitions, and normalize IPv6-mapped IPv4 addresses
This commit is contained in:
@ -21,9 +21,21 @@ export function convertToLegacyForwardConfig(
|
||||
? forwardConfig.target.host[0] // Use the first host in the array
|
||||
: forwardConfig.target.host;
|
||||
|
||||
// Extract port number, handling different port formats
|
||||
let port: number;
|
||||
if (typeof forwardConfig.target.port === 'function') {
|
||||
// Use a default port for function-based ports in adapter context
|
||||
port = 80;
|
||||
} else if (forwardConfig.target.port === 'preserve') {
|
||||
// For 'preserve', use the default port 80 in this adapter context
|
||||
port = 80;
|
||||
} else {
|
||||
port = forwardConfig.target.port;
|
||||
}
|
||||
|
||||
return {
|
||||
ip: host,
|
||||
port: forwardConfig.target.port
|
||||
port: port
|
||||
};
|
||||
}
|
||||
|
||||
@ -75,11 +87,23 @@ export function createPort80HandlerOptions(
|
||||
forwardConfig.type === 'https-terminate-to-https'));
|
||||
|
||||
if (supportsHttp) {
|
||||
// Determine port value handling different formats
|
||||
let port: number;
|
||||
if (typeof forwardConfig.target.port === 'function') {
|
||||
// Use a default port for function-based ports
|
||||
port = 80;
|
||||
} else if (forwardConfig.target.port === 'preserve') {
|
||||
// For 'preserve', use 80 in this adapter context
|
||||
port = 80;
|
||||
} else {
|
||||
port = forwardConfig.target.port;
|
||||
}
|
||||
|
||||
options.forward = {
|
||||
ip: Array.isArray(forwardConfig.target.host)
|
||||
? forwardConfig.target.host[0]
|
||||
: forwardConfig.target.host,
|
||||
port: forwardConfig.target.port
|
||||
port: port
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user