INNER CODE UNIT · JavaScript
Peer
feross/simple-peer · index.js:28
class Peer extends stream.Duplex {
constructor (opts) {
opts = Object.assign({
allowHalfOpen: false
}, opts)
super(opts)
this._id = randombytes(4).toString('hex').slice(0, 7)
this._debug('new peer %o', opts)
this.channelName = opts.initiator
? opts.channelName || randombytes(20).toString('hex')
: null
this.initiator = opts.initiator || false
this.channelConfig = opts.channelConfig || Peer.channelConfig
this.channelNegotiated = this.channelConfig.negotiated