AddressBook

Address book for libp2p

Constructors

this
this()
Undocumented in source.

Members

Aliases

NodeAddresses
alias NodeAddresses = NodeAddress[Pubkey]
Undocumented in source.

Functions

_data
immutable(NodeAddress[Pubkey]) _data()

Create associative array with public keys and addresses of nodes @return addresses of nodes

activeNodeChannels
Pubkey[] activeNodeChannels()

Return active node channels in network @return active node channels

erase
void erase(Pubkey pkey)

Remove addresses by public key @param pkey - public key fo remove addresses

exists
bool exists(Pubkey pkey)

Check for a public key in network @param pkey - public key fo check @return true if public key exist

getAddress
const(string) getAddress(Pubkey pkey)
Undocumented in source. Be warned that the author may not have intended to support it.
isActive
bool isActive(Pubkey pkey)

Check for an active public key in network @param pkey - public key fo check @return true if pkey active

isReady
bool isReady()

Check that nodes >= 4 and addresses >= nodes @return true if network ready

load
void load(string filename, bool do_unlock)

Load file if it's exist @param filename - file to load @param do_unlock - flag for unlock file

numOfActiveNodes
size_t numOfActiveNodes()

Return amount of active nodes in network @return amount of active nodes

numOfNodes
size_t numOfNodes()

Return amount of nodes in networt @return amount of nodes

number_of_active_nodes
void number_of_active_nodes(size_t nodes)

Set number of active nodes @param nodes - number of active nodes

opIndex
immutable(NodeAddress) opIndex(Pubkey pkey)

Init NodeAddress if public key exist @param pkey - public key for check @return initialized node address

opIndexAssign
void opIndexAssign(NodeAddress addr, Pubkey pkey)

Create associative array addresses @param addr - value @param pkey - key

random
immutable(NodePair) random()

For random generation node pair @return node pair

save
void save(string filename, bool nonelock)

Save addresses to file @param filename - file to save addresses @param nonelock - flag tolock file for save operation

selectActiveChannel
const(Pubkey) selectActiveChannel(size_t index)

Select active channel by index @param index - index to select active channel @return active channel

Manifest constants

max_count
enum max_count;

used for lock, unlock file

Structs

AddressDirectory
struct AddressDirectory

\struct AddressDirectory Storage for node addresses

Variables

addresses
shared(NodeAddresses) addresses;

Addresses for node

nodes
size_t nodes;

nodes amount

rnd
Random rnd;
Undocumented in source.
timeout
int timeout;

used for lock, unlock file

Meta