Identify and Push Identify implementation
Types
Delta {.proto2.} = object addedProtocols* {.fieldNumber: 1.}: seq[string] removedProtocols* {.fieldNumber: 2.}: seq[string]
- Source Edit
Identify = ref object of LPProtocol peerInfo*: PeerInfo sendSignedPeerRecord*: bool observedAddrManager*: ObservedAddrManager
- Source Edit
IdentifyError = object of LPError
- Source Edit
IdentifyInfo = object peerId*: PeerId pubkey*: Opt[PublicKey] 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
- Source Edit
IdentifyPushHandler = proc (newInfo: IdentifyInfo): Future[void] {....gcsafe, raises: [].}
- Source Edit
IdentityInvalidMsgError = object of IdentifyError
- Source Edit
IdentityNoMatchError = object of IdentifyError
- Source Edit
Consts
AgentVersion = "nim-libp2p"
- 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 identify(self: Identify; stream: Stream; remotePeerId: PeerId): InternalRaisesFuture[ IdentifyInfo, (IdentityInvalidMsgError, IdentityNoMatchError, LPStreamError, CancelledError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], 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 {. ...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; stream: Stream): InternalRaisesFuture[ void, (CancelledError, LPStreamError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Send new peerInfos to a connection Source Edit
Templates
template chroniclesExpandItIMPL(record: auto; it_name: static string; it: IdentifyMsg) {..}
- Source Edit
template chroniclesExpandItIMPL[RecordType: tuple](record: RecordType; it_name: static string; it: IdentifyMsg; enabled: auto) {..}
- Source Edit