libp2p/protocols/identify

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
  
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, TimeEffect, WriteIOEffect], forbids: [].}
Source   Edit  
proc identify(self: Identify; conn: Connection; remotePeerId: PeerId): Future[
    IdentifyInfo] {.async, ...gcsafe, raises: [],
                    tags: [RootEffect, TimeEffect, WriteIOEffect], forbids: [].}
Source   Edit  
proc init(p: IdentifyPush) {....raises: [], tags: [], forbids: [].}
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) {.async,
    public, ...raises: [], tags: [], forbids: [].}
Send new peerInfos to a connection Source   Edit  

Methods

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

Templates

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