New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

libp2p

Package Overview
Dependencies
Maintainers
0
Versions
1051
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libp2p - npm Package Compare versions

Comparing version 2.5.2-34b3c14b8 to 2.5.2-6e52ee346

dist/src/user-agent.browser.d.ts

2

dist/src/index.d.ts

@@ -44,3 +44,3 @@ /**

*/
nodeInfo?: NodeInfo;
nodeInfo?: Partial<NodeInfo>;
/**

@@ -47,0 +47,0 @@ * Addresses for transport listening and to advertise to the network

@@ -5,4 +5,3 @@ import { TypedEventEmitter } from '@libp2p/interface';

import type { Libp2p as Libp2pInterface, Libp2pInit } from './index.js';
import type { PeerRouting, ContentRouting, Libp2pEvents, PendingDial, ServiceMap, AbortOptions, ComponentLogger, Connection, NewStreamOptions, Stream, Metrics, PeerId, PeerStore, Topology, Libp2pStatus, IsDialableOptions, DialOptions, PublicKey, Ed25519PeerId, Secp256k1PeerId, RSAPublicKey, RSAPeerId, URLPeerId, Ed25519PublicKey, Secp256k1PublicKey } from '@libp2p/interface';
import type { StreamHandler, StreamHandlerOptions } from '@libp2p/interface-internal';
import type { PeerRouting, ContentRouting, Libp2pEvents, PendingDial, ServiceMap, AbortOptions, ComponentLogger, Connection, NewStreamOptions, Stream, Metrics, PeerId, PeerStore, Topology, Libp2pStatus, IsDialableOptions, DialOptions, PublicKey, Ed25519PeerId, Secp256k1PeerId, RSAPublicKey, RSAPeerId, URLPeerId, Ed25519PublicKey, Secp256k1PublicKey, StreamHandler, StreamHandlerOptions } from '@libp2p/interface';
export declare class Libp2p<T extends ServiceMap = ServiceMap> extends TypedEventEmitter<Libp2pEvents> implements Libp2pInterface<T> {

@@ -9,0 +8,0 @@ #private;

@@ -19,5 +19,6 @@ import { publicKeyFromProtobuf } from '@libp2p/crypto/keys';

import { RandomWalk } from './random-walk.js';
import { DefaultRegistrar } from './registrar.js';
import { Registrar } from './registrar.js';
import { DefaultTransportManager } from './transport-manager.js';
import { DefaultUpgrader } from './upgrader.js';
import { userAgent } from './user-agent.js';
import * as pkg from './version.js';

@@ -54,2 +55,4 @@ export class Libp2p extends TypedEventEmitter {

this.services = {};
const nodeInfoName = init.nodeInfo?.name ?? pkg.name;
const nodeInfoVersion = init.nodeInfo?.version ?? pkg.name;
// @ts-expect-error defaultComponents is missing component types added later

@@ -59,5 +62,6 @@ const components = this.components = defaultComponents({

privateKey: init.privateKey,
nodeInfo: init.nodeInfo ?? {
name: pkg.name,
version: pkg.version
nodeInfo: {
name: nodeInfoName,
version: nodeInfoVersion,
userAgent: init.nodeInfo?.userAgent ?? userAgent(nodeInfoName, nodeInfoVersion)
},

@@ -108,3 +112,3 @@ logger: this.logger,

// Create the Registrar
this.configureComponent('registrar', new DefaultRegistrar(this.components));
this.configureComponent('registrar', new Registrar(this.components));
// Addresses {listen, announce, noAnnounce}

@@ -111,0 +115,0 @@ this.configureComponent('addressManager', new AddressManager(this.components, init.addresses));

@@ -1,3 +0,3 @@

import type { IdentifyResult, Libp2pEvents, PeerUpdate, TypedEventTarget, PeerId, PeerStore, Topology } from '@libp2p/interface';
import type { StreamHandlerOptions, StreamHandlerRecord, Registrar, StreamHandler } from '@libp2p/interface-internal';
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 { ComponentLogger } from '@libp2p/logger';

@@ -15,3 +15,3 @@ export declare const DEFAULT_MAX_INBOUND_STREAMS = 32;

*/
export declare class DefaultRegistrar implements Registrar {
export declare class Registrar implements RegistrarInterface {
private readonly log;

@@ -18,0 +18,0 @@ private readonly topologies;

@@ -9,3 +9,3 @@ import { InvalidParametersError } from '@libp2p/interface';

*/
export class DefaultRegistrar {
export class Registrar {
log;

@@ -53,3 +53,3 @@ topologies;

async handle(protocol, handler, opts) {
if (this.handlers.has(protocol)) {
if (this.handlers.has(protocol) && opts?.force !== true) {
throw new errorsJs.DuplicateProtocolHandlerError(`Handler already registered for protocol ${protocol}`);

@@ -56,0 +56,0 @@ }

@@ -1,3 +0,3 @@

export declare const version = "2.5.2-34b3c14b8";
export declare const version = "2.5.2-6e52ee346";
export declare const name = "js-libp2p";
//# sourceMappingURL=version.d.ts.map

@@ -1,3 +0,3 @@

export const version = '2.5.2-34b3c14b8';
export const version = '2.5.2-6e52ee346';
export const name = 'js-libp2p';
//# sourceMappingURL=version.js.map
{
"name": "libp2p",
"version": "2.5.2-34b3c14b8",
"version": "2.5.2-6e52ee346",
"description": "JavaScript implementation of libp2p, a modular peer to peer network stack",

@@ -55,2 +55,6 @@ "license": "Apache-2.0 OR MIT",

},
"./user-agent": {
"types": "./dist/src/user-agent.d.ts",
"import": "./dist/src/user-agent.js"
},
"./version": {

@@ -91,11 +95,11 @@ "types": "./dist/src/version.d.ts",

"@chainsafe/netmask": "^2.0.0",
"@libp2p/crypto": "5.0.10-34b3c14b8",
"@libp2p/interface": "2.4.1-34b3c14b8",
"@libp2p/interface-internal": "2.2.4-34b3c14b8",
"@libp2p/logger": "5.1.7-34b3c14b8",
"@libp2p/multistream-select": "6.0.12-34b3c14b8",
"@libp2p/peer-collections": "6.0.16-34b3c14b8",
"@libp2p/peer-id": "5.0.11-34b3c14b8",
"@libp2p/peer-store": "11.0.16-34b3c14b8",
"@libp2p/utils": "6.5.0-34b3c14b8",
"@libp2p/crypto": "5.0.10-6e52ee346",
"@libp2p/interface": "2.4.1-6e52ee346",
"@libp2p/interface-internal": "2.2.4-6e52ee346",
"@libp2p/logger": "5.1.7-6e52ee346",
"@libp2p/multistream-select": "6.0.12-6e52ee346",
"@libp2p/peer-collections": "6.0.16-6e52ee346",
"@libp2p/peer-id": "5.0.11-6e52ee346",
"@libp2p/peer-store": "11.0.16-6e52ee346",
"@libp2p/utils": "6.5.0-6e52ee346",
"@multiformats/dns": "^1.0.6",

@@ -133,13 +137,16 @@ "@multiformats/multiaddr": "^12.3.5",

"sinon-ts": "^2.0.0",
"uint8arraylist": "^2.4.8"
"uint8arraylist": "^2.4.8",
"wherearewe": "^2.0.1"
},
"browser": {
"./dist/src/connection-manager/constants.js": "./dist/src/connection-manager/constants.browser.js",
"./dist/src/config/connection-gater.js": "./dist/src/config/connection-gater.browser.js"
"./dist/src/config/connection-gater.js": "./dist/src/config/connection-gater.browser.js",
"./dist/src/user-agent.js": "./dist/src/user-agent.browser.js"
},
"react-native": {
"./dist/src/connection-manager/constants.js": "./dist/src/connection-manager/constants.browser.js",
"./dist/src/config/connection-gater.js": "./dist/src/config/connection-gater.browser.js"
"./dist/src/config/connection-gater.js": "./dist/src/config/connection-gater.browser.js",
"./dist/src/user-agent.js": "./dist/src/user-agent.react-native.js"
},
"sideEffects": false
}

@@ -53,3 +53,3 @@ /**

*/
nodeInfo?: NodeInfo
nodeInfo?: Partial<NodeInfo>

@@ -56,0 +56,0 @@ /**

@@ -19,10 +19,10 @@ import { publicKeyFromProtobuf } from '@libp2p/crypto/keys'

import { RandomWalk } from './random-walk.js'
import { DefaultRegistrar } from './registrar.js'
import { Registrar } from './registrar.js'
import { DefaultTransportManager } from './transport-manager.js'
import { DefaultUpgrader } from './upgrader.js'
import { userAgent } from './user-agent.js'
import * as pkg from './version.js'
import type { Components } from './components.js'
import type { Libp2p as Libp2pInterface, Libp2pInit } from './index.js'
import type { PeerRouting, ContentRouting, Libp2pEvents, PendingDial, ServiceMap, AbortOptions, ComponentLogger, Logger, Connection, NewStreamOptions, Stream, Metrics, PeerId, PeerInfo, PeerStore, Topology, Libp2pStatus, IsDialableOptions, DialOptions, PublicKey, Ed25519PeerId, Secp256k1PeerId, RSAPublicKey, RSAPeerId, URLPeerId, Ed25519PublicKey, Secp256k1PublicKey } from '@libp2p/interface'
import type { StreamHandler, StreamHandlerOptions } from '@libp2p/interface-internal'
import type { PeerRouting, ContentRouting, Libp2pEvents, PendingDial, ServiceMap, AbortOptions, ComponentLogger, Logger, Connection, NewStreamOptions, Stream, Metrics, PeerId, PeerInfo, PeerStore, Topology, Libp2pStatus, IsDialableOptions, DialOptions, PublicKey, Ed25519PeerId, Secp256k1PeerId, RSAPublicKey, RSAPeerId, URLPeerId, Ed25519PublicKey, Secp256k1PublicKey, StreamHandler, StreamHandlerOptions } from '@libp2p/interface'

@@ -68,2 +68,6 @@ export class Libp2p<T extends ServiceMap = ServiceMap> extends TypedEventEmitter<Libp2pEvents> implements Libp2pInterface<T> {

this.services = {}
const nodeInfoName = init.nodeInfo?.name ?? pkg.name
const nodeInfoVersion = init.nodeInfo?.version ?? pkg.name
// @ts-expect-error defaultComponents is missing component types added later

@@ -73,5 +77,6 @@ const components = this.components = defaultComponents({

privateKey: init.privateKey,
nodeInfo: init.nodeInfo ?? {
name: pkg.name,
version: pkg.version
nodeInfo: {
name: nodeInfoName,
version: nodeInfoVersion,
userAgent: init.nodeInfo?.userAgent ?? userAgent(nodeInfoName, nodeInfoVersion)
},

@@ -132,3 +137,3 @@ logger: this.logger,

// Create the Registrar
this.configureComponent('registrar', new DefaultRegistrar(this.components))
this.configureComponent('registrar', new Registrar(this.components))

@@ -135,0 +140,0 @@ // Addresses {listen, announce, noAnnounce}

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 } from '@libp2p/interface'
import type { StreamHandlerOptions, StreamHandlerRecord, Registrar, StreamHandler } from '@libp2p/interface-internal'
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 { ComponentLogger } from '@libp2p/logger'

@@ -21,3 +21,3 @@

*/
export class DefaultRegistrar implements Registrar {
export class Registrar implements RegistrarInterface {
private readonly log: Logger

@@ -77,3 +77,3 @@ private readonly topologies: Map<string, Map<string, Topology>>

async handle (protocol: string, handler: StreamHandler, opts?: StreamHandlerOptions): Promise<void> {
if (this.handlers.has(protocol)) {
if (this.handlers.has(protocol) && opts?.force !== true) {
throw new errorsJs.DuplicateProtocolHandlerError(`Handler already registered for protocol ${protocol}`)

@@ -80,0 +80,0 @@ }

@@ -1,2 +0,2 @@

export const version = '2.5.2-34b3c14b8'
export const version = '2.5.2-6e52ee346'
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc