OSUtils.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2019 ZeroTier, Inc. https://www.zerotier.com/
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * --
  19. *
  20. * You can be released from the requirements of the license by purchasing
  21. * a commercial license. Buying such a license is mandatory as soon as you
  22. * develop commercial closed-source software that incorporates or links
  23. * directly against ZeroTier software without disclosing the source code
  24. * of your own application.
  25. */
  26. #include <stdio.h>
  27. #include <string.h>
  28. #include <stdlib.h>
  29. #include <stdarg.h>
  30. #include <sys/stat.h>
  31. #include <stdlib.h>
  32. #include "../node/Constants.hpp"
  33. #include "../node/Utils.hpp"
  34. #ifdef __UNIX_LIKE__
  35. #include <unistd.h>
  36. #include <errno.h>
  37. #include <fcntl.h>
  38. #include <sys/types.h>
  39. #include <sys/socket.h>
  40. #include <sys/stat.h>
  41. #include <sys/uio.h>
  42. #include <dirent.h>
  43. #include <netdb.h>
  44. #include <arpa/nameser.h>
  45. #include <resolv.h>
  46. #ifndef C_IN
  47. #define C_IN ns_c_in
  48. #endif
  49. #ifndef T_TXT
  50. #define T_TXT ns_t_txt
  51. #endif
  52. #endif
  53. #ifdef __WINDOWS__
  54. #include <windows.h>
  55. #include <wincrypt.h>
  56. #include <ShlObj.h>
  57. #include <netioapi.h>
  58. #include <iphlpapi.h>
  59. #endif
  60. #include <atomic>
  61. #include "OSUtils.hpp"
  62. namespace ZeroTier {
  63. unsigned int OSUtils::ztsnprintf(char *buf,unsigned int len,const char *fmt,...)
  64. {
  65. va_list ap;
  66. va_start(ap,fmt);
  67. int n = (int)vsnprintf(buf,len,fmt,ap);
  68. va_end(ap);
  69. if ((n >= (int)len)||(n < 0)) {
  70. if (len)
  71. buf[len - 1] = (char)0;
  72. throw std::length_error("buf[] overflow");
  73. }
  74. return (unsigned int)n;
  75. }
  76. #ifdef __UNIX_LIKE__
  77. bool OSUtils::redirectUnixOutputs(const char *stdoutPath,const char *stderrPath)
  78. throw()
  79. {
  80. int fdout = ::open(stdoutPath,O_WRONLY|O_CREAT,0600);
  81. if (fdout > 0) {
  82. int fderr;
  83. if (stderrPath) {
  84. fderr = ::open(stderrPath,O_WRONLY|O_CREAT,0600);
  85. if (fderr <= 0) {
  86. ::close(fdout);
  87. return false;
  88. }
  89. } else fderr = fdout;
  90. ::close(STDOUT_FILENO);
  91. ::close(STDERR_FILENO);
  92. ::dup2(fdout,STDOUT_FILENO);
  93. ::dup2(fderr,STDERR_FILENO);
  94. return true;
  95. }
  96. return false;
  97. }
  98. #endif // __UNIX_LIKE__
  99. std::vector<std::string> OSUtils::listDirectory(const char *path,bool includeDirectories)
  100. {
  101. std::vector<std::string> r;
  102. #ifdef __WINDOWS__
  103. HANDLE hFind;
  104. WIN32_FIND_DATAA ffd;
  105. if ((hFind = FindFirstFileA((std::string(path) + "\\*").c_str(),&ffd)) != INVALID_HANDLE_VALUE) {
  106. do {
  107. if ( (strcmp(ffd.cFileName,".")) && (strcmp(ffd.cFileName,"..")) && (((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)||(((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)&&(includeDirectories))) )
  108. r.push_back(std::string(ffd.cFileName));
  109. } while (FindNextFileA(hFind,&ffd));
  110. FindClose(hFind);
  111. }
  112. #else
  113. struct dirent de;
  114. struct dirent *dptr;
  115. DIR *d = opendir(path);
  116. if (!d)
  117. return r;
  118. dptr = (struct dirent *)0;
  119. for(;;) {
  120. if (readdir_r(d,&de,&dptr))
  121. break;
  122. if (dptr) {
  123. if ((strcmp(dptr->d_name,"."))&&(strcmp(dptr->d_name,".."))&&((dptr->d_type != DT_DIR)||(includeDirectories)))
  124. r.push_back(std::string(dptr->d_name));
  125. } else break;
  126. }
  127. closedir(d);
  128. #endif
  129. return r;
  130. }
  131. long OSUtils::cleanDirectory(const char *path,const int64_t olderThan)
  132. {
  133. long cleaned = 0;
  134. #ifdef __WINDOWS__
  135. HANDLE hFind;
  136. WIN32_FIND_DATAA ffd;
  137. LARGE_INTEGER date,adjust;
  138. adjust.QuadPart = 11644473600000 * 10000;
  139. char tmp[4096];
  140. if ((hFind = FindFirstFileA((std::string(path) + "\\*").c_str(),&ffd)) != INVALID_HANDLE_VALUE) {
  141. do {
  142. if ((strcmp(ffd.cFileName,"."))&&(strcmp(ffd.cFileName,".."))&&((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)) {
  143. date.HighPart = ffd.ftLastWriteTime.dwHighDateTime;
  144. date.LowPart = ffd.ftLastWriteTime.dwLowDateTime;
  145. if (date.QuadPart > 0) {
  146. date.QuadPart -= adjust.QuadPart;
  147. if ((int64_t)((date.QuadPart / 10000000) * 1000) < olderThan) {
  148. ztsnprintf(tmp, sizeof(tmp), "%s\\%s", path, ffd.cFileName);
  149. if (DeleteFileA(tmp))
  150. ++cleaned;
  151. }
  152. }
  153. }
  154. } while (FindNextFileA(hFind,&ffd));
  155. FindClose(hFind);
  156. }
  157. #else
  158. struct dirent de;
  159. struct dirent *dptr;
  160. struct stat st;
  161. char tmp[4096];
  162. DIR *d = opendir(path);
  163. if (!d)
  164. return -1;
  165. dptr = (struct dirent *)0;
  166. for(;;) {
  167. if (readdir_r(d,&de,&dptr))
  168. break;
  169. if (dptr) {
  170. if ((strcmp(dptr->d_name,"."))&&(strcmp(dptr->d_name,".."))&&(dptr->d_type == DT_REG)) {
  171. ztsnprintf(tmp,sizeof(tmp),"%s/%s",path,dptr->d_name);
  172. if (stat(tmp,&st) == 0) {
  173. int64_t mt = (int64_t)(st.st_mtime);
  174. if ((mt > 0)&&((mt * 1000) < olderThan)) {
  175. if (unlink(tmp) == 0)
  176. ++cleaned;
  177. }
  178. }
  179. }
  180. } else break;
  181. }
  182. closedir(d);
  183. #endif
  184. return cleaned;
  185. }
  186. bool OSUtils::rmDashRf(const char *path)
  187. {
  188. #ifdef __WINDOWS__
  189. HANDLE hFind;
  190. WIN32_FIND_DATAA ffd;
  191. if ((hFind = FindFirstFileA((std::string(path) + "\\*").c_str(),&ffd)) != INVALID_HANDLE_VALUE) {
  192. do {
  193. if ((strcmp(ffd.cFileName,".") != 0)&&(strcmp(ffd.cFileName,"..") != 0)) {
  194. if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
  195. if (DeleteFileA((std::string(path) + ZT_PATH_SEPARATOR_S + ffd.cFileName).c_str()) == FALSE)
  196. return false;
  197. } else {
  198. if (!rmDashRf((std::string(path) + ZT_PATH_SEPARATOR_S + ffd.cFileName).c_str()))
  199. return false;
  200. }
  201. }
  202. } while (FindNextFileA(hFind,&ffd));
  203. FindClose(hFind);
  204. }
  205. return (RemoveDirectoryA(path) != FALSE);
  206. #else
  207. struct dirent de;
  208. struct dirent *dptr;
  209. DIR *d = opendir(path);
  210. if (!d)
  211. return true;
  212. dptr = (struct dirent *)0;
  213. for(;;) {
  214. if (readdir_r(d,&de,&dptr) != 0)
  215. break;
  216. if (!dptr)
  217. break;
  218. if ((strcmp(dptr->d_name,".") != 0)&&(strcmp(dptr->d_name,"..") != 0)&&(strlen(dptr->d_name) > 0)) {
  219. std::string p(path);
  220. p.push_back(ZT_PATH_SEPARATOR);
  221. p.append(dptr->d_name);
  222. if (unlink(p.c_str()) != 0) { // unlink first will remove symlinks instead of recursing them
  223. if (!rmDashRf(p.c_str()))
  224. return false;
  225. }
  226. }
  227. }
  228. closedir(d);
  229. return (rmdir(path) == 0);
  230. #endif
  231. }
  232. void OSUtils::lockDownFile(const char *path,bool isDir)
  233. {
  234. #ifdef __UNIX_LIKE__
  235. chmod(path,isDir ? 0700 : 0600);
  236. #else
  237. #ifdef __WINDOWS__
  238. {
  239. STARTUPINFOA startupInfo;
  240. PROCESS_INFORMATION processInfo;
  241. startupInfo.cb = sizeof(startupInfo);
  242. memset(&startupInfo,0,sizeof(STARTUPINFOA));
  243. memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
  244. if (CreateProcessA(NULL,(LPSTR)(std::string("C:\\Windows\\System32\\icacls.exe \"") + path + "\" /inheritance:d /Q").c_str(),NULL,NULL,FALSE,CREATE_NO_WINDOW,NULL,NULL,&startupInfo,&processInfo)) {
  245. WaitForSingleObject(processInfo.hProcess,INFINITE);
  246. CloseHandle(processInfo.hProcess);
  247. CloseHandle(processInfo.hThread);
  248. }
  249. startupInfo.cb = sizeof(startupInfo);
  250. memset(&startupInfo,0,sizeof(STARTUPINFOA));
  251. memset(&processInfo,0,sizeof(PROCESS_INFORMATION));
  252. if (CreateProcessA(NULL,(LPSTR)(std::string("C:\\Windows\\System32\\icacls.exe \"") + path + "\" /remove *S-1-5-32-545 /Q").c_str(),NULL,NULL,FALSE,CREATE_NO_WINDOW,NULL,NULL,&startupInfo,&processInfo)) {
  253. WaitForSingleObject(processInfo.hProcess,INFINITE);
  254. CloseHandle(processInfo.hProcess);
  255. CloseHandle(processInfo.hThread);
  256. }
  257. }
  258. #endif
  259. #endif
  260. }
  261. uint64_t OSUtils::getLastModified(const char *path)
  262. {
  263. struct stat s;
  264. if (stat(path,&s))
  265. return 0;
  266. return (((uint64_t)s.st_mtime) * 1000ULL);
  267. }
  268. bool OSUtils::fileExists(const char *path,bool followLinks)
  269. {
  270. struct stat s;
  271. #ifdef __UNIX_LIKE__
  272. if (!followLinks)
  273. return (lstat(path,&s) == 0);
  274. #endif
  275. return (stat(path,&s) == 0);
  276. }
  277. int64_t OSUtils::getFileSize(const char *path)
  278. {
  279. struct stat s;
  280. if (stat(path,&s))
  281. return -1;
  282. #ifdef __WINDOWS__
  283. return s.st_size;
  284. #else
  285. if (S_ISREG(s.st_mode))
  286. return s.st_size;
  287. #endif
  288. return -1;
  289. }
  290. std::vector<std::string> OSUtils::resolveTxt(const char *host)
  291. {
  292. static std::atomic_bool libresolvInitialized(false);
  293. if (!libresolvInitialized.exchange(true))
  294. res_init();
  295. std::vector<std::string> results;
  296. uint8_t answer[32768];
  297. char name[1024];
  298. int alen = res_search(host,C_IN,T_TXT,answer,sizeof(answer));
  299. if ((alen > 12)&&(alen < sizeof(answer))) {
  300. uint8_t *pptr = answer + 12;
  301. uint8_t *const end = answer + alen;
  302. int explen = dn_expand(answer,end,pptr,name,sizeof(name));
  303. if (explen > 0) {
  304. pptr += explen;
  305. if ((pptr + 2) >= end) return results;
  306. unsigned int rtype = ((unsigned int)pptr[0] << 8) | (unsigned int)pptr[1];
  307. if (rtype == T_TXT) {
  308. pptr += 4;
  309. if (pptr >= end) return results;
  310. while (pptr < end) {
  311. explen = dn_expand(answer,end,pptr,name,sizeof(name));
  312. if (explen > 0) {
  313. pptr += explen;
  314. if ((pptr + 2) >= end) return results;
  315. rtype = ((unsigned int)pptr[0] << 8) | (unsigned int)pptr[1];
  316. pptr += 10;
  317. if (pptr >= end) return results;
  318. unsigned int elen = *(pptr++);
  319. if (elen) {
  320. if ((pptr + elen) > end) return results;
  321. if (rtype == T_TXT)
  322. results.push_back(std::string((const char *)pptr,elen));
  323. pptr += elen;
  324. }
  325. } else {
  326. return results;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. return results;
  333. }
  334. bool OSUtils::readFile(const char *path,std::string &buf)
  335. {
  336. char tmp[16384];
  337. FILE *f = fopen(path,"rb");
  338. if (f) {
  339. for(;;) {
  340. long n = (long)fread(tmp,1,sizeof(tmp),f);
  341. if (n > 0)
  342. buf.append(tmp,n);
  343. else break;
  344. }
  345. fclose(f);
  346. return true;
  347. }
  348. return false;
  349. }
  350. bool OSUtils::writeFile(const char *path,const void *buf,unsigned int len)
  351. {
  352. FILE *f = fopen(path,"wb");
  353. if (f) {
  354. if ((long)fwrite(buf,1,len,f) != (long)len) {
  355. fclose(f);
  356. return false;
  357. } else {
  358. fclose(f);
  359. return true;
  360. }
  361. }
  362. return false;
  363. }
  364. std::vector<std::string> OSUtils::split(const char *s,const char *const sep,const char *esc,const char *quot)
  365. {
  366. std::vector<std::string> fields;
  367. std::string buf;
  368. if (!esc)
  369. esc = "";
  370. if (!quot)
  371. quot = "";
  372. bool escapeState = false;
  373. char quoteState = 0;
  374. while (*s) {
  375. if (escapeState) {
  376. escapeState = false;
  377. buf.push_back(*s);
  378. } else if (quoteState) {
  379. if (*s == quoteState) {
  380. quoteState = 0;
  381. fields.push_back(buf);
  382. buf.clear();
  383. } else buf.push_back(*s);
  384. } else {
  385. const char *quotTmp;
  386. if (strchr(esc,*s))
  387. escapeState = true;
  388. else if ((buf.size() <= 0)&&((quotTmp = strchr(quot,*s))))
  389. quoteState = *quotTmp;
  390. else if (strchr(sep,*s)) {
  391. if (buf.size() > 0) {
  392. fields.push_back(buf);
  393. buf.clear();
  394. } // else skip runs of separators
  395. } else buf.push_back(*s);
  396. }
  397. ++s;
  398. }
  399. if (buf.size())
  400. fields.push_back(buf);
  401. return fields;
  402. }
  403. std::string OSUtils::platformDefaultHomePath()
  404. {
  405. #ifdef __QNAP__
  406. char *cmd = "/sbin/getcfg zerotier Install_Path -f /etc/config/qpkg.conf";
  407. char buf[128];
  408. FILE *fp;
  409. if ((fp = popen(cmd, "r")) == NULL) {
  410. printf("Error opening pipe!\n");
  411. return NULL;
  412. }
  413. while (fgets(buf, 128, fp) != NULL) { }
  414. if(pclose(fp)) {
  415. printf("Command not found or exited with error status\n");
  416. return NULL;
  417. }
  418. std::string homeDir = std::string(buf);
  419. homeDir.erase(std::remove(homeDir.begin(), homeDir.end(), '\n'), homeDir.end());
  420. return homeDir;
  421. #endif
  422. // Check for user-defined environment variable before using defaults
  423. #ifdef __WINDOWS__
  424. DWORD bufferSize = 65535;
  425. std::string userDefinedPath;
  426. bufferSize = GetEnvironmentVariable("ZEROTIER_HOME", &userDefinedPath[0], bufferSize);
  427. if (bufferSize) {
  428. return userDefinedPath;
  429. }
  430. #else
  431. if(const char* userDefinedPath = getenv("ZEROTIER_HOME")) {
  432. return std::string(userDefinedPath);
  433. }
  434. #endif
  435. // Finally, resort to using default paths if no user-defined path was provided
  436. #ifdef __UNIX_LIKE__
  437. #ifdef __APPLE__
  438. // /Library/... on Apple
  439. return std::string("/Library/Application Support/ZeroTier/One");
  440. #else
  441. #ifdef __BSD__
  442. // BSD likes /var/db instead of /var/lib
  443. return std::string("/var/db/zerotier-one");
  444. #else
  445. // Use /var/lib for Linux and other *nix
  446. return std::string("/var/lib/zerotier-one");
  447. #endif
  448. #endif
  449. #else // not __UNIX_LIKE__
  450. #ifdef __WINDOWS__
  451. // Look up app data folder on Windows, e.g. C:\ProgramData\...
  452. char buf[16384];
  453. if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_COMMON_APPDATA,NULL,0,buf)))
  454. return (std::string(buf) + "\\ZeroTier\\One");
  455. else return std::string("C:\\ZeroTier\\One");
  456. #else
  457. return (std::string(ZT_PATH_SEPARATOR_S) + "ZeroTier" + ZT_PATH_SEPARATOR_S + "One"); // UNKNOWN PLATFORM
  458. #endif
  459. #endif // __UNIX_LIKE__ or not...
  460. }
  461. #ifndef OMIT_JSON_SUPPORT
  462. // Inline these massive JSON operations in one place only to reduce binary footprint and compile time
  463. nlohmann::json OSUtils::jsonParse(const std::string &buf) { return nlohmann::json::parse(buf.c_str()); }
  464. std::string OSUtils::jsonDump(const nlohmann::json &j,int indentation) { return j.dump(indentation); }
  465. uint64_t OSUtils::jsonInt(const nlohmann::json &jv,const uint64_t dfl)
  466. {
  467. try {
  468. if (jv.is_number()) {
  469. return (uint64_t)jv;
  470. } else if (jv.is_string()) {
  471. std::string s = jv;
  472. return Utils::strToU64(s.c_str());
  473. } else if (jv.is_boolean()) {
  474. return ((bool)jv ? 1ULL : 0ULL);
  475. }
  476. } catch ( ... ) {}
  477. return dfl;
  478. }
  479. uint64_t OSUtils::jsonIntHex(const nlohmann::json &jv,const uint64_t dfl)
  480. {
  481. try {
  482. if (jv.is_number()) {
  483. return (uint64_t)jv;
  484. } else if (jv.is_string()) {
  485. std::string s = jv;
  486. return Utils::hexStrToU64(s.c_str());
  487. } else if (jv.is_boolean()) {
  488. return ((bool)jv ? 1ULL : 0ULL);
  489. }
  490. } catch ( ... ) {}
  491. return dfl;
  492. }
  493. bool OSUtils::jsonBool(const nlohmann::json &jv,const bool dfl)
  494. {
  495. try {
  496. if (jv.is_boolean()) {
  497. return (bool)jv;
  498. } else if (jv.is_number()) {
  499. return ((uint64_t)jv > 0ULL);
  500. } else if (jv.is_string()) {
  501. std::string s = jv;
  502. if (s.length() > 0) {
  503. switch(s[0]) {
  504. case 't':
  505. case 'T':
  506. case '1':
  507. return true;
  508. }
  509. }
  510. return false;
  511. }
  512. } catch ( ... ) {}
  513. return dfl;
  514. }
  515. std::string OSUtils::jsonString(const nlohmann::json &jv,const char *dfl)
  516. {
  517. try {
  518. if (jv.is_string()) {
  519. return jv;
  520. } else if (jv.is_number()) {
  521. char tmp[64];
  522. ztsnprintf(tmp,sizeof(tmp),"%llu",(uint64_t)jv);
  523. return tmp;
  524. } else if (jv.is_boolean()) {
  525. return ((bool)jv ? std::string("1") : std::string("0"));
  526. }
  527. } catch ( ... ) {}
  528. return std::string((dfl) ? dfl : "");
  529. }
  530. std::string OSUtils::jsonBinFromHex(const nlohmann::json &jv)
  531. {
  532. std::string s(jsonString(jv,""));
  533. if (s.length() > 0) {
  534. unsigned int buflen = (unsigned int)((s.length() / 2) + 1);
  535. char *buf = new char[buflen];
  536. try {
  537. unsigned int l = Utils::unhex(s.c_str(),buf,buflen);
  538. std::string b(buf,l);
  539. delete [] buf;
  540. return b;
  541. } catch ( ... ) {
  542. delete [] buf;
  543. }
  544. }
  545. return std::string();
  546. }
  547. #endif // OMIT_JSON_SUPPORT
  548. // Used to convert HTTP header names to ASCII lower case
  549. const unsigned char OSUtils::TOLOWER_TABLE[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '_', '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff };
  550. } // namespace ZeroTier