Compare commits

..
408 Commits
Author SHA1 Message Date
Adam Ierymenko 6f16f44438 VERSION 1.1.0: Win/Mac UI improvements, improved NAT-t, CIRCUIT_TEST, and more!
ZeroTier 1.1.0 introduces a number of fixes and improvements in several areas.
We incremented the secondary version to indicate the significance of this release.

Version numbering has been a bit ad-hoc in the past. In future versions we will
adopt the following scheme: odd-numbered revision numbers like 1.1.1 will indicate
development versions, while even numbered ones like 1.1.2 will indicate tagged
releases. The public git repo branching has also been revised: master will always
be the latest tagged release, dev will be usually-working development, and edge
will host maybe-broken "bleeding edge" development. Pull requests on GitHub should
generally be made against dev, not master or edge. Other branches that may appear
from time to time may be feature or experimental branches. Only master is confirmed
good, with dev usually being okay but not guaranteed to be such. (To the extent
that any software is ever guaranteed to be anything.)

Change summary:

User-facing changes and improvements:

 - Windows now has a new .NET-based native UI, which replaces the old WebControl
   wrapper around the React UI. This just didn't work well on older Windows systems,
   and we did not want to bundle 40+ megabytes of web browser with our app just for
   its very simple UI.
 - The web UI (still used for Mac and usable in Linux as well) is updated with
   improved look and simplifications.
 - Both UIs no longer have the "Peers" tab, since several users reported that non-
   technical users found this confusing and even alarming (does this mean people
   can access my system?). This information is visibile with "listpeers" from the
   command line (zerotier-cli).

New features:

 - Virtual networks that use our RFC4193-based IPv6 numbering scheme now emulate
   IPv6 NDP for queries that target these addresses within the same network. This
   allows for faster multicast-free connection init and improved security since
   the address is now hard-wired to the device ID (which is a crypto token). This
   does not affect IPv6 NDP for other IPv6 addresses or link-local, which will
   continue to work normally. This also opens the potential for a reduced footprint
   multicast-free build for embedded applications.
 - This version includes beta support for a feature called CIRCUIT_TEST. Network
   controllers for networks you have joined can now send a special message called
   CIRCUIT_TEST which allows for ZeroTier-layer link testing and remote diagnosis
   of link issues. Any operator of a network controller can do this; more
   documentation will be forthcoming. The only information that may be gathered
   in this way is IP addressing info and very basic system info (OS, 32/64 bit,
   ZeroTier version). No personal information, hard drive data, location, or other
   private info is available. This can only be ordered by a controller of a network
   you have joined and is secured using cryptographic signatures.
 - This version includes an alpha version of clustering a.k.a. multi-homing! This
   powerful feature allows for a single ZeroTier device to be run from multiple
   endpoints, with connecting peers being handed off to endpoints that are closer
   via GeoIP lookup and/or are more lightly loaded. Currently this is only suitable
   for use in our soon-to-be-upgraded root server infrastructure (details will be
   blogged soon), but in the future it will be capable of hosting multi-homed
   devices on user networks. This will allow things like (for example) a geo-
   clustered Cassandra server that appears behind a single IP on a virtual LAN.
   This feature must be enabled with the ZT_ENABLE_CLUSTER=1 build option.

Bug fixes and other improvements (including performance!):

 - A faster version of the Poly1305 cryptographic MAC function was substituted
   for sometimes greatly improved performance.
 - C++ STL std::map was replaced throughout the entire core with a hand-rolled
   Hashtable implementation for improved performance and in some cases a reduced
   memory footprint. Some maps are still used in peripheral code that is not
   performance critical or where ordered keys are needed.
 - The zerotier-cli and zerotier-idtool symbolic links are now created in
   /usr/local/bin on OSX to comply with El Capitan file security restrictions.
 - The OSX tap device driver has been updated. This update may fix issues that
   some users have reported with bridging on OSX. This new tap device driver
   drops 32-bit support, but if you have a 32-bit system you can manually install
   the old driver from ext/bin/tap-mac.
 - Mac users could experience a problem with the UI if they installed ZeroTier,
   then uninstalled it, then installed again. This is now fixed.
 - UPnP port mappings should work better on some routers, and a different local
   port is now used for UPnP mapped traffic vs. NAT-t'd traffic to get around
   a bug in several popular mid-tier routers where using UPnP mapping alongside
   traditional NAT traversal made a port unreachable.
 - Debian package now builds with the right arch label on armv7l systems (Pi 2)
 - The old "root topology" has been replaced with a similar but better thought
   out concept called a World. The World defines the root servers and possibly
   in the future other things, and can be updated in-band from trusted peers
   allowing for software-upgrade-free network upgrades to keep up with growing
   demand. See node/World.hpp for details.
 - A fix was made to "self-awareness," which keeps track of your external IP
   info and adapts to changes, to eliminate a problem that could cause "link
   thrashing" behind some symmetric NATs.
 - Escalating UDP TTLs was re-introduced to better transit some port-restricted
   cone NATs such as Linux IP MASQ (used for Docker).
 - An otherwise harmless crash-on-exit bug in the network controller was fixed.
 - All new direct links are now confirmed in both directions. This adds a very
   small amount of initial HELLO/OK traffic but fixes some edge cases where an
   incomplete or unidirectional path might be used.
 - [SECURITY] Better rate limiting was put in place for VERB_PUSH_DIRECT_PATHS
   to prevent potential abuse for amplification attacks.
 - [SECURITY] Build flags were tweaked on OSX to ensure that all code including
   dependency libraries are built with full stack canary protection and ASLR
   support.

Visit https://www.zerotier.com/blog or follow @ZeroTier on Twitter for updates
and announcements!
2015-11-17 12:18:45 -08:00
Adam Ierymenko 1c0c3e62dc Just add a launch prerequisite for .NET 4.5 -- it's usually there, and if not it can be easily installed. This is mostly an issue on old Windows Server systems, and in that case the admin will likely want to decide how to proceed. 2015-11-17 11:13:44 -08:00
Adam Ierymenko 9169b6c999 Fix crash on exit in Windows (does not affect other OSes) and revert debugging tweak in Windows version that prevented service from starting after real install. 2015-11-17 09:56:19 -08:00
Adam Ierymenko 48745eca57 Fix ARM dpkg build. 2015-11-16 19:54:58 -08:00
Adam Ierymenko 456bfea58d Real World -- edge now talks to real net. 2015-11-16 19:27:36 -08:00
Adam Ierymenko 0f5fb48a0b Turns out it wasn't hard to add miniupnpc to the VS2012 project and just have it build with the rest of the code. 2015-11-16 19:04:04 -08:00
Adam Ierymenko dc8edea0c6 Linux make rules to make libminiupnpc from source. 2015-11-16 18:33:52 -08:00
Adam Ierymenko cf6164e847 Build libminiupnpc from source now, and update version. 2015-11-16 18:28:55 -08:00
Adam Ierymenko a13a21377c Delete pre-build miniupnpc for Linux and Mac -- will add Make rules to build from source and include source in ext/ 2015-11-16 18:18:08 -08:00
Adam Ierymenko 37acd375d6 Fix 64-bit int warning. 2015-11-16 18:10:40 -08:00
Adam Ierymenko 7a53ecac86 UI stuff. 2015-11-16 17:18:44 -08:00
Adam Ierymenko 906e49ff72 Add make option ZT_ENABLE_CLUSTER and disable it in default Linux build. 2015-11-16 16:22:41 -08:00
Adam Ierymenko e4d1aba3f8 Use new OSX tap version, and update OSX install scripts. 2015-11-16 16:19:24 -08:00
Adam Ierymenko 38fe77ecf2 WebUIWrapper is dead. 2015-11-16 15:44:07 -08:00
Adam Ierymenko 8fde33d87c . 2015-11-16 14:45:17 -08:00
Adam Ierymenko 220552af62 GitHub issue #241 -- and also some appearance updates. Eventually this might get replaced by a native Mac app. 2015-11-16 14:30:25 -08:00
Adam Ierymenko 637d50a9de Write binary of world too. 2015-11-16 13:11:16 -08:00
Adam Ierymenko f5b465c0e1 Merge branch 'edge' of http://10.6.6.2/zerotier/ZeroTierOne into edge 2015-11-16 11:13:02 -08:00
Adam Ierymenko 6ac70ba808 . 2015-11-16 11:01:19 -08:00
Adam Ierymenko 08cd603623 Code to generate real World for edge. 2015-11-16 10:58:40 -08:00
Adam Ierymenko ddf0cb0278 Docs and tweak some caching values. 2015-11-16 09:54:08 -08:00
Grant Limberg 75f8ee1b9c get the compiler to stop complaining about two string literals (one a macro) next to each other without an intervening space 2015-11-14 18:19:33 -08:00
Grant Limberg 0508a41afd added ttl parameter to WirePacketSendFunction 2015-11-14 17:40:17 -08:00
Adam Ierymenko 0d9f33dc4f Fix: (1) Windows stack overflow due to buffer too large in peer deserialize, (2) clean up some other stuff seen during debugging and reduce the sizes of some buffers due to Windows small stack size, (3) remove a redundant try/catch. 2015-11-13 12:14:28 -08:00
Adam Ierymenko 90f9415107 Update installer to drag along a net-install binary for .NET 4.5 that it runs if .NET 4.5 is not present... because yes we have to install Microsoft's own flagship runtime under some conditions. (Rare, but present.) 2015-11-13 09:11:12 -08:00
Adam Ierymenko 2ec638a23d New Windows UI tweaks: get rid of networks tab (only one tab!), make networks full width and make window narrower and a bit taller, colors, fixed-width fonts in several places, make network IDs selectable. 2015-11-12 17:38:30 -08:00
Adam Ierymenko ccae473783 Eliminate Windows warnings. 2015-11-12 16:51:33 -08:00
Adam Ierymenko 54f68280bd Minor Windows build fixes. Builds on VS2012 again. 2015-11-12 16:48:42 -08:00
Adam Ierymenko bacb53fe8f Remove old Windows NDIS5 tap driver -- I think this is dead. 2015-11-12 16:40:50 -08:00
Adam Ierymenko 33c132968e GitHub issue #219 -- make Linux makefile cross-compiler aware. 2015-11-12 15:37:32 -08:00
Adam Ierymenko 73e314cc1a Shelve pcap-with-bridge OSX experiment -- apparently pcap_inject does not work with bridge devices. Still have to use a kext. 2015-11-12 15:28:55 -08:00
Adam Ierymenko 8ac411a9e4 Stashing utun work for OSX -- abandoning for now since utun excludes mDNS among other issues. 2015-11-12 10:47:50 -08:00
Adam Ierymenko 0940d673db Always advertise to the cluster when we have a peer even if we have also initiated handoff. This might be the cause of the warmup problem -- will test later. At the very least it should not hurt anything due to pick-latest logic and the fact that cluster members with only suboptimal paths do not respond to WANT_PEER. 2015-11-11 14:36:22 -08:00
Adam Ierymenko b94335f115 Increase WHOIS retry delay slightly to allow for global cluster latency (e.g. 300+ms from New York to Johhannesburg) 2015-11-11 11:07:08 -08:00
Adam Ierymenko a13ba7102a GitHub issue #242 -- crappy uPnP protocol demands infinite lease time or else 2015-11-10 17:45:05 -08:00
Adam Ierymenko 451b8aa7b2 Query both root and network controller for multicast last resort GATHER. 2015-11-10 17:37:38 -08:00
Adam Ierymenko 53731acf51 Bracket by time in result cruncher script. 2015-11-10 17:15:06 -08:00
Adam Ierymenko 3b9411044f Patch tap-mac to latest tuntaposx upstream changes, and add updated build for 10.8 or later (keep old one for 10.7). 2015-11-10 16:00:21 -08:00
Adam Ierymenko 141e2db38c More results. 2015-11-10 15:47:18 -08:00
Adam Ierymenko 0cf4ddda4a Some more test results, and fix OSX installer to put symlinks in /usr/local as per El Capitan requirements. 2015-11-10 15:11:15 -08:00
Adam Ierymenko 0e4a2c378f Fix a sporadic warning in cluster-geo, and fix test to not overload the test-watcher. 2015-11-10 13:09:58 -08:00
Adam Ierymenko 2854f14966 Some cluster parameter tweaks, and change the test code in tests/http to dramatically reduce the amount of data transfer to/from the test master. Also add results of first successful 50k test. 2015-11-10 11:59:03 -08:00
Adam Ierymenko 4328c6c3bc Fix delete oldest logic. 2015-11-10 09:46:14 -08:00
Adam Ierymenko b171c9a0db Replace slow std::list<> with an O(log(N)) data structure for the cluster relaying send queue. 2015-11-10 09:05:01 -08:00
Adam Ierymenko 32ec378e3b Announce that we have peers on the cluster when we first see them to improve startup times, and add a result crunching script to tests/http. 2015-11-09 18:01:23 -08:00
Adam Ierymenko 2cc50bdb10 Try bringing back TTL escalation -- may help with Docker (IP-MASQ) type NAT 2015-11-09 15:44:13 -08:00
Adam Ierymenko 94f4316a0e Fix for possible high CPU usage on multicast queries. 2015-11-09 14:54:05 -08:00
Adam Ierymenko 35c4e28f31 Mark geo-redirected paths as suboptimal and do not report that we have a peer if all we have is one of these. Also a few other small fixes. 2015-11-09 14:25:28 -08:00
Adam Ierymenko 47424df417 Fix (1) a deadlock bug and (2) a bug that prevented distributed rendezvous messages from being sent. 2015-11-09 13:39:06 -08:00
Adam Ierymenko 73e2c6e511 How did that ever work? 2015-11-09 12:24:49 -08:00
Adam Ierymenko 12cd9df059 . 2015-11-09 11:30:17 -08:00
Adam Ierymenko 4ad2ff2f71 . 2015-11-09 11:08:52 -08:00
Adam Ierymenko b57c855a8c PROXY_SEND fix. 2015-11-09 10:25:20 -08:00
Adam Ierymenko ed954c5ca2 . 2015-11-09 10:09:16 -08:00
Adam Ierymenko 21341ab15c Ready to test. 2015-11-09 09:45:43 -08:00
Adam Ierymenko f4d12603e0 Tweak how Switch passes off to Cluster on relay to fit new paradigm. 2015-11-09 09:19:03 -08:00
Adam Ierymenko ff81415ffe Build fixes... 2015-11-09 09:14:26 -08:00
Adam Ierymenko 5371195c80 Merge branch 'edge' of http://10.6.6.2/zerotier/ZeroTierOne into edge 2015-11-09 09:01:58 -08:00
Adam Ierymenko 473ce82040 Merge branch 'edge' of http://git.int.zerotier.com/zerotier/ZeroTierOne into edge 2015-11-09 09:01:41 -08:00
Adam Ierymenko ab013d831c . 2015-11-09 09:01:38 -08:00
Adam Ierymenko 57b71bfff0 Cluster simplification and refactor work in progress... 2015-11-08 13:57:02 -08:00
Adam Ierymenko 6bc8c9d8ef Clustering cleanup, still a work in progress. 2015-11-06 16:12:41 -08:00
Adam Ierymenko 5f39d5b7ea Further pare down Cluster messaging and rename some stuff. 2015-11-06 14:37:17 -08:00
Adam Ierymenko 9490b1f136 Try prioritizing cluster-send over direct send in cluster mode -- may improve cluster relaying reliability. 2015-11-06 13:38:56 -08:00
Adam Ierymenko badec136fc New agent master IP. 2015-11-06 11:55:06 -08:00
Adam Ierymenko 8ea5f424fd Small amount of cleanup. 2015-11-06 11:15:06 -08:00
Grant Limberg 3cafa60284 fix up some borders & colors 2015-11-05 19:44:19 -08:00
Grant Limberg 2415ae45c1 remove the peers page 2015-11-05 19:44:19 -08:00
Adam Ierymenko aa169b54de Add conntrack tweak to nf for testing. 2015-11-05 18:06:04 -08:00
Adam Ierymenko 83c6b7ab3d Use bigger UDP buffer on bigger x64 machines. Keep old value elsewhere since these are likely to be smaller boxes. 2015-11-05 17:41:07 -08:00
Adam Ierymenko ba5008c370 Now make cluster announcements slightly more frequent. 2015-11-05 17:28:55 -08:00
Adam Ierymenko 3fa1b5a89d Make cluster HAVE_PEER a little lighter by removing full identity. Technically this is not necessary and they will propagate over time in any case. Might restore it in some form in the future. 2015-11-05 17:22:22 -08:00
Adam Ierymenko 7603d8cee8 Merge branch 'edge' of http://git.int.zerotier.com/zerotier/ZeroTierOne into edge 2015-11-05 16:46:42 -08:00
Adam Ierymenko 869eff49bc . 2015-11-05 16:46:33 -08:00
Adam Ierymenko d9abc28fe3 . 2015-11-05 14:54:54 -08:00
Adam Ierymenko 3e22fee842 Integrate deferred background processing into main OneService implementation. 2015-11-05 12:41:14 -08:00
Adam Ierymenko 5ec5911e1b Merge branch 'edge' of http://10.6.6.2/zerotier/ZeroTierOne into edge 2015-11-05 12:23:06 -08:00
Adam Ierymenko 8ef4edebbf Deferred decode for HELLO to prevent HELLOcalypse under high load of new peers. 2015-11-05 12:22:58 -08:00
Grant Limberg 86c74d8a65 set manifest to require administrator privileges and read the authtoken and port from disk 2015-11-04 20:34:49 -08:00
Grant Limberg 49086e4556 just a little xaml cleanup 2015-11-04 20:31:41 -08:00
Grant Limberg 4c7bb06894 make the main window width a bit smaller 2015-11-04 20:19:14 -08:00
Grant Limberg f3e527e130 update the peer list in place rather than replacing it 2015-11-04 20:17:58 -08:00
Grant Limberg df74dd6e41 make the peers page prettier 2015-11-04 20:03:25 -08:00
Grant Limberg 5e9166cec7 setting width/height isn't necessary 2015-11-04 19:30:26 -08:00
Grant Limberg d2c288b13f Fix vertical scrolllbar on networks view 2015-11-04 19:12:12 -08:00
Grant Limberg fc32dc11a6 make the networks view a bit prettier 2015-11-04 19:08:13 -08:00
Grant Limberg 2721804ebf make the tabs a little prettier 2015-11-04 18:41:08 -08:00
Grant Limberg 7b86176d0e Don't go kaboom when the ZeroTier service isn't running. 2015-11-04 18:28:07 -08:00
Adam Ierymenko a95ff21aaf test stuff 2015-11-04 15:09:19 -08:00
Adam Ierymenko 9ec32e7926 Agent settings for big test. 2015-11-04 13:28:43 -08:00
Grant Limberg 7756b5bf1c Merge branch 'android-jni-dev' into edge 2015-11-03 19:15:00 -08:00
Grant Limberg eadeac0a42 logging of events 2015-11-03 19:14:11 -08:00
Adam Ierymenko 172fc1052b Merge windows-ui into edge. 2015-11-03 17:38:36 -08:00
Adam Ierymenko 523412edfb Abort backup in progress if thread is told to shut down. 2015-11-03 16:03:00 -08:00
Adam Ierymenko f7a407ffa0 Tweak timings and use lock in backup to make it a bit faster and still permit main thread to work. 2015-11-03 15:56:24 -08:00
Adam Ierymenko 7903f24a8f Create periodic backup copies of controller.db in network controller from the main process itself to facilitate easier and safer backups of controller.db. 2015-11-03 15:52:10 -08:00
Adam Ierymenko 4b655ab22c tests 2015-11-03 14:39:44 -08:00
Adam Ierymenko d9d11042ca . 2015-11-03 12:56:34 -08:00
Adam Ierymenko 0b245b031e Allow ZT_TRACE without debug. 2015-11-03 11:20:12 -08:00
Adam Ierymenko a42d714a87 . 2015-11-03 11:18:45 -08:00
Adam Ierymenko c9e6e60c09 Handle ZeroTier-RFC4193 IPv6 address NDP queries inline by spoofing responses if the addressing scheme matches -- this allows multicast-free instant lookup of local IPv6 for better performance and reliability. 2015-11-03 10:46:41 -08:00
Grant Limberg b7df177f33 updates for origin/edge 2015-11-02 19:18:55 -08:00
Grant Limberg 179b064b05 Merge branch 'edge' into android-jni-dev 2015-11-02 18:32:21 -08:00
Grant Limberg a19e82fcbc Merge branch 'edge' into windows-ui 2015-11-02 18:30:54 -08:00
Adam Ierymenko 4e9d430476 Make root and relay selection somewhat more robust. 2015-11-02 16:03:28 -08:00
Adam Ierymenko 00dcb0f22c . 2015-11-02 15:39:09 -08:00
Adam Ierymenko 7fbe2f7adf Tweak some more timings for better reliability. 2015-11-02 15:38:53 -08:00
Adam Ierymenko 60ce886605 Tweak some timings for better reliability. 2015-11-02 15:15:20 -08:00
Adam Ierymenko ab27a91b07 . 2015-11-02 13:53:27 -08:00
Adam Ierymenko fd3916a49e More test stuff... make it more granular and less batch based. 2015-11-02 13:17:11 -08:00
Adam Ierymenko e53ef9642e test stuff. 2015-11-02 12:31:34 -08:00
Adam Ierymenko 29249db5d2 Big test stuff. 2015-11-02 11:37:32 -08:00
Adam Ierymenko f1b6427e63 Decided to make this 1.1.0 (semantic versioning increment is warranted), and add a legacy hack for older clients working with clusters. 2015-11-02 09:32:56 -08:00
Adam Ierymenko 1b4cc4af5c Fix evil bug, and instrument/assert on some other stuff, and a bit of cleanup. 2015-10-30 15:54:40 -07:00
Adam Ierymenko 7382c328da Null pointer bug appears fixed... testing again at large scale. 2015-10-30 14:23:28 -07:00
Adam Ierymenko 641b0dec44 . 2015-10-30 14:12:20 -07:00
Adam Ierymenko 2fbb5d0bbf . 2015-10-30 14:11:45 -07:00
Adam Ierymenko d8dbbf7484 Add some debug code in TRACE mode to catch a bug. 2015-10-30 14:11:10 -07:00
Adam Ierymenko 377ccff600 getPeer() had a small potential to be unsafe. 2015-10-30 13:39:28 -07:00
Adam Ierymenko f974517f64 Save zerotier output in containers. 2015-10-30 13:06:30 -07:00
Adam Ierymenko f808138a94 docs and stuff 2015-10-30 13:05:34 -07:00
Adam Ierymenko b845dd1b88 Set contact IP for real test. 2015-10-30 12:38:12 -07:00
Adam Ierymenko b6725c4415 Optimize AntiRecursion. 2015-10-30 11:48:33 -07:00
Adam Ierymenko 5bfa29dded Make antirec tail len slightly shorter, better performance and still plenty long enough. 2015-10-30 11:09:40 -07:00
Adam Ierymenko 80e62ad291 docs 2015-10-30 10:55:05 -07:00
Adam Ierymenko e2fc20876d docs 2015-10-29 18:23:41 -07:00
Adam Ierymenko d6c0d176ee Periodically re-announce peers that we have. 2015-10-29 10:10:09 -07:00
Adam Ierymenko 9f0f0197fe More dead code removal. 2015-10-29 09:44:25 -07:00
Adam Ierymenko a994573a43 Eliminate some more dead code. We may do path trust, but not like that. 2015-10-29 09:42:15 -07:00
Adam Ierymenko 883c84bdb9 Tweak some timings, and remove some dead code. 2015-10-29 09:39:36 -07:00
Adam Ierymenko e3d811b04b docs 2015-10-28 15:55:40 -07:00
Adam Ierymenko cabb8752cb docs 2015-10-28 15:28:05 -07:00
Adam Ierymenko 1f5ef968cf Test need a more recent version of NodeJS so update Dockerfile. 2015-10-28 15:08:00 -07:00
Adam Ierymenko 68d6d3c4ff Fix bug in peer count. 2015-10-28 14:29:08 -07:00
Adam Ierymenko 4c24e0cfb0 More tweaks to tests... just about ready to run at scale. 2015-10-28 14:24:54 -07:00
Adam Ierymenko 9653531242 . 2015-10-28 14:18:58 -07:00
Adam Ierymenko 07c1b4ddee test stuff 2015-10-28 14:16:58 -07:00
Adam Ierymenko 1cae7327ae Basic Dockerfile for building test agents. 2015-10-28 13:35:52 -07:00
Adam Ierymenko c03550de35 HTTP test works! 2015-10-28 13:14:53 -07:00
Adam Ierymenko c6a918d996 HTTP test code. 2015-10-28 12:50:48 -07:00
Adam Ierymenko 0034efafe4 On semi-undocumented test net, assign a RFC4193 IPv6 address too. Will be useful for our at-scale tests. 2015-10-28 11:08:15 -07:00
Adam Ierymenko 0fd15d9cf3 Fix inverted sense bug. 2015-10-28 10:38:37 -07:00
Adam Ierymenko 938d0a970b TRACE build fixes. 2015-10-28 10:01:32 -07:00
Adam Ierymenko fdc3e103cc Cleanup and docs. 2015-10-28 09:38:33 -07:00
Adam Ierymenko c1b0329969 Only check IP equality to detect external surface changes (should prevent some spurious resets under symmetric NATs), and simplify some logic. 2015-10-28 09:32:07 -07:00
Adam Ierymenko da93712846 Clean up PUSH_DIRECT_PATH limits a bit more and make them a bit smarter. 2015-10-28 09:11:30 -07:00
Adam Ierymenko cdc99bfee1 Add a circuit breaker for VERB_PUSH_DIRECT_PATHS. 2015-10-27 18:18:26 -07:00
Adam Ierymenko 88b100e5d0 More cleanup. 2015-10-27 17:59:17 -07:00
Adam Ierymenko 51fcc75354 Some cleanup, and use getPeerNoCache() exclusively in Cluster. 2015-10-27 17:36:47 -07:00
Adam Ierymenko 4221552c0b Use getPeerNoCache() in Cluster to avoid keeping all peers cached everywhere. 2015-10-27 16:52:44 -07:00
Adam Ierymenko cc1b275ad9 Replicate peer endpoints and forget paths if we have them -- this allows two clusters to talk to each other, whereas forgetting all paths does not. 2015-10-27 16:47:13 -07:00
Adam Ierymenko cc6080fe38 (1) No need to confirm if we are a root (small optimization), (2) Refactor peer affinity tracking. 2015-10-27 15:57:26 -07:00
Adam Ierymenko 6399f6f094 This no longer has to be quite so fast. 2015-10-27 15:02:15 -07:00
Adam Ierymenko 218ef07d8e Build fix in TRACE mode. 2015-10-27 15:01:11 -07:00
Adam Ierymenko 16bc3e0398 Factor out RemotePath subclass of Path -- no longer needed, just cruft. 2015-10-27 15:00:16 -07:00
Adam Ierymenko 40976c02a4 Forget paths to peers if we are handing them off. 2015-10-27 14:37:38 -07:00
Adam Ierymenko f692cec763 Change how cluster relays packets -- just PROXY_UNITE and then send packet via normal ZeroTier front plane -- more efficient and eliminates fragmentation issues. 2015-10-27 14:04:12 -07:00
Adam Ierymenko 40e0a34a5c Add set buffer sizes code to Phy<> 2015-10-27 13:04:08 -07:00
Adam Ierymenko 7295fcfa86 Merge Phy<> from netcon. 2015-10-27 12:50:23 -07:00
Adam Ierymenko cfe166ef35 Tweak some size limits. 2015-10-27 12:29:01 -07:00
Adam Ierymenko 0ffbd05c0e --wtf; prevent roots from TCP fallback 2015-10-27 12:21:57 -07:00
Adam Ierymenko a1a0ee4edb Fix infinite loop in Cluster, clean up some stuff elsewhere, and back out rate limiting in PUSH_DIRECT_PATHS for now (but we will do something else to mitigate amplification attacks) 2015-10-27 12:01:00 -07:00
Adam Ierymenko 54a99d8e32 Well that was broken. 2015-10-27 11:14:07 -07:00
Adam Ierymenko 62db18b6dd Lessen this limit just a bit to make cluster settle faster. 2015-10-27 11:01:58 -07:00
Adam Ierymenko f32e9d07dd Don't include COM if not necessary (fix). 2015-10-27 10:58:01 -07:00
Adam Ierymenko 700c3166b7 Fix inverted sense bug. 2015-10-27 10:51:11 -07:00
Adam Ierymenko 17e7528e2c More root cleanup. 2015-10-27 10:40:31 -07:00
Adam Ierymenko 8a7a0b6b88 Cleanup, including simplification of root server picking algorithm since we no longer need all that craziness. 2015-10-27 10:37:39 -07:00
Adam Ierymenko 9617208e40 Some cleanup, and use VERB_PUSH_DIRECT_PATHS to redirect newer peers. 2015-10-27 09:53:43 -07:00
Adam Ierymenko fb3b7a3baa Take -DZT_ENABLE_CLUSTER out of Mac defaults. 2015-10-27 09:41:12 -07:00
Adam Ierymenko 69857b4ba8 Refactor cluster redirects to move code to push peers out of the actual Cluster function that checks for redirect, and clean up Peer::received() to be a bit more logical. 2015-10-27 09:36:48 -07:00
Grant Limberg 0ffcfa307e another build setting 2015-10-26 20:26:19 -07:00
Grant Limberg 16c812ec80 set the app icon for release 2015-10-26 20:24:08 -07:00
Grant Limberg 268fbdabce disable sorting of peers 2015-10-26 20:06:53 -07:00
Grant Limberg 87496e9f4a can now leave networks 2015-10-26 19:53:03 -07:00
Grant Limberg 300a951730 Figured out how to expand controls to fill parent. yay 2015-10-26 19:39:54 -07:00
Grant Limberg 095539de29 Initial peers page 2015-10-26 19:21:21 -07:00
Grant Limberg c4c67e591b add error handling for JSON serialization 2015-10-26 19:02:19 -07:00
Grant Limberg 502aa68bb7 change int to UInt64 for these properties 2015-10-26 19:01:59 -07:00
Grant Limberg 81cb4bc8d6 set up a timer to update the UI from a background thread 2015-10-26 18:31:10 -07:00
Adam Ierymenko e713f7a54c Can redirect in response to a few more verbs, just not these. 2015-10-26 18:20:40 -07:00
Grant Limberg 352b83252f Merge branch 'adamierymenko-dev' into windows-ui 2015-10-26 18:10:27 -07:00
Grant Limberg a0c3083af0 disallow paste of non hex characters 2015-10-26 18:08:44 -07:00
Adam Ierymenko 98d856daa2 Only send redirects to the sending InetAddress and only in response to a set of certain frame types to avoid potential race conditions. 2015-10-26 17:58:51 -07:00
Adam Ierymenko 8bfb02ba3c Only send redirects for the same address class, and elminiate some TRACE noise. 2015-10-26 16:55:55 -07:00
Adam Ierymenko 0b82c9ebad Fix infinite loop if there are no live roots (never happened before?!? wow!) 2015-10-26 16:09:56 -07:00
Adam Ierymenko de761c5a82 Fix test world def. 2015-10-26 15:47:32 -07:00
Adam Ierymenko 6cf1da166f Add the whole new World, though with test identities at this point. 2015-10-26 15:12:28 -07:00
Adam Ierymenko 6625d79296 Fix if cluster compiled in but not enabled. 2015-10-26 13:07:00 -07:00
Adam Ierymenko debed1ac2d Expose cluster status in /status JSON response. 2015-10-26 13:06:10 -07:00
Adam Ierymenko 5ff7733f84 More plumbing of cluster status. 2015-10-26 12:49:17 -07:00
Adam Ierymenko 865acfa40f Cluster status plumbing. 2015-10-26 12:41:08 -07:00
Adam Ierymenko 3ce5ad9e2c For forward compatibility, add minimal parse for some future physical address types. 2015-10-26 10:42:30 -07:00
Adam Ierymenko d2b1dfe424 Fully specify new network in alice-test, this will (with different identities) eventually become the World. 2015-10-23 15:51:50 -07:00
Grant Limberg 55dcf4c65f wire up the join network button 2015-10-23 15:50:49 -07:00
Grant Limberg 7e635d37ad only accept hex characters for network id 2015-10-23 15:49:04 -07:00
Grant Limberg b7b973624a add methods for joining/leaving networks, and getting peers 2015-10-23 15:37:36 -07:00
Grant Limberg 62059a91aa C#-ifying stuff 2015-10-23 15:36:42 -07:00
Adam Ierymenko 35676217e8 Refactor multicast group announcement to work directly or indirectly. 2015-10-23 14:50:07 -07:00
Adam Ierymenko e9648a6cdf Clarify logic in pinging, and prevent roots from pinging "down." 2015-10-23 14:05:12 -07:00
Adam Ierymenko e6a63f5547 Fix bug in setWorld that might have caused a peer entry for myself (which would never be used) 2015-10-23 13:57:02 -07:00
Adam Ierymenko 29b966894c (1) Fix bug in geo-ip service that prevented cache lookup, (2) fix problem in SelfAwareness (will need to test ALL versions in the wild with this), and (3) add more TRACE instrumentation to Cluster. 2015-10-23 13:03:34 -07:00
Adam Ierymenko f0160635a2 Add --harmony for older nodeJS. 2015-10-23 12:05:17 -07:00
Adam Ierymenko 964b30902a Cluster fix: was accumulating remote endpoints endlessly. 2015-10-23 11:51:18 -07:00
Adam Ierymenko 2a3dd53952 . 2015-10-22 17:50:00 -07:00
Adam Ierymenko dee6e7e3c1 . 2015-10-22 16:11:48 -07:00
Adam Ierymenko 7711eba297 More cluster wiring... 2015-10-22 16:02:01 -07:00
Adam Ierymenko 1bc451ed10 GeoIP cluster service works. 2015-10-22 10:41:15 -07:00
Adam Ierymenko e07bae2525 Run geoip cluster service sub-process. 2015-10-22 10:18:05 -07:00
Adam Ierymenko 5304b0d8d1 Rename index.js so process is distinguishable. 2015-10-22 09:09:15 -07:00
Grant Limberg fe6960888a add a scroll bar to the network info view 2015-10-21 20:40:43 -07:00
Grant Limberg 5b6ddaa2d7 Base windows UI is working.
* No joining/leaving networks yet, but they do display.
* Nothing is updated yet after first load of the app.  Need to set up a background task to run updates.
2015-10-21 20:29:03 -07:00
Grant Limberg 6471c1f4e2 Merge branch 'adamierymenko-dev' into windows-ui 2015-10-21 17:35:38 -07:00
Adam Ierymenko a46514b397 Cluster-geo launcher. 2015-10-21 12:47:02 -07:00
Adam Ierymenko 25a84e30fc Code for cluster-geo service. 2015-10-21 12:41:46 -07:00
Adam Ierymenko 978b056a01 Wire in redirectPeer(), now about ready to test clustering! 2015-10-20 17:36:10 -07:00
Adam Ierymenko 6a7b47e5e1 Forgot a return true. 2015-10-20 17:27:57 -07:00
Adam Ierymenko d6dee7bb5c Clustered handling of relaying. 2015-10-20 17:22:53 -07:00
Adam Ierymenko 35a12b94ea Outfit Cluster with TRACE for debugging. 2015-10-20 16:48:49 -07:00
Adam Ierymenko 2258e36a59 Move replication of COMs to avoid race condition. 2015-10-20 16:34:21 -07:00
Adam Ierymenko 59e1444b27 Finish wiring up Cluster, fix some issues with other recent changes. 2015-10-20 16:31:41 -07:00
Adam Ierymenko eb79d4a2f3 Wire up peer announcement in cluster. 2015-10-20 16:24:21 -07:00
Adam Ierymenko 57e29857cf Cluster work -- integrating with the rest of the code. 2015-10-20 15:27:53 -07:00
Grant Limberg 21ae423feb . 2015-10-19 21:19:23 -07:00
Grant Limberg 9ba5c91d4a initial layout for network info 2015-10-19 21:17:18 -07:00
Grant Limberg 80d02d189a set the main window icon 2015-10-19 20:30:21 -07:00
Grant Limberg 56267b2aed setting icon and a few other settings 2015-10-19 20:29:06 -07:00
Grant Limberg 6040574d8d set up project and base UI for a native windows UI for ZeroTier 2015-10-19 20:20:42 -07:00
Adam Ierymenko 5e6eae620b Make _members dynamically allocated due to static array limit on ARM. 2015-10-19 16:18:57 -07:00
Adam Ierymenko 69dad37d8f Restore default World for commit to upstream 2015-10-19 15:23:43 -07:00
Adam Ierymenko cfdcce6d12 Fix very obscure IP scope classification logic bug. 2015-10-19 15:19:04 -07:00
Adam Ierymenko 0b2e5ed499 Fix some broken logic in Path::reliable() 2015-10-19 15:11:43 -07:00
Adam Ierymenko 9150778757 . 2015-10-19 15:04:26 -07:00
Adam Ierymenko 50f3ccd3c9 . 2015-10-19 15:03:58 -07:00
Adam Ierymenko 584072fa6a Fix for V4/V6 stable addressing. 2015-10-19 14:04:36 -07:00
Adam Ierymenko 3adb183c5f Fix bad COM attachment bug and eliminate an unnecessary redundant check. 2015-10-19 13:38:27 -07:00
Adam Ierymenko 95953b48f9 Do not allow VERB_RENDEZVOUS from non-upstream peers to block potential DOS vector. 2015-10-19 12:56:29 -07:00
Adam Ierymenko aa6e3c79a0 Some test stuff that will not be pushed elsewhere. 2015-10-19 10:49:31 -07:00
Adam Ierymenko 0c43d34ce3 World test stuff... some of this will be yanked before release. 2015-10-19 10:00:35 -07:00
Adam Ierymenko 738fa5a5e5 . 2015-10-16 12:10:57 -07:00
Adam Ierymenko cc4d0199e7 Fix vProto init. 2015-10-16 10:58:59 -07:00
Adam Ierymenko 781f06ef82 Accept OK for confirm of HELLO or ECHO. 2015-10-16 10:48:38 -07:00
Adam Ierymenko f9f60f89d9 Peer save/restore fix. 2015-10-16 10:45:58 -07:00
Adam Ierymenko 5ce3aac929 Add rate limit on receive of DIRECT_PATH_PUSH to prevent DOS exploitation. 2015-10-16 10:28:09 -07:00
Adam Ierymenko 2229e91b57 IPv6 support fixes. 2015-10-16 10:10:12 -07:00
Adam Ierymenko 2debde3451 GitHub issue #235, and I also see no reason not to communicate with people from other Worlds. 2015-10-15 07:22:17 -07:00
Adam Ierymenko a775ee7d31 . 2015-10-14 16:21:39 -07:00
Adam Ierymenko 9ece8c465e decrypt fix 2015-10-14 15:49:41 -07:00
Adam Ierymenko 59389b3dce Untested cluster code, not enabled. 2015-10-14 14:17:55 -07:00
Adam Ierymenko 619e113748 Work in progress on Cluster for new root infrastructure, multi-homing. 2015-10-14 14:12:12 -07:00
Adam Ierymenko c312ae221f Fix for world size in OK(HELLO) 2015-10-14 10:45:33 -07:00
Adam Ierymenko 719233617c Add uint16_t key to Hashtable, and make Salsa20 zero its keyspace on destruction. 2015-10-14 10:14:07 -07:00
Adam Ierymenko 489e1a5b83 Don't keep connections up longer than the alive timeout (unless they are relays or roots) 2015-10-13 13:51:54 -07:00
Adam Ierymenko 824ed99160 . 2015-10-13 12:42:54 -07:00
Adam Ierymenko 385f1410d2 Expose world info in JSON. 2015-10-13 12:33:15 -07:00
Adam Ierymenko 70d8e3ad94 Expose world ID and world timestamp in ZT_NodeStatus 2015-10-13 12:31:38 -07:00
Adam Ierymenko 71348f3ebb docs 2015-10-13 12:29:01 -07:00
Adam Ierymenko e268d9492a cleanup 2015-10-13 12:18:47 -07:00
Adam Ierymenko 123c466843 Full integration of World and World updates. 2015-10-13 12:17:47 -07:00
Adam Ierymenko 5d2f523e81 World stuff... 2015-10-13 12:10:44 -07:00
Adam Ierymenko 05677f57e2 Add C output to mkworld. 2015-10-13 08:55:21 -07:00
Adam Ierymenko cae58f43f1 More World stuff, and mkworld. 2015-10-13 08:49:36 -07:00
Adam Ierymenko 1b1945c63e Work in progress on refactoring root-topology into World and adding in-band updates. 2015-10-12 18:25:29 -07:00
Adam Ierymenko 70fe7dd1fd cleanup 2015-10-12 16:40:57 -07:00
Adam Ierymenko eff1fe3c61 Create files for each hop (more convenient) and fix a packet parse bug. 2015-10-09 16:22:34 -07:00
Adam Ierymenko 7d01fab132 Reorg fields to be in same order as FS scheme. 2015-10-09 15:18:01 -07:00
Adam Ierymenko c9295a5883 . 2015-10-09 15:12:05 -07:00
Adam Ierymenko aec13b50fd Be a bit more verbose in circuit test reports to more clearly track current and upstream hop in graph traversal history. 2015-10-09 15:05:26 -07:00
Adam Ierymenko a95fa379cc Circuit tests basically work but need some tweaks, and fix some issues found with valgrind. 2015-10-09 14:51:38 -07:00
Adam Ierymenko 97dee9de36 Add more helpful example stuff. 2015-10-09 12:50:52 -07:00
Adam Ierymenko 6b5bb0b278 Eliminate format string warnings. 2015-10-09 12:22:13 -07:00
Adam Ierymenko e33adad8f5 Script to quickly generate test docker env files. 2015-10-09 12:15:42 -07:00
Adam Ierymenko 9a25651151 . 2015-10-09 10:14:45 -07:00
Adam Ierymenko c2bbec2f05 Docker example (and useful for testing) 2015-10-09 10:14:20 -07:00
Adam Ierymenko 0c498556d5 Unroll Salsa20 fully for a little more speed (non-SSE now almost as fast as SSE) 2015-10-09 09:39:27 -07:00
Adam Ierymenko 3fa6dd377f docs 2015-10-09 08:51:57 -07:00
Adam Ierymenko 160278c489 Little bit of reorg in Salsa20 which seems to speed things up very slightly. 2015-10-08 17:42:53 -07:00
Adam Ierymenko 59da8b2a4b Logging of circuit test results to disk. 2015-10-08 15:44:06 -07:00
Adam Ierymenko 558775d544 Merge branch 'adamierymenko-dev' of http://10.6.6.2/zerotier/ZeroTierOne into adamierymenko-dev 2015-10-08 13:26:43 -07:00
Adam Ierymenko a3876353ca Abiltiy to post a test via the controller web API, and parsing of CIRCUIT_TEST_REPORT messages. 2015-10-08 13:25:38 -07:00
Adam Ierymenko 273f0d18b0 docs 2015-10-08 09:05:25 -07:00
Grant Limberg 9347d6c866 Make it so ZeroTierOne.h can be used with a C compiler again. 2015-10-07 18:04:40 -07:00
Adam Ierymenko fea1b6b2c3 docs 2015-10-07 16:25:08 -07:00
Adam Ierymenko 0ce0bc00d2 Make sure received() gets called for some new messages, and docs. 2015-10-07 16:20:54 -07:00
Adam Ierymenko 69b44bf9a5 Finally add an ECHO. 2015-10-07 16:11:50 -07:00
Adam Ierymenko 73cafbe0ec Limit proof of work difficulty to something sane. 2015-10-07 13:46:44 -07:00
Adam Ierymenko e5f168f599 Add proof of work request for future DDOS mitigation use. 2015-10-07 13:35:46 -07:00
Adam Ierymenko 7d62dbe9f7 Tune NAT-t keepalives so that timing is better obeyed, clean up a build warning, and fix a potential source of network recursion (though harmless). 2015-10-07 11:57:59 -07:00
Adam Ierymenko 13f14c2f4c Kill debug line. 2015-10-07 10:56:47 -07:00
Adam Ierymenko c952fbbd8d Only enable 128-bit Poly1305 on X86_64 right now. Has compilation issues on ARM, but the 64-bit version should be fine. 2015-10-07 10:40:59 -07:00
Adam Ierymenko ab0228f626 More cleanup and simple refactoring, consolidate InetAddres serialize/deserialize into the class. 2015-10-07 10:30:47 -07:00
Adam Ierymenko 6c7ce79c89 Be consistent in how enums are defined in the main .h file. 2015-10-07 09:51:35 -07:00
Adam Ierymenko 1b2cac0cc5 Trim some cruft that is not used and probably never would be. 2015-10-07 09:38:33 -07:00
Adam Ierymenko 598a1d8dd7 Try reopening /dev/urandom if there is a problem. 2015-10-06 18:10:40 -07:00
Adam Ierymenko 64aaea3978 Cleanup, and add an even faster Poly1305 on systems that support it. 2015-10-06 18:04:53 -07:00
Adam Ierymenko 477feee8a3 Some work on CIRCUIT_TEST, and a significant speedup to Poly1305. 2015-10-06 17:55:57 -07:00
Adam Ierymenko 7394ec6f6a Prep in controller code to run tests. 2015-10-06 15:56:18 -07:00
Adam Ierymenko 3593fb3462 Send initial CIRCUIT_TEST packet. 2015-10-06 15:16:41 -07:00
Adam Ierymenko d3f29d09e8 Plumbing through circuit test stuff. 2015-10-06 14:42:51 -07:00
Adam Ierymenko 5341afcdcd Handling of CIRCUIT_TEST, should be ready to test. 2015-10-06 11:47:16 -07:00
Adam Ierymenko 57c857e89a Fix TRACE output. 2015-10-06 06:57:00 -07:00
Grant Limberg c16ad053b6 no toString() method on peer. Commenting out for now. 2015-10-02 19:39:46 -07:00
Grant Limberg 6080a45c9c change cert to com. no variable named cert. 2015-10-02 19:39:13 -07:00
Adam Ierymenko 5384f185ae Simplify Dictionary and reduce memory usage, now no more std::maps in core. 2015-10-01 18:12:16 -07:00
Adam Ierymenko 76a95dc58f The return of peer peristence. 2015-10-01 17:09:01 -07:00
Adam Ierymenko 5076c49210 Peer serialization and related changes. 2015-10-01 15:40:54 -07:00
Adam Ierymenko 72e7e36a5b No reason to randomly pick uPnP secondary port. In fact it would likely cause problems on restarts and uPnP rule bloat. 2015-10-01 14:40:28 -07:00
Adam Ierymenko 2fa21aa676 . 2015-10-01 13:43:57 -07:00
Adam Ierymenko 3999e468b7 Need to hold nconf so *com does not die while being used. 2015-10-01 13:43:15 -07:00
Adam Ierymenko 6693149f3e Send COM with MULTICAST_GATHER for future use. 2015-10-01 13:34:12 -07:00
Adam Ierymenko 2c196307ee --bugs; 2015-10-01 13:01:18 -07:00
Adam Ierymenko d6676a9d6c Always announce multicast groups, not just to peers with direct links, and push network COMs to any MULTICAST_LIKE recipient for future use. 2015-10-01 12:50:19 -07:00
Adam Ierymenko a7409850d6 Get trim() out of core where it is not needed. 2015-10-01 12:37:18 -07:00
Adam Ierymenko 53e5f94b99 . 2015-10-01 12:25:43 -07:00
Adam Ierymenko 64bf3ffe6c Mutex cleanup. 2015-10-01 11:44:09 -07:00
Adam Ierymenko 9405150b11 Restore group announcement on Peer::receive() but centralize packet composition in one place. 2015-10-01 11:37:02 -07:00
Adam Ierymenko a3db7d0728 Refactor: move network COMs out of Network and into Peer in prep for tightening up multicast lookup and other things. 2015-10-01 11:11:52 -07:00
Adam Ierymenko 11ff96ba1d Consider IPv6 paths reliable (no constant keepalives needed) 2015-09-30 15:20:08 -07:00
Adam Ierymenko 0d0039674f Add new verb names, and fix some Mac compiler flags. 2015-09-30 14:48:07 -07:00
Adam Ierymenko 789046ca57 Speed up Salsa20 just a bit. 2015-09-30 14:35:05 -07:00
Adam Ierymenko 1a4f16e0ed More work on circuit testing... 2015-09-30 13:59:05 -07:00
Adam Ierymenko a7bd1eaa40 Never assign v4 IPs ending in .255 even within range. 2015-09-28 15:28:30 -07:00
Adam Ierymenko 2d0adb562d Specify circuit test messages. 2015-09-27 11:37:39 -07:00
Grant Limberg 75a191a856 don't create an InetSocketAddress on local address if it's equal to ZT_SOCKADDR_NULL 2015-09-26 14:10:45 -07:00
Grant Limberg 7c3be2b5c1 fix function signature in lookup for onSendPacketRequested function 2015-09-26 14:10:16 -07:00
Grant Limberg 0b9e5928d3 update PacketSender interface 2015-09-26 13:53:38 -07:00
Grant Limberg e8cdff3eaf Merge branch 'adamierymenko-dev' into android-jni-dev
also update for changed function calls that now accept a local address

# Conflicts:
#	include/ZeroTierOne.h
#	java/CMakeLists.txt
#	java/jni/Android.mk
#	java/jni/ZT1_jnicache.cpp
#	java/jni/ZT1_jnilookup.h
#	java/jni/ZT1_jniutils.cpp
#	java/jni/com_zerotierone_sdk_Node.cpp
2015-09-26 13:47:55 -07:00
Adam Ierymenko f69454ec98 (1) Make ZT_ naming convention consistent (get rid of ZT1_), (2) Make local interface a full sockaddr_storage instead of an int identifier, which turns out to be better for multi-homing and other uses. 2015-09-24 16:21:36 -07:00
Adam Ierymenko 0e5aac6a11 Prefer IPv6 paths if available. 2015-09-23 16:16:36 -07:00
Adam Ierymenko b242216674 Version bump, preparing for a likely 1.0.6 soon. 2015-09-23 16:10:06 -07:00
Adam Ierymenko 423412df98 Pick a random secondary UDP port for uPnP mapped traffic because of broken routers. 2015-09-23 15:16:20 -07:00
Adam Ierymenko 7821d1cbdd . 2015-09-23 14:44:13 -07:00
Adam Ierymenko 80dc7fb675 Pick random port on -p0 2015-09-23 14:38:16 -07:00
Adam Ierymenko a3ed5277ef Make sure ZT_NO_TYPE_PUNNING also obeyed here. 2015-09-23 14:09:27 -07:00
Adam Ierymenko 2a527ea82e Fix for timer jitter problem. 2015-09-23 14:01:41 -07:00
Adam Ierymenko 367ffde00c Plumb through localInterfaceId to track local interfaces corresponding with remote addresses. 2015-09-23 13:49:56 -07:00
Adam Ierymenko 4464fa5d39 Eliminate another warning. 2015-09-23 10:29:05 -07:00
Adam Ierymenko 86996d4315 Eliminate compiler warning. 2015-09-23 10:27:53 -07:00
Adam Ierymenko d656e87395 Send a random small payload for NAT keepalives, since zero byte packets seem to fail to keep associations alive behind some NATs. 2015-09-22 15:58:00 -07:00
Adam Ierymenko ddf3d1f949 Controller side support for IPv6 assignment. 2015-09-18 13:35:00 -07:00
Adam Ierymenko 3664966340 Generate local IPv6 addresses from network IDs and addresses. 2015-09-17 21:30:32 -07:00
Adam Ierymenko 610ab0750c Drop Sqlite-based Log table for now and switch to an in-memory log for recent activity. Log table gets too big on busy nodes. Should probably support push of events to some kind of event system later. 2015-09-15 10:59:23 -07:00
Adam Ierymenko ef316ced3b Fix JSON. 2015-09-14 11:59:43 -07:00
Grant Limberg f7d3e262a9 ifdef default assignments 2015-09-11 17:16:38 -07:00
Adam Ierymenko cd005341c5 Extra statement to clean up Members -- cascade did not seem to work, possibly due to dual key. 2015-09-11 15:02:26 -07:00
Adam Ierymenko c1a53a2653 ARP cache and responder agent code for use in netcon and iOS. 2015-09-11 11:45:04 -07:00
Adam Ierymenko 9dc2ef5549 Rename some stuff in Phy since it can be used with any stream socket. 2015-09-10 15:55:48 -07:00
Adam Ierymenko cd3d77987c . 2015-09-10 15:52:24 -07:00
Adam Ierymenko a35fa7ac93 Add expansion of netconf in _test field. 2015-09-10 15:14:10 -07:00
Adam Ierymenko bebe3d7cfa Fix deadlock in test mode. 2015-09-10 14:47:04 -07:00
Adam Ierymenko 1f7a41cff8 Fix to allowing identity to be populated if not present. 2015-09-10 14:37:34 -07:00
Adam Ierymenko 9a723be263 Add socketpair support to Phy. 2015-09-10 13:18:57 -07:00
Adam Ierymenko 4fbcad2468 Allow identity to be populated for newly inserted Member objects to permit transfer from old network controller and testing. 2015-09-08 13:02:42 -07:00
Adam Ierymenko 0d386f1c31 Add a bit of useful testing instrumentation to SqliteNetworkController. 2015-09-08 11:35:55 -07:00
Adam Ierymenko 85b90f122a Final std::map<> from Switch, and add some smallish default values for hash size. 2015-09-04 15:35:43 -07:00
Adam Ierymenko 3dba016a93 Almost done... very few std::map<>s remaining in any spot that matters. 2015-09-04 15:21:22 -07:00
Adam Ierymenko db0369e9b8 Remove way-overkill multimap from Switch. 2015-09-04 14:56:39 -07:00
Adam Ierymenko 0ab3e49be9 Starting in on Switch... kill map in defrag queue, which will probably improve performance pretty decently under high load with lots of peers. 2015-09-04 14:44:22 -07:00
Adam Ierymenko f116c4b9c0 ... and another ... 2015-09-04 14:24:31 -07:00
Adam Ierymenko 307e44f7c8 Two for one! (std::map removal) 2015-09-04 14:14:32 -07:00
Adam Ierymenko d1341578d8 ... and another one! 2015-09-04 13:53:48 -07:00
Adam Ierymenko 7b8ce16057 Another std::map<> dies. 2015-09-04 13:42:19 -07:00
Adam Ierymenko 3a959a7763 Swap out std::map<> for Hashtable<> for main peer database in Topology. (ongoing std::map-ectomy) 2015-09-04 12:14:21 -07:00
Adam Ierymenko cfd101c9b8 Add entries() to go with keys() for future use. 2015-09-04 11:50:12 -07:00
Adam Ierymenko da9a720c3f Hash table bug fix, and add copy constructor and assignment operator for principle of least surprise. 2015-09-03 17:33:06 -07:00
Adam Ierymenko 4838cbc350 Unix domain sockets in Phy<> 2015-09-02 14:32:01 -07:00
Grant Limberg 53d98343b7 Merge branch 'master' into android-jni 2015-08-31 19:53:39 -07:00
Grant Limberg 73bedfcc01 ifdef default assignments 2015-08-29 17:54:30 -07:00
Grant Limberg d5b48c90ed added a 512x512 app icon (for Play store) 2015-08-27 19:51:27 -07:00
Grant Limberg ebfbb7f452 Merge branch 'master' of http://git.int.zerotier.com/ZeroTier/ZeroTierOne into android-jni 2015-08-27 19:31:46 -07:00
Adam Ierymenko b11ffc9635 Integrate Hashtable into Multicaster, where @mwarning found heaviest std::map() overhead. 2015-08-27 16:17:21 -07:00
Adam Ierymenko 3947807b1f A simple and fast Hashtable, tested but not yet integrated with anything. 2015-08-27 15:36:13 -07:00
Grant Limberg 7d676ad16a Merge branch 'adamierymenko-dev' into android-jni 2015-08-13 19:36:30 -07:00
Grant Limberg 0fd6808e21 Merge branch 'master' into android-jni 2015-08-01 11:52:47 -07:00
Grant Limberg c9b4028cd3 Merge branch 'adamierymenko-dev' into android-jni 2015-07-29 20:13:32 -07:00
Grant Limberg 508d31513a Merge branch 'adamierymenko-dev' into android-jni 2015-07-28 19:18:33 -07:00
Grant Limberg bc0954381c Merge branch 'adamierymenko-dev' into android-jni 2015-07-21 17:53:39 -07:00
Grant Limberg d05e8a9772 Merge branch 'adamierymenko-dev' into android-jni 2015-07-20 19:51:58 -07:00
Grant Limberg 1e8ead441c Merge branch 'adamierymenko-dev' into android-jni 2015-07-16 18:09:57 -07:00
Grant Limberg e45475c5b5 fixed a misspelling 2015-07-09 20:26:23 -07:00
Grant Limberg a408e5f685 set ZT_NO_TYPE_PUNNING and -O3 for Android builds 2015-07-08 18:00:13 -07:00
Grant Limberg f67ddb579d Merge branch 'adamierymenko-dev' into android-jni 2015-07-08 17:30:22 -07:00
Grant Limberg 1ad2cfeedf Merge branch 'adamierymenko-dev' into android-jni 2015-07-07 19:24:02 -07:00
Grant Limberg 6d398beefd Merge branch 'adamierymenko-dev' into android-jni 2015-07-03 18:15:56 -07:00
Grant Limberg ab34884e3e Set -O0
anything above that currently goes kaboom on ARM platforms
2015-07-03 18:14:50 -07:00
Grant Limberg 0b7cd2f40a change some build settings. add a lock 2015-07-01 20:26:14 -07:00
Grant Limberg 2a2e3b80b3 Merge branch 'adamierymenko-dev' into android-jni 2015-07-01 18:13:59 -07:00
Grant Limberg f803dd5ff4 ... 2015-07-01 18:13:39 -07:00
Grant Limberg d853dbf2d8 Merge branch 'adamierymenko-dev' into android-jni 2015-06-30 19:23:23 -07:00
Grant Limberg aee8e95d49 logging 2015-06-30 19:21:46 -07:00
Grant Limberg c9919cc5ba reflect changes to ZT1_PeerRole in JNI 2015-06-26 18:26:57 -07:00
Grant Limberg 9c26d10ea6 Merge branch 'adamierymenko-dev' into android-jni 2015-06-26 17:44:09 -07:00
Grant Limberg bfb152f53f configure the NDK to build all supported ABIs and package them up in the jar 2015-06-24 20:31:22 -07:00
Grant Limberg 759d71037e added Comparable interface to VirtualNetworkConfig so we can sort arrays containing it. 2015-06-23 23:03:02 -07:00
Grant Limberg adf89901c4 dont consider multicast groups in VirtualNetworkConfig.equals() 2015-06-19 19:00:06 -07:00
Grant Limberg dfdd46db80 Merge branch 'adamierymenko-dev' into android-jni 2015-06-17 18:42:23 -07:00
Grant Limberg c59c74ddda Merge branch 'adamierymenko-dev' into android-jni 2015-06-13 14:39:45 -07:00
Grant Limberg abbcb0a12c Modified ant build script so that it can be integrated with Android Studio's build system 2015-06-13 14:38:04 -07:00
Grant Limberg 472206dfb2 Rename JniCache to JniLookup
Removed caching capabilities as the cached methods, fields, and objects appears to be broken on Android
2015-06-10 20:16:13 -07:00
Grant Limberg 7e84f5a7db killing whitespace 2015-06-09 23:24:54 -07:00
Grant Limberg 6889fcfc28 Looks like it was the JNI cash causing the crash.
Forcing it to look up classes and methods instead of caching them stopped the crashes in the GC.  Will investigate more later.
2015-06-09 23:24:47 -07:00
Grant Limberg 4dc0ff8f13 Replace calls to Get<Type>ArrayElements with GetPrimitiveArrayCritical.
This puts code accessing the data in a critical section so that the GC cannot run while JNI has access to the array.  This helps with stability somewhat, but I'm still getting some crashes in the GC
2015-06-09 23:12:44 -07:00
Grant Limberg 3013d90f57 ignore windows binary output 2015-06-09 22:38:31 -07:00
Grant Limberg 60da0e6cae Merge branch 'adamierymenko-dev' into android-jni 2015-06-09 19:38:47 -07:00
Grant Limberg ced040c503 Logging and adding .equals() methods to MulticastGroup and VirtualNetworkCofnig 2015-06-09 19:38:05 -07:00
Grant Limberg 7cc64c5cb6 Might help to set the enabled field on a VirtualNetworkConfig object :) 2015-06-03 21:29:19 -07:00
Grant Limberg b84dba3ecb more logging 2015-06-03 21:29:07 -07:00
Grant Limberg 8fb9df9751 delete dead test code 2015-06-03 18:35:38 -07:00
338 changed files with 27809 additions and 16778 deletions

No files matched your search

+17 -12
View File
@@ -29,8 +29,12 @@ Thumbs.db
# *nix/Mac build droppings
/build-*
/ZeroTierOneInstaller-*
/examples/docker/zerotier-one
/examples/docker/test-*.env
/world/mkworld
/world/*.c25519
# Miscellaneous file types that we don't want to check in
# Miscellaneous temporaries, build files, etc.
*.log
*.opensdf
*.user
@@ -40,28 +44,26 @@ Thumbs.db
*.pid
*.pkg
*.o
*.a
*.dylib
*.so
*.o-*
*.core
*.deb
*.rpm
*.autosave
*.tmp
# Root topology build files, temporaries, and never check in secrets
/root-topology/bin2c
/root-topology/mktopology
/root-topology/*.secret
/root-topology/test/supernodes
/root-topology/test/test-root-topology
node_modules
cluster-geo/cluster-geo/config.js
cluster-geo/cluster-geo/cache.*
tests/http/zerotier-one
tests/http/big-test-hosts
# MacGap wrapper build files
/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/project.xcworkspace/xcuserdata/*
/ext/mac-ui-macgap1-wrapper/src/MacGap.xcodeproj/xcuserdata/*
/ext/mac-ui-macgap1-wrapper/src/build
# Web UI dev temporaries
/ui/.module-cache
node_modules
# Java/Android/JNI build droppings
java/obj/
java/libs/
@@ -71,3 +73,6 @@ java/doc/
java/build_win64/
java/build_win32/
/java/mac32_64/
windows/WinUI/obj/
windows/WinUI/bin/
windows/ZeroTierOne/Debug/
+5 -1
View File
@@ -116,7 +116,7 @@ On Mac the best way is to install [Packages](http://s.sudre.free.fr/Software/Pac
This builds a .pkg file that can be installed.
BSD has no installer yet. We're working on it.
In FreeBSD there is now an official .pkg in the FreeBSD repository. Type "pkg install zerotier". It can also be built and installed from source.
Linux/BSD and Mac installations have an *uninstall.sh* file in their ZeroTier home folder that cleanly removes ZeroTier One from the system. Run this with:
@@ -166,6 +166,10 @@ If you're interested, there's a [technical deep dive about NAT traversal on our
If a firewall between you and the Internet blocks ZeroTier's UDP traffic, you will fall back to last-resort TCP tunneling to rootservers over port 443 (https impersonation). This will work almost anywhere but is *very slow* compared to UDP or direct peer to peer connectivity.
### Contributing
There are three main branches: **edge**, **test**, and **master**. Other branches may be for specific features, tests, or use cases. In general **edge** is "bleeding" and may or may not work, while **test** should be relatively stable and **master** is the latest tagged release. Pull requests should generally be done against **test** or **edge**, since pull requests against **master** may be working against a branch that is somewhat out of date.
### License
The ZeroTier source code is open source and is licensed under the GNU GPL v3 (not LGPL). If you'd like to embed it in a closed-source commercial product or appliance, please e-mail [contact@zerotier.com](mailto:contact@zerotier.com) to discuss commercial licensing. Otherwise it can be used for free.
Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,96 @@
/*
* ZeroTier One - Network Virtualization Everywhere
* Copyright (C) 2011-2015 ZeroTier, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --
*
* ZeroTier may be used and distributed under the terms of the GPLv3, which
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
*
* If you would like to embed ZeroTier into a commercial application or
* redistribute it in a modified binary form, please contact ZeroTier Networks
* LLC. Start here: http://www.zerotier.com/
*/
#ifndef ZT_OSXETHERNETTAP_HPP
#define ZT_OSXETHERNETTAP_HPP
#include <stdio.h>
#include <stdlib.h>
#include <stdexcept>
#include <string>
#include <vector>
#include "../node/Constants.hpp"
#include "../node/MAC.hpp"
#include "../node/InetAddress.hpp"
#include "../node/MulticastGroup.hpp"
#include "Thread.hpp"
namespace ZeroTier {
/**
* OSX Ethernet tap using ZeroTier kernel extension zt# devices
*/
class OSXEthernetTap
{
public:
OSXEthernetTap(
const char *homePath,
const MAC &mac,
unsigned int mtu,
unsigned int metric,
uint64_t nwid,
const char *friendlyName,
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
void *arg);
~OSXEthernetTap();
inline void setEnabled(bool en) { _enabled = en; }
inline bool enabled() const { return _enabled; }
bool addIp(const InetAddress &ip);
bool removeIp(const InetAddress &ip);
std::vector<InetAddress> ips() const;
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
std::string deviceName() const;
void setFriendlyName(const char *friendlyName);
void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed);
void threadMain()
throw();
// Private members of OSXEthernetTap have public visibility to be accessable
// from an internal bounce function; don't modify directly.
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
void *_arg;
void *_pcap; // pcap_t *
uint64_t _nwid;
MAC _mac;
Thread _thread;
std::string _homePath;
std::string _dev;
std::vector<MulticastGroup> _multicastGroups;
unsigned int _mtu;
unsigned int _metric;
volatile bool _enabled;
};
} // namespace ZeroTier
#endif
@@ -0,0 +1,101 @@
/*
* ZeroTier One - Network Virtualization Everywhere
* Copyright (C) 2011-2015 ZeroTier, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --
*
* ZeroTier may be used and distributed under the terms of the GPLv3, which
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
*
* If you would like to embed ZeroTier into a commercial application or
* redistribute it in a modified binary form, please contact ZeroTier Networks
* LLC. Start here: http://www.zerotier.com/
*/
#ifndef ZT_OSXETHERNETTAP_HPP
#define ZT_OSXETHERNETTAP_HPP
#include <stdio.h>
#include <stdlib.h>
#include <stdexcept>
#include <string>
#include <vector>
#include "../node/Constants.hpp"
#include "../node/MAC.hpp"
#include "../node/InetAddress.hpp"
#include "../node/MulticastGroup.hpp"
#include "Thread.hpp"
namespace ZeroTier {
class Arp;
/**
* OSX Ethernet tap supporting either ZeroTier tun/tap kext or OSX-native utun
*/
class OSXEthernetTap
{
public:
OSXEthernetTap(
const char *homePath,
const MAC &mac,
unsigned int mtu,
unsigned int metric,
uint64_t nwid,
const char *friendlyName,
void (*handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int),
void *arg);
~OSXEthernetTap();
void setEnabled(bool en);
bool enabled() const;
bool addIp(const InetAddress &ip);
bool removeIp(const InetAddress &ip);
std::vector<InetAddress> ips() const;
void put(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
std::string deviceName() const;
void setFriendlyName(const char *friendlyName);
void scanMulticastGroups(std::vector<MulticastGroup> &added,std::vector<MulticastGroup> &removed);
inline bool isNativeUtun() const { return _utun; }
void threadMain()
throw();
private:
void (*_handler)(void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int);
void *_arg;
Arp *_arp; // created and used if utun is enabled
uint64_t _nwid;
Thread _thread;
std::string _homePath;
std::string _dev;
std::vector<MulticastGroup> _multicastGroups;
unsigned int _mtu;
unsigned int _metric;
int _fd;
int _shutdownSignalPipe[2];
bool _utun;
volatile bool _enabled;
};
} // namespace ZeroTier
#endif
+14
View File
@@ -0,0 +1,14 @@
Cluster GeoIP Service
======
In cluster mode (build with ZT\_ENABLE\_CLUSTER and install a cluster definition file), ZeroTier One can use geographic IP lookup to steer clients toward members of a cluster that are physically closer and are therefore very likely to offer lower latency and better performance. Ordinary non-clustered ZeroTier endpoints will have no use for this code.
If a cluster-mode instance detects a file in the ZeroTier home folder called *cluster-geo.exe*, it attempts to execute it. If this program runs, it receives IP addresses on STDIN and produces lines of CSV on STDOUT with the following format:
IP,result code,latitude,longitude,x,y,z
The first field is the IP echoed back. The second field is 0 if the result is pending and may be ready in the future or 1 if the result is ready now. If the second field is 0 the remaining fields should be 0. Otherwise the remaining fields contain the IP's latitude, longitude, and X/Y/Z coordinates.
ZeroTier's cluster route optimization code only uses the X/Y/Z values. These are computed by this cluster-geo code as the spherical coordinates of the IP address using the Earth's center as the point of origin and using an approximation of the Earth as a sphere. This doesn't yield *exact* coordinates, but it's good enough for our purposes since the goal is to route clients to the geographically closest endpoint.
To install, copy *cluster-geo.exe* and the *cluster-geo/* subfolder into the ZeroTier home. Then go into *cluster-geo/* and run *npm install* to install the project's dependencies. A recent (4.x or newer) version of NodeJS is recommended. You will also need a [MaxMind GeoIP2 Precision Services](https://www.maxmind.com/) license key. The *MaxMind GeoIP2 City* tier is required since this supplies actual coordinates. It's a commercial service but is very inexpensive and offers very good accuracy for both IPv4 and IPv6 addresses. The *cluster-geo.js* program caches results in a LevelDB database for up to 120 days to reduce GeoIP API queries.
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
cd `dirname $0`
if [ ! -d cluster-geo -o ! -f cluster-geo/cluster-geo.js ]; then
echo 'Cannot find ./cluster-geo containing NodeJS script files.'
exit 1
fi
cd cluster-geo
exec node --harmony cluster-geo.js
+102
View File
@@ -0,0 +1,102 @@
"use strict";
//
// GeoIP lookup service
//
// GeoIP cache TTL in ms
var CACHE_TTL = (60 * 60 * 24 * 120 * 1000); // 120 days
// Globally increase event emitter maximum listeners
var EventEmitter = require('events');
EventEmitter.prototype._maxListeners = 1000;
process.setMaxListeners(1000);
// Load config
var config = require(__dirname + '/config.js');
if (!config.maxmind) {
console.error('FATAL: only MaxMind GeoIP2 is currently supported and is not configured in config.js');
process.exit(1);
}
var geo = require('geoip2ws')(config.maxmind);
var cache = require('levelup')(__dirname + '/cache.leveldb');
function lookup(ip,callback)
{
cache.get(ip,function(err,cachedEntryJson) {
if ((!err)&&(cachedEntryJson)) {
try {
let cachedEntry = JSON.parse(cachedEntryJson.toString());
if (cachedEntry) {
let ts = cachedEntry.ts;
let r = cachedEntry.r;
if ((ts)&&(r)) {
if ((Date.now() - ts) < CACHE_TTL) {
r._cached = true;
return callback(null,r);
}
}
}
} catch (e) {}
}
geo(ip,function(err,result) {
if (err)
return callback(err,null);
if ((!result)||(!result.location))
return callback(new Error('null result'),null);
cache.put(ip,JSON.stringify({
ts: Date.now(),
r: result
}),function(err) {
if (err)
console.error('Error saving to cache: '+err);
return callback(null,result);
});
});
});
};
var linebuf = '';
process.stdin.on('readable',function() {
var chunk;
while (null !== (chunk = process.stdin.read())) {
for(var i=0;i<chunk.length;++i) {
let c = chunk[i];
if ((c == 0x0d)||(c == 0x0a)) {
if (linebuf.length > 0) {
let ip = linebuf;
lookup(ip,function(err,result) {
if ((err)||(!result)||(!result.location)) {
return process.stdout.write(ip+',0,0,0,0,0,0\n');
} else {
let lat = parseFloat(result.location.latitude);
let lon = parseFloat(result.location.longitude);
// Convert to X,Y,Z coordinates from Earth's origin, Earth-as-sphere approximation.
let latRadians = lat * 0.01745329251994; // PI / 180
let lonRadians = lon * 0.01745329251994; // PI / 180
let cosLat = Math.cos(latRadians);
let x = Math.round((-6371.0) * cosLat * Math.cos(lonRadians)); // 6371 == Earth's approximate radius in kilometers
let y = Math.round(6371.0 * Math.sin(latRadians));
let z = Math.round(6371.0 * cosLat * Math.sin(lonRadians));
return process.stdout.write(ip+',1,'+lat+','+lon+','+x+','+y+','+z+'\n');
}
});
}
linebuf = '';
} else {
linebuf += String.fromCharCode(c);
}
}
}
});
process.stdin.on('end',function() {
cache.close();
process.exit(0);
});
+7
View File
@@ -0,0 +1,7 @@
// MaxMind GeoIP2 config
module.exports.maxmind = {
userId: 1234,
licenseKey: 'asdf',
service: 'city',
requestTimeout: 1000
};
+16
View File
@@ -0,0 +1,16 @@
{
"name": "cluster-geo",
"version": "1.0.0",
"description": "Cluster GEO-IP Query Service",
"main": "cluster-geo.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "ZeroTier, Inc.",
"license": "GPL-3.0",
"dependencies": {
"geoip2ws": "^1.7.1",
"leveldown": "^1.4.2",
"levelup": "^1.3.0"
}
}
File diff suppressed because it is too large. Load diff
+60 -9
View File
@@ -39,13 +39,22 @@
#include "../node/Constants.hpp"
#include "../node/NetworkController.hpp"
#include "../node/Mutex.hpp"
#include "../osdep/Thread.hpp"
// Number of in-memory last log entries to maintain per user
#define ZT_SQLITENETWORKCONTROLLER_IN_MEMORY_LOG_SIZE 32
// How long do circuit tests "live"? This is just to prevent buildup in memory.
#define ZT_SQLITENETWORKCONTROLLER_CIRCUIT_TEST_TIMEOUT 300000
namespace ZeroTier {
class Node;
class SqliteNetworkController : public NetworkController
{
public:
SqliteNetworkController(const char *dbPath);
SqliteNetworkController(Node *node,const char *dbPath,const char *circuitTestPath);
virtual ~SqliteNetworkController();
virtual NetworkController::ResultCode doNetworkConfigRequest(
@@ -54,7 +63,6 @@ public:
const Identity &identity,
uint64_t nwid,
const Dictionary &metaData,
uint64_t haveRevision,
Dictionary &netconf);
unsigned int handleControlPlaneHttpGET(
@@ -79,6 +87,10 @@ public:
std::string &responseBody,
std::string &responseContentType);
// threadMain() for backup thread -- do not call directly
void threadMain()
throw();
private:
enum IpAssignmentType {
// IP assignment is a static IP address
@@ -94,11 +106,54 @@ private:
const std::string &body,
std::string &responseBody,
std::string &responseContentType);
NetworkController::ResultCode _doNetworkConfigRequest(
const InetAddress &fromAddr,
const Identity &signingId,
const Identity &identity,
uint64_t nwid,
const Dictionary &metaData,
Dictionary &netconf);
static void _circuitTestCallback(ZT_Node *node,ZT_CircuitTest *test,const ZT_CircuitTestReport *report);
Node *_node;
Thread _backupThread;
volatile bool _backupThreadRun;
std::string _dbPath;
std::string _circuitTestPath;
std::string _instanceId;
std::map< std::pair<Address,uint64_t>,uint64_t > _lastRequestTime;
// A circular buffer last log
struct _LLEntry
{
_LLEntry()
{
for(long i=0;i<ZT_SQLITENETWORKCONTROLLER_IN_MEMORY_LOG_SIZE;++i)
this->l[i].ts = 0;
this->lastRequestTime = 0;
this->totalRequests = 0;
}
// Circular buffer of last log entries
struct {
uint64_t ts; // timestamp or 0 if circular buffer entry unused
char version[64];
InetAddress fromAddr;
bool authorized;
} l[ZT_SQLITENETWORKCONTROLLER_IN_MEMORY_LOG_SIZE];
// Time of last request whether successful or not
uint64_t lastRequestTime;
// Total requests by this address / network ID pair (also serves mod IN_MEMORY_LOG_SIZE as circular buffer ptr)
uint64_t totalRequests;
};
// Last log entries by address and network ID pair
std::map< std::pair<Address,uint64_t>,_LLEntry > _lastLog;
// Circuit tests outstanding
std::map< uint64_t,ZT_CircuitTest * > _circuitTests;
sqlite3 *_db;
@@ -106,9 +161,7 @@ private:
sqlite3_stmt *_sGetMember;
sqlite3_stmt *_sCreateMember;
sqlite3_stmt *_sGetNodeIdentity;
sqlite3_stmt *_sCreateNode;
sqlite3_stmt *_sUpdateNode;
sqlite3_stmt *_sUpdateNode2;
sqlite3_stmt *_sCreateOrReplaceNode;
sqlite3_stmt *_sGetEtherTypesFromRuleTable;
sqlite3_stmt *_sGetActiveBridges;
sqlite3_stmt *_sGetIpAssignmentsForNode;
@@ -137,6 +190,7 @@ private:
sqlite3_stmt *_sUpdateMemberAuthorized;
sqlite3_stmt *_sUpdateMemberActiveBridge;
sqlite3_stmt *_sDeleteMember;
sqlite3_stmt *_sDeleteAllNetworkMembers;
sqlite3_stmt *_sDeleteNetwork;
sqlite3_stmt *_sGetGateways;
sqlite3_stmt *_sDeleteGateways;
@@ -144,9 +198,6 @@ private:
sqlite3_stmt *_sIncrementMemberRevisionCounter;
sqlite3_stmt *_sGetConfig;
sqlite3_stmt *_sSetConfig;
sqlite3_stmt *_sPutLog;
sqlite3_stmt *_sGetMemberLog;
sqlite3_stmt *_sGetRecentMemberLog;
Mutex _lock;
};
-13
View File
@@ -77,19 +77,6 @@ CREATE TABLE Member (
CREATE INDEX Member_networkId_activeBridge ON Member(networkId, activeBridge);
CREATE INDEX Member_networkId_memberRevision ON Member(networkId, memberRevision);
CREATE TABLE Log (
networkId char(16) NOT NULL,
nodeId char(10) NOT NULL,
ts integer NOT NULL,
authorized integer NOT NULL,
authTokenId integer,
version varchar(16),
fromAddr varchar(64)
);
CREATE INDEX Log_networkId_nodeId ON Log(networkId, nodeId);
CREATE INDEX Log_ts ON Log(ts);
CREATE TABLE Relay (
networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,
address char(10) NOT NULL,
-13
View File
@@ -78,19 +78,6 @@
"CREATE INDEX Member_networkId_activeBridge ON Member(networkId, activeBridge);\n"\
"CREATE INDEX Member_networkId_memberRevision ON Member(networkId, memberRevision);\n"\
"\n"\
"CREATE TABLE Log (\n"\
" networkId char(16) NOT NULL,\n"\
" nodeId char(10) NOT NULL,\n"\
" ts integer NOT NULL,\n"\
" authorized integer NOT NULL,\n"\
" authTokenId integer,\n"\
" version varchar(16),\n"\
" fromAddr varchar(64)\n"\
");\n"\
"\n"\
"CREATE INDEX Log_networkId_nodeId ON Log(networkId, nodeId);\n"\
"CREATE INDEX Log_ts ON Log(ts);\n"\
"\n"\
"CREATE TABLE Relay (\n"\
" networkId char(16) NOT NULL REFERENCES Network(id) ON DELETE CASCADE,\n"\
" address char(10) NOT NULL,\n"\
+26
View File
@@ -0,0 +1,26 @@
API Examples
======
This folder contains examples that can be posted with curl or another http query utility to a local instance.
To test querying with curl:
curl -H 'X-ZT1-Auth:AUTHTOKEN' http://127.0.0.1:9993/status
To create a public network on a local controller (service must be built with "make ZT\_ENABLE\_NETWORK\_CONTROLLER=1"):
curl -H 'X-ZT1-Auth:AUTHTOKEN' -X POST -d @public.json http://127.0.0.1:9993/controller/network/################
Replace AUTHTOKEN with the contents of this instance's authtoken.secret file and ################ with a valid network ID. Its first 10 hex digits must be the ZeroTier address of the controller itself, while the last 6 hex digits can be anything. Also be sure to change the port if you have this instance listening somewhere other than 9993.
After POSTing you can double check the network config with:
curl -H 'X-ZT1-Auth:AUTHTOKEN' http://127.0.0.1:9993/controller/network/################
Once this network is created (and if your controller is online, etc.) you can then join this network from any device anywhere in the world and it will receive a valid network configuration.
---
**public.json**: A valid configuration for a public network that allows IPv4 and IPv6 traffic.
**circuit-test-pingpong.json**: An example circuit test that can be posted to /controller/network/################/test to order a test -- you will have to edit this to insert the hops you want since the two hard coded device IDs are from our own test instances.
+13
View File
@@ -0,0 +1,13 @@
{
"hops": [
[ "4cbc810d4c" ],
[ "868cd1664f" ],
[ "4cbc810d4c" ],
[ "868cd1664f" ],
[ "4cbc810d4c" ],
[ "868cd1664f" ],
[ "4cbc810d4c" ],
[ "868cd1664f" ]
],
"reportAtEveryHop": true
}
+27
View File
@@ -0,0 +1,27 @@
{
"name": "public_test_network",
"private": false,
"enableBroadcast": true,
"allowPassiveBridging": false,
"v4AssignMode": "zt",
"v6AssignMode": "rfc4193",
"multicastLimit": 32,
"relays": [],
"gateways": [],
"ipLocalRoutes": ["10.66.0.0/16"],
"ipAssignmentPools": [{"ipRangeStart":"10.66.0.1","ipRangeEnd":"10.66.255.254"}],
"rules": [
{
"ruleNo": 10,
"etherType": 2048,
"action": "accept"
},{
"ruleNo": 20,
"etherType": 2054,
"action": "accept"
},{
"ruleNo": 30,
"etherType": 34525,
"action": "accept"
}]
}
+19
View File
@@ -0,0 +1,19 @@
FROM centos:7
MAINTAINER https://www.zerotier.com/
RUN yum -y update && yum install -y sqlite net-tools && yum clean all
EXPOSE 9993/udp
RUN mkdir -p /var/lib/zerotier-one
RUN mkdir -p /var/lib/zerotier-one/networks.d
RUN ln -sf /var/lib/zerotier-one/zerotier-one /usr/local/bin/zerotier-cli
RUN ln -sf /var/lib/zerotier-one/zerotier-one /usr/local/bin/zerotier-idtool
ADD zerotier-one /var/lib/zerotier-one/
ADD main.sh /
RUN chmod a+x /main.sh
CMD ["./main.sh"]
Loaded 20 of 338 files, more files were not shown because too many files have changed in this diff. Show more