|
@@ -35,12 +35,11 @@ initLogger('Debug');
|
|
|
path: '/ws',
|
|
|
})
|
|
|
export class MetaGateway
|
|
|
- implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect
|
|
|
-{
|
|
|
+ implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {
|
|
|
constructor(
|
|
|
private readonly sceneService: SceneService,
|
|
|
private readonly configService: ConfigService,
|
|
|
- ) {}
|
|
|
+ ) { }
|
|
|
private logger: Logger = new Logger('MetaGateway');
|
|
|
private peer: PeerConnection = null;
|
|
|
private timer: NodeJS.Timeout;
|
|
@@ -136,16 +135,14 @@ export class MetaGateway
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (/192.168\./.test(candidate)) {
|
|
|
- if (!/192.168.0\./.test(candidate) || !/192.168.10\./.test(candidate)) {
|
|
|
- this.logger.warn('不是192.168.0./192.168.10测试网段' + candidate);
|
|
|
+ this.logger.warn('是192.168.10测试网段' + candidate);
|
|
|
+ const PRIVATE_IP = this.configService.get('server.private_ip');
|
|
|
+ if (candidate.includes(PRIVATE_IP)) {
|
|
|
+ candidate = replaceToPublic(candidate);
|
|
|
+ } else {
|
|
|
return;
|
|
|
}
|
|
|
- // if (candidate.includes(process.env.PRIVATE_IP)) {
|
|
|
- // console.error('PRIVATE_IP', process.env.PRIVATE_IP);
|
|
|
- // candidate = replaceToPublic(candidate);
|
|
|
- // }
|
|
|
}
|
|
|
this.logger.warn('onLocalCandidate last Candidate:' + candidate);
|
|
|
|
|
@@ -292,7 +289,7 @@ export class MetaGateway
|
|
|
}
|
|
|
},
|
|
|
);
|
|
|
- } catch (error) {}
|
|
|
+ } catch (error) { }
|
|
|
}
|
|
|
|
|
|
handleConnection(client: WebSocket, ...args: any[]) {
|