Class IdentifyService

Hierarchy

  • IdentifyService

Index

References

Connection

Re-exports Connection

Messsage

Renames and exports Message

MuxedStream

Re-exports MuxedStream

multicodecs

Re-exports multicodecs

Constructors

constructor

Properties

Private _handleIdentify

_handleIdentify: any

Sends the Identify response with the Signed Peer Record to the requesting peer over the given connection

param
param
param
returns

Private _handlePush

_handlePush: any

Reads the Identify Push message from the given connection

param
param
param
returns

_host

_host: any

_libp2p

_libp2p: Libp2p

addressManager

addressManager: AddressManager

connectionManager

connectionManager: ConnectionManager

peerId

peerId: PeerId

peerStore

peerStore: PeerStore

Methods

handleMessage

  • handleMessage(__namedParameters: { connection: Connection; protocol: string; stream: MuxedStream }): Promise<void> | undefined
  • A handler to register with Libp2p to process identify messages.

    Parameters

    • __namedParameters: { connection: Connection; protocol: string; stream: MuxedStream }
      • connection: Connection
      • protocol: string
      • stream: MuxedStream

    Returns Promise<void> | undefined

identify

  • Requests the Identify message from peer associated with the given connection. If the identified peer does not match the PeerId associated with the connection, an error will be thrown.

    async

    Parameters

    Returns Promise<void>

push

  • push(connections: Connection[]): Promise<void[]>
  • Send an Identify Push update to the list of connections

    Parameters

    Returns Promise<void[]>

pushToPeerStore

  • pushToPeerStore(): void
  • Calls push for all peers in the peerStore that are connected

    Returns void

Static getCleanMultiaddr

  • getCleanMultiaddr(addr: Uint8Array | string): Multiaddr | null
  • Takes the addr and converts it to a Multiaddr if possible

    Parameters

    • addr: Uint8Array | string

    Returns Multiaddr | null