@libp2p/interface
Advanced tools
Comparing version 2.2.0-32ca76fcb to 2.2.0-656db81cf
@@ -8,5 +8,15 @@ import type { Connection, ConnectionLimits, MultiaddrConnection } from '../connection/index.js'; | ||
export interface ListenerEvents { | ||
'connection': CustomEvent<Connection>; | ||
/** | ||
* This event signals to the transport manager that the listening addresses | ||
* have changed and may be emitted at any point and/or multiple times | ||
*/ | ||
'listening': CustomEvent; | ||
/** | ||
* Emitted if listening on an address failed | ||
*/ | ||
'error': CustomEvent<Error>; | ||
/** | ||
* Emitted when the listener has been shut down, has no open connections and | ||
* will no longer accept new connections | ||
*/ | ||
'close': CustomEvent; | ||
@@ -31,5 +41,2 @@ } | ||
export declare const transportSymbol: unique symbol; | ||
export interface ConnectionHandler { | ||
(connection: Connection): void; | ||
} | ||
export interface MultiaddrFilter { | ||
@@ -39,5 +46,13 @@ (multiaddrs: Multiaddr[]): Multiaddr[]; | ||
export interface CreateListenerOptions { | ||
/** | ||
* The upgrader turns a MultiaddrConnection into a Connection and notifies | ||
* other libp2p components about a new incoming connection. | ||
*/ | ||
upgrader: Upgrader; | ||
} | ||
export interface DialTransportOptions<DialEvents extends ProgressEvent = ProgressEvent> extends AbortOptions, ProgressOptions<DialEvents> { | ||
/** | ||
* The upgrader turns a MultiaddrConnection into a Connection which should be | ||
* returned by the transport's dial method | ||
*/ | ||
upgrader: Upgrader; | ||
@@ -100,10 +115,11 @@ } | ||
/** | ||
* Upgrades an outbound connection on `transport.dial`. | ||
* Upgrades an outbound connection created by the `dial` method of a transport | ||
*/ | ||
upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>; | ||
/** | ||
* Upgrades an inbound connection on transport listener. | ||
* Upgrades an inbound connection received by a transport listener and | ||
* notifies other libp2p components about the new connection | ||
*/ | ||
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<Connection>; | ||
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@libp2p/interface", | ||
"version": "2.2.0-32ca76fcb", | ||
"version": "2.2.0-656db81cf", | ||
"description": "The interface implemented by a libp2p node", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -9,5 +9,17 @@ import type { Connection, ConnectionLimits, MultiaddrConnection } from '../connection/index.js' | ||
export interface ListenerEvents { | ||
'connection': CustomEvent<Connection> | ||
/** | ||
* This event signals to the transport manager that the listening addresses | ||
* have changed and may be emitted at any point and/or multiple times | ||
*/ | ||
'listening': CustomEvent | ||
/** | ||
* Emitted if listening on an address failed | ||
*/ | ||
'error': CustomEvent<Error> | ||
/** | ||
* Emitted when the listener has been shut down, has no open connections and | ||
* will no longer accept new connections | ||
*/ | ||
'close': CustomEvent | ||
@@ -35,7 +47,9 @@ } | ||
export interface ConnectionHandler { (connection: Connection): void } | ||
export interface MultiaddrFilter { (multiaddrs: Multiaddr[]): Multiaddr[] } | ||
export interface CreateListenerOptions { | ||
/** | ||
* The upgrader turns a MultiaddrConnection into a Connection and notifies | ||
* other libp2p components about a new incoming connection. | ||
*/ | ||
upgrader: Upgrader | ||
@@ -45,2 +59,6 @@ } | ||
export interface DialTransportOptions<DialEvents extends ProgressEvent = ProgressEvent> extends AbortOptions, ProgressOptions<DialEvents> { | ||
/** | ||
* The upgrader turns a MultiaddrConnection into a Connection which should be | ||
* returned by the transport's dial method | ||
*/ | ||
upgrader: Upgrader | ||
@@ -122,3 +140,3 @@ } | ||
/** | ||
* Upgrades an outbound connection on `transport.dial`. | ||
* Upgrades an outbound connection created by the `dial` method of a transport | ||
*/ | ||
@@ -128,5 +146,6 @@ upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection> | ||
/** | ||
* Upgrades an inbound connection on transport listener. | ||
* Upgrades an inbound connection received by a transport listener and | ||
* notifies other libp2p components about the new connection | ||
*/ | ||
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<Connection> | ||
upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void> | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302021
7467