Skip to content

Commit

Permalink
feat: add service capabilities definition (#79)
Browse files Browse the repository at this point in the history
The latest libp2p release allows services to declare their
capabilities (what they provide to the node) and their dependencies
(the capabilities they require other services to provide for the
config to be "valid").

Adds the `serviceCapabilities` symbol property that says Yamux
provides the `@libp2p/stream-multiplexing` capability.
  • Loading branch information
achingbrain committed Jun 20, 2024
1 parent 46af2f8 commit 0aff43d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"docs": "aegir docs"
},
"dependencies": {
"@libp2p/interface": "^1.1.3",
"@libp2p/interface": "^1.5.0",
"@libp2p/utils": "^5.2.5",
"get-iterator": "^2.0.1",
"it-foreach": "^2.0.6",
Expand Down
8 changes: 7 additions & 1 deletion src/muxer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeError, setMaxListeners } from '@libp2p/interface'
import { CodeError, serviceCapabilities, setMaxListeners } from '@libp2p/interface'
import { getIterator } from 'get-iterator'
import { pushable, type Pushable } from 'it-pushable'
import { Uint8ArrayList } from 'uint8arraylist'
Expand Down Expand Up @@ -28,6 +28,12 @@ export class Yamux implements StreamMuxerFactory {
this._init = init
}

readonly [Symbol.toStringTag] = '@chainsafe/libp2p-yamux'

readonly [serviceCapabilities]: string[] = [
'@libp2p/stream-multiplexing'
]

createStreamMuxer (init?: YamuxMuxerInit): YamuxMuxer {
return new YamuxMuxer(this._components, {
...this._init,
Expand Down

0 comments on commit 0aff43d

Please sign in to comment.