fix: Make SmartProxy work with pure route-based configuration
This commit is contained in:
parent
18f03c1acf
commit
8dd222443d
@ -301,22 +301,28 @@ export class RouteConnectionHandler {
|
|||||||
// Setup direct connection with default settings
|
// Setup direct connection with default settings
|
||||||
let targetHost: string;
|
let targetHost: string;
|
||||||
let targetPort: number;
|
let targetPort: number;
|
||||||
|
|
||||||
if (isRoutedOptions(this.settings) && this.settings.defaults?.target) {
|
if (isRoutedOptions(this.settings) && this.settings.defaults?.target) {
|
||||||
// Use defaults from routed configuration
|
// Use defaults from routed configuration
|
||||||
targetHost = this.settings.defaults.target.host;
|
targetHost = this.settings.defaults.target.host;
|
||||||
targetPort = this.settings.defaults.target.port;
|
targetPort = this.settings.defaults.target.port;
|
||||||
} else {
|
} else if (this.settings.targetIP && this.settings.toPort) {
|
||||||
// Fall back to legacy settings
|
// Fall back to legacy settings
|
||||||
targetHost = this.settings.targetIP || 'localhost';
|
targetHost = this.settings.targetIP;
|
||||||
targetPort = this.settings.toPort;
|
targetPort = this.settings.toPort;
|
||||||
|
} else {
|
||||||
|
// No default target available, terminate the connection
|
||||||
|
console.log(`[${connectionId}] No default target configured. Closing connection.`);
|
||||||
|
socket.end();
|
||||||
|
this.connectionManager.cleanupConnection(record, 'no_default_target');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.setupDirectConnection(
|
return this.setupDirectConnection(
|
||||||
socket,
|
socket,
|
||||||
record,
|
record,
|
||||||
undefined,
|
undefined,
|
||||||
serverName,
|
serverName,
|
||||||
initialChunk,
|
initialChunk,
|
||||||
undefined,
|
undefined,
|
||||||
targetHost,
|
targetHost,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user