kademlia-routing-table 1.0.6 → 1.0.7

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.
Files changed (4) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +21 -18
  3. package/index.js +82 -34
  4. package/package.json +13 -9
package/LICENSE CHANGED
@@ -1,21 +1,201 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019 Mathias Buus
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -6,27 +6,23 @@ XOR distance based routing table used for P2P networks such as a Kademlia DHT.
6
6
  npm install kademlia-routing-table
7
7
  ```
8
8
 
9
- Similar to k-buckets, but implemented using the simplifications described in https://github.com/ethereum/wiki/wiki/Kademlia-Peer-Selection
9
+ Similar to k-buckets, but implemented using the simplifications described in https://web.archive.org/web/20181102041849/https://github.com/ethereum/wiki/wiki/Kademlia-Peer-Selection
10
10
 
11
11
  To understand the concept behind peer routing, DHTs, and the terms used here,
12
12
  I recommend reading the [Kademlia DHT paper](https://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf) as well.
13
13
 
14
14
  ## Usage
15
15
 
16
- ``` js
16
+ ```js
17
17
  const RoutingTable = require('kademlia-routing-table')
18
18
  const { randomBytes } = require('crypto')
19
19
 
20
20
  // Create a new table that stores nodes "close" to the passed in id.
21
- // The id should be uniformily distributed, ie a hash, random bytes etc.
21
+ // The id should be uniformly distributed, ie a hash, random bytes etc.
22
22
  const table = new RoutingTable(randomBytes(32))
23
23
 
24
- // Add a node to the routing table
25
- table.add({
26
- id: randomBytes(32), // this field is required
27
- // populate with any other data you want to store
28
- })
29
-
24
+ // Listen before adding nodes: 'row' is only emitted when a row is created,
25
+ // so rows created before this listener is attached never get a 'full' handler.
30
26
  table.on('row', function (row) {
31
27
  // A new row has been added to the routing table
32
28
  // This row represents row.index similar bits to the table.id
@@ -39,6 +35,12 @@ table.on('row', function (row) {
39
35
  })
40
36
  })
41
37
 
38
+ // Add a node to the routing table
39
+ table.add({
40
+ id: randomBytes(32) // this field is required
41
+ // populate with any other data you want to store
42
+ })
43
+
42
44
  // Get the 20 nodes "closest" to a passed in id
43
45
  const closest = table.closest(randomBytes(32), 20)
44
46
  ```
@@ -49,9 +51,9 @@ const closest = table.closest(randomBytes(32), 20)
49
51
 
50
52
  Create a new routing table.
51
53
 
52
- `id` should be a Buffer that is uniformily distributed. `options` include:
54
+ `id` should be a Buffer that is uniformly distributed. `options` include:
53
55
 
54
- ``` js
56
+ ```js
55
57
  {
56
58
  k: 20 // The max row size
57
59
  }
@@ -64,7 +66,7 @@ When inserting a node the XOR distance between the node and the table.id is
64
66
  calculated and used to figure which table row this node should be inserted into.
65
67
 
66
68
  Returns `true` if the node could be added to the corresponding row or `false` if not.
67
- If `false` is returned the onfullrow function is invoked for the corresponding row and node.
69
+ If `false` is returned the corresponding row emits `'full'` with the node.
68
70
 
69
71
  #### `node = table.get(id)`
70
72
 
@@ -110,7 +112,7 @@ about accessing rows directly outside the row event.
110
112
 
111
113
  ## Row API
112
114
 
113
- For the row passed in the the `onfullrow` function the following API exists.
115
+ For the row passed in the `'row'` event the following API exists.
114
116
 
115
117
  #### `row.index`
116
118
 
@@ -127,13 +129,14 @@ Property set to null initially you can use if you want to store optional data on
127
129
 
128
130
  #### `bool = row.add(node)`
129
131
 
130
- Same as `table.add` but for a specific row. Only use this to add the `newNode`
131
- passed in `onfullrow` function.
132
+ Same as `table.add` but for a specific row. Only use this to add the node
133
+ passed to the `'full'` event.
132
134
 
133
- #### `bool = row.remove(node)`
135
+ #### `bool = row.remove(id)`
134
136
 
135
- Same as `table.remove` but for a specific row. Only use this to remove the
136
- "worst" node from the row when wanting to add the newNode.
137
+ Same as `table.remove` but for a specific row. Takes the node's id, not the
138
+ node, e.g. `row.remove(worst.id)`. Only use this to remove the "worst" node
139
+ from the row when wanting to add the node passed to the `'full'` event.
137
140
 
138
141
  #### `row.on('add', node)`
139
142
 
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const { EventEmitter } = require('events')
2
2
 
3
3
  module.exports = class RoutingTable extends EventEmitter {
4
- constructor (id, opts) {
4
+ constructor(id, opts) {
5
5
  if (!opts) opts = {}
6
6
 
7
7
  super()
@@ -10,46 +10,42 @@ module.exports = class RoutingTable extends EventEmitter {
10
10
  this.k = opts.k || 20
11
11
  this.size = 0
12
12
  this.rows = new Array(id.length * 8)
13
+ this._top = -1 // highest row index in use, so closest() can skip the empty tail
13
14
  }
14
15
 
15
- add (node) {
16
+ add(node) {
16
17
  const i = this._diff(node.id)
17
18
 
18
19
  let row = this.rows[i]
19
20
 
20
21
  if (!row) {
21
22
  row = this.rows[i] = new Row(this, i)
23
+ if (i > this._top) this._top = i
22
24
  this.emit('row', row)
23
25
  }
24
26
 
25
- const len = row.nodes.length
26
- if (!row.add(node, this.k)) return false
27
-
28
- this.size += row.nodes.length - len
29
- return true
27
+ return row.add(node)
30
28
  }
31
29
 
32
- remove (id) {
30
+ remove(id) {
33
31
  const i = this._diff(id)
34
32
  const row = this.rows[i]
35
33
  if (!row) return false
36
- if (!row.remove(id)) return false
37
- this.size--
38
- return true
34
+ return row.remove(id)
39
35
  }
40
36
 
41
- get (id) {
37
+ get(id) {
42
38
  const i = this._diff(id)
43
39
  const row = this.rows[i]
44
40
  if (!row) return null
45
41
  return row.get(id)
46
42
  }
47
43
 
48
- has (id) {
44
+ has(id) {
49
45
  return this.get(id) !== null
50
46
  }
51
47
 
52
- random () {
48
+ random() {
53
49
  let n = (Math.random() * this.size) | 0
54
50
 
55
51
  for (let i = 0; i < this.rows.length; i++) {
@@ -62,34 +58,66 @@ module.exports = class RoutingTable extends EventEmitter {
62
58
  return null
63
59
  }
64
60
 
65
- closest (id, k) {
61
+ closest(id, k) {
66
62
  if (!k) k = this.k
67
63
 
68
64
  const result = []
69
65
  const d = this._diff(id)
70
66
 
71
- // push close nodes
72
- for (let i = d; i >= 0 && result.length < k; i--) this._pushNodes(i, k, result)
67
+ // Row i holds nodes that match this.id before bit i and differ from it at bit i.
68
+ // If id also differs from this.id at bit i, those nodes are closer to id than every
69
+ // node in a later row; if id matches this.id there, they are farther. So we take
70
+ // the rows where id differs going up from d (all closer to id than we are), then
71
+ // the rows where id matches going down from the top (all farther).
72
+
73
+ // rows where id differs from this.id, closest first
74
+ for (let i = d; i <= this._top && result.length < k; i++) {
75
+ const row = this.rows[i]
76
+ if (row && bitDiffers(id, this.id, i)) this._pushNodes(row, id, k, result)
77
+ }
73
78
 
74
- // if we don't have enough close nodes, populate from other rows, re the paper
75
- for (let i = d + 1; i < this.rows.length && result.length < k; i++) this._pushNodes(i, k, result)
79
+ // rows where id matches this.id, closest first
80
+ for (let i = this._top; i >= 0 && result.length < k; i--) {
81
+ const row = this.rows[i]
82
+ if (row && !bitDiffers(id, this.id, i)) this._pushNodes(row, id, k, result)
83
+ }
76
84
 
77
85
  return result
78
86
  }
79
87
 
80
- _pushNodes (i, k, result) {
81
- const row = this.rows[i]
82
- if (!row) return
88
+ _pushNodes(row, id, k, result) {
89
+ const nodes = row.nodes
90
+ const start = result.length
91
+
92
+ if (k - start >= nodes.length) {
93
+ for (let j = 0; j < nodes.length; j++) result.push(nodes[j])
94
+ return
95
+ }
96
+
97
+ // only some fit, and rows are sorted by id, not by distance to id, so insertion sort
98
+ // the row into the tail of the result, dropping whatever falls off the end
99
+ const offset = row.byteOffset
83
100
 
84
- const missing = Math.min(k - result.length, row.nodes.length)
85
- for (let j = 0; j < missing; j++) result.push(row.nodes[j])
101
+ for (let n = 0; n < nodes.length; n++) {
102
+ const node = nodes[n]
103
+ let j = result.length
104
+
105
+ if (j < k) result.push(node)
106
+ else if (compareDistance(node.id, result[--j].id, id, offset) >= 0) continue
107
+
108
+ for (; j > start && compareDistance(node.id, result[j - 1].id, id, offset) < 0; j--) {
109
+ result[j] = result[j - 1]
110
+ }
111
+
112
+ result[j] = node
113
+ }
86
114
  }
87
115
 
88
- toArray () {
116
+ toArray() {
89
117
  return this.closest(this.id, Infinity)
90
118
  }
91
119
 
92
- _diff (id) {
120
+ _diff(id) {
93
121
  for (let i = 0; i < id.length; i++) {
94
122
  const a = id[i]
95
123
  const b = this.id[i]
@@ -102,7 +130,7 @@ module.exports = class RoutingTable extends EventEmitter {
102
130
  }
103
131
 
104
132
  class Row extends EventEmitter {
105
- constructor (table, index) {
133
+ constructor(table, index) {
106
134
  super()
107
135
 
108
136
  this.data = null // can be used be upstream for whatevs
@@ -112,7 +140,7 @@ class Row extends EventEmitter {
112
140
  this.nodes = []
113
141
  }
114
142
 
115
- add (node) {
143
+ add(node) {
116
144
  const id = node.id
117
145
 
118
146
  let l = 0
@@ -137,10 +165,11 @@ class Row extends EventEmitter {
137
165
  }
138
166
 
139
167
  this.insert(l, node)
168
+ this.table.size++
140
169
  return true
141
170
  }
142
171
 
143
- remove (id) {
172
+ remove(id) {
144
173
  let l = 0
145
174
  let r = this.nodes.length - 1
146
175
 
@@ -150,6 +179,7 @@ class Row extends EventEmitter {
150
179
 
151
180
  if (c === 0) {
152
181
  this.splice(m)
182
+ this.table.size--
153
183
  return true
154
184
  }
155
185
 
@@ -160,7 +190,7 @@ class Row extends EventEmitter {
160
190
  return false
161
191
  }
162
192
 
163
- get (id) {
193
+ get(id) {
164
194
  let l = 0
165
195
  let r = this.nodes.length - 1
166
196
 
@@ -177,20 +207,22 @@ class Row extends EventEmitter {
177
207
  return null
178
208
  }
179
209
 
180
- insert (i, node) {
210
+ insert(i, node) {
181
211
  this.nodes.push(node) // push node or null or whatevs, just trying to not be polymorphic
182
212
  for (let j = this.nodes.length - 1; j > i; j--) this.nodes[j] = this.nodes[j - 1]
183
213
  this.nodes[i] = node
184
214
  this.emit('add', node)
185
215
  }
186
216
 
187
- splice (i) {
217
+ splice(i) {
218
+ const node = this.nodes[i]
188
219
  for (; i < this.nodes.length - 1; i++) this.nodes[i] = this.nodes[i + 1]
189
- this.emit('remove', this.nodes.pop())
220
+ this.nodes.pop()
221
+ this.emit('remove', node)
190
222
  }
191
223
 
192
224
  // very likely they diverge after a couple of bytes so a simple impl, like this is prop fastest vs Buffer.compare
193
- compare (a, b) {
225
+ compare(a, b) {
194
226
  for (let i = this.byteOffset; i < a.length; i++) {
195
227
  const ai = a[i]
196
228
  const bi = b[i]
@@ -200,3 +232,19 @@ class Row extends EventEmitter {
200
232
  return 0
201
233
  }
202
234
  }
235
+
236
+ function bitDiffers(a, b, i) {
237
+ const j = i >> 3
238
+ return ((a[j] ^ b[j]) & (0x80 >> (i & 7))) !== 0
239
+ }
240
+
241
+ // nodes in the same row share their first `offset` bytes, so those bytes can't decide the order
242
+ function compareDistance(a, b, target, offset) {
243
+ for (let i = offset; i < a.length; i++) {
244
+ const ai = a[i] ^ target[i]
245
+ const bi = b[i] ^ target[i]
246
+ if (ai === bi) continue
247
+ return ai < bi ? -1 : 1
248
+ }
249
+ return 0
250
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kademlia-routing-table",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "XOR based routing table used for P2P networks such as a Kademlia DHT.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -16,11 +16,15 @@
16
16
  "bare-events": "^2.2.0"
17
17
  },
18
18
  "devDependencies": {
19
- "brittle": "^3.3.2",
20
- "standard": "^17.1.0"
19
+ "brittle": "^4.6.1",
20
+ "lunte": "^1.8.6",
21
+ "prettier": "^3.10.1",
22
+ "prettier-config-holepunch": "^2.0.0"
21
23
  },
22
24
  "scripts": {
23
- "test": "standard && brittle test.js"
25
+ "format": "prettier --write .",
26
+ "lint": "prettier --check . && lunte",
27
+ "test": "brittle-node test.js"
24
28
  },
25
29
  "keywords": [
26
30
  "kademlia",
@@ -34,12 +38,12 @@
34
38
  ],
35
39
  "repository": {
36
40
  "type": "git",
37
- "url": "https://github.com/mafintosh/kademlia-routing-table.git"
41
+ "url": "https://github.com/holepunchto/kademlia-routing-table.git"
38
42
  },
39
- "author": "Mathias Buus (@mafintosh)",
40
- "license": "MIT",
43
+ "author": "Holepunch Inc.",
44
+ "license": "Apache-2.0",
41
45
  "bugs": {
42
- "url": "https://github.com/mafintosh/kademlia-routing-table/issues"
46
+ "url": "https://github.com/holepunchto/kademlia-routing-table/issues"
43
47
  },
44
- "homepage": "https://github.com/mafintosh/kademlia-routing-table"
48
+ "homepage": "https://github.com/holepunchto/kademlia-routing-table"
45
49
  }