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.11 to 1.3.12

87

dist/src/connection/index.d.ts

@@ -5,2 +5,3 @@ import type { Multiaddr } from '@multiformats/multiaddr';

import type { Duplex } from 'it-stream-types';
import type { MultiaddrConnection } from '../transport';
export interface Timeline {

@@ -59,2 +60,88 @@ open: number;

}
export interface ConnectionGater {
/**
* denyDialMultiaddr tests whether we're permitted to Dial the
* specified peer.
*
* This is called by the dialer.connectToPeer implementation before
* dialling a peer.
*
* Return true to prevent dialing the passed peer.
*/
denyDialPeer: (peerId: PeerId) => Promise<boolean>;
/**
* denyDialMultiaddr tests whether we're permitted to dial the specified
* multiaddr for the given peer.
*
* This is called by the dialer.connectToPeer implementation after it has
* resolved the peer's addrs, and prior to dialling each.
*
* Return true to prevent dialing the passed peer on the passed multiaddr.
*/
denyDialMultiaddr: (peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>;
/**
* denyInboundConnection tests whether an incipient inbound connection is allowed.
*
* This is called by the upgrader, or by the transport directly (e.g. QUIC,
* Bluetooth), straight after it has accepted a connection from its socket.
*
* Return true to deny the incoming passed connection.
*/
denyInboundConnection: (maConn: MultiaddrConnection) => Promise<boolean>;
/**
* denyOutboundConnection tests whether an incipient outbound connection is allowed.
*
* This is called by the upgrader, or by the transport directly (e.g. QUIC,
* Bluetooth), straight after it has created a connection with its socket.
*
* Return true to deny the incoming passed connection.
*/
denyOutboundConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>;
/**
* denyInboundEncryptedConnection tests whether a given connection, now encrypted,
* is allowed.
*
* This is called by the upgrader, after it has performed the security
* handshake, and before it negotiates the muxer, or by the directly by the
* transport, at the exact same checkpoint.
*
* Return true to deny the passed secured connection.
*/
denyInboundEncryptedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>;
/**
* denyOutboundEncryptedConnection tests whether a given connection, now encrypted,
* is allowed.
*
* This is called by the upgrader, after it has performed the security
* handshake, and before it negotiates the muxer, or by the directly by the
* transport, at the exact same checkpoint.
*
* Return true to deny the passed secured connection.
*/
denyOutboundEncryptedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>;
/**
* denyInboundUpgradedConnection tests whether a fully capable connection is allowed.
*
* This is called after encryption has been negotiated and the connection has been
* multiplexed, if a multiplexer is configured.
*
* Return true to deny the passed upgraded connection.
*/
denyInboundUpgradedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>;
/**
* denyOutboundUpgradedConnection tests whether a fully capable connection is allowed.
*
* This is called after encryption has been negotiated and the connection has been
* multiplexed, if a multiplexer is configured.
*
* Return true to deny the passed upgraded connection.
*/
denyOutboundUpgradedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>;
/**
* Used by the address book to filter passed addresses.
*
* Return true to allow storing the passed multiaddr for the passed peer.
*/
filterMultiaddrForPeer: (peer: PeerId, multiaddr: Multiaddr) => Promise<boolean>;
}
//# sourceMappingURL=index.d.ts.map

8

dist/src/content-routing/index.d.ts

@@ -1,5 +0,4 @@

import type { PeerId } from '../peer-id';
import type { Multiaddr } from '@multiformats/multiaddr';
import type { CID } from 'multiformats/cid';
import type { AbortOptions } from '../index';
import type { PeerData } from '../peer-data';
export interface ContentRoutingFactory {

@@ -10,8 +9,5 @@ new (options?: any): ContentRouting;

provide: (cid: CID, options: AbortOptions) => Promise<void>;
findProviders: (cid: CID, options: AbortOptions) => AsyncIterable<{
id: PeerId;
multiaddrs: Multiaddr[];
}>;
findProviders: (cid: CID, options: AbortOptions) => AsyncIterable<PeerData>;
}
export default ContentRouting;
//# sourceMappingURL=index.d.ts.map

@@ -19,2 +19,4 @@ import type { PeerId } from './peer-id/index.js';

}) => Promise<ProtocolStream>;
getTokens: (count: number) => number[];
releaseToken: (token: number) => void;
}

@@ -21,0 +23,0 @@ export interface Addressable {

@@ -99,3 +99,3 @@ import type { Startable } from '..';

*/
getComponentMetrics: () => Map<string, Map<string, Map<string, string>>>;
getComponentMetrics: () => Map<string, Map<string, Map<string, number>>>;
/**

@@ -102,0 +102,0 @@ * Update the stored metric value for the given system and component

import type { PeerId } from '../peer-id';
import type { Multiaddr } from '@multiformats/multiaddr';
import type { PeerData } from '../peer-data';
export interface PeerRoutingFactory {

@@ -7,12 +7,6 @@ new (options?: any): PeerRouting;

export interface PeerRouting {
findPeer: (peerId: PeerId, options?: Object) => Promise<{
id: PeerId;
multiaddrs: Multiaddr[];
}>;
getClosestPeers: (key: Uint8Array, options?: Object) => AsyncIterable<{
id: PeerId;
multiaddrs: Multiaddr[];
}>;
findPeer: (peerId: PeerId, options?: Object) => Promise<PeerData>;
getClosestPeers: (key: Uint8Array, options?: Object) => AsyncIterable<PeerData>;
}
export default PeerRouting;
//# sourceMappingURL=index.d.ts.map

@@ -16,2 +16,5 @@ import type { PeerId } from '../peer-id/index.js';

}
export interface AddressSorter {
(ms: Address[]): Address[];
}
export interface Peer {

@@ -106,3 +109,3 @@ /**

*/
getMultiaddrsForPeer: (peerId: PeerId, addressSorter?: (ms: Address[]) => Address[]) => Promise<Multiaddr[]>;
getMultiaddrsForPeer: (peerId: PeerId, addressSorter?: AddressSorter) => Promise<Multiaddr[]>;
}

@@ -109,0 +112,0 @@ /**

@@ -12,2 +12,3 @@ import type { EventEmitter } from '../index.js';

'peer:connect': CustomEvent<Connection>;
'peer:disconnect': CustomEvent<Connection>;
}

@@ -14,0 +15,0 @@ export interface ConnectionManager extends EventEmitter<ConnectionManagerEvents> {

{
"name": "@libp2p/interfaces",
"version": "1.3.11",
"version": "1.3.12",
"description": "Interfaces for JS Libp2p",

@@ -221,4 +221,4 @@ "license": "Apache-2.0 OR MIT",

"dependencies": {
"@multiformats/multiaddr": "^10.1.1",
"multiformats": "^9.4.10"
"@multiformats/multiaddr": "^10.1.5",
"multiformats": "^9.6.3"
},

@@ -225,0 +225,0 @@ "devDependencies": {

@@ -5,2 +5,3 @@ import type { Multiaddr } from '@multiformats/multiaddr'

import type { Duplex } from 'it-stream-types'
import type { MultiaddrConnection } from '../transport'

@@ -66,1 +67,96 @@ export interface Timeline {

}
export interface ConnectionGater {
/**
* denyDialMultiaddr tests whether we're permitted to Dial the
* specified peer.
*
* This is called by the dialer.connectToPeer implementation before
* dialling a peer.
*
* Return true to prevent dialing the passed peer.
*/
denyDialPeer: (peerId: PeerId) => Promise<boolean>
/**
* denyDialMultiaddr tests whether we're permitted to dial the specified
* multiaddr for the given peer.
*
* This is called by the dialer.connectToPeer implementation after it has
* resolved the peer's addrs, and prior to dialling each.
*
* Return true to prevent dialing the passed peer on the passed multiaddr.
*/
denyDialMultiaddr: (peerId: PeerId, multiaddr: Multiaddr) => Promise<boolean>
/**
* denyInboundConnection tests whether an incipient inbound connection is allowed.
*
* This is called by the upgrader, or by the transport directly (e.g. QUIC,
* Bluetooth), straight after it has accepted a connection from its socket.
*
* Return true to deny the incoming passed connection.
*/
denyInboundConnection: (maConn: MultiaddrConnection) => Promise<boolean>
/**
* denyOutboundConnection tests whether an incipient outbound connection is allowed.
*
* This is called by the upgrader, or by the transport directly (e.g. QUIC,
* Bluetooth), straight after it has created a connection with its socket.
*
* Return true to deny the incoming passed connection.
*/
denyOutboundConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>
/**
* denyInboundEncryptedConnection tests whether a given connection, now encrypted,
* is allowed.
*
* This is called by the upgrader, after it has performed the security
* handshake, and before it negotiates the muxer, or by the directly by the
* transport, at the exact same checkpoint.
*
* Return true to deny the passed secured connection.
*/
denyInboundEncryptedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>
/**
* denyOutboundEncryptedConnection tests whether a given connection, now encrypted,
* is allowed.
*
* This is called by the upgrader, after it has performed the security
* handshake, and before it negotiates the muxer, or by the directly by the
* transport, at the exact same checkpoint.
*
* Return true to deny the passed secured connection.
*/
denyOutboundEncryptedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>
/**
* denyInboundUpgradedConnection tests whether a fully capable connection is allowed.
*
* This is called after encryption has been negotiated and the connection has been
* multiplexed, if a multiplexer is configured.
*
* Return true to deny the passed upgraded connection.
*/
denyInboundUpgradedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>
/**
* denyOutboundUpgradedConnection tests whether a fully capable connection is allowed.
*
* This is called after encryption has been negotiated and the connection has been
* multiplexed, if a multiplexer is configured.
*
* Return true to deny the passed upgraded connection.
*/
denyOutboundUpgradedConnection: (peerId: PeerId, maConn: MultiaddrConnection) => Promise<boolean>
/**
* Used by the address book to filter passed addresses.
*
* Return true to allow storing the passed multiaddr for the passed peer.
*/
filterMultiaddrForPeer: (peer: PeerId, multiaddr: Multiaddr) => Promise<boolean>
}

@@ -1,5 +0,4 @@

import type { PeerId } from '../peer-id'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { CID } from 'multiformats/cid'
import type { AbortOptions } from '../index'
import type { PeerData } from '../peer-data'

@@ -12,5 +11,5 @@ export interface ContentRoutingFactory {

provide: (cid: CID, options: AbortOptions) => Promise<void>
findProviders: (cid: CID, options: AbortOptions) => AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>
findProviders: (cid: CID, options: AbortOptions) => AsyncIterable<PeerData>
}
export default ContentRouting

@@ -18,2 +18,4 @@ import type { PeerId } from './peer-id/index.js'

dialProtocol: (peer: PeerId, protocol: string, options?: { signal?: AbortSignal }) => Promise<ProtocolStream>
getTokens: (count: number) => number[]
releaseToken: (token: number) => void
}

@@ -20,0 +22,0 @@

@@ -114,3 +114,3 @@ import type { Startable } from '..'

*/
getComponentMetrics: () => Map<string, Map<string, Map<string, string>>>
getComponentMetrics: () => Map<string, Map<string, Map<string, number>>>

@@ -117,0 +117,0 @@ /**

import type { PeerId } from '../peer-id'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { PeerData } from '../peer-data'

@@ -9,6 +9,6 @@ export interface PeerRoutingFactory {

export interface PeerRouting {
findPeer: (peerId: PeerId, options?: Object) => Promise<{ id: PeerId, multiaddrs: Multiaddr[] }>
getClosestPeers: (key: Uint8Array, options?: Object) => AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>
findPeer: (peerId: PeerId, options?: Object) => Promise<PeerData>
getClosestPeers: (key: Uint8Array, options?: Object) => AsyncIterable<PeerData>
}
export default PeerRouting

@@ -19,2 +19,6 @@ import type { PeerId } from '../peer-id/index.js'

export interface AddressSorter {
(ms: Address[]): Address[]
}
export interface Peer {

@@ -127,3 +131,3 @@ /**

*/
getMultiaddrsForPeer: (peerId: PeerId, addressSorter?: (ms: Address[]) => Address[]) => Promise<Multiaddr[]>
getMultiaddrsForPeer: (peerId: PeerId, addressSorter?: AddressSorter) => Promise<Multiaddr[]>
}

@@ -130,0 +134,0 @@

@@ -14,2 +14,3 @@ import type { EventEmitter } from '../index.js'

'peer:connect': CustomEvent<Connection>
'peer:disconnect': CustomEvent<Connection>
}

@@ -16,0 +17,0 @@

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

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