update TLS servername for frame stream
This commit is contained in:
parent
7f2f14ec4d
commit
a14c260bb4
2 changed files with 4 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ const { bblCA } = require('./certificates');
|
|||
class FrameStream extends EventEmitter {
|
||||
#remoteSocket;
|
||||
|
||||
constructor(host, code) {
|
||||
constructor(host, code, serial) {
|
||||
super();
|
||||
|
||||
const abuf = new ArrayBuffer(80);
|
||||
|
|
@ -25,12 +25,11 @@ class FrameStream extends EventEmitter {
|
|||
new Uint8Array(abuf, 0x30, codeBytes.length).set(codeBytes);
|
||||
|
||||
let frame;
|
||||
|
||||
const remoteSocket = this.#remoteSocket = tls.connect({
|
||||
host,
|
||||
port: 6000,
|
||||
ca: bblCA,
|
||||
checkServerIdentity: () => {} // TODO: use `servername: serial` instead
|
||||
servername: serial
|
||||
}, () => {
|
||||
// send authentication to start jpeg frame stream
|
||||
remoteSocket.write(Buffer.from(abuf));
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ module.exports = async (server) => {
|
|||
this.#frames.end();
|
||||
this.#frames = undefined;
|
||||
} else if (!this.#frames && bool) {
|
||||
this.#frames = new FrameStream(this.#options.host, this.#options.password)
|
||||
let { host, password } = this.#options;
|
||||
this.#frames = new FrameStream(host, password, this.#serial)
|
||||
.on("frame", jpg => {
|
||||
wsend({ serial: this.#serial, frame: jpg.toString('base64') });
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue