@olane/o-config 0.7.1 → 0.7.3

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/README.md CHANGED
@@ -1 +1,729 @@
1
- # o-config
1
+ # @olane/o-config
2
+
3
+ Pre-configured libp2p setup for Olane OS networking - batteries included, ready to use.
4
+
5
+ [![npm version](https://badge.fury.io/js/%40olane%2Fo-config.svg)](https://www.npmjs.com/package/@olane/o-config)
6
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
7
+
8
+ ## TL;DR {#tldr}
9
+
10
+ **o-config** bundles libp2p and networking utilities with sensible defaults so you don't have to configure complex P2P networking yourself. Import it, use the defaults, and you're ready to build distributed systems on Olane OS.
11
+
12
+ ## What is o-config? {#what-is-o-config}
13
+
14
+ **o-config** is the **networking configuration layer** for Olane OS. Instead of manually setting up libp2p with dozens of configuration options, o-config provides:
15
+
16
+ - **Pre-configured libp2p settings** - Production-ready defaults for transports, encryption, multiplexing
17
+ - **Unified exports** - All libp2p modules in one place
18
+ - **Helper functions** - Quick node creation with `createNode()`
19
+ - **Multiple transports** - TCP, WebSocket, WebTransport, and Memory (for testing)
20
+ - **DHT & Discovery** - Distributed hash table and peer discovery out of the box
21
+
22
+ ## Quick Start {#quick-start}
23
+
24
+ ### Installation
25
+
26
+ ```bash
27
+ npm install @olane/o-config
28
+ ```
29
+
30
+ ### Create Your First libp2p Node
31
+
32
+ ```typescript
33
+ import { createNode, defaultLibp2pConfig } from '@olane/o-config';
34
+
35
+ // Create a libp2p node with default configuration
36
+ const node = await createNode(defaultLibp2pConfig);
37
+
38
+ // Start the node
39
+ await node.start();
40
+
41
+ console.log('Node started!');
42
+ console.log('Peer ID:', node.peerId.toString());
43
+ console.log('Listening on:', node.getMultiaddrs());
44
+
45
+ // Stop when done
46
+ await node.stop();
47
+ ```
48
+
49
+ ### Custom Configuration
50
+
51
+ ```typescript
52
+ import { createNode, tcp, webSockets } from '@olane/o-config';
53
+
54
+ // Create node with custom transports and listeners
55
+ const node = await createNode({
56
+ listeners: [
57
+ '/ip4/0.0.0.0/tcp/4001', // Listen on TCP port 4001
58
+ '/ip4/0.0.0.0/tcp/4002/ws' // Listen on WebSocket port 4002
59
+ ],
60
+ transports: [tcp(), webSockets()], // Only TCP and WebSocket
61
+ connectionManager: {
62
+ minConnections: 5,
63
+ maxConnections: 50
64
+ }
65
+ });
66
+
67
+ await node.start();
68
+ ```
69
+
70
+ ## How It Works {#how-it-works}
71
+
72
+ **o-config** provides a **default libp2p configuration** optimized for Olane OS networks. Instead of manually configuring:
73
+
74
+ - Transports (TCP, WebSocket, WebTransport, Memory)
75
+ - Connection encryption (Noise protocol)
76
+ - Stream multiplexing (Yamux)
77
+ - Services (DHT, Identify, Ping)
78
+ - Connection management
79
+ - Peer discovery
80
+
81
+ ...you get all of this pre-configured and ready to use.
82
+
83
+ ### Default Configuration
84
+
85
+ ```typescript
86
+ {
87
+ // Listen on all network interfaces
88
+ listeners: ['/ip4/0.0.0.0/tcp/0', '/ip6/::/tcp/0'],
89
+
90
+ // Multiple transport protocols
91
+ transports: [webTransport(), webSockets(), tcp(), memory()],
92
+
93
+ // Noise protocol for encryption
94
+ connectionEncrypters: [noise()],
95
+
96
+ // Yamux for multiplexing
97
+ streamMuxers: [yamux()],
98
+
99
+ // Built-in services
100
+ services: {
101
+ ping: ping(), // Health checks
102
+ identify: identify(), // Peer identification
103
+ dht: kadDHT({ // Distributed hash table
104
+ peerInfoMapper: removePublicAddressesMapper,
105
+ clientMode: false,
106
+ kBucketSize: 20
107
+ })
108
+ }
109
+ }
110
+ ```
111
+
112
+ ## API Reference {#api-reference}
113
+
114
+ ### `createNode(config?)` {#create-node}
115
+
116
+ Creates a configured libp2p node.
117
+
118
+ **Parameters:**
119
+ - `config` (Libp2pConfig, optional): Custom configuration to merge with defaults
120
+
121
+ **Returns:** `Promise<Libp2p>` - A libp2p node instance
122
+
123
+ **Example:**
124
+
125
+ ```typescript
126
+ import { createNode } from '@olane/o-config';
127
+
128
+ // Use defaults
129
+ const node1 = await createNode();
130
+
131
+ // Customize
132
+ const node2 = await createNode({
133
+ listeners: ['/ip4/0.0.0.0/tcp/4001'],
134
+ connectionManager: {
135
+ minConnections: 10,
136
+ maxConnections: 100
137
+ }
138
+ });
139
+ ```
140
+
141
+ ---
142
+
143
+ ### `defaultLibp2pConfig` {#default-libp2p-config}
144
+
145
+ Pre-configured libp2p settings ready to use.
146
+
147
+ **Type:** `Libp2pConfig`
148
+
149
+ **Properties:**
150
+ - `listeners`: Default listening addresses (IPv4 and IPv6 on TCP port 0)
151
+ - `transports`: Array of transport protocols
152
+ - `connectionEncrypters`: Noise protocol
153
+ - `streamMuxers`: Yamux multiplexer
154
+ - `services`: DHT, ping, and identify services
155
+
156
+ **Example:**
157
+
158
+ ```typescript
159
+ import { createNode, defaultLibp2pConfig } from '@olane/o-config';
160
+
161
+ // Use as-is
162
+ const node = await createNode(defaultLibp2pConfig);
163
+
164
+ // Extend with custom settings
165
+ const customNode = await createNode({
166
+ ...defaultLibp2pConfig,
167
+ listeners: ['/ip4/127.0.0.1/tcp/4001'],
168
+ connectionManager: {
169
+ minConnections: 5
170
+ }
171
+ });
172
+ ```
173
+
174
+ ---
175
+
176
+ ### Transport Functions {#transport-functions}
177
+
178
+ Pre-configured transport protocol factories.
179
+
180
+ #### `tcp()` {#tcp}
181
+
182
+ TCP transport for direct network connections.
183
+
184
+ ```typescript
185
+ import { tcp } from '@olane/o-config';
186
+
187
+ const node = await createNode({
188
+ transports: [tcp()],
189
+ listeners: ['/ip4/0.0.0.0/tcp/4001']
190
+ });
191
+ ```
192
+
193
+ #### `webSockets()` {#websockets}
194
+
195
+ WebSocket transport for browser compatibility.
196
+
197
+ ```typescript
198
+ import { webSockets } from '@olane/o-config';
199
+
200
+ const node = await createNode({
201
+ transports: [webSockets()],
202
+ listeners: ['/ip4/0.0.0.0/tcp/4001/ws']
203
+ });
204
+ ```
205
+
206
+ #### `webTransport()` {#webtransport}
207
+
208
+ WebTransport for modern browser support.
209
+
210
+ ```typescript
211
+ import { webTransport } from '@olane/o-config';
212
+
213
+ const node = await createNode({
214
+ transports: [webTransport()]
215
+ });
216
+ ```
217
+
218
+ #### `memory()` {#memory}
219
+
220
+ In-memory transport for testing (no network required).
221
+
222
+ ```typescript
223
+ import { memory } from '@olane/o-config';
224
+
225
+ const node = await createNode({
226
+ transports: [memory()],
227
+ listeners: ['/memory/test-network']
228
+ });
229
+ ```
230
+
231
+ ---
232
+
233
+ ### Encryption & Multiplexing {#encryption-multiplexing}
234
+
235
+ #### `noise()` {#noise}
236
+
237
+ Noise protocol for connection encryption.
238
+
239
+ ```typescript
240
+ import { noise } from '@olane/o-config';
241
+
242
+ const node = await createNode({
243
+ connectionEncrypters: [noise()]
244
+ });
245
+ ```
246
+
247
+ #### `yamux()` {#yamux}
248
+
249
+ Yamux stream multiplexer.
250
+
251
+ ```typescript
252
+ import { yamux } from '@olane/o-config';
253
+
254
+ const node = await createNode({
255
+ streamMuxers: [yamux()]
256
+ });
257
+ ```
258
+
259
+ ---
260
+
261
+ ### Services {#services}
262
+
263
+ #### `ping()` {#ping}
264
+
265
+ Ping service for connection health checks.
266
+
267
+ ```typescript
268
+ import { ping } from '@olane/o-config';
269
+
270
+ const node = await createNode({
271
+ services: {
272
+ ping: ping()
273
+ }
274
+ });
275
+
276
+ // Use it
277
+ await node.services.ping.ping(remotePeerId);
278
+ ```
279
+
280
+ #### `identify()` {#identify}
281
+
282
+ Peer identification service.
283
+
284
+ ```typescript
285
+ import { identify } from '@olane/o-config';
286
+
287
+ const node = await createNode({
288
+ services: {
289
+ identify: identify()
290
+ }
291
+ });
292
+ ```
293
+
294
+ #### `kadDHT()` {#kad-dht}
295
+
296
+ Kademlia distributed hash table for peer and content routing.
297
+
298
+ ```typescript
299
+ import { kadDHT, removePublicAddressesMapper } from '@olane/o-config';
300
+
301
+ const node = await createNode({
302
+ services: {
303
+ dht: kadDHT({
304
+ peerInfoMapper: removePublicAddressesMapper,
305
+ clientMode: false, // Server mode for providing content
306
+ kBucketSize: 20 // Number of peers per k-bucket
307
+ })
308
+ }
309
+ });
310
+ ```
311
+
312
+ ---
313
+
314
+ ### Discovery {#discovery}
315
+
316
+ #### `bootstrap(config)` {#bootstrap}
317
+
318
+ Bootstrap peer discovery.
319
+
320
+ ```typescript
321
+ import { bootstrap } from '@olane/o-config';
322
+
323
+ const node = await createNode({
324
+ peerDiscovery: [
325
+ bootstrap({
326
+ list: [
327
+ '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN',
328
+ '/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ'
329
+ ]
330
+ })
331
+ ]
332
+ });
333
+ ```
334
+
335
+ **Parameters:**
336
+ - `config.list` (string[], required): Array of bootstrap peer multiaddresses
337
+
338
+ ---
339
+
340
+ ### Utilities {#utilities}
341
+
342
+ #### `multiaddr(address)` {#multiaddr}
343
+
344
+ Create multiaddress objects.
345
+
346
+ ```typescript
347
+ import { multiaddr } from '@olane/o-config';
348
+
349
+ const addr = multiaddr('/ip4/127.0.0.1/tcp/4001');
350
+ console.log(addr.toString()); // "/ip4/127.0.0.1/tcp/4001"
351
+ ```
352
+
353
+ #### `pipe(...streams)` {#pipe}
354
+
355
+ Stream piping utility from it-pipe.
356
+
357
+ ```typescript
358
+ import { pipe } from '@olane/o-config';
359
+
360
+ // Pipe data through streams
361
+ await pipe(
362
+ source,
363
+ transform,
364
+ sink
365
+ );
366
+ ```
367
+
368
+ #### `all(iterator)` {#all}
369
+
370
+ Collect all values from an async iterator.
371
+
372
+ ```typescript
373
+ import { all } from '@olane/o-config';
374
+
375
+ const values = await all(asyncIterator);
376
+ console.log(values); // Array of all values
377
+ ```
378
+
379
+ ---
380
+
381
+ ### Peer ID Generation {#peer-id-generation}
382
+
383
+ #### `createFromPrivKey(privateKey)` {#create-from-priv-key}
384
+
385
+ Create a peer ID from a private key.
386
+
387
+ ```typescript
388
+ import { createFromPrivKey } from '@olane/o-config';
389
+
390
+ const peerId = await createFromPrivKey(privateKey);
391
+ ```
392
+
393
+ #### `createEd25519PeerId()` {#create-ed25519-peer-id}
394
+
395
+ Generate a new Ed25519 peer ID.
396
+
397
+ ```typescript
398
+ import { createEd25519PeerId } from '@olane/o-config';
399
+
400
+ const peerId = await createEd25519PeerId();
401
+ console.log(peerId.toString());
402
+ ```
403
+
404
+ ---
405
+
406
+ ### Type Definitions {#type-definitions}
407
+
408
+ #### `Libp2pConfig` {#libp2p-config-type}
409
+
410
+ Configuration interface for libp2p nodes.
411
+
412
+ ```typescript
413
+ interface Libp2pConfig extends Libp2pInit {
414
+ listeners?: string[]; // Listen addresses
415
+ transports?: any[]; // Transport protocols
416
+ connectionEncrypters?: any[]; // Encryption protocols
417
+ streamMuxers?: any[]; // Multiplexing protocols
418
+ services?: Record<string, any>; // libp2p services
419
+ }
420
+ ```
421
+
422
+ ## Common Use Cases {#common-use-cases}
423
+
424
+ ### Use Case 1: Basic P2P Network {#use-case-basic}
425
+
426
+ Create two nodes that can communicate.
427
+
428
+ ```typescript
429
+ import { createNode, defaultLibp2pConfig } from '@olane/o-config';
430
+
431
+ // Create first node
432
+ const node1 = await createNode(defaultLibp2pConfig);
433
+ await node1.start();
434
+
435
+ // Create second node
436
+ const node2 = await createNode(defaultLibp2pConfig);
437
+ await node2.start();
438
+
439
+ // Connect them
440
+ await node1.dial(node2.getMultiaddrs());
441
+
442
+ console.log('Nodes connected!');
443
+ console.log('Node 1 peers:', await node1.getPeers());
444
+ ```
445
+
446
+ ---
447
+
448
+ ### Use Case 2: Testing with Memory Transport {#use-case-testing}
449
+
450
+ Run tests without network access.
451
+
452
+ ```typescript
453
+ import { createNode, memory } from '@olane/o-config';
454
+
455
+ // Create nodes with in-memory transport
456
+ const node1 = await createNode({
457
+ transports: [memory()],
458
+ listeners: ['/memory/test-network']
459
+ });
460
+
461
+ const node2 = await createNode({
462
+ transports: [memory()],
463
+ listeners: ['/memory/test-network']
464
+ });
465
+
466
+ await node1.start();
467
+ await node2.start();
468
+
469
+ // Nodes can communicate without any network
470
+ await node1.dial(node2.getMultiaddrs());
471
+ ```
472
+
473
+ ---
474
+
475
+ ### Use Case 3: Browser-Compatible Node {#use-case-browser}
476
+
477
+ WebSocket-only configuration for browser environments.
478
+
479
+ ```typescript
480
+ import { createNode, webSockets } from '@olane/o-config';
481
+
482
+ // Browser-compatible configuration
483
+ const node = await createNode({
484
+ transports: [webSockets()],
485
+ listeners: ['/ip4/0.0.0.0/tcp/4001/ws']
486
+ });
487
+
488
+ await node.start();
489
+
490
+ // This node can communicate with other WebSocket nodes
491
+ ```
492
+
493
+ ---
494
+
495
+ ### Use Case 4: Production Server Node {#use-case-production}
496
+
497
+ Full-featured server with multiple transports.
498
+
499
+ ```typescript
500
+ import {
501
+ createNode,
502
+ tcp,
503
+ webSockets,
504
+ webTransport,
505
+ bootstrap,
506
+ kadDHT,
507
+ removePublicAddressesMapper
508
+ } from '@olane/o-config';
509
+
510
+ const node = await createNode({
511
+ // Listen on multiple ports and protocols
512
+ listeners: [
513
+ '/ip4/0.0.0.0/tcp/4001', // TCP
514
+ '/ip4/0.0.0.0/tcp/4002/ws', // WebSocket
515
+ '/ip6/::/tcp/4001', // IPv6 TCP
516
+ '/ip6/::/tcp/4002/ws' // IPv6 WebSocket
517
+ ],
518
+
519
+ // Support multiple transports
520
+ transports: [tcp(), webSockets(), webTransport()],
521
+
522
+ // Connection management
523
+ connectionManager: {
524
+ minConnections: 10,
525
+ maxConnections: 200,
526
+ pollInterval: 2000,
527
+ autoDialInterval: 10000
528
+ },
529
+
530
+ // Bootstrap from known peers
531
+ peerDiscovery: [
532
+ bootstrap({
533
+ list: [
534
+ '/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN'
535
+ ]
536
+ })
537
+ ],
538
+
539
+ // DHT for content routing
540
+ services: {
541
+ dht: kadDHT({
542
+ peerInfoMapper: removePublicAddressesMapper,
543
+ clientMode: false,
544
+ kBucketSize: 20
545
+ })
546
+ }
547
+ });
548
+
549
+ await node.start();
550
+ console.log('Production node running on:', node.getMultiaddrs());
551
+ ```
552
+
553
+ ---
554
+
555
+ ### Use Case 5: Custom Protocol Handler {#use-case-custom-protocol}
556
+
557
+ Register custom protocol handlers.
558
+
559
+ ```typescript
560
+ import { createNode, defaultLibp2pConfig, pipe } from '@olane/o-config';
561
+
562
+ const node = await createNode(defaultLibp2pConfig);
563
+ await node.start();
564
+
565
+ // Register custom protocol
566
+ await node.handle('/my-app/1.0.0', async ({ stream }) => {
567
+ await pipe(
568
+ stream,
569
+ async function* (source) {
570
+ for await (const msg of source) {
571
+ // Process incoming message
572
+ const data = new TextDecoder().decode(msg.subarray());
573
+ console.log('Received:', data);
574
+
575
+ // Send response
576
+ const response = `Echo: ${data}`;
577
+ yield new TextEncoder().encode(response);
578
+ }
579
+ },
580
+ stream
581
+ );
582
+ });
583
+
584
+ console.log('Custom protocol handler registered');
585
+ ```
586
+
587
+ ## Troubleshooting {#troubleshooting}
588
+
589
+ ### Error: "No transports available"
590
+
591
+ **Solution:** Make sure you've included at least one transport in your configuration.
592
+
593
+ ```typescript
594
+ // ❌ Wrong - no transports
595
+ const node = await createNode({
596
+ listeners: ['/ip4/0.0.0.0/tcp/4001']
597
+ });
598
+
599
+ // ✅ Correct - includes TCP transport
600
+ import { tcp } from '@olane/o-config';
601
+
602
+ const node = await createNode({
603
+ transports: [tcp()],
604
+ listeners: ['/ip4/0.0.0.0/tcp/4001']
605
+ });
606
+ ```
607
+
608
+ ---
609
+
610
+ ### Error: "Transport not supported"
611
+
612
+ **Solution:** Match your transport to your listener addresses.
613
+
614
+ ```typescript
615
+ // ❌ Wrong - WebSocket listener but only TCP transport
616
+ import { tcp } from '@olane/o-config';
617
+
618
+ const node = await createNode({
619
+ transports: [tcp()],
620
+ listeners: ['/ip4/0.0.0.0/tcp/4001/ws'] // /ws requires webSockets()
621
+ });
622
+
623
+ // ✅ Correct - matching transports and listeners
624
+ import { tcp, webSockets } from '@olane/o-config';
625
+
626
+ const node = await createNode({
627
+ transports: [tcp(), webSockets()],
628
+ listeners: [
629
+ '/ip4/0.0.0.0/tcp/4001', // TCP
630
+ '/ip4/0.0.0.0/tcp/4002/ws' // WebSocket
631
+ ]
632
+ });
633
+ ```
634
+
635
+ ---
636
+
637
+ ### Error: "Port already in use"
638
+
639
+ **Solution:** Use port 0 for automatic port assignment, or specify a free port.
640
+
641
+ ```typescript
642
+ // Use port 0 for automatic assignment
643
+ const node = await createNode({
644
+ listeners: ['/ip4/0.0.0.0/tcp/0'] // OS chooses available port
645
+ });
646
+
647
+ await node.start();
648
+ console.log('Listening on:', node.getMultiaddrs());
649
+ ```
650
+
651
+ ---
652
+
653
+ ### Warning: "DHT in client mode"
654
+
655
+ **Solution:** If you want to provide content on the network, set `clientMode: false`.
656
+
657
+ ```typescript
658
+ import { kadDHT, removePublicAddressesMapper } from '@olane/o-config';
659
+
660
+ const node = await createNode({
661
+ services: {
662
+ dht: kadDHT({
663
+ clientMode: false, // Server mode - can provide content
664
+ peerInfoMapper: removePublicAddressesMapper,
665
+ kBucketSize: 20
666
+ })
667
+ }
668
+ });
669
+ ```
670
+
671
+ ## Testing {#testing}
672
+
673
+ ```bash
674
+ # Run all tests
675
+ npm test
676
+
677
+ # Node.js tests only
678
+ npm run test:node
679
+
680
+ # Browser tests only
681
+ npm run test:browser
682
+ ```
683
+
684
+ ## Development {#development}
685
+
686
+ ```bash
687
+ # Install dependencies
688
+ npm install
689
+
690
+ # Build the package
691
+ npm run build
692
+
693
+ # Run in development mode
694
+ npm run dev
695
+
696
+ # Lint code
697
+ npm run lint
698
+ ```
699
+
700
+ ## Related Packages {#related-packages}
701
+
702
+ - [@olane/o-node](../o-node) - Production P2P node implementation (uses o-config)
703
+ - [@olane/o-core](../o-core) - Abstract kernel and base classes
704
+ - [@olane/o-protocol](../o-protocol) - Protocol definitions
705
+ - [@olane/o-tool](../o-tool) - Tool system for node capabilities
706
+
707
+ ## Documentation {#documentation}
708
+
709
+ - [o-node Documentation](../o-node/README.md) - See how o-config is used in practice
710
+ - [libp2p Documentation](https://docs.libp2p.io/) - Deep dive into libp2p concepts
711
+ - [Full Olane Documentation](https://olane.com/docs)
712
+
713
+ ## Support {#support}
714
+
715
+ - [GitHub Issues](https://github.com/olane-labs/olane/issues)
716
+ - [Community Forum](https://olane.com/community)
717
+ - [Email Support](mailto:support@olane.com)
718
+
719
+ ## Contributing {#contributing}
720
+
721
+ We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
722
+
723
+ ## License {#license}
724
+
725
+ ISC © Olane Inc.
726
+
727
+ ---
728
+
729
+ **Part of the Olane OS ecosystem** - Pre-configured networking for distributed systems. o-config provides the foundation for P2P communication in Olane OS, letting you focus on building tool nodes instead of configuring libp2p.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOpC,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,EAAE,YAcjC,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAOpC,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB,EAAE,YAqBjC,CAAC"}
@@ -21,4 +21,11 @@ export const defaultLibp2pConfig = {
21
21
  kBucketSize: 20, // peer size
22
22
  }),
23
23
  },
24
+ connectionManager: {
25
+ maxConnections: Infinity,
26
+ maxParallelDials: Infinity,
27
+ maxDialQueueLength: Infinity,
28
+ maxPeerAddrsToDial: Infinity,
29
+ inboundConnectionThreshold: Infinity,
30
+ },
24
31
  };
@@ -1,6 +1,7 @@
1
1
  export * from 'libp2p';
2
2
  export * from '@chainsafe/libp2p-noise';
3
3
  export * from '@chainsafe/libp2p-yamux';
4
+ export * from '@libp2p/utils';
4
5
  export * from '@libp2p/ping';
5
6
  export * from '@libp2p/crypto/keys';
6
7
  export { persistentPeerStore } from '@libp2p/peer-store';
@@ -11,9 +12,17 @@ export * from 'it-pushable';
11
12
  export * from '@libp2p/peer-id-factory';
12
13
  export * from '@libp2p/bootstrap';
13
14
  export * from '@libp2p/memory';
14
- export { Metrics, OutboundConnectionUpgradeEvents, ComponentLogger, CounterGroup, CreateListenerOptions, DialTransportOptions, Transport, Listener, Connection, transportSymbol, serviceCapabilities, IncomingStreamData, Stream, Libp2pEvents, PeerId, } from '@libp2p/interface';
15
+ export { Metrics, OutboundConnectionUpgradeEvents, ComponentLogger, CounterGroup, CreateListenerOptions, DialTransportOptions, Transport, Listener, Connection, transportSymbol, serviceCapabilities, Stream, Libp2pEvents, PeerId, StreamMessageEvent, } from '@libp2p/interface';
15
16
  export { Multiaddr, multiaddr, protocols } from '@multiformats/multiaddr';
16
17
  import all from 'it-all';
17
18
  export { all };
18
19
  export { pipe } from 'it-pipe';
20
+ export { webTransport } from '@libp2p/webtransport';
21
+ export { webSockets } from '@libp2p/websockets';
22
+ export { tcp } from '@libp2p/tcp';
23
+ export { kadDHT } from '@libp2p/kad-dht';
24
+ export { memory } from '@libp2p/memory';
25
+ export { ping } from '@libp2p/ping';
26
+ export { identify } from '@libp2p/identify';
27
+ export { duplexPair } from 'it-pair/duplex';
19
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,EACN,YAAY,EACZ,MAAM,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,YAAY,EACZ,MAAM,EACN,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAE,GAAG,EAAE,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from 'libp2p';
2
2
  export * from '@chainsafe/libp2p-noise';
3
3
  export * from '@chainsafe/libp2p-yamux';
4
+ export * from '@libp2p/utils';
4
5
  export * from '@libp2p/ping';
5
6
  export * from '@libp2p/crypto/keys';
6
7
  export { persistentPeerStore } from '@libp2p/peer-store';
@@ -11,8 +12,16 @@ export * from 'it-pushable';
11
12
  export * from '@libp2p/peer-id-factory';
12
13
  export * from '@libp2p/bootstrap';
13
14
  export * from '@libp2p/memory';
14
- export { transportSymbol, serviceCapabilities, } from '@libp2p/interface';
15
+ export { transportSymbol, serviceCapabilities, StreamMessageEvent, } from '@libp2p/interface';
15
16
  export { multiaddr, protocols } from '@multiformats/multiaddr';
16
17
  import all from 'it-all';
17
18
  export { all };
18
19
  export { pipe } from 'it-pipe';
20
+ export { webTransport } from '@libp2p/webtransport';
21
+ export { webSockets } from '@libp2p/websockets';
22
+ export { tcp } from '@libp2p/tcp';
23
+ export { kadDHT } from '@libp2p/kad-dht';
24
+ export { memory } from '@libp2p/memory';
25
+ export { ping } from '@libp2p/ping';
26
+ export { identify } from '@libp2p/identify';
27
+ export { duplexPair } from 'it-pair/duplex';
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAuB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExE,wBAAsB,UAAU,CAAC,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B3E"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/node/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAuB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExE,wBAAsB,UAAU,CAAC,MAAM,GAAE,YAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAU3E"}
@@ -8,22 +8,6 @@ export async function createNode(config = {}) {
8
8
  ...{ listen: config.listeners || defaultLibp2pConfig.listeners },
9
9
  ...config.addresses,
10
10
  },
11
- services: {
12
- ...defaultLibp2pConfig.services,
13
- ...config.services,
14
- },
15
- peerDiscovery: [
16
- ...(defaultLibp2pConfig.peerDiscovery || []),
17
- ...(config.peerDiscovery || []),
18
- ],
19
- peerRouters: [
20
- ...(defaultLibp2pConfig.peerRouters || []),
21
- ...(config.peerRouters || []),
22
- ],
23
- contentRouters: [
24
- ...(defaultLibp2pConfig.contentRouters || []),
25
- ...(config.contentRouters || []),
26
- ],
27
11
  };
28
12
  return await createLibp2p(mergedConfig);
29
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-config",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "url": "git+https://github.com/olane-labs/olane.git"
31
31
  },
32
32
  "author": "oLane Inc.",
33
- "license": "ISC",
33
+ "license": "(MIT OR Apache-2.0)",
34
34
  "description": "oLane Network Config",
35
35
  "devDependencies": {
36
36
  "@eslint/eslintrc": "^3.3.1",
@@ -56,24 +56,26 @@
56
56
  "util": "^0.12.5"
57
57
  },
58
58
  "dependencies": {
59
- "@chainsafe/libp2p-noise": "^16.1.3",
60
- "@chainsafe/libp2p-yamux": "^7.0.1",
61
- "@libp2p/bootstrap": "^11.0.41",
62
- "@libp2p/identify": "^3.0.35",
63
- "@libp2p/interface": "^2.10.4",
64
- "@libp2p/kad-dht": "^15.1.11",
65
- "@libp2p/memory": "^1.1.14",
59
+ "@chainsafe/libp2p-noise": "^17.0.0",
60
+ "@chainsafe/libp2p-yamux": "^8.0.0",
61
+ "@libp2p/bootstrap": "^12.0.6",
62
+ "@libp2p/identify": "^4.0.5",
63
+ "@libp2p/interface": "^3.0.2",
64
+ "@libp2p/kad-dht": "^16.0.5",
65
+ "@libp2p/memory": "^2.0.5",
66
66
  "@libp2p/peer-id-factory": "^4.2.4",
67
- "@libp2p/peer-store": "^11.2.7",
68
- "@libp2p/ping": "^2.0.37",
67
+ "@libp2p/peer-store": "^12.0.5",
68
+ "@libp2p/ping": "^3.0.5",
69
69
  "@libp2p/pubsub": "^10.1.18",
70
- "@libp2p/tcp": "^10.1.19",
71
- "@libp2p/websockets": "^9.2.19",
72
- "@libp2p/webtransport": "^5.0.51",
70
+ "@libp2p/tcp": "^11.0.5",
71
+ "@libp2p/utils": "^7.0.5",
72
+ "@libp2p/websockets": "^10.0.6",
73
+ "@libp2p/webtransport": "^6.0.7",
73
74
  "@multiformats/multiaddr": "^12.5.0",
74
75
  "it-all": "^3.0.9",
76
+ "it-pair": "^2.0.6",
75
77
  "it-pushable": "^3.2.3",
76
- "libp2p": "^2.10.0",
78
+ "libp2p": "^3.0.6",
77
79
  "uint8arraylist": "^2.4.8"
78
80
  }
79
81
  }