Skip to content

Commit

Permalink
Merge pull request libp2p#54 from little-bear-labs/ckousik/add-prefix…
Browse files Browse the repository at this point in the history
…-len

Length prefixed protobuf messages
  • Loading branch information
ckousik committed Nov 2, 2022
2 parents ed6deda + f80baba commit 2b7b2c1
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 157 deletions.
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,41 +62,40 @@
"devDependencies": {
"@libp2p/interface-mocks": "^7.0.2",
"@libp2p/peer-id-factory": "^1.0.19",
"@protobuf-ts/plugin": "^2.8.0",
"@protobuf-ts/protoc": "^2.8.0",
"@types/uuid": "^8.3.4",
"@typescript-eslint/parser": "^5.32.0",
"aegir": "^37.4.6",
"chai": "^4.3.6",
"chai-bytes": "^0.1.2",
"it-all": "^2.0.0",
"it-first": "^2.0.0",
"libp2p": "^0.40.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.7.1",
"typescript": "^4.7.4",
"uint8arrays": "^4.0.2",
"wait-on": "^6.0.1"
},
"dependencies": {
"@chainsafe/libp2p-noise": "^9.0.0",
"@libp2p/interface-connection": "^3.0.2",
"@libp2p/interface-registrar": "^2.0.3",
"@libp2p/interface-stream-muxer": "^3.0.0",
"@libp2p/interface-transport": "^2.0.0",
"@libp2p/interfaces": "^3.0.3",
"@libp2p/logger": "^2.0.0",
"@libp2p/multistream-select": "^3.0.0",
"@libp2p/peer-id": "^1.1.15",
"@multiformats/multiaddr": "^11.0.3",
"@protobuf-ts/plugin": "^2.8.0",
"@protobuf-ts/protoc": "^2.8.0",
"@protobuf-ts/runtime": "^2.8.0",
"abortable-iterator": "^4.0.2",
"err-code": "^3.0.1",
"it-length-prefixed": "^8.0.3",
"it-merge": "^2.0.0",
"it-pipe": "^2.0.4",
"it-pushable": "^3.1.0",
"it-stream-types": "^1.0.4",
"multiformats": "^10.0.0",
"multihashes": "^4.0.3",
"p-defer": "^4.0.0",
"socket.io-client": "^4.1.2",
"timeout-abort-controller": "^3.0.0",
"uint8arraylist": "^2.3.3",
"uint8arrays": "^4.0.2",
"uuid": "^9.0.0"
}
}
3 changes: 1 addition & 2 deletions src/muxer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import {Stream} from "@libp2p/interface-connection"
import {StreamMuxer, StreamMuxerFactory, StreamMuxerInit} from "@libp2p/interface-stream-muxer"
import {Source, Sink} from "it-stream-types"
import {v4} from "uuid"
import {WebRTCStream} from "./stream.js"
import {nopSink, nopSource} from "./util.js"

Expand Down Expand Up @@ -53,7 +52,7 @@ export class DataChannelMuxer implements StreamMuxer {
}

newStream(name?: string | undefined): Stream {
const streamName = name || v4();
const streamName = name || '';
const channel = this.peerConnection.createDataChannel(streamName)
const stream = new WebRTCStream({
channel,
Expand Down
Loading

0 comments on commit 2b7b2c1

Please sign in to comment.