@libp2p/kad-dht 13.1.2 → 14.0.0-0d326d102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +2 -2
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +3 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +28 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/kad-dht.d.ts.map +1 -1
- package/dist/src/kad-dht.js +25 -11
- package/dist/src/kad-dht.js.map +1 -1
- package/dist/src/network.d.ts +1 -1
- package/dist/src/network.d.ts.map +1 -1
- package/dist/src/network.js +1 -3
- package/dist/src/network.js.map +1 -1
- package/dist/src/peer-distance-list.d.ts.map +1 -0
- package/dist/src/{peer-list/peer-distance-list.js → peer-distance-list.js} +1 -1
- package/dist/src/peer-distance-list.js.map +1 -0
- package/dist/src/peer-routing/index.js +1 -1
- package/dist/src/peer-routing/index.js.map +1 -1
- package/dist/src/query-self.d.ts.map +1 -1
- package/dist/src/query-self.js +13 -6
- package/dist/src/query-self.js.map +1 -1
- package/dist/src/routing-table/closest-peers.d.ts +43 -0
- package/dist/src/routing-table/closest-peers.d.ts.map +1 -0
- package/dist/src/routing-table/closest-peers.js +86 -0
- package/dist/src/routing-table/closest-peers.js.map +1 -0
- package/dist/src/routing-table/index.d.ts +55 -32
- package/dist/src/routing-table/index.d.ts.map +1 -1
- package/dist/src/routing-table/index.js +259 -161
- package/dist/src/routing-table/index.js.map +1 -1
- package/dist/src/routing-table/k-bucket.d.ts +65 -21
- package/dist/src/routing-table/k-bucket.d.ts.map +1 -1
- package/dist/src/routing-table/k-bucket.js +122 -66
- package/dist/src/routing-table/k-bucket.js.map +1 -1
- package/dist/src/routing-table/refresh.d.ts.map +1 -1
- package/dist/src/routing-table/refresh.js +4 -1
- package/dist/src/routing-table/refresh.js.map +1 -1
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/rpc/index.js +3 -7
- package/dist/src/rpc/index.js.map +1 -1
- package/package.json +11 -12
- package/src/constants.ts +5 -0
- package/src/index.ts +32 -6
- package/src/kad-dht.ts +29 -13
- package/src/network.ts +1 -4
- package/src/{peer-list/peer-distance-list.ts → peer-distance-list.ts} +1 -1
- package/src/peer-routing/index.ts +1 -1
- package/src/query-self.ts +14 -6
- package/src/routing-table/closest-peers.ts +113 -0
- package/src/routing-table/index.ts +300 -194
- package/src/routing-table/k-bucket.ts +194 -81
- package/src/routing-table/refresh.ts +5 -1
- package/src/rpc/index.ts +4 -7
- package/dist/src/peer-list/index.d.ts +0 -29
- package/dist/src/peer-list/index.d.ts.map +0 -1
- package/dist/src/peer-list/index.js +0 -45
- package/dist/src/peer-list/index.js.map +0 -1
- package/dist/src/peer-list/peer-distance-list.d.ts.map +0 -1
- package/dist/src/peer-list/peer-distance-list.js.map +0 -1
- package/dist/typedoc-urls.json +0 -56
- package/src/peer-list/index.ts +0 -54
- /package/dist/src/{peer-list/peer-distance-list.d.ts → peer-distance-list.d.ts} +0 -0
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PeerMap } from '@libp2p/peer-collections'
|
|
2
2
|
import map from 'it-map'
|
|
3
|
+
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
3
4
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
4
5
|
import { xor as uint8ArrayXor } from 'uint8arrays/xor'
|
|
5
|
-
import { PeerDistanceList } from '../peer-
|
|
6
|
-
import {
|
|
6
|
+
import { PeerDistanceList } from '../peer-distance-list.js'
|
|
7
|
+
import { convertPeerId } from '../utils.js'
|
|
8
|
+
import { KBUCKET_SIZE, LAST_PING_THRESHOLD, PING_OLD_CONTACT_COUNT, PREFIX_LENGTH } from './index.js'
|
|
7
9
|
import type { PeerId } from '@libp2p/interface'
|
|
10
|
+
import type { AbortOptions } from 'it-protobuf-stream'
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
for (let i = 0, length = array1.length; i < length; ++i) {
|
|
17
|
-
if (array1[i] !== array2[i]) {
|
|
18
|
-
return false
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return true
|
|
12
|
+
export interface PingFunction {
|
|
13
|
+
/**
|
|
14
|
+
* Return either none or at least one contact that does not respond to a ping
|
|
15
|
+
* message
|
|
16
|
+
*/
|
|
17
|
+
(oldContacts: Peer[], options?: AbortOptions): AsyncGenerator<Peer>
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Before a peer can be added to the table, verify that it is online and working
|
|
22
|
+
* correctly
|
|
23
|
+
*/
|
|
24
|
+
export interface VerifyFunction {
|
|
25
|
+
(contact: Peer, options?: AbortOptions): Promise<boolean>
|
|
26
|
+
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
export interface OnAddCallback {
|
|
29
|
+
/**
|
|
30
|
+
* Invoked when a new peer is added to the routing tables
|
|
31
|
+
*/
|
|
32
|
+
(peer: Peer, bucket: LeafBucket): Promise<void>
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export interface
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
export interface OnRemoveCallback {
|
|
36
|
+
/**
|
|
37
|
+
* Invoked when a peer is evicted from the routing tables
|
|
38
|
+
*/
|
|
39
|
+
(peer: Peer, bucket: LeafBucket): Promise<void>
|
|
37
40
|
}
|
|
38
41
|
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
export interface OnMoveCallback {
|
|
43
|
+
/**
|
|
44
|
+
* Invoked when a peer is moved between buckets in the routing tables
|
|
45
|
+
*/
|
|
46
|
+
(peer: Peer, oldBucket: LeafBucket, newBucket: LeafBucket): Promise<void>
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
export interface KBucketOptions {
|
|
@@ -47,14 +51,16 @@ export interface KBucketOptions {
|
|
|
47
51
|
* The current peer. All subsequently added peers must have a KadID that is
|
|
48
52
|
* the same length as this peer.
|
|
49
53
|
*/
|
|
50
|
-
localPeer: Peer
|
|
54
|
+
// localPeer: Peer
|
|
51
55
|
|
|
52
56
|
/**
|
|
53
57
|
* How many bits of the key to use when forming the bucket trie. The larger
|
|
54
58
|
* this value, the deeper the tree will grow and the slower the lookups will
|
|
55
59
|
* be but the peers returned will be more specific to the key.
|
|
60
|
+
*
|
|
61
|
+
* @default 8
|
|
56
62
|
*/
|
|
57
|
-
prefixLength
|
|
63
|
+
prefixLength?: number
|
|
58
64
|
|
|
59
65
|
/**
|
|
60
66
|
* The number of nodes that a max-depth k-bucket can contain before being
|
|
@@ -74,15 +80,30 @@ export interface KBucketOptions {
|
|
|
74
80
|
|
|
75
81
|
/**
|
|
76
82
|
* The number of nodes to ping when a bucket that should not be split becomes
|
|
77
|
-
* full. KBucket will emit a `ping` event that contains
|
|
78
|
-
* nodes that have not been contacted the longest.
|
|
83
|
+
* full. KBucket will emit a `ping` event that contains
|
|
84
|
+
* `numberOfOldContactsToPing` nodes that have not been contacted the longest.
|
|
85
|
+
*
|
|
86
|
+
* @default 3
|
|
79
87
|
*/
|
|
80
|
-
|
|
88
|
+
numberOfOldContactsToPing?: number
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Do not re-ping a peer during this time window in ms
|
|
92
|
+
*
|
|
93
|
+
* @default 600000
|
|
94
|
+
*/
|
|
95
|
+
lastPingThreshold?: number
|
|
96
|
+
|
|
97
|
+
ping: PingFunction
|
|
98
|
+
verify: VerifyFunction
|
|
99
|
+
onAdd?: OnAddCallback
|
|
100
|
+
onRemove?: OnRemoveCallback
|
|
81
101
|
}
|
|
82
102
|
|
|
83
103
|
export interface Peer {
|
|
84
104
|
kadId: Uint8Array
|
|
85
105
|
peerId: PeerId
|
|
106
|
+
lastPing: number
|
|
86
107
|
}
|
|
87
108
|
|
|
88
109
|
export interface LeafBucket {
|
|
@@ -108,24 +129,32 @@ export function isLeafBucket (obj: any): obj is LeafBucket {
|
|
|
108
129
|
* Implementation of a Kademlia DHT routing table as a prefix binary trie with
|
|
109
130
|
* configurable prefix length, bucket split threshold and size.
|
|
110
131
|
*/
|
|
111
|
-
export class KBucket
|
|
132
|
+
export class KBucket {
|
|
112
133
|
public root: Bucket
|
|
113
|
-
public localPeer
|
|
134
|
+
public localPeer?: Peer
|
|
114
135
|
private readonly prefixLength: number
|
|
115
136
|
private readonly splitThreshold: number
|
|
116
137
|
private readonly kBucketSize: number
|
|
117
138
|
private readonly numberOfNodesToPing: number
|
|
139
|
+
private readonly lastPingThreshold: number
|
|
140
|
+
public ping: PingFunction
|
|
141
|
+
public verify: VerifyFunction
|
|
142
|
+
private readonly onAdd?: OnAddCallback
|
|
143
|
+
private readonly onRemove?: OnRemoveCallback
|
|
144
|
+
private readonly onMove?: OnMoveCallback
|
|
145
|
+
private readonly addingPeerMap: PeerMap<Promise<void>>
|
|
118
146
|
|
|
119
147
|
constructor (options: KBucketOptions) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.localPeer = options.localPeer
|
|
123
|
-
this.prefixLength = options.prefixLength
|
|
148
|
+
this.prefixLength = options.prefixLength ?? PREFIX_LENGTH
|
|
124
149
|
this.kBucketSize = options.kBucketSize ?? KBUCKET_SIZE
|
|
125
150
|
this.splitThreshold = options.splitThreshold ?? this.kBucketSize
|
|
126
|
-
this.numberOfNodesToPing = options.
|
|
127
|
-
|
|
128
|
-
|
|
151
|
+
this.numberOfNodesToPing = options.numberOfOldContactsToPing ?? PING_OLD_CONTACT_COUNT
|
|
152
|
+
this.lastPingThreshold = options.lastPingThreshold ?? LAST_PING_THRESHOLD
|
|
153
|
+
this.ping = options.ping
|
|
154
|
+
this.verify = options.verify
|
|
155
|
+
this.onAdd = options.onAdd
|
|
156
|
+
this.onRemove = options.onRemove
|
|
157
|
+
this.addingPeerMap = new PeerMap()
|
|
129
158
|
|
|
130
159
|
this.root = {
|
|
131
160
|
prefix: '',
|
|
@@ -134,14 +163,40 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
134
163
|
}
|
|
135
164
|
}
|
|
136
165
|
|
|
166
|
+
async addSelfPeer (peerId: PeerId): Promise<void> {
|
|
167
|
+
this.localPeer = {
|
|
168
|
+
peerId,
|
|
169
|
+
kadId: await convertPeerId(peerId),
|
|
170
|
+
lastPing: Date.now()
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
137
174
|
/**
|
|
138
|
-
* Adds a contact to the
|
|
139
|
-
*
|
|
140
|
-
* @param {Peer} peer - the contact object to add
|
|
175
|
+
* Adds a contact to the trie
|
|
141
176
|
*/
|
|
142
|
-
add (
|
|
143
|
-
|
|
177
|
+
async add (peerId: PeerId, options?: AbortOptions): Promise<void> {
|
|
178
|
+
const peer = {
|
|
179
|
+
peerId,
|
|
180
|
+
kadId: await convertPeerId(peerId),
|
|
181
|
+
lastPing: 0
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const existingPromise = this.addingPeerMap.get(peerId)
|
|
185
|
+
|
|
186
|
+
if (existingPromise != null) {
|
|
187
|
+
return existingPromise
|
|
188
|
+
}
|
|
144
189
|
|
|
190
|
+
try {
|
|
191
|
+
const p = this._add(peer, options)
|
|
192
|
+
this.addingPeerMap.set(peerId, p)
|
|
193
|
+
await p
|
|
194
|
+
} finally {
|
|
195
|
+
this.addingPeerMap.delete(peerId)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
private async _add (peer: Peer, options?: AbortOptions): Promise<void> {
|
|
145
200
|
const bucket = this._determineBucket(peer.kadId)
|
|
146
201
|
|
|
147
202
|
// check if the contact already exists
|
|
@@ -152,18 +207,32 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
152
207
|
// are there too many peers in the bucket and can we make the trie deeper?
|
|
153
208
|
if (bucket.peers.length === this.splitThreshold && bucket.depth < this.prefixLength) {
|
|
154
209
|
// split the bucket
|
|
155
|
-
this._split(bucket)
|
|
210
|
+
await this._split(bucket)
|
|
156
211
|
|
|
157
212
|
// try again
|
|
158
|
-
this.
|
|
213
|
+
await this._add(peer, options)
|
|
159
214
|
|
|
160
215
|
return
|
|
161
216
|
}
|
|
162
217
|
|
|
163
218
|
// is there space in the bucket?
|
|
164
219
|
if (bucket.peers.length < this.kBucketSize) {
|
|
165
|
-
bucket
|
|
166
|
-
|
|
220
|
+
// we've ping this peer previously, just add them to the bucket
|
|
221
|
+
if (!needsPing(peer, this.lastPingThreshold)) {
|
|
222
|
+
bucket.peers.push(peer)
|
|
223
|
+
await this.onAdd?.(peer, bucket)
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const result = await this.verify(peer, options)
|
|
228
|
+
|
|
229
|
+
// only add if peer is online and functioning correctly
|
|
230
|
+
if (result) {
|
|
231
|
+
peer.lastPing = Date.now()
|
|
232
|
+
|
|
233
|
+
// try again - buckets may have changed during ping
|
|
234
|
+
await this._add(peer, options)
|
|
235
|
+
}
|
|
167
236
|
|
|
168
237
|
return
|
|
169
238
|
}
|
|
@@ -171,17 +240,51 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
171
240
|
// we are at the bottom of the trie and the bucket is full so we can't add
|
|
172
241
|
// any more peers.
|
|
173
242
|
//
|
|
174
|
-
// instead ping the first this.numberOfNodesToPing in order to determine
|
|
243
|
+
// instead ping the first `this.numberOfNodesToPing` in order to determine
|
|
175
244
|
// if they are still online.
|
|
176
245
|
//
|
|
177
246
|
// only add the new peer if one of the pinged nodes does not respond, this
|
|
178
247
|
// prevents DoS flooding with new invalid contacts.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
248
|
+
const toPing = bucket.peers
|
|
249
|
+
.filter(peer => {
|
|
250
|
+
if (peer.peerId.equals(this.localPeer?.peerId)) {
|
|
251
|
+
return false
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (peer.lastPing > (Date.now() - this.lastPingThreshold)) {
|
|
255
|
+
return false
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return true
|
|
259
|
+
})
|
|
260
|
+
.sort((a, b) => {
|
|
261
|
+
// sort oldest ping -> newest
|
|
262
|
+
if (a.lastPing < b.lastPing) {
|
|
263
|
+
return -1
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (a.lastPing > b.lastPing) {
|
|
267
|
+
return 1
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return 0
|
|
271
|
+
})
|
|
272
|
+
.slice(0, this.numberOfNodesToPing)
|
|
273
|
+
|
|
274
|
+
let evicted = false
|
|
275
|
+
|
|
276
|
+
for await (const toEvict of this.ping(toPing, options)) {
|
|
277
|
+
evicted = true
|
|
278
|
+
await this.remove(toEvict.kadId)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// did not evict any peers, cannot add new contact
|
|
282
|
+
if (!evicted) {
|
|
283
|
+
return
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// try again - buckets may have changed during ping
|
|
287
|
+
await this._add(peer, options)
|
|
185
288
|
}
|
|
186
289
|
|
|
187
290
|
/**
|
|
@@ -235,7 +338,7 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
235
338
|
* which branch of the tree to traverse and repeat.
|
|
236
339
|
*
|
|
237
340
|
* @param {Uint8Array} kadId - The ID of the contact to fetch.
|
|
238
|
-
* @returns {
|
|
341
|
+
* @returns {Peer | undefined} The contact if available, otherwise null
|
|
239
342
|
*/
|
|
240
343
|
get (kadId: Uint8Array): Peer | undefined {
|
|
241
344
|
const bucket = this._determineBucket(kadId)
|
|
@@ -249,15 +352,14 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
249
352
|
*
|
|
250
353
|
* @param {Uint8Array} kadId - The ID of the contact to remove
|
|
251
354
|
*/
|
|
252
|
-
remove (kadId: Uint8Array): void {
|
|
355
|
+
async remove (kadId: Uint8Array): Promise<void> {
|
|
253
356
|
const bucket = this._determineBucket(kadId)
|
|
254
357
|
const index = this._indexOf(bucket, kadId)
|
|
255
358
|
|
|
256
359
|
if (index > -1) {
|
|
257
360
|
const peer = bucket.peers.splice(index, 1)[0]
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
})
|
|
361
|
+
|
|
362
|
+
await this.onRemove?.(peer, bucket)
|
|
261
363
|
}
|
|
262
364
|
}
|
|
263
365
|
|
|
@@ -303,14 +405,13 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
303
405
|
*/
|
|
304
406
|
private _determineBucket (kadId: Uint8Array): LeafBucket {
|
|
305
407
|
const bitString = uint8ArrayToString(kadId, 'base2')
|
|
306
|
-
const prefix = bitString.substring(0, this.prefixLength)
|
|
307
408
|
|
|
308
409
|
function findBucket (bucket: Bucket, bitIndex: number = 0): LeafBucket {
|
|
309
410
|
if (isLeafBucket(bucket)) {
|
|
310
411
|
return bucket
|
|
311
412
|
}
|
|
312
413
|
|
|
313
|
-
const bit =
|
|
414
|
+
const bit = bitString[bitIndex]
|
|
314
415
|
|
|
315
416
|
if (bit === '0') {
|
|
316
417
|
return findBucket(bucket.left, bitIndex + 1)
|
|
@@ -331,7 +432,7 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
331
432
|
* @returns {number} Integer Index of contact with provided id if it exists, -1 otherwise.
|
|
332
433
|
*/
|
|
333
434
|
private _indexOf (bucket: LeafBucket, kadId: Uint8Array): number {
|
|
334
|
-
return bucket.peers.findIndex(peer =>
|
|
435
|
+
return bucket.peers.findIndex(peer => uint8ArrayEquals(peer.kadId, kadId))
|
|
335
436
|
}
|
|
336
437
|
|
|
337
438
|
/**
|
|
@@ -339,18 +440,16 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
339
440
|
*
|
|
340
441
|
* @param {any} bucket - bucket for splitting
|
|
341
442
|
*/
|
|
342
|
-
private _split (bucket: LeafBucket): void {
|
|
343
|
-
const depth = bucket.depth + 1
|
|
344
|
-
|
|
443
|
+
private async _split (bucket: LeafBucket): Promise<void> {
|
|
345
444
|
// create child buckets
|
|
346
445
|
const left: LeafBucket = {
|
|
347
446
|
prefix: '0',
|
|
348
|
-
depth,
|
|
447
|
+
depth: bucket.depth + 1,
|
|
349
448
|
peers: []
|
|
350
449
|
}
|
|
351
450
|
const right: LeafBucket = {
|
|
352
451
|
prefix: '1',
|
|
353
|
-
depth,
|
|
452
|
+
depth: bucket.depth + 1,
|
|
354
453
|
peers: []
|
|
355
454
|
}
|
|
356
455
|
|
|
@@ -358,19 +457,33 @@ export class KBucket extends TypedEventEmitter<KBucketEvents> {
|
|
|
358
457
|
for (const peer of bucket.peers) {
|
|
359
458
|
const bitString = uint8ArrayToString(peer.kadId, 'base2')
|
|
360
459
|
|
|
361
|
-
if (bitString[depth] === '0') {
|
|
460
|
+
if (bitString[bucket.depth] === '0') {
|
|
362
461
|
left.peers.push(peer)
|
|
462
|
+
await this.onMove?.(peer, bucket, left)
|
|
363
463
|
} else {
|
|
364
464
|
right.peers.push(peer)
|
|
465
|
+
await this.onMove?.(peer, bucket, right)
|
|
365
466
|
}
|
|
366
467
|
}
|
|
367
468
|
|
|
368
|
-
// convert leaf bucket to internal bucket
|
|
369
|
-
|
|
370
|
-
delete bucket.peers
|
|
371
|
-
// @ts-expect-error left is not a property of LeafBucket
|
|
372
|
-
bucket.left = left
|
|
373
|
-
// @ts-expect-error right is not a property of LeafBucket
|
|
374
|
-
bucket.right = right
|
|
469
|
+
// convert old leaf bucket to internal bucket
|
|
470
|
+
convertToInternalBucket(bucket, left, right)
|
|
375
471
|
}
|
|
376
472
|
}
|
|
473
|
+
|
|
474
|
+
function convertToInternalBucket (bucket: any, left: any, right: any): bucket is InternalBucket {
|
|
475
|
+
delete bucket.peers
|
|
476
|
+
bucket.left = left
|
|
477
|
+
bucket.right = right
|
|
478
|
+
|
|
479
|
+
if (bucket.prefix === '') {
|
|
480
|
+
delete bucket.depth
|
|
481
|
+
delete bucket.prefix
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
return true
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function needsPing (peer: Peer, threshold: number): boolean {
|
|
488
|
+
return peer.lastPing < (Date.now() - threshold)
|
|
489
|
+
}
|
|
@@ -169,6 +169,10 @@ export class RoutingTableRefresh {
|
|
|
169
169
|
throw new Error('Routing table not started')
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
if (this.routingTable.kb.localPeer == null) {
|
|
173
|
+
throw new Error('Local peer not set')
|
|
174
|
+
}
|
|
175
|
+
|
|
172
176
|
const randomData = randomBytes(2)
|
|
173
177
|
const randomUint16 = (randomData[1] << 8) + randomData[0]
|
|
174
178
|
|
|
@@ -245,7 +249,7 @@ export class RoutingTableRefresh {
|
|
|
245
249
|
* Yields the common prefix length of every peer in the table
|
|
246
250
|
*/
|
|
247
251
|
* _prefixLengths (): Generator<number> {
|
|
248
|
-
if (this.routingTable.kb == null) {
|
|
252
|
+
if (this.routingTable.kb?.localPeer == null) {
|
|
249
253
|
return
|
|
250
254
|
}
|
|
251
255
|
|
package/src/rpc/index.ts
CHANGED
|
@@ -63,12 +63,6 @@ export class RPC {
|
|
|
63
63
|
* Process incoming DHT messages
|
|
64
64
|
*/
|
|
65
65
|
async handleMessage (peerId: PeerId, msg: Message): Promise<Message | undefined> {
|
|
66
|
-
try {
|
|
67
|
-
await this.routingTable.add(peerId)
|
|
68
|
-
} catch (err: any) {
|
|
69
|
-
this.log.error('Failed to update the kbucket store', err)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
66
|
// get handler & execute it
|
|
73
67
|
const handler = this.handlers[msg.type]
|
|
74
68
|
|
|
@@ -94,6 +88,8 @@ export class RPC {
|
|
|
94
88
|
* Handle incoming streams on the dht protocol
|
|
95
89
|
*/
|
|
96
90
|
onIncomingStream (data: IncomingStreamData): void {
|
|
91
|
+
let message = 'unknown'
|
|
92
|
+
|
|
97
93
|
Promise.resolve().then(async () => {
|
|
98
94
|
const { stream, connection } = data
|
|
99
95
|
const peerId = connection.remotePeer
|
|
@@ -113,6 +109,7 @@ export class RPC {
|
|
|
113
109
|
for await (const msg of source) {
|
|
114
110
|
// handle the message
|
|
115
111
|
const desMessage = Message.decode(msg)
|
|
112
|
+
message = desMessage.type
|
|
116
113
|
self.log('incoming %s from %p', desMessage.type, peerId)
|
|
117
114
|
const res = await self.handleMessage(peerId, desMessage)
|
|
118
115
|
|
|
@@ -127,7 +124,7 @@ export class RPC {
|
|
|
127
124
|
)
|
|
128
125
|
})
|
|
129
126
|
.catch(err => {
|
|
130
|
-
this.log.error(err)
|
|
127
|
+
this.log.error('error handling %s RPC message from %p - %e', message, data.connection.remotePeer, err)
|
|
131
128
|
})
|
|
132
129
|
}
|
|
133
130
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { PeerId } from '@libp2p/interface';
|
|
2
|
-
/**
|
|
3
|
-
* A list of unique peers.
|
|
4
|
-
*/
|
|
5
|
-
export declare class PeerList {
|
|
6
|
-
private readonly list;
|
|
7
|
-
constructor();
|
|
8
|
-
/**
|
|
9
|
-
* Add a new peer. Returns `true` if it was a new one
|
|
10
|
-
*/
|
|
11
|
-
push(peerId: PeerId): boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Check if this PeerInfo is already in here
|
|
14
|
-
*/
|
|
15
|
-
has(peerId: PeerId): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Get the list as an array
|
|
18
|
-
*/
|
|
19
|
-
toArray(): PeerId[];
|
|
20
|
-
/**
|
|
21
|
-
* Remove the last element
|
|
22
|
-
*/
|
|
23
|
-
pop(): PeerId | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* The length of the list
|
|
26
|
-
*/
|
|
27
|
-
get length(): number;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/peer-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAU;;IAM/B;;OAEG;IACH,IAAI,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAU9B;;OAEG;IACH,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAK7B;;OAEG;IACH,OAAO,IAAK,MAAM,EAAE;IAIpB;;OAEG;IACH,GAAG,IAAK,MAAM,GAAG,SAAS;IAI1B;;OAEG;IACH,IAAI,MAAM,IAAK,MAAM,CAEpB;CACF"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A list of unique peers.
|
|
3
|
-
*/
|
|
4
|
-
export class PeerList {
|
|
5
|
-
list;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.list = [];
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Add a new peer. Returns `true` if it was a new one
|
|
11
|
-
*/
|
|
12
|
-
push(peerId) {
|
|
13
|
-
if (!this.has(peerId)) {
|
|
14
|
-
this.list.push(peerId);
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Check if this PeerInfo is already in here
|
|
21
|
-
*/
|
|
22
|
-
has(peerId) {
|
|
23
|
-
const match = this.list.find((i) => i.equals(peerId));
|
|
24
|
-
return Boolean(match);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get the list as an array
|
|
28
|
-
*/
|
|
29
|
-
toArray() {
|
|
30
|
-
return this.list.slice();
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Remove the last element
|
|
34
|
-
*/
|
|
35
|
-
pop() {
|
|
36
|
-
return this.list.pop();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The length of the list
|
|
40
|
-
*/
|
|
41
|
-
get length() {
|
|
42
|
-
return this.list.length;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/peer-list/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,QAAQ;IACF,IAAI,CAAU;IAE/B;QACE,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;IAED;;OAEG;IACH,IAAI,CAAE,MAAc;QAClB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAEtB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;OAEG;IACH,GAAG,CAAE,MAAc;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;QACrD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,GAAG;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAA;IACzB,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peer-distance-list.d.ts","sourceRoot":"","sources":["../../../src/peer-list/peer-distance-list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAOzD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAY;IAEzC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IAEjC,OAAO,CAAC,aAAa,CAAgB;gBAExB,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAMvD;;OAEG;IACH,IAAI,MAAM,IAAK,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,KAAK,IAAK,QAAQ,EAAE,CAEvB;IAED;;OAEG;IACG,GAAG,CAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzC;;OAEG;IACH,WAAW,CAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI;IAerD;;;OAGG;IACG,QAAQ,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYjD;;;OAGG;IACG,SAAS,CAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAStD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"peer-distance-list.js","sourceRoot":"","sources":["../../../src/peer-list/peer-distance-list.ts"],"names":[],"mappings":"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"}
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"codec": "https://libp2p.github.io/js-libp2p/functions/_libp2p_kad_dht.MessageType.codec.html",
|
|
3
|
-
"EventTypes": "https://libp2p.github.io/js-libp2p/enums/_libp2p_kad_dht.EventTypes.html",
|
|
4
|
-
".:EventTypes": "https://libp2p.github.io/js-libp2p/enums/_libp2p_kad_dht.EventTypes.html",
|
|
5
|
-
"MessageType": "https://libp2p.github.io/js-libp2p/enums/_libp2p_kad_dht.MessageType-1.html",
|
|
6
|
-
"AddPeerEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.AddPeerEvent.html",
|
|
7
|
-
".:AddPeerEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.AddPeerEvent.html",
|
|
8
|
-
"DHTRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.DHTRecord.html",
|
|
9
|
-
".:DHTRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.DHTRecord.html",
|
|
10
|
-
"DialPeerEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.DialPeerEvent.html",
|
|
11
|
-
".:DialPeerEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.DialPeerEvent.html",
|
|
12
|
-
"FinalPeerEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.FinalPeerEvent.html",
|
|
13
|
-
".:FinalPeerEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.FinalPeerEvent.html",
|
|
14
|
-
"KadDHT": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.KadDHT.html",
|
|
15
|
-
".:KadDHT": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.KadDHT.html",
|
|
16
|
-
"KadDHTComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.KadDHTComponents.html",
|
|
17
|
-
".:KadDHTComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.KadDHTComponents.html",
|
|
18
|
-
"KadDHTInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.KadDHTInit.html",
|
|
19
|
-
".:KadDHTInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.KadDHTInit.html",
|
|
20
|
-
"PeerInfoMapper": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.PeerInfoMapper.html",
|
|
21
|
-
".:PeerInfoMapper": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.PeerInfoMapper.html",
|
|
22
|
-
"PeerResponseEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.PeerResponseEvent.html",
|
|
23
|
-
".:PeerResponseEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.PeerResponseEvent.html",
|
|
24
|
-
"ProviderEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ProviderEvent.html",
|
|
25
|
-
".:ProviderEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ProviderEvent.html",
|
|
26
|
-
"ProvidersInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ProvidersInit.html",
|
|
27
|
-
"QueryErrorEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.QueryErrorEvent.html",
|
|
28
|
-
".:QueryErrorEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.QueryErrorEvent.html",
|
|
29
|
-
"RoutingTable": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.RoutingTable.html",
|
|
30
|
-
".:RoutingTable": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.RoutingTable.html",
|
|
31
|
-
"SelectFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.SelectFn.html",
|
|
32
|
-
".:SelectFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.SelectFn.html",
|
|
33
|
-
"SendQueryEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.SendQueryEvent.html",
|
|
34
|
-
".:SendQueryEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.SendQueryEvent.html",
|
|
35
|
-
"SingleKadDHT": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.SingleKadDHT.html",
|
|
36
|
-
".:SingleKadDHT": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.SingleKadDHT.html",
|
|
37
|
-
"ValidateFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ValidateFn.html",
|
|
38
|
-
".:ValidateFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ValidateFn.html",
|
|
39
|
-
"ValueEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ValueEvent.html",
|
|
40
|
-
".:ValueEvent": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_kad_dht.ValueEvent.html",
|
|
41
|
-
"DHTProgressEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.DHTProgressEvents.html",
|
|
42
|
-
".:DHTProgressEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.DHTProgressEvents.html",
|
|
43
|
-
"MessageName": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.MessageName.html",
|
|
44
|
-
".:MessageName": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.MessageName.html",
|
|
45
|
-
"QueryEvent": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.QueryEvent.html",
|
|
46
|
-
".:QueryEvent": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.QueryEvent.html",
|
|
47
|
-
"Selectors": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.Selectors.html",
|
|
48
|
-
".:Selectors": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.Selectors.html",
|
|
49
|
-
"Validators": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.Validators.html",
|
|
50
|
-
".:Validators": "https://libp2p.github.io/js-libp2p/types/_libp2p_kad_dht.Validators.html",
|
|
51
|
-
"kadDHT": "https://libp2p.github.io/js-libp2p/functions/_libp2p_kad_dht.kadDHT-1.html",
|
|
52
|
-
".:kadDHT": "https://libp2p.github.io/js-libp2p/functions/_libp2p_kad_dht.kadDHT-1.html",
|
|
53
|
-
"passthroughMapper": "https://libp2p.github.io/js-libp2p/functions/_libp2p_kad_dht.passthroughMapper.html",
|
|
54
|
-
"removePrivateAddressesMapper": "https://libp2p.github.io/js-libp2p/functions/_libp2p_kad_dht.removePrivateAddressesMapper.html",
|
|
55
|
-
"removePublicAddressesMapper": "https://libp2p.github.io/js-libp2p/functions/_libp2p_kad_dht.removePublicAddressesMapper.html"
|
|
56
|
-
}
|