🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@libp2p/interface

Package Overview
Dependencies
Maintainers
6
Versions
686
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/interface - npm Package Compare versions

Comparing version

to
1.6.0-151bc46fb

3

dist/src/peer-id/index.d.ts

@@ -17,2 +17,5 @@ import type { KeyType } from '../keys/index.js';

}
export interface URLPeerId extends PeerId {
readonly type: 'url';
}
export interface PeerId {

@@ -19,0 +22,0 @@ type: PeerIdType;

17

dist/src/transport/index.d.ts

@@ -6,2 +6,3 @@ import type { Connection, MultiaddrConnection } from '../connection/index.js';

import type { Multiaddr } from '@multiformats/multiaddr';
import type { ProgressOptions, ProgressEvent } from 'progress-events';
export interface ListenerEvents {

@@ -40,9 +41,9 @@ 'connection': CustomEvent<Connection>;

}
export interface DialOptions extends AbortOptions {
export interface DialOptions<DialEvents extends ProgressEvent = ProgressEvent> extends AbortOptions, ProgressOptions<DialEvents> {
upgrader: Upgrader;
}
/**
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
* A libp2p transport offers dial and listen methods to establish connections.
*/
export interface Transport {
export interface Transport<DialEvents extends ProgressEvent = ProgressEvent> {
/**

@@ -59,3 +60,3 @@ * Used to identify the transport

*/
dial(ma: Multiaddr, options: DialOptions): Promise<Connection>;
dial(ma: Multiaddr, options: DialOptions<DialEvents>): Promise<Connection>;
/**

@@ -90,3 +91,3 @@ * Create transport listeners.

}
export interface UpgraderOptions {
export interface UpgraderOptions<ConnectionUpgradeEvents extends ProgressEvent = ProgressEvent> extends ProgressOptions<ConnectionUpgradeEvents> {
skipEncryption?: boolean;

@@ -101,2 +102,4 @@ skipProtection?: boolean;

}
export type InboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-inbound-connection'> | ProgressEvent<'upgrader:multiplex-inbound-connection'>;
export type OutboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-outbound-connection'> | ProgressEvent<'upgrader:multiplex-outbound-connection'>;
export interface Upgrader {

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

*/
upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>;
upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>;
/**
* Upgrades an inbound connection on transport listener.
*/
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>;
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<Connection>;
}
//# sourceMappingURL=index.d.ts.map
{
"name": "@libp2p/interface",
"version": "1.5.0",
"version": "1.6.0-151bc46fb",
"description": "The interface implemented by a libp2p node",

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

@@ -22,2 +22,6 @@ import type { KeyType } from '../keys/index.js'

export interface URLPeerId extends PeerId {
readonly type: 'url'
}
export interface PeerId {

@@ -24,0 +28,0 @@ type: PeerIdType

@@ -6,2 +6,3 @@ import type { Connection, MultiaddrConnection } from '../connection/index.js'

import type { Multiaddr } from '@multiformats/multiaddr'
import type { ProgressOptions, ProgressEvent } from 'progress-events'

@@ -43,3 +44,3 @@ export interface ListenerEvents {

export interface DialOptions extends AbortOptions {
export interface DialOptions<DialEvents extends ProgressEvent = ProgressEvent> extends AbortOptions, ProgressOptions<DialEvents> {
upgrader: Upgrader

@@ -49,5 +50,5 @@ }

/**
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
* A libp2p transport offers dial and listen methods to establish connections.
*/
export interface Transport {
export interface Transport<DialEvents extends ProgressEvent = ProgressEvent> {
/**

@@ -66,3 +67,3 @@ * Used to identify the transport

*/
dial(ma: Multiaddr, options: DialOptions): Promise<Connection>
dial(ma: Multiaddr, options: DialOptions<DialEvents>): Promise<Connection>

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

export interface UpgraderOptions {
export interface UpgraderOptions<ConnectionUpgradeEvents extends ProgressEvent = ProgressEvent> extends ProgressOptions<ConnectionUpgradeEvents> {
skipEncryption?: boolean

@@ -119,2 +120,10 @@ skipProtection?: boolean

export type InboundConnectionUpgradeEvents =
ProgressEvent<'upgrader:encrypt-inbound-connection'> |
ProgressEvent<'upgrader:multiplex-inbound-connection'>
export type OutboundConnectionUpgradeEvents =
ProgressEvent<'upgrader:encrypt-outbound-connection'> |
ProgressEvent<'upgrader:multiplex-outbound-connection'>
export interface Upgrader {

@@ -124,3 +133,3 @@ /**

*/
upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>
upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>

@@ -130,3 +139,3 @@ /**

*/
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions): Promise<Connection>
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<Connection>
}

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