@libp2p/interface
Advanced tools
Comparing version
@@ -28,2 +28,3 @@ /** | ||
import type { Listener, OutboundConnectionUpgradeEvents } from './transport.js'; | ||
import type { DNS } from '@multiformats/dns'; | ||
import type { Multiaddr } from '@multiformats/multiaddr'; | ||
@@ -159,3 +160,23 @@ import type { TypedEventTarget } from 'main-event'; | ||
} | ||
export interface MultiaddrResolveOptions extends AbortOptions, LoggerOptions { | ||
/** | ||
* An optional DNS resolver | ||
*/ | ||
dns?: DNS; | ||
} | ||
/** | ||
* `MultiaddrResolver`s perform resolution of multiaddr components that require | ||
* translation by external systems (for example DNSADDR to TXT records). | ||
*/ | ||
export interface MultiaddrResolver { | ||
/** | ||
* Returns true if this resolver can resolve components of this multiaddr | ||
*/ | ||
canResolve(address: Multiaddr): boolean; | ||
/** | ||
* Returns one or more multiaddrs with components resolved to other values | ||
*/ | ||
resolve(address: Multiaddr, options: MultiaddrResolveOptions): Promise<Multiaddr[]>; | ||
} | ||
/** | ||
* Once you have a libp2p instance, you can listen to several events it emits, | ||
@@ -162,0 +183,0 @@ * so that you can be notified of relevant network events. |
{ | ||
"name": "@libp2p/interface", | ||
"version": "2.10.4", | ||
"version": "2.10.5-57e7fa441", | ||
"description": "The interface implemented by a libp2p node", | ||
@@ -44,2 +44,3 @@ "license": "Apache-2.0 OR MIT", | ||
"dependencies": { | ||
"@multiformats/dns": "^1.0.6", | ||
"@multiformats/multiaddr": "^12.4.4", | ||
@@ -46,0 +47,0 @@ "it-pushable": "^3.2.3", |
@@ -29,2 +29,3 @@ /** | ||
import type { Listener, OutboundConnectionUpgradeEvents } from './transport.js' | ||
import type { DNS } from '@multiformats/dns' | ||
import type { Multiaddr } from '@multiformats/multiaddr' | ||
@@ -177,3 +178,26 @@ import type { TypedEventTarget } from 'main-event' | ||
export interface MultiaddrResolveOptions extends AbortOptions, LoggerOptions { | ||
/** | ||
* An optional DNS resolver | ||
*/ | ||
dns?: DNS | ||
} | ||
/** | ||
* `MultiaddrResolver`s perform resolution of multiaddr components that require | ||
* translation by external systems (for example DNSADDR to TXT records). | ||
*/ | ||
export interface MultiaddrResolver { | ||
/** | ||
* Returns true if this resolver can resolve components of this multiaddr | ||
*/ | ||
canResolve (address: Multiaddr): boolean | ||
/** | ||
* Returns one or more multiaddrs with components resolved to other values | ||
*/ | ||
resolve (address: Multiaddr, options: MultiaddrResolveOptions): Promise<Multiaddr[]> | ||
} | ||
/** | ||
* Once you have a libp2p instance, you can listen to several events it emits, | ||
@@ -180,0 +204,0 @@ * so that you can be notified of relevant network events. |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
428084
-4.61%8
14.29%104
-0.95%8197
-2.09%1
Infinity%+ Added