Compare commits
No commits in common. "5b87187bc064b4a8c558038e784ef59ee325041f" and "81559342be03b60a427c1f2fde6c4db1cd809714" have entirely different histories.
5b87187bc0
...
81559342be
|
@ -4,7 +4,6 @@ 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;
|
||||
|
@ -34,10 +33,7 @@ class Peer {
|
|||
protocol: this._proxy.protocol,
|
||||
async onopen(m) {
|
||||
if (!m) {
|
||||
m = buffer_1.Buffer.from([]);
|
||||
}
|
||||
if (m instanceof Uint8Array) {
|
||||
m = buffer_1.Buffer.from(m);
|
||||
m = Buffer.from([]);
|
||||
}
|
||||
self._socket = new socket_js_1.default({
|
||||
remoteAddress: self._peer.rawStream.remoteHost,
|
||||
|
@ -59,9 +55,6 @@ 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);
|
||||
},
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
"typescript": "^4.9.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"buffer": "^6.0.3",
|
||||
"compact-encoding": "^2.11.0",
|
||||
"protomux": "^3.4.0",
|
||||
"streamx": "^2.13.0"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Proxy from "./proxy.js";
|
||||
import Socket from "./socket.js";
|
||||
import { Buffer } from "buffer";
|
||||
export type OnOpen = (
|
||||
socket: Socket,
|
||||
data: any
|
||||
|
@ -71,10 +70,6 @@ export default class Peer {
|
|||
if (!m) {
|
||||
m = Buffer.from([]);
|
||||
}
|
||||
|
||||
if (m instanceof Uint8Array) {
|
||||
m = Buffer.from(m);
|
||||
}
|
||||
self._socket = new Socket({
|
||||
remoteAddress: self._peer.rawStream.remoteHost,
|
||||
remotePort: self._peer.rawStream.remotePort,
|
||||
|
@ -86,7 +81,6 @@ export default class Peer {
|
|||
// @ts-ignore
|
||||
self._socket.emit("connect");
|
||||
}
|
||||
|
||||
self._socket.emit("data", m);
|
||||
},
|
||||
async onclose() {
|
||||
|
@ -96,9 +90,6 @@ export default class Peer {
|
|||
});
|
||||
const pipe = channel.addMessage({
|
||||
async onmessage(m: any) {
|
||||
if (m instanceof Uint8Array) {
|
||||
m = Buffer.from(m);
|
||||
}
|
||||
self._socket.emit("data", m);
|
||||
await self._onreceive?.(m);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue