Class Upgrader

property

{MultiaddrConnection} conn A duplex iterable

property

{PeerId} remotePeer

property

{string} protocol

Hierarchy

  • Upgrader

Index

References

Crypto

Re-exports Crypto

CryptoResult

Re-exports CryptoResult

Multiaddr

Re-exports Multiaddr

MultiaddrConnection

Re-exports MultiaddrConnection

MuxedStream

Re-exports MuxedStream

Muxer

Re-exports Muxer

MuxerFactory

Re-exports MuxerFactory

Constructors

constructor

  • new Upgrader(__namedParameters: { cryptos: undefined | Map<string, Crypto>; localPeer: PeerId; metrics: undefined | Metrics; muxers: undefined | Map<string, MuxerFactory>; onConnection: (Connection: any) => void; onConnectionEnd: (Connection: any) => void }): Upgrader
  • Parameters

    • __namedParameters: { cryptos: undefined | Map<string, Crypto>; localPeer: PeerId; metrics: undefined | Metrics; muxers: undefined | Map<string, MuxerFactory>; onConnection: (Connection: any) => void; onConnectionEnd: (Connection: any) => void }
      • cryptos: undefined | Map<string, Crypto>
      • localPeer: PeerId
      • metrics: undefined | Metrics
      • muxers: undefined | Map<string, MuxerFactory>
      • onConnection: (Connection: any) => void
          • (Connection: any): void
          • Parameters

            • Connection: any

            Returns void

      • onConnectionEnd: (Connection: any) => void
          • (Connection: any): void
          • Parameters

            • Connection: any

            Returns void

    Returns Upgrader

Properties

Private _createConnection

_createConnection: any

A convenience method for generating a new Connection

param
param

The crypto protocol that was negotiated

param

One of ['inbound', 'outbound']

param

The transport layer connection

param

A duplex connection returned from multiplexer and/or crypto selection

param

The muxer to be used for muxing

param

The peer the connection is with

returns

Private _encryptInbound

_encryptInbound: any

Attempts to encrypt the incoming connection with the provided cryptos.

async
param

The initiators PeerId

param
param
returns

An encrypted connection, remote peer PeerId and the protocol of the Crypto used

Private _encryptOutbound

_encryptOutbound: any

Attempts to encrypt the given connection with the provided cryptos. The first Crypto module to succeed will be used

async
param

The initiators PeerId

param
param
param
returns

An encrypted connection, remote peer PeerId and the protocol of the Crypto used

Private _multiplexInbound

_multiplexInbound: any

Registers support for one of the given muxers via multistream-select. The selected muxer will be used for all future streams on the connection.

async
param

A basic duplex connection to multiplex

param

The muxers to attempt multiplexing with

returns

} A muxed connection

Private _multiplexOutbound

_multiplexOutbound: any

Selects one of the given muxers via multistream-select. That muxer will be used for all future streams on the connection.

async
param

A basic duplex connection to multiplex

param

The muxers to attempt multiplexing with

returns

} A muxed connection

Private _onStream

_onStream: any

Routes incoming streams to the correct handler

param
param

The connection the stream belongs to

param
param

cryptos

cryptos: Map<string, Crypto>

localPeer

localPeer: PeerId

metrics

metrics: Metrics | undefined

muxers

muxers: Map<string, MuxerFactory>

onConnection

onConnection: (Connection: any) => void

Type declaration

    • (Connection: any): void
    • Parameters

      • Connection: any

      Returns void

onConnectionEnd

onConnectionEnd: (Connection: any) => void

Type declaration

    • (Connection: any): void
    • Parameters

      • Connection: any

      Returns void

protector

protector: any

protocols

protocols: Map<any, any>

Methods

upgradeInbound

upgradeOutbound