This repository was archived by the owner on Jun 26, 2023. It is now read-only.
File tree 3 files changed +63
-0
lines changed
interface-content-routing/src
interface-peer-discovery/src
interface-peer-routing/src
3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,27 @@ import type { CID } from 'multiformats/cid'
2
2
import type { AbortOptions } from '@libp2p/interfaces'
3
3
import type { PeerInfo } from '@libp2p/interface-peer-info'
4
4
5
+ /**
6
+ * Any object that implements this Symbol as a property should return a
7
+ * ContentRouting instance as the property value, similar to how
8
+ * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
9
+ *
10
+ * @example
11
+ *
12
+ * ```js
13
+ * import { contentRouting, ContentRouting } from '@libp2p/content-routing'
14
+ *
15
+ * class MyContentRouter implements ContentRouting {
16
+ * get [contentRouting] () {
17
+ * return this
18
+ * }
19
+ *
20
+ * // ...other methods
21
+ * }
22
+ * ```
23
+ */
24
+ export const contentRouting = Symbol . for ( '@libp2p/content-routing' )
25
+
5
26
export interface ContentRouting {
6
27
/**
7
28
* The implementation of this method should ensure that network peers know the
Original file line number Diff line number Diff line change 1
1
import type { PeerInfo } from '@libp2p/interface-peer-info'
2
2
import type { EventEmitter } from '@libp2p/interfaces/events'
3
3
4
+ /**
5
+ * Any object that implements this Symbol as a property should return a
6
+ * PeerDiscovery instance as the property value, similar to how
7
+ * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
8
+ *
9
+ * @example
10
+ *
11
+ * ```js
12
+ * import { peerDiscovery, PeerDiscovery } from '@libp2p/peer-discovery'
13
+ *
14
+ * class MyPeerDiscoverer implements PeerDiscovery {
15
+ * get [peerDiscovery] () {
16
+ * return this
17
+ * }
18
+ *
19
+ * // ...other methods
20
+ * }
21
+ * ```
22
+ */
23
+ export const peerDiscovery = Symbol . for ( '@libp2p/peer-discovery' )
24
+
4
25
export const symbol = Symbol . for ( '@libp2p/peer-discovery' )
5
26
6
27
export interface PeerDiscoveryEvents {
Original file line number Diff line number Diff line change @@ -2,6 +2,27 @@ import type { PeerId } from '@libp2p/interface-peer-id'
2
2
import type { PeerInfo } from '@libp2p/interface-peer-info'
3
3
import type { AbortOptions } from '@libp2p/interfaces'
4
4
5
+ /**
6
+ * Any object that implements this Symbol as a property should return a
7
+ * PeerRouting instance as the property value, similar to how
8
+ * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
9
+ *
10
+ * @example
11
+ *
12
+ * ```js
13
+ * import { peerRouting, PeerRouting } from '@libp2p/peer-routing'
14
+ *
15
+ * class MyPeerRouter implements PeerRouting {
16
+ * get [peerRouting] () {
17
+ * return this
18
+ * }
19
+ *
20
+ * // ...other methods
21
+ * }
22
+ * ```
23
+ */
24
+ export const peerRouting = Symbol . for ( '@libp2p/peer-routing' )
25
+
5
26
export interface PeerRouting {
6
27
/**
7
28
* Searches the network for peer info corresponding to the passed peer id.
You can’t perform that action at this time.
0 commit comments