From b6698d8415728a249426ee784fcbebfdfb8e4632 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 20 May 2015 16:35:33 -0700 Subject: Ground work for reincorporating software updater for select platforms. --- service/OneService.cpp | 28 ++++++++++++++++++++++++++++ service/OneService.hpp | 14 ++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'service') diff --git a/service/OneService.cpp b/service/OneService.cpp index a566449f..c2ea034b 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -96,6 +96,8 @@ namespace ZeroTier { typedef BSDEthernetTap EthernetTap; } namespace ZeroTier { +namespace { + class OneServiceImpl; static int SnodeVirtualNetworkConfigFunction(ZT1_Node *node,void *uptr,uint64_t nwid,enum ZT1_VirtualNetworkConfigOperation op,const ZT1_VirtualNetworkConfig *nwconf); @@ -903,6 +905,8 @@ static int ShttpOnMessageComplete(http_parser *parser) return 0; } +} // anonymous namespace + std::string OneService::platformDefaultHomePath() { #ifdef __UNIX_LIKE__ @@ -939,6 +943,30 @@ std::string OneService::platformDefaultHomePath() #endif // __UNIX_LIKE__ or not... } +std::string OneService::autoUpdateUrl() +{ +#ifdef ZT_AUTO_UPDATE + +/* +#if defined(__LINUX__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) + if (sizeof(void *) == 8) + return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x64-LATEST.nfo"; + else return "http://download.zerotier.com/ZeroTierOneInstaller-linux-x86-LATEST.nfo"; +#endif +*/ + +#if defined(__APPLE__) && ( defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__i386) ) + return "http://download.zerotier.com/update/mac_intel/LATEST.nfo"; +#endif + +#ifdef __WINDOWS__ + return "http://download.zerotier.com/update/win_intel/LATEST.nfo"; +#endif + +#endif // ZT_AUTO_UPDATE + return std::string(); +} + OneService *OneService::newInstance(const char *hp,unsigned int port,const char *overrideRootTopology) { return new OneServiceImpl(hp,port,overrideRootTopology); } OneService::~OneService() {} diff --git a/service/OneService.hpp b/service/OneService.hpp index 33c40547..aea314f5 100644 --- a/service/OneService.hpp +++ b/service/OneService.hpp @@ -34,6 +34,15 @@ namespace ZeroTier { /** * Local service for ZeroTier One as system VPN/NFV provider + * + * If built with ZT_ENABLE_NETWORK_CONTROLLER defined, this includes and + * runs controller/SqliteNetworkController with a database called + * controller.db in the specified home directory. + * + * If built with ZT_AUTO_UPDATE, an official ZeroTier update URL is + * periodically checked and updates are automatically downloaded, verified + * against a built-in list of update signing keys, and installed. This is + * only supported for certain platforms. */ class OneService { @@ -69,6 +78,11 @@ public: */ static std::string platformDefaultHomePath(); + /** + * @return Auto-update URL or empty string if auto-updates unsupported or not enabled + */ + static std::string autoUpdateUrl(); + /** * Create a new instance of the service * -- cgit v1.2.3