Add persistent identity caching for use on supernodes. Activate by just making an iddb.d directory in the ZeroTier home folder. Also clean up some obsolete cruft from makefiles.
This commit is contained in:
parent
40e4f39181
commit
5e71e07f59
8 changed files with 82 additions and 29 deletions
|
@ -53,7 +53,7 @@ class RuntimeEnvironment;
|
|||
class Topology
|
||||
{
|
||||
public:
|
||||
Topology(const RuntimeEnvironment *renv);
|
||||
Topology(const RuntimeEnvironment *renv,bool enablePermanentIdCaching);
|
||||
~Topology();
|
||||
|
||||
/**
|
||||
|
@ -82,6 +82,25 @@ public:
|
|||
*/
|
||||
SharedPtr<Peer> getPeer(const Address &zta);
|
||||
|
||||
/**
|
||||
* Get an identity if cached or available in a peer record
|
||||
*
|
||||
* @param zta ZeroTier address
|
||||
* @return Identity or NULL-identity if not found
|
||||
*/
|
||||
Identity getIdentity(const Address &zta);
|
||||
|
||||
/**
|
||||
* Save identity in permanent store, or do nothing if disabled
|
||||
*
|
||||
* This is called automatically by addPeer(), so it should not need to be
|
||||
* called manually anywhere else. The private part of the identity, if
|
||||
* present, is NOT cached by this.
|
||||
*
|
||||
* @param id Identity to save
|
||||
*/
|
||||
void saveIdentity(const Identity &id);
|
||||
|
||||
/**
|
||||
* @return Current network supernodes
|
||||
*/
|
||||
|
@ -274,6 +293,8 @@ private:
|
|||
void _dumpPeers();
|
||||
void _loadPeers();
|
||||
|
||||
std::string _idCacheBase; // empty if identity caching disabled
|
||||
|
||||
std::map< Address,SharedPtr<Peer> > _activePeers;
|
||||
Mutex _activePeers_m;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue