Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/interfaces

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/interfaces - npm Package Compare versions

Comparing version 1.3.29 to 1.3.30

30

dist/src/components.js

@@ -59,46 +59,40 @@ import errCode from 'err-code';

async beforeStart() {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj;
await Promise.all(Object.values(this).filter(obj => isStartable(obj)).map(async (startable) => {
if (startable.beforeStart != null) {
await startable.beforeStart();
}
}
}));
}
async start() {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj;
await Promise.all(Object.values(this).filter(obj => isStartable(obj)).map(async (startable) => {
await startable.start();
}
}));
this.started = true;
}
async afterStart() {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj;
await Promise.all(Object.values(this).filter(obj => isStartable(obj)).map(async (startable) => {
if (startable.afterStart != null) {
await startable.afterStart();
}
}
}));
}
async beforeStop() {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj;
await Promise.all(Object.values(this).filter(obj => isStartable(obj)).map(async (startable) => {
if (startable.beforeStop != null) {
await startable.beforeStop();
}
}
}));
}
async stop() {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj;
await Promise.all(Object.values(this).filter(obj => isStartable(obj)).map(async (startable) => {
await startable.stop();
}
}));
this.started = false;
}
async afterStop() {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj;
await Promise.all(Object.values(this).filter(obj => isStartable(obj)).map(async (startable) => {
if (startable.afterStop != null) {
await startable.afterStop();
}
}
}));
}

@@ -105,0 +99,0 @@ setPeerId(peerId) {

import type { AbortOptions, EventEmitter } from '../index.js';
import type { Connection } from '../connection/index.js';
import type { PeerId } from '../peer-id/index.js';
import type { AddressSorter } from '../peer-store/index.js';
import type { Resolver } from '@multiformats/multiaddr';
export interface ConnectionManagerInit {
/**
* If true, try to connect to all discovered peers up to the connection manager limit
*/
autoDial?: boolean;
/**
* The maximum number of connections to keep open
*/
maxConnections: number;
/**
* The minimum number of connections to keep open
*/
minConnections: number;
/**
* How long to wait between attempting to keep our number of concurrent connections
* above minConnections
*/
autoDialInterval: number;
/**
* Sort the known addresses of a peer before trying to dial
*/
addressSorter?: AddressSorter;
/**
* Number of max concurrent dials
*/
maxParallelDials?: number;
/**
* Number of max addresses to dial for a given peer
*/
maxAddrsToDial?: number;
/**
* How long a dial attempt is allowed to take
*/
dialTimeout?: number;
/**
* Number of max concurrent dials per peer
*/
maxDialsPerPeer?: number;
/**
* Multiaddr resolvers to use when dialing
*/
resolvers?: Record<string, Resolver>;
}
export interface ConnectionManagerEvents {

@@ -50,0 +5,0 @@ 'peer:connect': CustomEvent<Connection>;

2

package.json
{
"name": "@libp2p/interfaces",
"version": "1.3.29",
"version": "1.3.30",
"description": "Interfaces for JS Libp2p",

@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT",

@@ -127,18 +127,18 @@ import errCode from 'err-code'

async beforeStart () {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj as Startable
if (startable.beforeStart != null) {
await startable.beforeStart()
}
}
await Promise.all(
Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {
if (startable.beforeStart != null) {
await startable.beforeStart()
}
})
)
}
async start () {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj as Startable
await Promise.all(
Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {
await startable.start()
})
)
await startable.start()
}
this.started = true

@@ -148,28 +148,28 @@ }

async afterStart () {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj as Startable
if (startable.afterStart != null) {
await startable.afterStart()
}
}
await Promise.all(
Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {
if (startable.afterStart != null) {
await startable.afterStart()
}
})
)
}
async beforeStop () {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj as Startable
if (startable.beforeStop != null) {
await startable.beforeStop()
}
}
await Promise.all(
Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {
if (startable.beforeStop != null) {
await startable.beforeStop()
}
})
)
}
async stop () {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj as Startable
await Promise.all(
Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {
await startable.stop()
})
)
await startable.stop()
}
this.started = false

@@ -179,9 +179,9 @@ }

async afterStop () {
for (const obj of Object.values(this).filter(obj => isStartable(obj))) {
const startable = obj as Startable
if (startable.afterStop != null) {
await startable.afterStop()
}
}
await Promise.all(
Object.values(this).filter(obj => isStartable(obj)).map(async (startable: Startable) => {
if (startable.afterStop != null) {
await startable.afterStop()
}
})
)
}

@@ -188,0 +188,0 @@

import type { AbortOptions, EventEmitter } from '../index.js'
import type { Connection } from '../connection/index.js'
import type { PeerId } from '../peer-id/index.js'
import type { AddressSorter } from '../peer-store/index.js'
import type { Resolver } from '@multiformats/multiaddr'
export interface ConnectionManagerInit {
/**
* If true, try to connect to all discovered peers up to the connection manager limit
*/
autoDial?: boolean
/**
* The maximum number of connections to keep open
*/
maxConnections: number
/**
* The minimum number of connections to keep open
*/
minConnections: number
/**
* How long to wait between attempting to keep our number of concurrent connections
* above minConnections
*/
autoDialInterval: number
/**
* Sort the known addresses of a peer before trying to dial
*/
addressSorter?: AddressSorter
/**
* Number of max concurrent dials
*/
maxParallelDials?: number
/**
* Number of max addresses to dial for a given peer
*/
maxAddrsToDial?: number
/**
* How long a dial attempt is allowed to take
*/
dialTimeout?: number
/**
* Number of max concurrent dials per peer
*/
maxDialsPerPeer?: number
/**
* Multiaddr resolvers to use when dialing
*/
resolvers?: Record<string, Resolver>
}
export interface ConnectionManagerEvents {

@@ -61,0 +6,0 @@ 'peer:connect': CustomEvent<Connection>

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