From c72f45393ca99d9125a57cf22605933f36c3ddb3 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 15 Nov 2022 15:53:25 -0500 Subject: [PATCH] *Update dist --- dist/index.d.ts | 1 + dist/index.d.ts.map | 2 +- dist/index.js | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 9bd142a..2477f02 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -17,5 +17,6 @@ export default class DHTFlood extends EventEmitter { private handleMessage; private setupPeer; broadcast(data: any, ttl?: number): void; + send(peer: any, data: any, ttl?: number): void; } //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index c2a27e7..69d447e 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoBlC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAChD,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,KAAK,CAAM;gBAEP,EACV,OAAkB,EAClB,GAAS,EACT,aAAiB,EACjB,EAA2B,EAC3B,KAAY,GACb;;;;;;KAAK;IAkBN,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,SAAS;IA6CjB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;CAcpC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAoBlC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,YAAY;IAChD,OAAO,CAAC,EAAE,CAAS;IACnB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,KAAK,CAAM;gBAEP,EACV,OAAkB,EAClB,GAAS,EACT,aAAiB,EACjB,EAA2B,EAC3B,KAAY,GACb;;;;;;KAAK;IAkBN,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,SAAS;IA6CjB,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;IAenC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,SAAW;CAY1C"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index b92b525..f95eb4a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -108,5 +108,16 @@ class DHTFlood extends events_1.default { }); } } + send(peer, data, ttl = this.ttl) { + this.messageNumber++; + const { id, messageNumber } = this; + const message = this.setupPeer(peer); + message.send({ + originId: id, + messageNumber, + ttl, + data: b4a_1.default.from(data), + }); + } } exports.default = DHTFlood;