fix(PortProxy): Fix TypeScript errors by using correct variable names
Fixed TypeScript errors caused by using 'connectionRecord' instead of 'record' in TLS renegotiation handlers. The variable name mistake occurred when moving and restructuring the TLS handshake detection code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ef8f583a90
commit
7850a80452
@ -768,12 +768,12 @@ export class PortProxy {
|
||||
}
|
||||
|
||||
// Set up the renegotiation listener *before* piping if this is a TLS connection with SNI
|
||||
if (serverName && connectionRecord.isTLS) {
|
||||
if (serverName && record.isTLS) {
|
||||
// This listener handles TLS renegotiation detection
|
||||
socket.on('data', (renegChunk) => {
|
||||
if (renegChunk.length > 0 && renegChunk.readUInt8(0) === 22) {
|
||||
// Always update activity timestamp for any handshake packet
|
||||
this.updateActivity(connectionRecord);
|
||||
this.updateActivity(record);
|
||||
|
||||
try {
|
||||
// Try to extract SNI from potential renegotiation
|
||||
@ -792,8 +792,8 @@ export class PortProxy {
|
||||
// Allow if the new SNI matches existing domain config or find a new matching config
|
||||
let allowed = false;
|
||||
|
||||
if (connectionRecord.domainConfig) {
|
||||
allowed = connectionRecord.domainConfig.domains.some(d => plugins.minimatch(newSNI, d));
|
||||
if (record.domainConfig) {
|
||||
allowed = record.domainConfig.domains.some(d => plugins.minimatch(newSNI, d));
|
||||
}
|
||||
|
||||
if (!allowed) {
|
||||
@ -811,20 +811,20 @@ export class PortProxy {
|
||||
...(this.settings.defaultBlockedIPs || []),
|
||||
];
|
||||
|
||||
allowed = isGlobIPAllowed(connectionRecord.remoteIP, effectiveAllowedIPs, effectiveBlockedIPs);
|
||||
allowed = isGlobIPAllowed(record.remoteIP, effectiveAllowedIPs, effectiveBlockedIPs);
|
||||
|
||||
if (allowed) {
|
||||
connectionRecord.domainConfig = newDomainConfig;
|
||||
record.domainConfig = newDomainConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allowed) {
|
||||
console.log(`[${connectionId}] Updated domain for connection from ${connectionRecord.remoteIP} to: ${newSNI}`);
|
||||
connectionRecord.lockedDomain = newSNI;
|
||||
console.log(`[${connectionId}] Updated domain for connection from ${record.remoteIP} to: ${newSNI}`);
|
||||
record.lockedDomain = newSNI;
|
||||
} else {
|
||||
console.log(`[${connectionId}] Rehandshake SNI ${newSNI} not allowed. Terminating connection.`);
|
||||
this.initiateCleanupOnce(connectionRecord, 'sni_mismatch');
|
||||
this.initiateCleanupOnce(record, 'sni_mismatch');
|
||||
}
|
||||
} else {
|
||||
console.log(`[${connectionId}] Rehandshake with same SNI: ${newSNI}`);
|
||||
@ -870,12 +870,12 @@ export class PortProxy {
|
||||
});
|
||||
} else {
|
||||
// Set up the renegotiation listener *before* piping if this is a TLS connection with SNI
|
||||
if (serverName && connectionRecord.isTLS) {
|
||||
if (serverName && record.isTLS) {
|
||||
// This listener handles TLS renegotiation detection
|
||||
socket.on('data', (renegChunk) => {
|
||||
if (renegChunk.length > 0 && renegChunk.readUInt8(0) === 22) {
|
||||
// Always update activity timestamp for any handshake packet
|
||||
this.updateActivity(connectionRecord);
|
||||
this.updateActivity(record);
|
||||
|
||||
try {
|
||||
// Try to extract SNI from potential renegotiation
|
||||
@ -894,8 +894,8 @@ export class PortProxy {
|
||||
// Allow if the new SNI matches existing domain config or find a new matching config
|
||||
let allowed = false;
|
||||
|
||||
if (connectionRecord.domainConfig) {
|
||||
allowed = connectionRecord.domainConfig.domains.some(d => plugins.minimatch(newSNI, d));
|
||||
if (record.domainConfig) {
|
||||
allowed = record.domainConfig.domains.some(d => plugins.minimatch(newSNI, d));
|
||||
}
|
||||
|
||||
if (!allowed) {
|
||||
@ -913,20 +913,20 @@ export class PortProxy {
|
||||
...(this.settings.defaultBlockedIPs || []),
|
||||
];
|
||||
|
||||
allowed = isGlobIPAllowed(connectionRecord.remoteIP, effectiveAllowedIPs, effectiveBlockedIPs);
|
||||
allowed = isGlobIPAllowed(record.remoteIP, effectiveAllowedIPs, effectiveBlockedIPs);
|
||||
|
||||
if (allowed) {
|
||||
connectionRecord.domainConfig = newDomainConfig;
|
||||
record.domainConfig = newDomainConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allowed) {
|
||||
console.log(`[${connectionId}] Updated domain for connection from ${connectionRecord.remoteIP} to: ${newSNI}`);
|
||||
connectionRecord.lockedDomain = newSNI;
|
||||
console.log(`[${connectionId}] Updated domain for connection from ${record.remoteIP} to: ${newSNI}`);
|
||||
record.lockedDomain = newSNI;
|
||||
} else {
|
||||
console.log(`[${connectionId}] Rehandshake SNI ${newSNI} not allowed. Terminating connection.`);
|
||||
this.initiateCleanupOnce(connectionRecord, 'sni_mismatch');
|
||||
this.initiateCleanupOnce(record, 'sni_mismatch');
|
||||
}
|
||||
} else {
|
||||
console.log(`[${connectionId}] Rehandshake with same SNI: ${newSNI}`);
|
||||
|
Loading…
x
Reference in New Issue
Block a user