@libp2p/interface
Advanced tools
Comparing version 2.2.0-02f285fc8 to 2.2.0-05d559f54
@@ -8,4 +8,15 @@ import type { Connection, ConnectionLimits, MultiaddrConnection } from '../connection/index.js'; | ||
export interface ListenerEvents { | ||
/** | ||
* 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; | ||
@@ -30,5 +41,2 @@ } | ||
export declare const transportSymbol: unique symbol; | ||
export interface ConnectionHandler { | ||
(connection: Connection): void; | ||
} | ||
export interface MultiaddrFilter { | ||
@@ -38,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; | ||
@@ -99,7 +115,8 @@ } | ||
/** | ||
* 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 received by a transport listener | ||
* Upgrades an inbound connection received by a transport listener and | ||
* notifies other libp2p components about the new connection | ||
*/ | ||
@@ -106,0 +123,0 @@ upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void>; |
{ | ||
"name": "@libp2p/interface", | ||
"version": "2.2.0-02f285fc8", | ||
"version": "2.2.0-05d559f54", | ||
"description": "The interface implemented by a libp2p node", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -9,4 +9,17 @@ import type { Connection, ConnectionLimits, MultiaddrConnection } from '../connection/index.js' | ||
export interface ListenerEvents { | ||
/** | ||
* 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 | ||
@@ -34,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 | ||
@@ -44,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 | ||
@@ -121,3 +140,3 @@ } | ||
/** | ||
* Upgrades an outbound connection on `transport.dial` | ||
* Upgrades an outbound connection created by the `dial` method of a transport | ||
*/ | ||
@@ -127,5 +146,6 @@ upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection> | ||
/** | ||
* Upgrades an inbound connection received by a 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<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