Comparing version 2.7.1 to 2.7.2-5b084e968
@@ -158,4 +158,4 @@ /* eslint-disable complexity */ | ||
if (options?.type === 'dns-mapping' || this.dnsMappings.has(addr)) { | ||
const dnsMapingStartingConfidence = this.dnsMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL); | ||
if (!dnsMapingStartingConfidence && startingConfidence) { | ||
const dnsMappingStartingConfidence = this.dnsMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL); | ||
if (!dnsMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false; | ||
@@ -165,4 +165,4 @@ } | ||
if (options?.type === 'ip-mapping' || this.ipMappings.has(addr)) { | ||
const ipMapingStartingConfidence = this.ipMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL); | ||
if (!ipMapingStartingConfidence && startingConfidence) { | ||
const ipMappingStartingConfidence = this.ipMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL); | ||
if (!ipMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false; | ||
@@ -205,4 +205,4 @@ } | ||
if (this.dnsMappings.has(addr)) { | ||
const dnsMapingStartingConfidence = this.dnsMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry); | ||
if (!dnsMapingStartingConfidence && startingConfidence) { | ||
const dnsMappingStartingConfidence = this.dnsMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry); | ||
if (!dnsMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false; | ||
@@ -212,4 +212,4 @@ } | ||
if (this.ipMappings.has(addr)) { | ||
const ipMapingStartingConfidence = this.ipMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry); | ||
if (!ipMapingStartingConfidence && startingConfidence) { | ||
const ipMappingStartingConfidence = this.ipMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry); | ||
if (!ipMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false; | ||
@@ -216,0 +216,0 @@ } |
@@ -7,3 +7,3 @@ import type { ConnectionGater } from '@libp2p/interface'; | ||
* Browsers are severely limited in their resource usage so don't waste time | ||
* trying to dial undiallable addresses, and they also print verbose error | ||
* trying to dial undialable addresses, and they also print verbose error | ||
* messages when making connections over insecure transports which causes | ||
@@ -10,0 +10,0 @@ * confusion. |
@@ -10,3 +10,3 @@ import { isPrivateIp } from '@libp2p/utils/private-ip'; | ||
* Browsers are severely limited in their resource usage so don't waste time | ||
* trying to dial undiallable addresses, and they also print verbose error | ||
* trying to dial undialable addresses, and they also print verbose error | ||
* messages when making connections over insecure transports which causes | ||
@@ -13,0 +13,0 @@ * confusion. |
@@ -12,8 +12,8 @@ import { isLoopback } from '@libp2p/utils/multiaddr/is-loopback'; | ||
export function reliableTransportsFirst(a, b) { | ||
const isATCP = TCP.exactMatch(a.multiaddr); | ||
const isBTCP = TCP.exactMatch(b.multiaddr); | ||
if (isATCP && !isBTCP) { | ||
const isATcp = TCP.exactMatch(a.multiaddr); | ||
const isBTcp = TCP.exactMatch(b.multiaddr); | ||
if (isATcp && !isBTcp) { | ||
return -1; | ||
} | ||
if (!isATCP && isBTCP) { | ||
if (!isATcp && isBTcp) { | ||
return 1; | ||
@@ -20,0 +20,0 @@ } |
@@ -149,3 +149,3 @@ /* eslint-disable max-depth */ | ||
// load addresses from address book, resolve and dnsaddrs, filter | ||
// undiallables, add peer IDs, etc | ||
// undialables, add peer IDs, etc | ||
addrsToDial = await this.calculateMultiaddrs(peerId, options?.multiaddrs, { | ||
@@ -348,3 +348,3 @@ ...options, | ||
} | ||
const gatedAdrs = []; | ||
const gatedAddrs = []; | ||
for (const addr of dedupedMultiaddrs) { | ||
@@ -354,5 +354,5 @@ if (this.components.connectionGater.denyDialMultiaddr != null && await this.components.connectionGater.denyDialMultiaddr(addr.multiaddr)) { | ||
} | ||
gatedAdrs.push(addr); | ||
gatedAddrs.push(addr); | ||
} | ||
const sortedGatedAddrs = this.addressSorter == null ? defaultAddressSorter(gatedAdrs) : gatedAdrs.sort(this.addressSorter); | ||
const sortedGatedAddrs = this.addressSorter == null ? defaultAddressSorter(gatedAddrs) : gatedAddrs.sort(this.addressSorter); | ||
// make sure we actually have some addresses to dial | ||
@@ -359,0 +359,0 @@ if (sortedGatedAddrs.length === 0) { |
@@ -32,2 +32,5 @@ export declare enum messages { | ||
} | ||
export declare class NoSupportedAddressesError extends Error { | ||
constructor(message?: string); | ||
} | ||
export declare class ConnectionInterceptedError extends Error { | ||
@@ -34,0 +37,0 @@ constructor(message?: string); |
@@ -60,2 +60,8 @@ export var messages; | ||
} | ||
export class NoSupportedAddressesError extends Error { | ||
constructor(message = 'No supported addresses') { | ||
super(message); | ||
this.name = 'NoSupportedAddressesError'; | ||
} | ||
} | ||
export class ConnectionInterceptedError extends Error { | ||
@@ -62,0 +68,0 @@ constructor(message = 'Connection intercepted') { |
@@ -86,3 +86,3 @@ /** | ||
* Connection encrypters ensure that data sent over connections cannot be | ||
* eavesdropped on, and that the remote peer posesses the private key that | ||
* eavesdropped on, and that the remote peer possesses the private key that | ||
* corresponds to the public key that it's Peer ID is derived from. | ||
@@ -89,0 +89,0 @@ */ |
@@ -56,3 +56,3 @@ import { publicKeyFromProtobuf } from '@libp2p/crypto/keys'; | ||
const nodeInfoName = init.nodeInfo?.name ?? pkg.name; | ||
const nodeInfoVersion = init.nodeInfo?.version ?? pkg.name; | ||
const nodeInfoVersion = init.nodeInfo?.version ?? pkg.version; | ||
// @ts-expect-error defaultComponents is missing component types added later | ||
@@ -59,0 +59,0 @@ const components = this.components = defaultComponents({ |
@@ -101,3 +101,3 @@ import { randomBytes } from '@libp2p/crypto'; | ||
catch (err) { | ||
this.log.error('randomwalk errored', err); | ||
this.log.error('random walk errored', err); | ||
this.safeDispatchEvent('walk:error', { | ||
@@ -111,3 +111,3 @@ detail: err | ||
.catch(err => { | ||
this.log.error('randomwalk errored', err); | ||
this.log.error('random walk errored', err); | ||
}) | ||
@@ -114,0 +114,0 @@ .finally(() => { |
@@ -273,3 +273,3 @@ import { InvalidMultiaddrError, TooManyInboundProtocolStreamsError, TooManyOutboundProtocolStreamsError, LimitedConnectionError, setMaxListeners, InvalidPeerIdError } from '@libp2p/interface'; | ||
// after the handshake the returned stream can have early data so override | ||
// the souce/sink | ||
// the source/sink | ||
muxedStream.source = stream.source; | ||
@@ -291,3 +291,3 @@ muxedStream.sink = stream.sink; | ||
// If a protocol stream has been successfully negotiated and is to be passed to the application, | ||
// the peerstore should ensure that the peer is registered with that protocol | ||
// the peer store should ensure that the peer is registered with that protocol | ||
await this.components.peerStore.merge(remotePeer, { | ||
@@ -339,3 +339,3 @@ protocols: [protocol] | ||
// If a protocol stream has been successfully negotiated and is to be passed to the application, | ||
// the peerstore should ensure that the peer is registered with that protocol | ||
// the peer store should ensure that the peer is registered with that protocol | ||
await this.components.peerStore.merge(remotePeer, { | ||
@@ -345,3 +345,3 @@ protocols: [protocol] | ||
// after the handshake the returned stream can have early data so override | ||
// the souce/sink | ||
// the source/sink | ||
muxedStream.source = stream.source; | ||
@@ -348,0 +348,0 @@ muxedStream.sink = stream.sink; |
@@ -1,3 +0,3 @@ | ||
export declare const version = "2.7.1"; | ||
export declare const version = "2.7.2-5b084e968"; | ||
export declare const name = "js-libp2p"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,3 +0,3 @@ | ||
export const version = '2.7.1'; | ||
export const version = '2.7.2-5b084e968'; | ||
export const name = 'js-libp2p'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "libp2p", | ||
"version": "2.7.1", | ||
"version": "2.7.2-5b084e968", | ||
"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.12", | ||
"@libp2p/interface": "^2.6.0", | ||
"@libp2p/interface-internal": "^2.3.3", | ||
"@libp2p/logger": "^5.1.9", | ||
"@libp2p/multistream-select": "^6.0.15", | ||
"@libp2p/peer-collections": "^6.0.19", | ||
"@libp2p/peer-id": "^5.0.13", | ||
"@libp2p/peer-store": "^11.0.19", | ||
"@libp2p/utils": "^6.5.3", | ||
"@libp2p/crypto": "5.0.12-5b084e968", | ||
"@libp2p/interface": "2.6.0-5b084e968", | ||
"@libp2p/interface-internal": "2.3.4-5b084e968", | ||
"@libp2p/logger": "5.1.9-5b084e968", | ||
"@libp2p/multistream-select": "6.0.16-5b084e968", | ||
"@libp2p/peer-collections": "6.0.20-5b084e968", | ||
"@libp2p/peer-id": "5.0.13-5b084e968", | ||
"@libp2p/peer-store": "11.0.20-5b084e968", | ||
"@libp2p/utils": "6.5.4-5b084e968", | ||
"@multiformats/dns": "^1.0.6", | ||
@@ -120,3 +120,3 @@ "@multiformats/multiaddr": "^12.3.5", | ||
"race-event": "^1.3.0", | ||
"race-signal": "^1.1.0", | ||
"race-signal": "^1.1.2", | ||
"uint8arrays": "^5.1.0" | ||
@@ -123,0 +123,0 @@ }, |
@@ -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 | ||
@@ -31,3 +60,3 @@ | ||
To sum up, libp2p is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects. | ||
To sum up, libp2p is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects. | ||
@@ -74,3 +103,3 @@ # Roadmap | ||
```sh | ||
# run all the unit tsts | ||
# run all the unit tests | ||
> npm test | ||
@@ -148,3 +177,3 @@ | ||
- Go through the modules and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. | ||
- **Perform code reviews**. Most of this has been developed by @diasdavid, which means that more eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs. | ||
- **Perform code reviews**. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs. | ||
- **Add tests**. There can never be enough tests. | ||
@@ -151,0 +180,0 @@ |
@@ -263,5 +263,5 @@ /* eslint-disable complexity */ | ||
if (options?.type === 'dns-mapping' || this.dnsMappings.has(addr)) { | ||
const dnsMapingStartingConfidence = this.dnsMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL) | ||
const dnsMappingStartingConfidence = this.dnsMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL) | ||
if (!dnsMapingStartingConfidence && startingConfidence) { | ||
if (!dnsMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false | ||
@@ -272,5 +272,5 @@ } | ||
if (options?.type === 'ip-mapping' || this.ipMappings.has(addr)) { | ||
const ipMapingStartingConfidence = this.ipMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL) | ||
const ipMappingStartingConfidence = this.ipMappings.confirm(addr, options?.ttl ?? this.addressVerificationTTL) | ||
if (!ipMapingStartingConfidence && startingConfidence) { | ||
if (!ipMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false | ||
@@ -322,5 +322,5 @@ } | ||
if (this.dnsMappings.has(addr)) { | ||
const dnsMapingStartingConfidence = this.dnsMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry) | ||
const dnsMappingStartingConfidence = this.dnsMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry) | ||
if (!dnsMapingStartingConfidence && startingConfidence) { | ||
if (!dnsMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false | ||
@@ -331,5 +331,5 @@ } | ||
if (this.ipMappings.has(addr)) { | ||
const ipMapingStartingConfidence = this.ipMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry) | ||
const ipMappingStartingConfidence = this.ipMappings.unconfirm(addr, options?.ttl ?? this.addressVerificationRetry) | ||
if (!ipMapingStartingConfidence && startingConfidence) { | ||
if (!ipMappingStartingConfidence && startingConfidence) { | ||
startingConfidence = false | ||
@@ -336,0 +336,0 @@ } |
@@ -14,3 +14,3 @@ import { isPrivateIp } from '@libp2p/utils/private-ip' | ||
* Browsers are severely limited in their resource usage so don't waste time | ||
* trying to dial undiallable addresses, and they also print verbose error | ||
* trying to dial undialable addresses, and they also print verbose error | ||
* messages when making connections over insecure transports which causes | ||
@@ -17,0 +17,0 @@ * confusion. |
@@ -14,10 +14,10 @@ import { isLoopback } from '@libp2p/utils/multiaddr/is-loopback' | ||
export function reliableTransportsFirst (a: Address, b: Address): -1 | 0 | 1 { | ||
const isATCP = TCP.exactMatch(a.multiaddr) | ||
const isBTCP = TCP.exactMatch(b.multiaddr) | ||
const isATcp = TCP.exactMatch(a.multiaddr) | ||
const isBTcp = TCP.exactMatch(b.multiaddr) | ||
if (isATCP && !isBTCP) { | ||
if (isATcp && !isBTcp) { | ||
return -1 | ||
} | ||
if (!isATCP && isBTCP) { | ||
if (!isATcp && isBTcp) { | ||
return 1 | ||
@@ -24,0 +24,0 @@ } |
@@ -219,3 +219,3 @@ /* eslint-disable max-depth */ | ||
// load addresses from address book, resolve and dnsaddrs, filter | ||
// undiallables, add peer IDs, etc | ||
// undialables, add peer IDs, etc | ||
addrsToDial = await this.calculateMultiaddrs(peerId, options?.multiaddrs, { | ||
@@ -453,3 +453,3 @@ ...options, | ||
const gatedAdrs: Address[] = [] | ||
const gatedAddrs: Address[] = [] | ||
@@ -461,6 +461,6 @@ for (const addr of dedupedMultiaddrs) { | ||
gatedAdrs.push(addr) | ||
gatedAddrs.push(addr) | ||
} | ||
const sortedGatedAddrs = this.addressSorter == null ? defaultAddressSorter(gatedAdrs) : gatedAdrs.sort(this.addressSorter) | ||
const sortedGatedAddrs = this.addressSorter == null ? defaultAddressSorter(gatedAddrs) : gatedAddrs.sort(this.addressSorter) | ||
@@ -467,0 +467,0 @@ // make sure we actually have some addresses to dial |
@@ -69,2 +69,9 @@ export enum messages { | ||
export class NoSupportedAddressesError extends Error { | ||
constructor (message = 'No supported addresses') { | ||
super(message) | ||
this.name = 'NoSupportedAddressesError' | ||
} | ||
} | ||
export class ConnectionInterceptedError extends Error { | ||
@@ -71,0 +78,0 @@ constructor (message = 'Connection intercepted') { |
@@ -105,3 +105,3 @@ /** | ||
* Connection encrypters ensure that data sent over connections cannot be | ||
* eavesdropped on, and that the remote peer posesses the private key that | ||
* eavesdropped on, and that the remote peer possesses the private key that | ||
* corresponds to the public key that it's Peer ID is derived from. | ||
@@ -108,0 +108,0 @@ */ |
@@ -70,3 +70,3 @@ import { publicKeyFromProtobuf } from '@libp2p/crypto/keys' | ||
const nodeInfoName = init.nodeInfo?.name ?? pkg.name | ||
const nodeInfoVersion = init.nodeInfo?.version ?? pkg.name | ||
const nodeInfoVersion = init.nodeInfo?.version ?? pkg.version | ||
@@ -73,0 +73,0 @@ // @ts-expect-error defaultComponents is missing component types added later |
@@ -136,3 +136,3 @@ import { randomBytes } from '@libp2p/crypto' | ||
} catch (err) { | ||
this.log.error('randomwalk errored', err) | ||
this.log.error('random walk errored', err) | ||
@@ -148,3 +148,3 @@ this.safeDispatchEvent('walk:error', { | ||
.catch(err => { | ||
this.log.error('randomwalk errored', err) | ||
this.log.error('random walk errored', err) | ||
}) | ||
@@ -151,0 +151,0 @@ .finally(() => { |
@@ -416,3 +416,3 @@ import { InvalidMultiaddrError, TooManyInboundProtocolStreamsError, TooManyOutboundProtocolStreamsError, LimitedConnectionError, setMaxListeners, InvalidPeerIdError } from '@libp2p/interface' | ||
// after the handshake the returned stream can have early data so override | ||
// the souce/sink | ||
// the source/sink | ||
muxedStream.source = stream.source | ||
@@ -438,3 +438,3 @@ muxedStream.sink = stream.sink | ||
// If a protocol stream has been successfully negotiated and is to be passed to the application, | ||
// the peerstore should ensure that the peer is registered with that protocol | ||
// the peer store should ensure that the peer is registered with that protocol | ||
await this.components.peerStore.merge(remotePeer, { | ||
@@ -504,3 +504,3 @@ protocols: [protocol] | ||
// If a protocol stream has been successfully negotiated and is to be passed to the application, | ||
// the peerstore should ensure that the peer is registered with that protocol | ||
// the peer store should ensure that the peer is registered with that protocol | ||
await this.components.peerStore.merge(remotePeer, { | ||
@@ -511,3 +511,3 @@ protocols: [protocol] | ||
// after the handshake the returned stream can have early data so override | ||
// the souce/sink | ||
// the source/sink | ||
muxedStream.source = stream.source | ||
@@ -514,0 +514,0 @@ muxedStream.sink = stream.sink |
@@ -1,2 +0,2 @@ | ||
export const version = '2.7.1' | ||
export const version = '2.7.2-5b084e968' | ||
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
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
191
997872
173
12455
1
+ Added@libp2p/crypto@5.0.12-5b084e968(transitive)
+ Added@libp2p/interface@2.6.0-5b084e968(transitive)
+ Added@libp2p/interface-internal@2.3.4-5b084e968(transitive)
+ Added@libp2p/logger@5.1.9-5b084e968(transitive)
+ Added@libp2p/multistream-select@6.0.16-5b084e968(transitive)
+ Added@libp2p/peer-collections@6.0.20-5b084e968(transitive)
+ Added@libp2p/peer-id@5.0.13-5b084e968(transitive)
+ Added@libp2p/peer-record@8.0.20-5b084e968(transitive)
+ Added@libp2p/peer-store@11.0.20-5b084e968(transitive)
+ Added@libp2p/utils@6.5.4-5b084e968(transitive)
+ Addedasn1js@3.0.5(transitive)
+ Addedpvtsutils@1.3.6(transitive)
+ Addedpvutils@1.1.3(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@libp2p/crypto@5.0.15(transitive)
- Removed@libp2p/interface-internal@2.3.7(transitive)
- Removed@libp2p/multistream-select@6.0.19(transitive)
- Removed@libp2p/peer-collections@6.0.23(transitive)
- Removed@libp2p/peer-id@5.0.16(transitive)
- Removed@libp2p/peer-record@8.0.23(transitive)
- Removed@libp2p/peer-store@11.1.0(transitive)
- Removed@libp2p/utils@6.5.7(transitive)
Updatedrace-signal@^1.1.2