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*: Opt[PublicKey] peerId*: PeerId addrs*: seq[MultiAddress] observedAddr*: Opt[MultiAddress] protoVersion*: Opt[string] agentVersion*: Opt[string] protos*: seq[string] signedPeerRecord*: Opt[Envelope]
- Source Edit
IdentifyNoPubKeyError = object of IdentifyError
- Source Edit
IdentifyPush = ref object of LPProtocol identifyHandler: IdentifyPushHandler
- Source Edit
IdentifyPushHandler = proc (peer: PeerId; newInfo: IdentifyInfo): Future[void] {. async: (...raises: [CancelledError]), public.}
- Source Edit
IdentityInvalidMsgError = object of IdentifyError
- Source Edit
IdentityNoMatchError = object of IdentifyError
- 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): InternalRaisesFuture[ void, (CancelledError, LPStreamError)] {.public(), stackTrace: false, ...raises: [], gcsafe, raises: [], raises: [], tags: [RootEffect].}
- Send new peerInfos to a connection Source Edit
Templates
template expandItIMPL(record: auto; it_name: static string; it: IdentifyInfo)
- Source Edit