From 67d62077592c04a901e7b3071257b075fed8cf41 Mon Sep 17 00:00:00 2001 From: RonaldZielaznicki <58531251+RonaldZielaznicki@users.noreply.github.com> Date: Tue, 28 Jul 2020 14:29:05 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#46298=20Bittorrent?= =?UTF-8?q?=20protocol=20add=20dynamic=20property=20key=20for=20extensions?= =?UTF-8?q?=20by=20@RonaldZielaznicki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add dynamic property to Wire Interface * Attempt to access wire extensions name to test that extension can be accessed. --- types/bittorrent-protocol/bittorrent-protocol-tests.ts | 3 +++ types/bittorrent-protocol/index.d.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/types/bittorrent-protocol/bittorrent-protocol-tests.ts b/types/bittorrent-protocol/bittorrent-protocol-tests.ts index 2be291b9ff..6f5d4acc43 100644 --- a/types/bittorrent-protocol/bittorrent-protocol-tests.ts +++ b/types/bittorrent-protocol/bittorrent-protocol-tests.ts @@ -27,4 +27,7 @@ net.createServer(socket => { // Extend wire using the test extension wire.extended('extname', {}); + + // Confirm extension has been added to Wire instance. + console.log(wire.extname.name); }).listen(6881); diff --git a/types/bittorrent-protocol/index.d.ts b/types/bittorrent-protocol/index.d.ts index 79bdcfeae0..a345fd4a01 100644 --- a/types/bittorrent-protocol/index.d.ts +++ b/types/bittorrent-protocol/index.d.ts @@ -56,6 +56,8 @@ declare namespace BittorrentProtocol { use(ext: ExtensionConstructor): void; + [key: string]: any; + handshake(infoHash: string | Buffer, peerId: string | Buffer, extensions?: any): void; choke(): void;