*Update dist

This commit is contained in:
Derrick Hammer 2023-02-06 05:51:41 -05:00
parent b4b30cbdea
commit 5b87187bc0
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 1 deletions

9
dist/peer.js vendored
View File

@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const socket_js_1 = __importDefault(require("./socket.js"));
const buffer_1 = require("buffer");
class Peer {
_proxy;
_peer;
@ -33,7 +34,10 @@ class Peer {
protocol: this._proxy.protocol,
async onopen(m) {
if (!m) {
m = Buffer.from([]);
m = buffer_1.Buffer.from([]);
}
if (m instanceof Uint8Array) {
m = buffer_1.Buffer.from(m);
}
self._socket = new socket_js_1.default({
remoteAddress: self._peer.rawStream.remoteHost,
@ -55,6 +59,9 @@ class Peer {
});
const pipe = channel.addMessage({
async onmessage(m) {
if (m instanceof Uint8Array) {
m = buffer_1.Buffer.from(m);
}
self._socket.emit("data", m);
await self._onreceive?.(m);
},