libp2p/protocols/identify

    Dark Mode
Search:
Group by:
  Source   Edit

Identify and Push Identify implementation

Types

Identify = ref object of LPProtocol
  peerInfo*: PeerInfo
  sendSignedPeerRecord*: bool
  observedAddrManager*: ObservedAddrManager
  Source   Edit
IdentifyError = object of LPError
  Source   Edit
IdentifyInfo {.public.} = object
  pubkey*: Option[PublicKey]
  peerId*: PeerId
  addrs*: seq[MultiAddress]
  observedAddr*: Option[MultiAddress]
  protoVersion*: Option[string]
  agentVersion*: Option[string]
  protos*: seq[string]
  signedPeerRecord*: Option[Envelope]
  Source   Edit
IdentifyPush = ref object of LPProtocol
  identifyHandler: IdentifyPushHandler
  Source   Edit
IdentifyPushHandler = proc (peer: PeerId; newInfo: IdentifyInfo): Future[void] {.
    ...gcsafe, raises: [], public().}
  Source   Edit

Consts

AgentVersion = "nim-libp2p/0.0.1"
  Source   Edit
IdentifyCodec = "/ipfs/id/1.0.0"
  Source   Edit
IdentifyPushCodec = "/ipfs/id/push/1.0.0"
  Source   Edit
ProtoVersion = "ipfs/0.1.0"
  Source   Edit

Procs

proc decodeMsg(buf: seq[byte]): Opt[IdentifyInfo] {....raises: [],
    tags: [RootEffect, WriteIOEffect, TimeEffect].}
  Source   Edit
proc identify(self: Identify; conn: Connection; remotePeerId: PeerId): InternalRaisesFuture[
    IdentifyInfo, (CancelledError, IdentifyError, LPStreamError)] {.
    stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [],
    tags: [RootEffect].}
  Source   Edit
proc init(p: IdentifyPush) {....raises: [], tags: [].}
  Source   Edit
proc new(T: typedesc[Identify]; peerInfo: PeerInfo;
         sendSignedPeerRecord = false;
         observedAddrManager = ObservedAddrManager.new()): T:type {....raises: [].}
  Source   Edit
proc new(T: typedesc[IdentifyPush]; handler: IdentifyPushHandler = nil): T:type {.
    public, ...raises: [].}
Create a IdentifyPush protocol. handler will be called every time a peer sends us new PeerInfo   Source   Edit
proc push(p: IdentifyPush; peerInfo: PeerInfo; conn: Connection): Future[void] {.
    public(), stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [],
    tags: [RootEffect].}
Send new peerInfos to a connection   Source   Edit

Methods

method init(p: Identify) {....raises: [], tags: [].}
  Source   Edit

Templates

template expandItIMPL(record: auto; it_name: static string; it: IdentifyInfo)
  Source   Edit