Compare commits

..

2 Commits

2 changed files with 16 additions and 16 deletions

View File

@ -108,7 +108,7 @@ class MultiSocketProxy extends proxy_js_1.default {
item[1].end(); item[1].end();
} }
} }
const pubkey = this._toString(peer.socket.remotePublicKey); const pubkey = this._toString(peer.stream.remotePublicKey);
if (this._peers.has(pubkey)) { if (this._peers.has(pubkey)) {
this._peers.delete(pubkey); this._peers.delete(pubkey);
} }
@ -153,7 +153,7 @@ class MultiSocketProxy extends proxy_js_1.default {
async onmessage(m) { async onmessage(m) {
if (self._allowedPorts.length && if (self._allowedPorts.length &&
!self._allowedPorts.includes(m.port)) { !self._allowedPorts.includes(m.port)) {
self.get(peer.socket.remotePublicKey).messages.errorSocket.send({ self.get(peer.stream.remotePublicKey).messages.errorSocket.send({
id: m.id, id: m.id,
err: new Error(`port ${m.port} not allowed`), err: new Error(`port ${m.port} not allowed`),
}); });
@ -161,7 +161,7 @@ class MultiSocketProxy extends proxy_js_1.default {
} }
m = m; m = m;
if (self._server) { if (self._server) {
new self.socketClass(nextSocketId(), m, self, self.get(peer.socket.remotePublicKey), m).connect(); new self.socketClass(nextSocketId(), m, self, self.get(peer.stream.remotePublicKey), m).connect();
return; return;
} }
const socket = self._sockets.get(m.id); const socket = self._sockets.get(m.id);
@ -172,7 +172,7 @@ class MultiSocketProxy extends proxy_js_1.default {
} }
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { openSocket: message }, messages: { openSocket: message },
}); });
} }
@ -184,7 +184,7 @@ class MultiSocketProxy extends proxy_js_1.default {
self._sockets.get(m.id)?.push(m.data); self._sockets.get(m.id)?.push(m.data);
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { writeSocket: message }, messages: { writeSocket: message },
}); });
} }
@ -196,7 +196,7 @@ class MultiSocketProxy extends proxy_js_1.default {
self._sockets.get(m.id)?.end(); self._sockets.get(m.id)?.end();
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { closeSocket: message }, messages: { closeSocket: message },
}); });
} }
@ -209,7 +209,7 @@ class MultiSocketProxy extends proxy_js_1.default {
self._sockets.get(m.id)?.emit("timeout"); self._sockets.get(m.id)?.emit("timeout");
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { timeoutSocket: message }, messages: { timeoutSocket: message },
}); });
} }
@ -222,7 +222,7 @@ class MultiSocketProxy extends proxy_js_1.default {
self._sockets.get(m.id)?.emit("error", m.err); self._sockets.get(m.id)?.emit("error", m.err);
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { errorSocket: message }, messages: { errorSocket: message },
}); });
} }

View File

@ -130,7 +130,7 @@ export default class MultiSocketProxy extends Proxy {
} }
} }
const pubkey = this._toString(peer.socket.remotePublicKey); const pubkey = this._toString(peer.stream.remotePublicKey);
if (this._peers.has(pubkey)) { if (this._peers.has(pubkey)) {
this._peers.delete(pubkey); this._peers.delete(pubkey);
@ -188,7 +188,7 @@ export default class MultiSocketProxy extends Proxy {
self._allowedPorts.length && self._allowedPorts.length &&
!self._allowedPorts.includes((m as TcpSocketConnectOpts).port) !self._allowedPorts.includes((m as TcpSocketConnectOpts).port)
) { ) {
self.get(peer.socket.remotePublicKey).messages.errorSocket.send({ self.get(peer.stream.remotePublicKey).messages.errorSocket.send({
id: (m as SocketRequest).id, id: (m as SocketRequest).id,
err: new Error( err: new Error(
`port ${(m as TcpSocketConnectOpts).port} not allowed` `port ${(m as TcpSocketConnectOpts).port} not allowed`
@ -204,7 +204,7 @@ export default class MultiSocketProxy extends Proxy {
nextSocketId(), nextSocketId(),
m, m,
self, self,
self.get(peer.socket.remotePublicKey) as PeerEntity, self.get(peer.stream.remotePublicKey) as PeerEntity,
m m
).connect(); ).connect();
return; return;
@ -218,7 +218,7 @@ export default class MultiSocketProxy extends Proxy {
} }
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { openSocket: message }, messages: { openSocket: message },
}); });
} }
@ -231,7 +231,7 @@ export default class MultiSocketProxy extends Proxy {
self._sockets.get(m.id)?.push(m.data); self._sockets.get(m.id)?.push(m.data);
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { writeSocket: message }, messages: { writeSocket: message },
}); });
} }
@ -244,7 +244,7 @@ export default class MultiSocketProxy extends Proxy {
self._sockets.get(m.id)?.end(); self._sockets.get(m.id)?.end();
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { closeSocket: message }, messages: { closeSocket: message },
}); });
} }
@ -258,7 +258,7 @@ export default class MultiSocketProxy extends Proxy {
self._sockets.get(m.id)?.emit("timeout"); self._sockets.get(m.id)?.emit("timeout");
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { timeoutSocket: message }, messages: { timeoutSocket: message },
}); });
} }
@ -272,7 +272,7 @@ export default class MultiSocketProxy extends Proxy {
self._sockets.get(m.id)?.emit("error", m.err); self._sockets.get(m.id)?.emit("error", m.err);
}, },
}); });
this.update(peer.socket.remotePublicKey, { this.update(peer.stream.remotePublicKey, {
messages: { errorSocket: message }, messages: { errorSocket: message },
}); });
} }