libp2p/peerinfo

Search:
Group by:
Source   Edit  

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:

  1. Automatically after a call to PeerInfo.update, which may change the resolved addrs list.
  2. Manually when PeerInfo.notifyObservers is called explicitly.
Source   Edit  

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 fullAddrs(p: PeerInfo): MaResult[seq[MultiAddress]] {....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  
func shortLog(p: PeerInfo): auto {....raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
proc toFullAddress(peerId: PeerId; ma: MultiAddress): MaResult[MultiAddress] {.
    ...raises: [], tags: [RootEffect], forbids: [].}
Source   Edit  
proc update(p: PeerInfo): InternalRaisesFuture[void, (CancelledError,)] {.
    ...stackTrace: false, raises: [], gcsafe, raises: [], tags: [RootEffect],
    forbids: [].}
Source   Edit  

Templates

template chroniclesFormatItIMPL(it: PeerInfo): auto {..}
Source   Edit  

Exports

hash, shortLog, init, random, supportsPacked, $, write, PeerId, ==, getField, <=, shortLog, computeFieldSize, shortLog, capLen, init, validate, init, supportsPacked, exclIfIt, match, <, chroniclesFormatItIMPL, write, getPubKey, maxInlineKeyLength, withValue, writeField, >=, withValue, shortLog, toBytes, filterIt, match, readFieldInto, toChunks, 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, 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, protoArgument, 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, IpTransportProtocol, validate, mapEq, Onion3, MaPattern, MaInvalidAddress, TranscoderP2P, toException, WSS_DNS, writeLPVarint, write, WebRTCDirect, len, UDP, TranscoderIP6Zone, MaPatResult, TranscoderOnion, QUIC_V1_DNS, readFieldInto, init, shortLog, writeArray, readFieldInto, init, UTP, [], 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, Signature, exclIfIt, shortLog, init, toBytes, DigestSheme, ephemeral, ECDHEScheme, init, filterIt, shortLog, init, sign, Rng, macOpenArray, PublicKey, Secret, $, mac, init, selectBest, init, ephemeral, withValue, write, init, stretchKeys, generateBytes, withValue, write, write, init, getField, init, init, generate, toBytes, write, random, getBytes, toOpt, init, newRng, withValue, getPublicKey, init, init, random, write, ivOpenArray, init, getField, iv, init, CryptoError, ==, key, SupportedSchemes, generate, RsaDefaultKeySize, init, keyOpenArray, SupportedSchemesInt, toBytes, capLen, shuffle, supported, ==, toRawBytes, libp2p_pki_schemes, random, pickOne, init, random, CryptoResult, shortLog, getBytes, verify, PKScheme, getBytes, init, toChunks, generate, PrivateKey, take, toOpt, newBearSslRng, orError, $, generate, goffset, getRawBytes, pick, getOrder, KeyPair, init, toOpt, init, DNS_OR_IP, shortLog, init, decode, random, UDP_DNS, MaError, writeField, ephemeral, decode, replaceIp, MaPattern, MaPatternOp, WS_DNS, initVBuffer, <=, ==, ==, filterIt, ECDHEScheme, shortLog, init, [], shuffle, random, init, Secret, peekVarint, random, $, validate, mapOr, chroniclesFormatItIMPL, take, Memory, bytes, getPubKey, maxInlineKeyLength, TranscoderDNS, QUIC, init, ephemeral, withValue, mac, getIp, generateBytes, WS_IP, MAKind, write, init, getField, init, getRepeatedField, generate, matchPartial, libp2p_pki_schemes, getBytes, len, areAddrsConsistent, ==, HTTP, initVBuffer, peekSeq, TCP_IP4, toOpt, payloadType, concat, init, IP, protoAddress, QUIC_V1_IP, newRng, ==, withValue, checkValid, getPublicKey, chroniclesFormatItIMPL, libp2p_multiaddress_exts, WebSockets, readFieldInto, getPart, CircuitRelay, extractPublicKey, mapAnd, maErr, UDP_IP, init, random, DNSADDR, write, WSS, QUIC_V1, TCP_IP, init, toBytes, TCP_DNS, shortLog, encode, UDP_IP4, len, capLen, init, protoName, protoArgument, toRawBytes, $, key, DNS, WSS_DNS, match, <, CryptoResult, init, WebRTCDirect, init, $, UDP, TranscoderOnion, write, init, Rng, writeArray, decode, PeerId, pick, [], IP6, writeField, initVBuffer, PKScheme, payload, init, init, write, init, generate, TCP, PrivateKey, write, &=, newBearSslRng, random, TranscoderMemory, TranscoderIP4, init, $, toException, init, goffset, getRawBytes, >, KeyPair, high, toString, cmp, DNSANY, Signature, contains, exclIfIt, computeFieldSize, hash, readFieldInto, supportsPacked, toBytes, DigestSheme, init, IPFS, shortLog, isEmpty, shortLog, hex, protocols, readArray, hash, HTTPS, UNIX, computeFieldSize, LPError, supportsPacked, TLS_WS, TranscoderIP6, readSeq, encode, getProtocolArgument, data, MaResult, supportsPacked, toBytes, QUIC_V1_IP4, writeSeq, finish, init, &, DNS6, [], IpTransportProtocol, init, IP4, TranscoderPort, getBytes, getField, init, >=, payloadDomain, $, withValue, init, TranscoderOnion3, SignedPayload, toBytes, protoArgument, getBytes, keyOpenArray, match, WebSockets_DNS, SignedPeerRecord, $, isEmpty, decode, init, MAProtocol, init, getField, shortLog, DNS4, selectBest, encode, P2PPattern, Envelope, hasPublicKey, toException, init, isEnough, Reliable, hex, write, ivOpenArray, WS, stretchKeys, encode, init, init, init, getField, match, writeLPVarint, iv, CryptoError, <, append, verify, init, WSS_IP, peekArray, PeerRecord, init, SupportedSchemes, generate, RsaDefaultKeySize, Unreliable, SupportedSchemesInt, random, checkFutures, macOpenArray, init, validate, mapEq, Onion3, TcpOnion3, pickOne, TranscoderP2P, AddressInfo, sign, write, EnvelopeError, encode, len, TranscoderIP6Zone, MaPatResult, QUIC_V1_DNS, init, write, getBytes, write, init, UTP, readFieldInto, QUIC_IP, init, PublicKey, WebSockets_IP, VBuffer, supported, writePBVarint, toChunks, init, getField, MultiAddress, supportsPacked, readVarint, toOpt, orError, getField, protoCode, MaInvalidAddress, generate, items, write, getOrder, QUIC_DNS, TranscoderUnix, toOpt, writeVarint, PeerAddressPolicy, publicRoutableAddressPolicy, filterAddrs, defaultAddressPolicy, accepts, noPrivateAddressPolicy, toException, toException, checkFutures, LPError