Types
AddressMapper = proc (listenAddrs: seq[MultiAddress]): Future[seq[MultiAddress]] {. ...gcsafe, async: (...raises: [CancelledError]).}
- A proc that resolves listen addresses into dialable addresses. Source Edit
PeerInfo = ref object peerId*: PeerId listenAddrs*: seq[MultiAddress] ## contains addresses the node listens on, which may include wildcard and private addresses (not directly reachable). announcedAddrs*: seq[MultiAddress] ## explicit addresses to announce to peers, distinct from listenAddrs. ## When non-empty, these replace the output of the addressMappers chain in `expandAddrs`, ## allowing a node to advertise (e.g.) a public NAT-mapped address while binding locally. ## The addressPolicy filter is still applied. Leave empty to use mapper-chain output. addrs*: seq[MultiAddress] ## contains resolved addresses that other peers can use to connect, including public-facing NAT and port-forwarded addresses. addressMappers*: seq[AddressMapper] ## contains a list of procs that can be used to resolve the listen addresses into dialable addresses. addressPolicy*: PeerAddressPolicy ## applied after address mappers protocols*: seq[string] protoVersion*: string agentVersion*: string privateKey*: PrivateKey publicKey*: PublicKey signedPeerRecord*: SignedPeerRecord
- PeerInfo represents our local peer info Source Edit
PeerInfoError = object of LPError
- Source Edit
PeerInfoObserver = proc (p: PeerInfo) {....gcsafe, raises: [].}
-
A callback type for observing changes in a PeerInfo's resolved addresses. PeerInfo object passed to the observer contains the updated state at the time of the callback.
This observer is invoked in two scenarios:
- Automatically after a call to PeerInfo.update, which may change the resolved addrs list.
- Manually when PeerInfo.notifyObservers is called explicitly.
Procs
proc addObserver(p: PeerInfo; observer: PeerInfoObserver) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc addrs(p: PeerInfo): seq[MultiAddress] {....raises: [], tags: [], forbids: [].}
- Source Edit
proc expandAddrs(p: PeerInfo): InternalRaisesFuture[seq[MultiAddress], (CancelledError,)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc new(p: typedesc[PeerInfo]; key: PrivateKey; listenAddrs: openArray[MultiAddress] = []; protocols: openArray[string] = []; protoVersion: string = ""; agentVersion: string = ""; addressMappers = newSeq[AddressMapper](); addressPolicy: PeerAddressPolicy = defaultAddressPolicy; announcedAddrs: openArray[MultiAddress] = []): PeerInfo {. ...raises: [LPError], raises: [].}
- Source Edit
proc notifyObservers(p: PeerInfo) {....raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc parseFullAddress(ma: MultiAddress): MaResult[(PeerId, MultiAddress)] {. ...raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
proc parseFullAddress(ma: string | seq[byte]): MaResult[(PeerId, MultiAddress)] {. ...raises: [].}
- Source Edit
proc removeObserver(p: PeerInfo; observer: PeerInfoObserver) {....raises: [], tags: [], forbids: [].}
- Source Edit
proc stripPeerId(ma: MultiAddress): MultiAddress {....raises: [], tags: [RootEffect], forbids: [].}
- Strip a terminal /p2p/<peer-id> suffix from a dial address. Keeps relay route components like /p2p/<relay>/p2p-circuit intact. Source Edit
proc toFullAddress(peerId: PeerId; ma: MultiAddress): MaResult[MultiAddress] {. ...raises: [], tags: [RootEffect], forbids: [].}
- Source Edit
Templates
template chroniclesFormatItIMPL(it: PeerInfo): auto {..}
- Source Edit
Exports
-
hash, shortLog, init, random, supportsPacked, $, write, PeerId, ==, getField, <=, toCidString, shortLog, computeFieldSize, shortLog, capLen, init, validate, init, supportsPacked, exclIfIt, match, <, chroniclesFormatItIMPL, write, getPubKey, maxInlineKeyLength, readFieldInto, withValue, writeField, >=, withValue, computeFieldSize, shortLog, writeField, toBytes, filterIt, match, readFieldInto, toChunks, toCid, getBytes, init, init, take, toOpt, toOpt, init, withValue, hasPublicKey, chroniclesFormatItIMPL, random, >, hex, len, toOpt, cmp, extractPublicKey, DNS_OR_IP, contains, exclIfIt, hash, shortLog, readSeq, UDP_DNS, MaError, IPFS, writeField, data, MaPatternOp, isEmpty, WS_DNS, initVBuffer, hex, protocols, bytes, ==, HTTPS, UNIX, filterIt, QUIC_DNS, shortLog, LPError, TranscoderIP6, encode, getProtocolArgument, MaResult, init, supportsPacked, peekVarint, mapOr, QUIC_V1_IP4, writeSeq, &, Memory, DNS6, TLS_WS, TranscoderDNS, QUIC, [], [], IP4, TranscoderPort, withValue, getIp, $, WS_IP, withValue, MAKind, TranscoderOnion3, getRepeatedField, matchPartial, IpTransportProtocol, match, WebSockets_DNS, WebSockets, $, areAddrsConsistent, isEmpty, HTTP, finish, init, TcpOnion3, MAProtocol, peekSeq, TCP_IP4, toOpt, concat, init, IP, protoAddress, DNS4, QUIC_V1_IP, readArray, withValue, P2PPattern, isEnough, libp2p_multiaddress_exts, Reliable, len, WS, getPart, CircuitRelay, mapAnd, maErr, <, UDP_IP, DNSANY, DNSADDR, append, write, WSS_IP, peekArray, WSS, QUIC_V1, TCP_IP, getField, Unreliable, checkFutures, TCP_DNS, UDP_IP4, capLen, init, protoName, protoArgument, validate, mapEq, Onion3, MaPattern, MaInvalidAddress, TCP_IP6, TranscoderP2P, toException, WSS_DNS, writeLPVarint, write, WebRTCDirect, len, UDP, TranscoderIP6Zone, MaPatResult, TranscoderOnion, QUIC_V1_DNS, readFieldInto, init, shortLog, writeArray, readFieldInto, init, UTP, [], computeFieldSize, IP6, writeField, initVBuffer, QUIC_IP, initVBuffer, WebSockets_IP, VBuffer, writePBVarint, toChunks, TCP, protoArgument, replaceIp, init, take, MultiAddress, supportsPacked, &=, readVarint, toOpt, TranscoderMemory, TranscoderIP4, init, protoCode, $, toException, DNS, items, computeFieldSize, TranscoderUnix, high, toOpt, toString, writeVarint, computeFieldSize, Signature, exclIfIt, shortLog, init, supportsPacked, toBytes, DigestSheme, ephemeral, ECDHEScheme, init, filterIt, shortLog, init, sign, Rng, macOpenArray, PublicKey, Secret, supportsPacked, $, mac, init, selectBest, init, ephemeral, withValue, readFieldInto, init, stretchKeys, generateBytes, withValue, readFieldInto, write, init, init, init, generate, toBytes, write, random, getBytes, toOpt, init, newRng, supportsPacked, withValue, getPublicKey, init, init, random, write, ivOpenArray, init, iv, init, CryptoError, ==, key, SupportedSchemes, generate, RsaDefaultKeySize, init, keyOpenArray, SupportedSchemesInt, toBytes, capLen, shuffle, supported, ==, toRawBytes, libp2p_pki_schemes, random, pickOne, init, random, CryptoResult, shortLog, writeField, getBytes, verify, writeField, PKScheme, getBytes, init, toChunks, generate, PrivateKey, take, supportsPacked, toOpt, newBearSslRng, orError, $, generate, goffset, getRawBytes, pick, getOrder, computeFieldSize, KeyPair, init, toOpt, init, DNS_OR_IP, shortLog, random, UDP_DNS, MaError, ephemeral, decode, replaceIp, MaPatternOp, WS_DNS, initVBuffer, <=, decode, ==, ==, filterIt, ECDHEScheme, shortLog, supportsPacked, writeField, init, [], shuffle, random, init, Secret, peekVarint, random, $, validate, mapOr, chroniclesFormatItIMPL, take, Memory, bytes, getPubKey, maxInlineKeyLength, TranscoderDNS, QUIC, writeField, init, ephemeral, withValue, mac, getIp, generateBytes, WS_IP, MAKind, write, init, init, getRepeatedField, generate, matchPartial, libp2p_pki_schemes, data, len, areAddrsConsistent, ==, init, readFieldInto, HTTP, initVBuffer, payloadDomain, peekSeq, TCP_IP4, toOpt, payloadType, concat, IP, protoAddress, MaPattern, QUIC_V1_IP, newRng, ==, withValue, checkValid, getPublicKey, chroniclesFormatItIMPL, libp2p_multiaddress_exts, WebSockets, getPart, CircuitRelay, extractPublicKey, mapAnd, maErr, verify, UDP_IP, init, random, DNSADDR, write, WSS, QUIC_V1, TCP_IP, init, toCidString, toBytes, TCP_DNS, shortLog, encode, UDP_IP4, len, capLen, init, protoName, protoArgument, toRawBytes, supportsPacked, $, writeField, TCP_IP6, key, DNS, WSS_DNS, match, <, CryptoResult, init, WebRTCDirect, init, $, UDP, TranscoderOnion, write, init, Rng, writeArray, decode, PeerId, pick, [], IP6, writeField, decode, initVBuffer, PKScheme, payload, init, init, init, generate, TCP, PrivateKey, getBytes, write, init, &=, newBearSslRng, computeFieldSize, random, TranscoderMemory, TranscoderIP4, init, $, toException, goffset, getRawBytes, >, KeyPair, init, high, toString, cmp, DNSANY, computeFieldSize, Signature, contains, exclIfIt, hash, computeFieldSize, supportsPacked, toBytes, DigestSheme, init, IPFS, shortLog, readFieldInto, init, isEmpty, toCid, shortLog, hex, protocols, readArray, HTTPS, UNIX, hash, LPError, supportsPacked, computeFieldSize, TLS_WS, TranscoderIP6, readSeq, encode, getProtocolArgument, MaResult, init, supportsPacked, toBytes, QUIC_V1_IP4, writeSeq, finish, init, &, DNS6, writeField, [], IpTransportProtocol, init, IP4, TranscoderPort, getBytes, init, >=, supportsPacked, $, withValue, init, TranscoderOnion3, SignedPayload, toBytes, protoArgument, getBytes, keyOpenArray, match, WebSockets_DNS, SignedPeerRecord, $, isEmpty, init, MAProtocol, readFieldInto, stretchKeys, shortLog, DNS4, readFieldInto, selectBest, P2PPattern, Envelope, hasPublicKey, toException, init, isEnough, init, Reliable, hex, readFieldInto, ivOpenArray, WS, init, encode, init, init, match, writeLPVarint, iv, CryptoError, <, append, init, WSS_IP, peekArray, PeerRecord, SupportedSchemes, getField, generate, RsaDefaultKeySize, computeFieldSize, Unreliable, SupportedSchemesInt, random, checkFutures, supportsPacked, macOpenArray, init, checkAddresses, validate, mapEq, Onion3, TcpOnion3, pickOne, TranscoderP2P, AddressInfo, sign, write, EnvelopeError, QUIC_DNS, encode, len, TranscoderIP6Zone, MaPatResult, QUIC_V1_DNS, items, readFieldInto, getBytes, write, init, UTP, verify, QUIC_IP, init, PublicKey, WebSockets_IP, VBuffer, supported, writePBVarint, toChunks, init, getField, MultiAddress, supportsPacked, readVarint, toOpt, orError, protoCode, MaInvalidAddress, generate, writeField, write, getOrder, computeFieldSize, TranscoderUnix, toOpt, writeVarint, PeerAddressPolicy, publicRoutableAddressPolicy, filterAddrs, defaultAddressPolicy, accepts, noPrivateAddressPolicy, toException, toException, checkFutures, LPError