Add code to check external surface against reported surface from other trusted peers, and also rename ExternalSurface to SelfAwareness because lulz.

This commit is contained in:
Adam Ierymenko 2015-04-06 20:17:21 -07:00
commit a2821e9000
6 changed files with 83 additions and 40 deletions

View file

@ -45,7 +45,6 @@
#include "InetAddress.hpp"
#include "Utils.hpp"
#include "Dictionary.hpp"
#include "ExternalSurface.hpp"
namespace ZeroTier {
@ -321,20 +320,6 @@ public:
};
#endif
/**
* Update our knowledge of exterior network addresses
*
* If the remote peer in question is trusted, this will update our internal
* instance of ExternalSurface. If our surface has changed, this triggers a
* partial or total reset of ephemeral peer addresses and a renegotiation of
* new ones using supernodes / relays.
*
* @param remotePeer Remote peer address
* @param mirroredAddress Real-world network address the remote peer told us we have
* @param now Current time
*/
bool updateSurface(const SharedPtr<Peer> &remotePeer,const InetAddress &mirroredAddress,uint64_t now);
/**
* Validate a root topology dictionary against the identities specified in Defaults
*
@ -356,8 +341,6 @@ private:
std::vector< Address > _supernodeAddresses;
std::vector< SharedPtr<Peer> > _supernodePeers;
ExternalSurface _surface;
Mutex _lock;
// Set to true if my identity is in _supernodes