Defaults.cpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2015 ZeroTier, Inc.
  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. * ZeroTier may be used and distributed under the terms of the GPLv3, which
  21. * are available at: http://www.gnu.org/licenses/gpl-3.0.html
  22. *
  23. * If you would like to embed ZeroTier into a commercial application or
  24. * redistribute it in a modified binary form, please contact ZeroTier Networks
  25. * LLC. Start here: http://www.zerotier.com/
  26. */
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30. #include "../include/ZeroTierOne.h"
  31. #include "Constants.hpp"
  32. #include "Defaults.hpp"
  33. #include "Utils.hpp"
  34. // bin2c'd signed default root topology dictionary
  35. #include "../root-topology/ZT_DEFAULT_ROOT_TOPOLOGY.c"
  36. #ifdef __WINDOWS__
  37. #include <WinSock2.h>
  38. #include <Windows.h>
  39. #include <ShlObj.h>
  40. #endif
  41. namespace ZeroTier {
  42. const Defaults ZT_DEFAULTS;
  43. static inline std::map< Address,Identity > _mkRootTopologyAuth()
  44. {
  45. std::map< Address,Identity > ua;
  46. { // 0001
  47. Identity id("77792b1c02:0:b5c361e8e9c2154e82c3e902fdfc337468b092a7c4d8dc685c37eb10ee4f3c17cc0bb1d024167e8cb0824d12263428373582da3d0a9a14b36e4546c317e811e6");
  48. ua[id.address()] = id;
  49. }
  50. { // 0002
  51. Identity id("86921e6de1:0:9ba04f9f12ed54ef567f548cb69d31e404537d7b0ee000c63f3d7c8d490a1a47a5a5b2af0cbe12d23f9194270593f298d936d7c872612ea509ef1c67ce2c7fc1");
  52. ua[id.address()] = id;
  53. }
  54. { // 0003
  55. Identity id("90302b7025:0:358154a57af1b7afa07d0d91b69b92eaad2f11ade7f02343861f0c1b757d15626e8cb7f08fc52993d2202a39cbf5128c5647ee8c63d27d92db5a1d0fbe1eba19");
  56. ua[id.address()] = id;
  57. }
  58. { // 0004
  59. Identity id("e5174078ee:0:c3f90daa834a74ee47105f5726ae2e29fc8ae0e939c9326788b52b16d847354de8de3b13a81896bbb509b91e1da21763073a30bbfb2b8e994550798d30a2d709");
  60. ua[id.address()] = id;
  61. }
  62. return ua;
  63. }
  64. Defaults::Defaults() :
  65. defaultRootTopology((const char *)ZT_DEFAULT_ROOT_TOPOLOGY,ZT_DEFAULT_ROOT_TOPOLOGY_LEN),
  66. rootTopologyAuthorities(_mkRootTopologyAuth()),
  67. v4Broadcast(((uint32_t)0xffffffff),ZT_DEFAULT_PORT)
  68. {
  69. }
  70. } // namespace ZeroTier