Comparing version
@@ -1,3 +0,3 @@ | ||
import type { IdentifyResult, Libp2pEvents, PeerUpdate, TypedEventTarget, PeerId, PeerStore, Topology, StreamHandlerRecord, StreamHandlerOptions } from '@libp2p/interface'; | ||
import type { Registrar as RegistrarInterface, StreamHandler } from '@libp2p/interface-internal'; | ||
import type { IdentifyResult, Libp2pEvents, PeerUpdate, TypedEventTarget, PeerId, PeerStore, Topology, StreamHandler, StreamHandlerRecord, StreamHandlerOptions } from '@libp2p/interface'; | ||
import type { Registrar as RegistrarInterface } from '@libp2p/interface-internal'; | ||
import type { ComponentLogger } from '@libp2p/logger'; | ||
@@ -4,0 +4,0 @@ export declare const DEFAULT_MAX_INBOUND_STREAMS = 32; |
@@ -44,3 +44,3 @@ import type { Libp2pEvents, AbortOptions, ComponentLogger, MultiaddrConnection, Connection, Stream, ConnectionProtector, ConnectionEncrypter, SecuredConnection, ConnectionGater, TypedEventTarget, Metrics, PeerId, PeerStore, StreamMuxerFactory, Upgrader as UpgraderInterface, UpgraderOptions, ConnectionLimits, SecureConnectionOptions, ClearableSignal } from '@libp2p/interface'; | ||
} | ||
export interface DefaultUpgraderComponents { | ||
export interface UpgraderComponents { | ||
peerId: PeerId; | ||
@@ -66,3 +66,3 @@ metrics?: Metrics; | ||
private readonly metrics; | ||
constructor(components: DefaultUpgraderComponents, init: UpgraderInit); | ||
constructor(components: UpgraderComponents, init: UpgraderInit); | ||
readonly [Symbol.toStringTag] = "@libp2p/upgrader"; | ||
@@ -114,4 +114,6 @@ shouldBlockConnection(connectionType: 'denyInboundConnection', maConn: MultiaddrConnection): Promise<void>; | ||
}>; | ||
getConnectionEncrypters(): Map<string, ConnectionEncrypter<unknown>>; | ||
getStreamMuxers(): Map<string, StreamMuxerFactory>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=upgrader.d.ts.map |
@@ -179,3 +179,4 @@ import { InvalidMultiaddrError, TooManyInboundProtocolStreamsError, TooManyOutboundProtocolStreamsError, LimitedConnectionError, setMaxListeners, InvalidPeerIdError } from '@libp2p/interface'; | ||
remotePeer, | ||
protocol: cryptoProtocol | ||
protocol: cryptoProtocol, | ||
streamMuxer: muxerFactory | ||
} = await (direction === 'inbound' | ||
@@ -210,3 +211,3 @@ ? this._encryptInbound(protectedConn, opts) | ||
} | ||
else if (this.streamMuxers.size > 0) { | ||
else if (muxerFactory == null && this.streamMuxers.size > 0) { | ||
opts?.onProgress?.(new CustomProgressEvent(`upgrader:multiplex-${direction}-connection`)); | ||
@@ -557,3 +558,9 @@ // Multiplex the connection | ||
} | ||
getConnectionEncrypters() { | ||
return this.connectionEncrypters; | ||
} | ||
getStreamMuxers() { | ||
return this.streamMuxers; | ||
} | ||
} | ||
//# sourceMappingURL=upgrader.js.map |
@@ -1,3 +0,3 @@ | ||
export declare const version = "2.7.5"; | ||
export declare const version = "2.8.0-0699fb747"; | ||
export declare const name = "js-libp2p"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,3 +0,3 @@ | ||
export const version = '2.7.5'; | ||
export const version = '2.8.0-0699fb747'; | ||
export const name = 'js-libp2p'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "libp2p", | ||
"version": "2.7.5", | ||
"version": "2.8.0-0699fb747", | ||
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack", | ||
@@ -95,11 +95,11 @@ "license": "Apache-2.0 OR MIT", | ||
"@chainsafe/netmask": "^2.0.0", | ||
"@libp2p/crypto": "^5.0.14", | ||
"@libp2p/interface": "^2.6.1", | ||
"@libp2p/interface-internal": "^2.3.6", | ||
"@libp2p/logger": "^5.1.11", | ||
"@libp2p/multistream-select": "^6.0.18", | ||
"@libp2p/peer-collections": "^6.0.22", | ||
"@libp2p/peer-id": "^5.0.15", | ||
"@libp2p/peer-store": "^11.0.22", | ||
"@libp2p/utils": "^6.5.6", | ||
"@libp2p/crypto": "5.0.15-0699fb747", | ||
"@libp2p/interface": "2.7.0-0699fb747", | ||
"@libp2p/interface-internal": "2.3.7-0699fb747", | ||
"@libp2p/logger": "5.1.12-0699fb747", | ||
"@libp2p/multistream-select": "6.0.19-0699fb747", | ||
"@libp2p/peer-collections": "6.0.23-0699fb747", | ||
"@libp2p/peer-id": "5.0.16-0699fb747", | ||
"@libp2p/peer-store": "11.1.0-0699fb747", | ||
"@libp2p/utils": "6.5.7-0699fb747", | ||
"@multiformats/dns": "^1.0.6", | ||
@@ -106,0 +106,0 @@ "@multiformats/multiaddr": "^12.3.5", |
@@ -11,6 +11,35 @@ <h1 align="center"> | ||
[](http://webchat.freenode.net/?channels=%23libp2p) | ||
[](https://discord.com/invite/Ae4TbahHaT) | ||
[](https://discord.com/invite/Ae4TbahHaT) | ||
[](https://codecov.io/gh/libp2p/js-libp2p) | ||
[](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amain) | ||
# About | ||
<!-- | ||
!IMPORTANT! | ||
Everything in this README between "# About" and "# Install" is automatically | ||
generated and will be overwritten the next time the doc generator is run. | ||
To make changes to this section, please update the @packageDocumentation section | ||
of src/index.js or src/index.ts | ||
To experiment with formatting, please run "npm run docs" from the root of this | ||
repo and examine the changes made. | ||
--> | ||
Use the `createLibp2p` function to create a libp2p node. | ||
## Example | ||
```typescript | ||
import { createLibp2p } from 'libp2p' | ||
const node = await createLibp2p({ | ||
// ...other options | ||
}) | ||
``` | ||
# Background | ||
@@ -17,0 +46,0 @@ |
import { InvalidParametersError } from '@libp2p/interface' | ||
import merge from 'merge-options' | ||
import * as errorsJs from './errors.js' | ||
import type { IdentifyResult, Libp2pEvents, Logger, PeerUpdate, TypedEventTarget, PeerId, PeerStore, Topology, StreamHandlerRecord, StreamHandlerOptions } from '@libp2p/interface' | ||
import type { Registrar as RegistrarInterface, StreamHandler } from '@libp2p/interface-internal' | ||
import type { IdentifyResult, Libp2pEvents, Logger, PeerUpdate, TypedEventTarget, PeerId, PeerStore, Topology, StreamHandler, StreamHandlerRecord, StreamHandlerOptions } from '@libp2p/interface' | ||
import type { Registrar as RegistrarInterface } from '@libp2p/interface-internal' | ||
import type { ComponentLogger } from '@libp2p/logger' | ||
@@ -7,0 +7,0 @@ |
@@ -103,3 +103,3 @@ import { InvalidMultiaddrError, TooManyInboundProtocolStreamsError, TooManyOutboundProtocolStreamsError, LimitedConnectionError, setMaxListeners, InvalidPeerIdError } from '@libp2p/interface' | ||
export interface DefaultUpgraderComponents { | ||
export interface UpgraderComponents { | ||
peerId: PeerId | ||
@@ -119,3 +119,3 @@ metrics?: Metrics | ||
export class Upgrader implements UpgraderInterface { | ||
private readonly components: DefaultUpgraderComponents | ||
private readonly components: UpgraderComponents | ||
private readonly connectionEncrypters: Map<string, ConnectionEncrypter> | ||
@@ -132,3 +132,3 @@ private readonly streamMuxers: Map<string, StreamMuxerFactory> | ||
constructor (components: DefaultUpgraderComponents, init: UpgraderInit) { | ||
constructor (components: UpgraderComponents, init: UpgraderInit) { | ||
this.components = components | ||
@@ -292,3 +292,4 @@ this.connectionEncrypters = new Map() | ||
remotePeer, | ||
protocol: cryptoProtocol | ||
protocol: cryptoProtocol, | ||
streamMuxer: muxerFactory | ||
} = await (direction === 'inbound' | ||
@@ -329,3 +330,3 @@ ? this._encryptInbound(protectedConn, opts) | ||
muxerFactory = opts.muxerFactory | ||
} else if (this.streamMuxers.size > 0) { | ||
} else if (muxerFactory == null && this.streamMuxers.size > 0) { | ||
opts?.onProgress?.(new CustomProgressEvent(`upgrader:multiplex-${direction}-connection`)) | ||
@@ -754,2 +755,10 @@ | ||
} | ||
getConnectionEncrypters (): Map<string, ConnectionEncrypter<unknown>> { | ||
return this.connectionEncrypters | ||
} | ||
getStreamMuxers (): Map<string, StreamMuxerFactory> { | ||
return this.streamMuxers | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
export const version = '2.7.5' | ||
export const version = '2.8.0-0699fb747' | ||
export const name = 'js-libp2p' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
960606
0.19%12424
0.04%191
17.9%173
-0.57%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed