mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-24 18:25:20 +00:00
Compare commits
1107 Commits
Author | SHA1 | Date | |
---|---|---|---|
bd7e4ab695 | |||
ee1a008f2d | |||
4c687fca45 | |||
753a80d419 | |||
7213a6cf0b | |||
9b0c8965bb | |||
7e647c5303 | |||
fe87136870 | |||
b897ec1efd | |||
6a11c76248 | |||
3512402558 | |||
4fe12756d4 | |||
bf415bdeb9 | |||
c5a3e80113 | |||
806ea79f37 | |||
cd58614c23 | |||
0b68344fc8 | |||
191b8f8164 | |||
29e3437350 | |||
65999611d7 | |||
9d49e8f237 | |||
855d893c67 | |||
a2690047bb | |||
648efff1f6 | |||
3d6c1860ca | |||
f0be5e814e | |||
79efceb57b | |||
b8f40c0b91 | |||
97dd8d864f | |||
1afd02df54 | |||
fb0bf52b1b | |||
74f7d5377d | |||
a9a390a930 | |||
d7344871e6 | |||
aab17d9f1f | |||
ecb6a1d84f | |||
5341e32729 | |||
960ceb4791 | |||
318c2f025b | |||
5bc89034bc | |||
229195166a | |||
b3b9af0dd8 | |||
5015c0ae78 | |||
b6196a53de | |||
58ca657da6 | |||
7822616966 | |||
e3feac17b1 | |||
4c680e3126 | |||
ea419c21d0 | |||
502cd6921f | |||
09631ad382 | |||
2d67196667 | |||
9755dad7ff | |||
adaf9cf32b | |||
703c311e07 | |||
e184aa4cb4 | |||
fbb990f8a3 | |||
ff2272d59a | |||
c075e68c6c | |||
ecb1ee8e0d | |||
ba7809367a | |||
5e3c6d9e0d | |||
d8ad555b9a | |||
d29f2ce858 | |||
af1d29cc6f | |||
91f02d699e | |||
6e998efd15 | |||
5c2aaad365 | |||
d8783b14eb | |||
6867922d9e | |||
9774f789f2 | |||
cdec05af24 | |||
196f27f1f0 | |||
b388d9fdc9 | |||
1e043a3f66 | |||
c430d88bd4 | |||
50aedda54d | |||
d9006712f6 | |||
123ff28863 | |||
0f7dcb3ef2 | |||
61021fc778 | |||
2ad69237cf | |||
82f6b3f550 | |||
905d2e91e5 | |||
1213073916 | |||
b6698d8415 | |||
e285a6e75f | |||
6fc090eb00 | |||
0caac25d28 | |||
dd70188643 | |||
c7eb5f0c81 | |||
68cb7ad4cd | |||
9682f50b15 | |||
63cea7d337 | |||
44d1bd14bd | |||
b4a34cc105 | |||
32588b3d84 | |||
992438f054 | |||
8c7a4efe1a | |||
e0313455e7 | |||
ac629150ac | |||
89027d78ac | |||
f48509d50c | |||
c76217c2d4 | |||
2d700f644b | |||
c76b9d1340 | |||
0e87002d78 | |||
ddaf3ef347 | |||
2810cd7c15 | |||
0af18b164c | |||
086f21ed70 | |||
7649d6746b | |||
0e00981059 | |||
d41b6eb0c8 | |||
651e67f2e5 | |||
e0090e56f4 | |||
9a00366b18 | |||
69ceb7e730 | |||
cf51961d52 | |||
c9fd8de007 | |||
a187d290f1 | |||
27c5f04d68 | |||
d0935f667f | |||
4be4908914 | |||
38243e5eff | |||
0bb92715f4 | |||
78769900a9 | |||
65a9a9a6f2 | |||
e269846f84 | |||
6d2376eb9c | |||
f693d4d0c8 | |||
0bdd56ebd6 | |||
d0e0f5dd12 | |||
e94518590d | |||
4a0280686c | |||
a8835cd8b3 | |||
bdce679d84 | |||
241f308334 | |||
e744580b89 | |||
1b895c45eb | |||
2158d26bd7 | |||
4565e9948f | |||
c1e5c1c710 | |||
257187a284 | |||
8e888f8df9 | |||
8594e17f2b | |||
a40192a40b | |||
92ca53e141 | |||
a913f00670 | |||
b1164ed181 | |||
c0caba8944 | |||
0be3190d49 | |||
bd2ce82ea6 | |||
a4a62be698 | |||
da45840e5a | |||
4426899e8c | |||
d56e9fce41 | |||
5b54612d91 | |||
8130b2a0de | |||
e58047eaa0 | |||
03dbec960a | |||
20b76d266d | |||
4a2c46e008 | |||
b2b32e5969 | |||
bdc5b3d3a5 | |||
e28712555d | |||
40f312a827 | |||
18ca6f34ff | |||
59fa687830 | |||
e922324bc6 | |||
b4b067bf12 | |||
625ddf41a7 | |||
af66f14761 | |||
da254d967f | |||
7054c365f2 | |||
06ab338ecc | |||
ad6ec22857 | |||
a9307693a6 | |||
742c59a7c7 | |||
e79a6915ff | |||
818339f966 | |||
079d248eab | |||
9f2732d661 | |||
fb6b56a85f | |||
02b33e3763 | |||
b242886c33 | |||
0a15eae00f | |||
75d7137025 | |||
9279bac385 | |||
105e1a016f | |||
604576075e | |||
52df59c552 | |||
d3820049b8 | |||
9eb7698f0e | |||
5185103692 | |||
3ac23165c7 | |||
9a34fde8a5 | |||
918fc8884b | |||
f3d7c9d681 | |||
226e0f8722 | |||
288d73a4ad | |||
9464504e4a | |||
7e0cc28a89 | |||
0a2d1e7a66 | |||
9bf9670ff9 | |||
a9a3705877 | |||
5983b4367b | |||
d1ed269537 | |||
73d68c0c98 | |||
7dcde7503a | |||
b9f7f75ddf | |||
a1005ca858 | |||
8c5ec54711 | |||
ab3f4d7539 | |||
a1d6df4bf8 | |||
4c71e92a67 | |||
3bdbc6390f | |||
8a09e0ec3c | |||
db80070ccb | |||
042f914dc5 | |||
ec45aeb42a | |||
a86a0ab2b1 | |||
29bb2a9004 | |||
56f8160af8 | |||
7af1f3a79a | |||
e78899fddf | |||
9325535ced | |||
720ac93ba9 | |||
42b4148876 | |||
4b658d83bc | |||
d4c06e924d | |||
1ebe2ad920 | |||
0d4283a3fa | |||
9c62ce9e6f | |||
f2eed5a65f | |||
5e1fb4e253 | |||
dc00ce4f44 | |||
53ebd5a9a5 | |||
d5fc2b39aa | |||
4137246653 | |||
28168fa673 | |||
99af0f3a88 | |||
6f07a476a6 | |||
52a20b4b0f | |||
f3c29d3f0d | |||
b3429481cd | |||
0f808e11df | |||
ce09e363dc | |||
e2c65bf16a | |||
0e31551349 | |||
f5848972f9 | |||
54954f5b88 | |||
883a216d2a | |||
1a65a79e57 | |||
6dd3c07b25 | |||
1df6bc6bc3 | |||
9ab7280703 | |||
7f6556eba0 | |||
1bea940323 | |||
6ff2e6ecfe | |||
d66f2cd54d | |||
46adf870a1 | |||
4906f8e848 | |||
fa9d42b7e5 | |||
1a528aec76 | |||
ffb9e2901e | |||
407e2fc7de | |||
667a103a6a | |||
32a35e6808 | |||
34028aa7c8 | |||
3ccaef88b7 | |||
f5bb57d5aa | |||
a1a35e0279 | |||
1308f02b93 | |||
b078d69372 | |||
e31e54483c | |||
3c499777c8 | |||
9c038d3ecd | |||
6187a91f4c | |||
321b67c73c | |||
5df253fa69 | |||
3a6807d584 | |||
787b4a8e50 | |||
b33e4af49f | |||
5202fbdaf3 | |||
103dcb072d | |||
79f63ba30a | |||
71f006cbeb | |||
e4046964f0 | |||
ddebe2d4c7 | |||
0c8051da15 | |||
e0c8ddb65b | |||
bd4049fdc0 | |||
5f314f209e | |||
99a1a4e65b | |||
ec3a1c87d1 | |||
f40eb665c5 | |||
ed107c4daf | |||
8a13cfdace | |||
86c87875a7 | |||
69076f8a45 | |||
60f05518aa | |||
740121504f | |||
417f56de2f | |||
b51d00146b | |||
8715242e7f | |||
895c32a0d2 | |||
489cc66b78 | |||
ce77e67e00 | |||
1f5700191f | |||
c4c5fa63d1 | |||
13d5073e5b | |||
8333bf065e | |||
53cbe485f0 | |||
6c29e966dd | |||
377367175c | |||
12b4646ce8 | |||
4e5d2d2c72 | |||
21a7e774bb | |||
c301d8e438 | |||
d2503172d8 | |||
91ca238163 | |||
33c8d3c50b | |||
ea1859541c | |||
f7b1437154 | |||
6369c264e2 | |||
871473255b | |||
a0f8685453 | |||
8639538299 | |||
98bcc3d4b5 | |||
1c9ca73065 | |||
508519b62a | |||
c9af603b9f | |||
aeb4b42ab3 | |||
67f1f1892f | |||
e205e5fdfe | |||
347e98dcd2 | |||
29a2175b7a | |||
49d31613b9 | |||
758b5caf94 | |||
6f4b30add8 | |||
1cfa67bbdd | |||
a2605561af | |||
b888e033c0 | |||
ff0eff4b7c | |||
5c1262f324 | |||
daef54ba32 | |||
5572b7ffb6 | |||
7576911951 | |||
9e651b39e4 | |||
08a11a6f32 | |||
5e331d6733 | |||
068d311ecc | |||
38200cc6a5 | |||
6615a70027 | |||
46ecad451c | |||
9342380146 | |||
7192fe6d15 | |||
d761330465 | |||
ccc73b920e | |||
d9e9b60a98 | |||
e34bc961db | |||
0751eaabd8 | |||
12431ce95d | |||
4d5a6a25d3 | |||
9d9d0ef12c | |||
c894710ac1 | |||
608b5ca13a | |||
37bd6fdb9c | |||
7529d050c7 | |||
bf2ff964e1 | |||
ee2f51f48e | |||
40bfe37a19 | |||
59af674e74 | |||
6de7996218 | |||
49f031ccb4 | |||
9e55f882d3 | |||
8210ed4805 | |||
0a90681849 | |||
24608d5ca3 | |||
eae2c89b09 | |||
52c3b7c34e | |||
817824b88b | |||
a2821e9000 | |||
76ad19f411 | |||
758bf949db | |||
4e691c8e22 | |||
6807ccd710 | |||
51f46a009a | |||
8001b2c0cb | |||
a86300c58f | |||
488f5bf977 | |||
197d272287 | |||
be4683a96d | |||
5f351f2f6b | |||
f4fd2d4971 | |||
a95f1e1418 | |||
6eb9289367 | |||
ee0f56355b | |||
a69e1876f1 | |||
5f51653f9c | |||
0214dbc277 | |||
1f28ce3980 | |||
49349470a0 | |||
8130848020 | |||
7ff0cab1b7 | |||
b723855751 | |||
36eab4f1a9 | |||
647ce82b86 | |||
e61a40a956 | |||
a61acf36d2 | |||
8990fb8267 | |||
2c5dbecb3c | |||
fe94c9460b | |||
fe87c1db67 | |||
60158aa5dd | |||
3c1a59fa24 | |||
b6241f6cb1 | |||
4445bfc869 | |||
8d409def74 | |||
91810c5f44 | |||
64ea58d523 | |||
96737368aa | |||
7ee1a1151f | |||
a8a92c5b89 | |||
cea3f28155 | |||
ba69240bcb | |||
49a2450e76 | |||
278c8fd9f1 | |||
61d89bd118 | |||
1b0908fab2 | |||
31bf0a4ea6 | |||
fab951e98a | |||
ab211cf599 | |||
badf260e1f | |||
66f29f09da | |||
ecffa9f5e7 | |||
b6fba5934a | |||
78fc62d967 | |||
ff255a34de | |||
93012b0ee5 | |||
89f0c948f8 | |||
eeed31b396 | |||
b7148c107d | |||
b1bf3f68c3 | |||
37d23336ed | |||
61cff47f5b | |||
c30bf7957e | |||
d73a11b60b | |||
83227dc386 | |||
fbc6ca28b7 | |||
72f926dc41 | |||
eab3ca1401 | |||
c8c5d3b06e | |||
0b84c10ccc | |||
afea153a0b | |||
64ba596e0b | |||
60fb28a90a | |||
a369c69091 | |||
f043321281 | |||
b644d2a893 | |||
4e95384ad6 | |||
08ba2ff752 | |||
efa0bab296 | |||
96e9a90e8e | |||
87c599df5c | |||
56cfe1d603 | |||
95e303d6f3 | |||
ebb63cce70 | |||
f24283a674 | |||
f60dfe4963 | |||
536bcf6505 | |||
1a02bcc9f5 | |||
d10abab786 | |||
ff539c22f9 | |||
0324ef2a47 | |||
cd2bf6f4b3 | |||
ad4923846a | |||
83a6edd08e | |||
58f2dc5cf3 | |||
3a786ccc17 | |||
b3a9bfca4d | |||
03c7dc2b4c | |||
000eac5a2b | |||
62c31e70d4 | |||
1b6af7836e | |||
638ae153cc | |||
059aaae7a9 | |||
4bf2fa3edb | |||
149dbff3ea | |||
c030294bf5 | |||
30e82a4d9c | |||
8c64046a53 | |||
04e4c5263e | |||
4303376ba6 | |||
cda61fe2d9 | |||
0f505411cf | |||
15d3e383e6 | |||
6888c6482c | |||
d772639cc6 | |||
acac88cf77 | |||
0bcac1fd79 | |||
959f611a65 | |||
7619b0ecbd | |||
0c85b4ef5f | |||
ee9e6a3c6b | |||
7b6f10e859 | |||
c61e9c0ef9 | |||
b1b37d9d72 | |||
1bd5a1ebcd | |||
14e4ffd15f | |||
16461eca1f | |||
8f29f19e98 | |||
5ca20da7af | |||
8bd9f7d51d | |||
0e84eb3852 | |||
4923ab2945 | |||
4c59497b95 | |||
5484cf4309 | |||
22d8aa4dc9 | |||
95f421024a | |||
f65b48d447 | |||
5bb854e504 | |||
faff84e63a | |||
9a5f6f020f | |||
4dec598fb8 | |||
3e948fcd93 | |||
8aa75321e2 | |||
ffbf0781fe | |||
e4966c7a07 | |||
ac23f74547 | |||
fa60463da5 | |||
3d85a615fb | |||
f873881a0d | |||
934a575a74 | |||
fe7b429866 | |||
295f6a20e0 | |||
6a94a4a51b | |||
8672ca9cf8 | |||
a75a7547b4 | |||
3857116724 | |||
5c7cd53f13 | |||
4fbb098daa | |||
0a195e7bc0 | |||
ae228ade8c | |||
4a5756e7fb | |||
29ba34ab7c | |||
2436e22f46 | |||
128a131070 | |||
6bc9a938cf | |||
0e47f13f14 | |||
7c0f5e97e1 | |||
0fd562bebc | |||
8730d30575 | |||
babf3787c6 | |||
74f36f5dc0 | |||
2eeb3dee9e | |||
4951e5e1b5 | |||
6429c51ec7 | |||
a8bd8fff93 | |||
a94b0e6a43 | |||
7a37326cc0 | |||
42d644a57e | |||
023cac4ebb | |||
2416491cbc | |||
6e23986bb3 | |||
1921e28c5f | |||
52314dcdf6 | |||
d8d4aace42 | |||
05309037a8 | |||
7943414c89 | |||
c7c545bf6c | |||
6316011024 | |||
8b0846d077 | |||
0d017c043f | |||
c2aac69a9f | |||
a9c6913f12 | |||
e071c05f1b | |||
03dc823ad7 | |||
1774e615a1 | |||
56f8f8aa24 | |||
4941c8a1f3 | |||
d5e0f7e3e4 | |||
620e64c58f | |||
b809dad94a | |||
b13845e528 | |||
3f15752f73 | |||
cb6fd3afb3 | |||
7788a3d45d | |||
923c325a40 | |||
87f1b1b1e3 | |||
ab22feba9a | |||
10c196df50 | |||
2c8321be1f | |||
62da7e67b6 | |||
e7c81ef34e | |||
3f7e7e8a88 | |||
496109fdcc | |||
aad344bb84 | |||
13fc20b0ee | |||
351db7f1a0 | |||
6ab7b1b915 | |||
f853bc6a86 | |||
d7189dd6c7 | |||
5fc3c0812a | |||
67aa23530b | |||
2a58c3fb98 | |||
96fa3f7550 | |||
1109046782 | |||
49dc47ff38 | |||
dee86e2448 | |||
17da733f97 | |||
23836d4c11 | |||
e53d208ea4 | |||
e8c5495b61 | |||
28646eee0a | |||
e1882b614b | |||
ae082c3cb8 | |||
ea6124dd2f | |||
b41437780b | |||
2659427864 | |||
8607aa7c3c | |||
ed0ba49502 | |||
2d41055bdc | |||
027060dad1 | |||
0778332747 | |||
9e186bbd89 | |||
050a0ce85d | |||
6c87f9f765 | |||
81b12b6826 | |||
431476e2e4 | |||
557801a09e | |||
9180a30986 | |||
61d0f27d2a | |||
c49e253e21 | |||
954f9cbc13 | |||
d9abd4d9be | |||
d37c3ad30f | |||
4708231046 | |||
924f030994 | |||
6b76cac6cf | |||
2762db8408 | |||
edff13dcae | |||
e22fae2397 | |||
73dd9d3b74 | |||
8d2e20ede6 | |||
5c1c70a604 | |||
fb22ef053b | |||
4ba4269344 | |||
2dcf584834 | |||
13aba7640b | |||
2e46bb4264 | |||
1d37204a37 | |||
6b4346d1ac | |||
ea0f836ef1 | |||
b8729de9da | |||
4e9280fc7a | |||
d02ecfb288 | |||
3afc629ac5 | |||
6e1339fedf | |||
7d4b6767eb | |||
93f9b4392d | |||
6df9546742 | |||
4dbeb97eb9 | |||
34349d1a61 | |||
6497a4a0f6 | |||
b8d29cb6ba | |||
e77e224171 | |||
dcea212e40 | |||
644db7a04a | |||
00b16f6aa6 | |||
1952db5069 | |||
6f8364ba59 | |||
eadff71d37 | |||
af62a6cade | |||
de4e29288d | |||
44d58ee871 | |||
9d5819ff44 | |||
08d7fe0432 | |||
9f2571cc01 | |||
b4b2e2ed9f | |||
17ebd0afc7 | |||
351b7f3a09 | |||
721625d512 | |||
282114e96c | |||
95d123cfc2 | |||
f5cbb45ab9 | |||
b7b9b9c0b7 | |||
715afc0314 | |||
f281886bfd | |||
4f0fcc582e | |||
aa59cfd545 | |||
f696299cfc | |||
b0719eacf9 | |||
c2187c8759 | |||
56296f96db | |||
be6b61b1bc | |||
f8d4611d15 | |||
f25bd41a03 | |||
fe3ad5e2cc | |||
502ea66f15 | |||
673aab5ba2 | |||
77457cbff1 | |||
db0d17cebb | |||
dd58006d65 | |||
f0ebb0b0f1 | |||
8c9d3146df | |||
117f977ce3 | |||
d8e5d9d6e8 | |||
1f5feb75fb | |||
05031ff938 | |||
adfb71fa6b | |||
37341048a9 | |||
b3491f9de1 | |||
80fc584923 | |||
b7389995f4 | |||
92d9ad4a7f | |||
8a804b5257 | |||
e3c5ada3a7 | |||
7adf0eac7e | |||
df0a8e8450 | |||
526435859f | |||
98d426e1d5 | |||
b80c229d87 | |||
9b93141dd0 | |||
59ebc9d41e | |||
f0199d6770 | |||
f2d372545a | |||
9809511c4c | |||
538e8a86c8 | |||
27aa6ea44e | |||
7475c4047e | |||
5e58a7d54a | |||
6a174483d8 | |||
a76d9d4408 | |||
1189f4a568 | |||
51766e6549 | |||
d315156733 | |||
4c4675e3ac | |||
49ef980ecf | |||
12692c551e | |||
00f9305ad8 | |||
0097949ba9 | |||
1b33a9e807 | |||
4a0b33561c | |||
96faaa85cf | |||
f82c7006ea | |||
681af253ef | |||
88bdb81791 | |||
458f6ae7c3 | |||
999e963533 | |||
5336f2600a | |||
38433e85bf | |||
c3cbc92757 | |||
45a1e048bb | |||
40bd460b1c | |||
ae7143d693 | |||
aead1050fb | |||
6e485833ef | |||
be0a8ec1f1 | |||
11e1f7a3fb | |||
0b0d5fabac | |||
35aa0921ee | |||
2f8936181c | |||
4c3fb8cf10 | |||
c3cea55493 | |||
5d467f0f45 | |||
2162a419e3 | |||
f15271f31f | |||
9d6488c31a | |||
adc922d7fb | |||
cf4700bc26 | |||
367b5439e1 | |||
6802da457e | |||
5682f0b772 | |||
08b7bb3c7a | |||
d6a4f8d77b | |||
c30f9832b0 | |||
d44e1349d8 | |||
6f831d5370 | |||
4e1f49258b | |||
fb31f93c52 | |||
f720f04fa0 | |||
7a56c3c396 | |||
994565bdeb | |||
67498e576c | |||
eae130467b | |||
f764cf8d31 | |||
49247180dc | |||
914bebba31 | |||
4b773b61f5 | |||
657f6ae342 | |||
2861229558 | |||
f939d0ee62 | |||
77c58e741d | |||
66a38a9e7c | |||
31ddc49da2 | |||
317995b921 | |||
beb7b5bbe5 | |||
05f5755bb1 | |||
cfd92cb18d | |||
2456d3a197 | |||
f0b821f880 | |||
319f9a9346 | |||
596e5dd583 | |||
b958a2d30c | |||
e270887391 | |||
986773cc9c | |||
ecbcc9eb2c | |||
1ad29fe31f | |||
42f6aae259 | |||
de485ad900 | |||
99c5fae9da | |||
98f0418fb9 | |||
d7977fa3e1 | |||
1e6475fad6 | |||
d5f95b721d | |||
ae2eeff5c6 | |||
08da4b8c7b | |||
0ba0c6d04d | |||
93f24ea86a | |||
f8eae84e15 | |||
7831c4bfef | |||
5f45977e3e | |||
d187ec82d4 | |||
42c3474223 | |||
aee742e767 | |||
c9294c1a78 | |||
b117ff5435 | |||
119ef5ecbf | |||
8fb442d81a | |||
73153b89b4 | |||
d9836adbf6 | |||
420edf23ad | |||
6c5f6feb5e | |||
a1c1c82b0d | |||
83a0d988ec | |||
a8c12369fd | |||
28a6d328a5 | |||
dd404b8ba3 | |||
1c636afe3f | |||
48a1799f49 | |||
bf24de43fe | |||
76d9ea911d | |||
ff773def26 | |||
5abfb11813 | |||
0b8d6c7f4a | |||
6c60305a96 | |||
19c4d82512 | |||
e11149bcae | |||
fe85426df6 | |||
158002d2d1 | |||
c96d3ebf8c | |||
b1088a6bd7 | |||
f0223490be | |||
81e5690410 | |||
700a450806 | |||
0e1fc06a6f | |||
c3b41c289d | |||
6ab95e0391 | |||
67b3fa9311 | |||
316e8d1939 | |||
f13493edb2 | |||
595b386afc | |||
8e587ae481 | |||
acb056e3b1 | |||
5ef2c6fd6f | |||
1a0572d7e7 | |||
7957ab6b1d | |||
e8b613e625 | |||
9c68a343f6 | |||
881ff08269 | |||
e3239d23f4 | |||
f9c92b0351 | |||
b73c36acbf | |||
181369964f | |||
d2c5d71502 | |||
c231510f8b | |||
2ac56fd120 | |||
e6b23059ac | |||
04169b5150 | |||
daaec84c6b | |||
73c1d43f2f | |||
ab5a460177 | |||
67a85221d5 | |||
328be8f846 | |||
d9b91758e0 | |||
4e26ade2df | |||
8d3eb1a258 | |||
33ad3deaee | |||
ba3f04deed | |||
45e823d27c | |||
70b736f440 | |||
97e6b38144 | |||
7a45ff460d | |||
6f5a4d7e29 | |||
4d0ad9abb6 | |||
15e8c18106 | |||
1c555e4b96 | |||
6fdb360e2a | |||
0d847d9410 | |||
abc82d6a52 | |||
acf7d70d24 | |||
3be4c38946 | |||
6a1bd52854 | |||
0b75992737 | |||
91fef21973 | |||
dc0f3559be | |||
bb25128406 | |||
bf5d8de999 | |||
1a0a6755b1 | |||
8adbbe092d | |||
bd749e040d | |||
7e80d7e551 | |||
ce09d00679 | |||
dbd7a06ea9 | |||
74c2e644a9 | |||
dfee7e0389 | |||
60f25ccdf9 | |||
2b0dbead17 | |||
d0b506c12b | |||
742261c7fc | |||
939cdc82a2 | |||
a207ce13c0 | |||
17c77da38f | |||
54313212a4 | |||
b2673eab55 | |||
282d41bc94 | |||
b72c2c6358 | |||
5581339d5b | |||
78f3966d66 | |||
bae9fa1480 | |||
cef750d1d2 | |||
be36eda858 | |||
13fbf9a200 | |||
f2a03f68bd | |||
d997c1a32a | |||
d27251ec4e | |||
9ae6403346 | |||
39d411ce0b | |||
93fe848bb6 | |||
9d05897f7a | |||
cbeb9c5236 | |||
2203958798 | |||
268ec8d1e0 | |||
093d745b86 | |||
655b6d1996 | |||
833a0621fa | |||
b5c3a92be2 | |||
78694bb2f5 | |||
297cfd86fa | |||
43b2bf6c16 | |||
aceb938e07 | |||
68f44fb932 | |||
e38619dd02 | |||
4ec7cd2760 | |||
b0277ab904 | |||
87b26b0aaf | |||
01d13c153d | |||
c17082a4f8 | |||
9acfd3eb73 | |||
0ad84b8723 | |||
3f912eb4ad | |||
f1b45f7df0 | |||
29c18d4bde | |||
33728840ec | |||
cd339486b7 | |||
e54a34d8dd | |||
d24b192f8c | |||
0442d7e2d6 | |||
5b97bb247e | |||
8a7486577a | |||
6d17993eb6 | |||
d0e5da2884 | |||
d5b50ee466 | |||
8031fe00c7 | |||
3f6152806f | |||
7fdca150a9 | |||
165de71754 | |||
6b1a4b6e64 | |||
aaf0ef6b19 | |||
fb2745ba3b | |||
d452ed7db8 | |||
8f5cd0a361 | |||
d7bc3c6f4a | |||
d04e5a1fe0 | |||
bf5f09a0c7 | |||
a154d660d9 | |||
7a49d50187 | |||
ce0bd93289 | |||
0fdefdf7a4 | |||
8236f20759 | |||
e16b2a8831 | |||
f7fbc6f633 | |||
3a9b0cf132 | |||
2a3e646b94 | |||
64231aa3f0 | |||
117e6fb356 | |||
03ea06fa84 | |||
525ab3faa9 | |||
490e86dde3 | |||
6e076e77d8 | |||
d75f2f7051 | |||
aa1be9fcad | |||
17796aaed4 | |||
2355fa973e | |||
694e9f2bdc | |||
372566295e | |||
4e85213473 | |||
d6a346ca6e | |||
8b65b3e6d7 | |||
ffffc0179f | |||
f80ec871f6 | |||
e0cb5caef2 | |||
afbbf61588 | |||
28665079a0 | |||
80997f652b | |||
9d67a02b5f | |||
22efa1ab53 | |||
f19d1e253a | |||
b65f7f7895 | |||
fb49d2ced9 | |||
434ce96f2c | |||
6ae2c5f5c7 | |||
6f4e494e06 | |||
eb554a504d | |||
8771418170 | |||
2f37ea842f | |||
9232ba1da0 | |||
a0916b926f | |||
2da6a7570b | |||
2498ecbc84 | |||
4935fdf6e4 | |||
370dd6c4da | |||
06ca24e8e2 | |||
c4425c836a | |||
f0dd90d9d7 | |||
6bc5a84a2d | |||
3375363d93 | |||
fbb40b98ad | |||
a365a0e3ba | |||
45c5b66e9e | |||
f303c24d3c | |||
3d4762eab3 | |||
a5896264fa | |||
4d1cca1150 | |||
092e6e947e | |||
07f505971c | |||
7eccc5ebf2 | |||
dab124dfb9 | |||
8be664cca9 | |||
866edd41a7 | |||
412f93122d | |||
3201d1d493 | |||
9df7f65dd5 | |||
e23be8c91a | |||
99c384e110 | |||
49076d406e | |||
9e491decc0 | |||
ad77d9b014 | |||
4788d911ad | |||
80ea7db9c0 | |||
bacb8f56c3 | |||
d553555880 | |||
9e508779c2 | |||
14d144ea22 | |||
305ed0b3c5 | |||
9208c6b4e6 | |||
def893fe40 | |||
2a3c9e73e5 | |||
15854a1b14 | |||
12a0a9dedd | |||
5c90afa296 | |||
68ddba60a3 | |||
3482d836ae | |||
60731e6d02 | |||
c1256fff5b | |||
ddb77b1454 | |||
afec5b0f2e | |||
eb1598831a | |||
ea73e736c8 | |||
f2976178c9 | |||
76638aae76 | |||
2edaf0588a | |||
e525e3a571 | |||
a19c19c58c | |||
67a71868cb | |||
029f64495c | |||
63d6052159 | |||
50043f9cd6 | |||
59b1623477 | |||
22b52858e0 | |||
baea75f2df | |||
69c993357d | |||
fb685bcb1d | |||
14e4e9e479 | |||
b99940f8a1 | |||
3d76d6649f | |||
7519d8ca2c | |||
9f28eec95c | |||
17126b0c6d | |||
c37cb60d3c | |||
6c587b1c57 | |||
5917453611 | |||
cc2a1444ae | |||
10df5dcf70 | |||
8055635e85 |
91
.gitignore
vendored
91
.gitignore
vendored
@ -1,38 +1,73 @@
|
||||
/ext/llvm-g++-Xcode4.6.2
|
||||
/ext/llvm-g++-Xcode4.6.2.tar.bz2
|
||||
# Main binaries created in *nix builds
|
||||
/zerotier-*
|
||||
/build-ZeroTierUI-*
|
||||
/ZeroTierUI/*.user
|
||||
*.o
|
||||
|
||||
# OS-created garbage files from various platforms
|
||||
.DS_Store
|
||||
.Apple*
|
||||
*.dSYM
|
||||
netconf-service/netconf-test
|
||||
netconf-service/netconf.service
|
||||
mac-tap/tuntap/src/tap/tap
|
||||
mac-tap/tuntap/tap.kext
|
||||
/ipch
|
||||
/ZeroTierOne.sdf
|
||||
/ZeroTierOne.v11.suo
|
||||
/vsprojects/SelfTest/Debug
|
||||
/vsprojects/SelfTest/Release
|
||||
/vsprojects/ZeroTierOne/Debug
|
||||
/vsprojects/ZeroTierOne/Release
|
||||
/vsprojects/ZeroTierOne/x64
|
||||
/vsprojects/TapDriver/Win32
|
||||
/vsprojects/TapDriver/x64
|
||||
/vsprojects/InstallerUpdater/obj
|
||||
/vsprojects/Service/obj
|
||||
/vsprojects/SelfTest/SelfTest.aps
|
||||
/Build/*
|
||||
Thumbs.db
|
||||
|
||||
# Windows build droppings
|
||||
/windows/ZeroTierOne.sdf
|
||||
/windows/ZeroTierOne.v11.suo
|
||||
/windows/x64
|
||||
/windows/Win32
|
||||
/windows/*/x64
|
||||
/windows/*/Win32
|
||||
/windows/ZeroTierOne/Release
|
||||
/windows/ZeroTierOneService/obj
|
||||
/windows/ZeroTierOneService/bin
|
||||
/windows/Build
|
||||
/windows/Debug
|
||||
/windows/Release
|
||||
/windows/WebUIWrapper/bin
|
||||
/windows/WebUIWrapper/obj
|
||||
/ext/installfiles/windows/ZeroTier One-SetupFiles
|
||||
/ext/installfiles/windows/Prerequisites
|
||||
/ext/installfiles/windows/*-cache
|
||||
/ZeroTier One.msi
|
||||
|
||||
# *nix/Mac build droppings
|
||||
/build-*
|
||||
/ZeroTierOneInstaller-*
|
||||
|
||||
# Miscellaneous file types that we don't want to check in
|
||||
*.log
|
||||
*.opensdf
|
||||
*.user
|
||||
*.cache
|
||||
*.obj
|
||||
*.tlog
|
||||
/installer-build
|
||||
/zt1-*-install
|
||||
/file2lz4c
|
||||
.qmake.stash
|
||||
*.pid
|
||||
*.pkg
|
||||
*.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
|
||||
|
||||
# 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/
|
||||
java/bin/
|
||||
java/classes/
|
||||
java/doc/
|
||||
java/build_win64/
|
||||
java/build_win32/
|
||||
/java/mac32_64/
|
||||
|
@ -9,6 +9,12 @@ ZeroTier One includes the following third party code:
|
||||
* LZ4 compression algorithm by Yann Collet (BSD license)
|
||||
http://code.google.com/p/lz4/
|
||||
|
||||
* http-parser by many authors (MIT license)
|
||||
https://github.com/joyent/http-parser
|
||||
|
||||
* json-parser by James McLaughlin (BSD license)
|
||||
https://github.com/udp/json-parser
|
||||
|
||||
* TunTapOSX by Mattias Nissler (forked for ZT1) (BSD license)
|
||||
http://tuntaposx.sourceforge.net
|
||||
|
||||
|
45
BUILDING.txt
45
BUILDING.txt
@ -1,45 +0,0 @@
|
||||
Building ZeroTier One on different platforms:
|
||||
|
||||
(See RUNNING.txt for what to do next.)
|
||||
|
||||
Developers note: there is currently no management of dependencies on *nix
|
||||
platforms, so you should make clean ; make if you change a header. Will
|
||||
do this eventually.
|
||||
|
||||
-- Linux
|
||||
|
||||
make
|
||||
|
||||
That's it. Add ZT_AUTO_UPDATE=1 to the make command line to build an
|
||||
auto-update-enabled version that will update from ZeroTier's servers.
|
||||
This is disabled by default since such a build will automatically
|
||||
replace itself with our binary distributions.
|
||||
|
||||
-- MacOS
|
||||
|
||||
make
|
||||
|
||||
The same ZT_AUTO_UPDATE=1 option as Linux supports can be used here to
|
||||
build an auto-update-enabled version. By default auto-updates are not
|
||||
enabled.
|
||||
|
||||
If you are building ext/tap-mac you will need a different version of the
|
||||
OSX gcc compiler chain than what currently ships (clang). We've got a copy
|
||||
available here:
|
||||
|
||||
http://download.zerotier.com/dev/llvm-g++-Xcode4.6.2.tar.bz2
|
||||
|
||||
Un-tar this into ext/ (it's excluded in .gitignore) and then 'make' in
|
||||
ext/tap-mac/tuntap/src/tap.
|
||||
|
||||
Most users should not need to build tap-mac, since a binary is included
|
||||
in ext/bin.
|
||||
|
||||
To build the UI you will need Qt version 5.0 or later. The Qt home must
|
||||
be symbolically linked into "Qt" in the parent directory of the ZeroTier
|
||||
One source tree. Then you can type "make mac-ui" and the UI should build.
|
||||
You can also load the UI in Qt Creator and build/test it that way.
|
||||
|
||||
-- Windows
|
||||
|
||||
Here be dragons.
|
7
Makefile
7
Makefile
@ -9,3 +9,10 @@ endif
|
||||
ifeq ($(OSTYPE),Linux)
|
||||
include make-linux.mk
|
||||
endif
|
||||
|
||||
ifeq ($(OSTYPE),FreeBSD)
|
||||
include make-freebsd.mk
|
||||
endif
|
||||
ifeq ($(OSTYPE),OpenBSD)
|
||||
include make-freebsd.mk
|
||||
endif
|
||||
|
169
README.md
169
README.md
@ -1,18 +1,171 @@
|
||||
ZeroTier One
|
||||
======
|
||||
|
||||
ZeroTier One creates flat virtual Ethernet networks of almost unlimited size. [Visit ZeroTier Networks on the web](https://www.zerotier.com/) for more information.
|
||||
ZeroTier is a software defined networking layer for Earth.
|
||||
|
||||
This project is now in beta, which means that major incompatible protocol shifts should now become considerably more rare. You should still update very often if you plan to use it. Binary packages with auto-update are coming very soon.
|
||||
It can be used for on-premise network virtualization, as a peer to peer VPN for mobile teams, for hybrid or multi-data-center cloud deployments, or just about anywhere else secure software defined virtual networking is useful.
|
||||
|
||||
Follow the [ZeroTier blog](http://blog.zerotier.com/) and the [GitHub project](https://github.com/zerotier/ZeroTierOne) to stay up to date.
|
||||
ZeroTier One is our OS-level client service. It allows Mac, Linux, Windows, FreeBSD, and soon other types of clients to join ZeroTier virtual networks like conventional VPNs or VLANs. It can run on native systems, VMs, or containers (Docker, OpenVZ, etc.).
|
||||
|
||||
See BUILDING.txt and RUNNING.txt for instructions. It currently runs on Mac and Linux. A Windows port is well along the way to completion. If you're brave you can load the Visual Studio 2012 solution and play around.
|
||||
Visit [ZeroTier's site](https://www.zerotier.com/) for more information. You can also download professionally packaged binary installers/packages for a variety of supported OSes there if you don't want to build ZeroTier One from source.
|
||||
|
||||
Once you have it running you can join the Earth network -- a LAN for the planet -- by using the 'zerotier-cli' tool: 'sudo zerotier-cli join 8056c2e21c000001'. Right now Earth is the only network. Ability to create private networks, as well as some additional special-purpose public ones, will be coming soon. (Note: previous alpha versions auto-joined Earth, but since 0.5.0 it no longer does this.)
|
||||
### Building from Source
|
||||
|
||||
Note that this won't work if your firewall does not allow outbound UDP. It must allow two way UDP conversations on port 9993 at a minimum.
|
||||
For Mac, Linux, and BSD, just type "make" (or "gmake" on BSD). You won't need much installed; here are the requirements for various platforms:
|
||||
|
||||
ZeroTier One is licensed under the GNU General Public License version 3. You are free to use, modify, or redistribute it under the terms of that license. If you would like to embed ZeroTier One in a closed source product or create a closed source derivative product, contact ZeroTier Networks LLC.
|
||||
* Mac: Xcode command line tools, and [Packages](http://s.sudre.free.fr/Software/Packages/about.html) if you want to build an OSX .pkg installer ("make mac-dist-pkg"). It should build on OSX 10.7 or newer.
|
||||
* Linux: gcc/g++ or clang/clang++ (Makefile will use clang by default if available.)
|
||||
* FreeBSD (and other BSD): C++ compiler (G++ usually) and GNU make (gmake).
|
||||
|
||||
(c)2012-2013 [ZeroTier Networks LLC](https://www.zerotier.com/)
|
||||
Each supported platform has its own *make-XXX.mk* file that contains the actual make rules for the platform. The right .mk file is included by the main Makefile based on the GNU make *OSTYPE* variable. Take a look at the .mk file for your platform for other targets, debug build rules, etc.
|
||||
|
||||
Windows, of course, is special. We build for Windows with Microsoft Visual Studio 2012 on Windows 7. A solution file is located in the *windows* subfolder. Newer versions of Visual Studio (and Windows) may work but haven't been tested. Older versions almost certainly will not, since they lack things like *stdint.h* and certain STL features. MinGW or other ports of gcc/clang to Windows should also work but haven't been tested. Build steps for Windows are a bit more complicated. For the moment you are on your own there.
|
||||
|
||||
Mobile versions are in progress. They don't work yet, and in any case only the glue code will be included in this repository. The full mobile apps are in private repositories on our own git server.
|
||||
|
||||
### Supported Platforms
|
||||
|
||||
CPU architecture shouldn't matter unless it's smaller than 32-bit or something really bizarre like a "middle-endian" processor. We have reports of ZeroTier One running on arm32, arm64, and MIPS. It builds and runs out of the box on Raspberry Pi, BeagleBone, BananaPi, and other ARM-based developer/hobbyist boards.
|
||||
|
||||
ZeroTier is written in C and C++ (C++03 / ISO/IEC 14882:2003) and uses data structures and algorithms from the C++03 STL. We do not use any C++11 features (yet), since we want to support a few old and embedded platforms that don't have C++11 compilers. You *will* require a compiler and headers new enough to support 64-bit integers (long long) and the *stdint.h* header. The latter could also be faked by adding defines for things like *uint32\_t*, *int64\_t*, etc.
|
||||
|
||||
Typing "make selftest" will build a *zerotier-selftest* binary which unit tests various internals and reports on a few aspects of the build environment. It's a good idea to try this on novel platforms or architectures.
|
||||
|
||||
### Running
|
||||
|
||||
Running *zerotier-one* with -h will show help.
|
||||
|
||||
On Linux and BSD you can start the service with:
|
||||
|
||||
sudo ./zerotier-one -d
|
||||
|
||||
A home folder for your system will automatically be created.
|
||||
|
||||
The service is controlled via the JSON API, which by default is available at 127.0.0.1 port 9993. We include a *zerotier-cli* command line utility to make API calls for standard things like joining and leaving networks. The *authtoken.secret* file in the home folder contains the secret token for accessing this API. See README.md in [service/](service/) for API documentation.
|
||||
|
||||
Here's where home folders live (by default) on each OS:
|
||||
|
||||
* Linux: /var/lib/zerotier-one
|
||||
* BSD: /var/db/zerotier-one
|
||||
* Mac: /Library/Application Support/ZeroTier/One
|
||||
* Windows: \\ProgramData\\ZeroTier\\One (That's for Windows 7. The base 'shared app data' folder might be different on different Windows versions.)
|
||||
|
||||
Running ZeroTier One on a Mac is the same, but OSX requires a kernel extension. We ship a signed binary build of the ZeroTier tap device driver, which can be installed on Mac with:
|
||||
|
||||
sudo make install-mac-tap
|
||||
|
||||
This will create the home folder for Mac, place *tap.kext* there, and set its modes correctly to enable ZeroTier One to manage it with *kextload* and *kextunload*.
|
||||
|
||||
We recommend using our binary packages on Windows, since there are several prerequisites such as a tap driver that must be installed on the system *and* in the home folder.
|
||||
|
||||
### Joining A Network
|
||||
|
||||
ZeroTier virtual networks are identified by 16-digit hexadecimal network IDs, while devices are identified by 10-digit addresses. To get your address run:
|
||||
|
||||
sudo zerotier-cli status
|
||||
|
||||
(Use ./zerotier-cli if you're running it right from your build folder.)
|
||||
|
||||
You should see something like:
|
||||
|
||||
200 info ########## ONLINE #.#.#
|
||||
|
||||
That 10-digit hex code is you. It's derived via a one-way proof of work function from your cryptographic public key. Your public key can be found in *identity.public* in ZeroTier's home folder, while *identity.secret* contains your full identity including the secret portion of the key pair.
|
||||
|
||||
(The identity files define your device's *identity*. Moving them to another system will move that identity. Be careful when cloning virtual machines that have identities stored on them. If two devices have the same identity, they'll "fight" over it and you won't know which device will receive network packets.)
|
||||
|
||||
If you want to do a quick test, you can join [Earth](https://www.zerotier.com/earth.html). It's a global public network that anyone can join. Type:
|
||||
|
||||
sudo zerotier-cli join 8056c2e21c000001
|
||||
|
||||
Then:
|
||||
|
||||
sudo zerotier-cli listnetworks
|
||||
|
||||
At first it'll be in *REQUESTING\_CONFIGURATION* state. In a few seconds to a minute you should see something like:
|
||||
|
||||
200 listnetworks 8056c2e21c000001 earth.zerotier.net ##:##:##:##:##:## OK PUBLIC zt0 ##.##.##.##/##
|
||||
|
||||
Earth will assign you an IP address in the "unofficially available" globally unrouted 28.0.0.0/7 IP block so as to avoid conflicts with local networks. (Your networks can use any IP scheme, or can even leave IP addresses unmanaged.) Once you get an IP, you should be able to ping something:
|
||||
|
||||
ping earth.zerotier.net
|
||||
|
||||
Go to [http://earth.zerotier.net/](http://earth.zerotier.net/) to see a short little welcome page that will tell you your IP and Ethernet MAC address.
|
||||
|
||||
Earth is a public place. If you don't want to stick around run:
|
||||
|
||||
sudo zerotier-cli leave 8056c2e21c000001
|
||||
|
||||
The network (and associated interface) should be gone.
|
||||
|
||||
Networks are created and administrated by network controllers. Most users will want to use our hosted controllers. Visit [our web site](https://www.zerotier.com/) for more information. Later in this README there are brief instructions about building ZeroTier One with network controller support for those who want to try running their own.
|
||||
|
||||
Macintosh and Windows installers also install a GUI application.
|
||||
|
||||
### Installing
|
||||
|
||||
We don't have a "make install" rule quite yet. On Linux you can type:
|
||||
|
||||
make installer
|
||||
|
||||
This will build a binary that, when run, will install ZeroTier One on most current Linux distributions. We also have RPM and DEB build files in *ext/installfiles/linux* that wrap this installer in packages for RedHat/CentOS and Debian/Ubuntu derived distributions. If *rpmbuild* is present on the system, the RPM will be built. If *dpkg-deb* is present, the DEB package will be built.
|
||||
|
||||
On Mac the best way is to install [Packages](http://s.sudre.free.fr/Software/Packages/about.html) and use:
|
||||
|
||||
make mac-dist-pkg
|
||||
|
||||
This builds a .pkg file that can be installed.
|
||||
|
||||
BSD has no installer yet. We're working on it.
|
||||
|
||||
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:
|
||||
|
||||
sudo /path/to/ZeroTier/home/folder/uninstall.sh
|
||||
|
||||
Windows installers are insane. We build our .MSI installers with [Advanced Installer Enterprise](http://www.advancedinstaller.com). The Advanced Installer project file is in *ext/installfiles/windows*. To avoid lasting psychological trauma we recommend leaving Windows installers alone and using the pre-built Windows binaries on our web site.
|
||||
|
||||
### Using ZeroTier One in Docker Containers
|
||||
|
||||
To run the ZeroTier One service in a Docker container, run it with "--device=/dev/net/tun --cap-add=NET_ADMIN". This will allow ZeroTier One to open a "tap" virtual network port inside the container.
|
||||
|
||||
Alternately, you can use Ethernet bridging to bridge the *docker0* device on your system to a ZeroTier virtual network. This allows you to run ZeroTier One on the host and bridge the entire Docker network backplane to a virtual network or other hosts.
|
||||
|
||||
We're working on better "official" Docker support. In the meantime there is a [user-contributed project here](https://github.com/davide/docker-zerotier).
|
||||
|
||||
### Building with Network Controller Support
|
||||
|
||||
**Warning: as of beta version 1.0.3 the new network controller is not heavily tested. We recommend waiting for 1.0.4 to deploy this in production.**
|
||||
|
||||
Network controllers are nodes responsible for issuing configurations and certificates to members of ZeroTier virtual networks. Most users won't need to run their own, so this code is by default not included in the ZeroTier One binary.
|
||||
|
||||
You can build a network controller on Linux or Mac with:
|
||||
|
||||
make ZT_ENABLE_NETWORK_CONTROLLER=1
|
||||
|
||||
This will build a version that contains the Sqlite-backed network controller and associated extensions to the JSON local service control API. You will need the development headers for sqlite3 installed. On Mac these ship as part of Xcode, while on Linux they'll be found in packages for the various distributions.
|
||||
|
||||
See the JSON API documentation in [service/](service/) for more information about how to control controllers.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
For most users, it just works.
|
||||
|
||||
If you are running a local system firewall, we recommend adding a rule permitting UDP port 9993 inbound and outbound. If you installed binaries for Windows this should be done automatically. Other platforms might require manual editing of local firewall rules depending on your configuration.
|
||||
|
||||
The Mac firewall can be founder under "Security" in System Preferences. Linux has a variety of firewall configuration systems and tools. If you're using Ubuntu's *ufw*, you can do this:
|
||||
|
||||
sudo ufw allow 9993/udp
|
||||
|
||||
On CentOS check */etc/sysconfig/iptables* for IPTables rules. For other distributions consult your distribution's documentation. You'll also have to check the UIs or documentation for commercial third party firewall applications like Little Snitch (Mac), McAfee Firewall Enterprise (Windows), etc. if you are running any of those. Some corporate environments might have centrally managed firewall software, so you might also have to contact IT.
|
||||
|
||||
ZeroTier One peers will automatically locate each other and communicate directly over a local wired LAN *if UDP port 9993 inbound is open*. If that port is filtered, they won't be able to see each others' LAN announcement packets. If you're experiencing poor performance between devices on the same physical network, check their firewall settings. Without LAN auto-location peers must attempt "loopback" NAT traversal, which sometimes fails and in any case requires that every packet traverse your external router twice.
|
||||
|
||||
Users behind certain types of firewalls and "symmetric" NAT devices may not able able to connect to external peers directly at all. ZeroTier has limited support for port prediction and will *attempt* to traverse symmetric NATs, but this doesn't always work. If P2P connectivity fails you'll be bouncing UDP packets off our relay servers resulting in slower performance. Some NAT router(s) have a configurable NAT mode, and setting this to "full cone" will eliminate this problem. If you do this you may also see a magical improvement for things like VoIP phones, Skype, BitTorrent, WebRTC, certain games, etc., since all of these use NAT traversal techniques similar to ours.
|
||||
|
||||
If you're interested, there's a [technical deep dive about NAT traversal on our blog](https://www.zerotier.com/blog/?p=226). A troubleshooting tool to help you diagnose NAT issues is planned for the future as are uPnP/IGD/NAT-PMP and IPv6 transport.
|
||||
|
||||
If a firewall between you and the Internet blocks ZeroTier's UDP traffic, you will fall back to last-resort TCP tunneling to supernodes over port 443 (https impersonation). This will work almost anywhere but is *very slow* compared to UDP or direct peer to peer connectivity.
|
||||
|
||||
### 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.
|
||||
|
78
RUNNING.txt
78
RUNNING.txt
@ -1,78 +0,0 @@
|
||||
First build it -- see BUILDING.txt -- then...
|
||||
|
||||
-- MacOS --
|
||||
|
||||
By convention, ZeroTier One will keep its state here on mac:
|
||||
|
||||
/Library/Application Support/ZeroTier/One
|
||||
|
||||
ZeroTier ships with a kernel extension for its own tap device, which it
|
||||
stores in the above directory. To install this, type:
|
||||
|
||||
sudo make -f Makefile.mac install-mac-tap
|
||||
|
||||
This will create the ZeroTier One home above if it does not exist and install
|
||||
the kext there. Note that the kext must be owned by root:wheel. The make
|
||||
rule for install-mac-tap takes care of that.
|
||||
|
||||
Next, simply run the binary. It must be run as root to open the tap device.
|
||||
If run with no options, it will use the default home directory above.
|
||||
|
||||
sudo ./zerotier-one &
|
||||
|
||||
Finally, join the Earth network (the big public LAN and the only net for now):
|
||||
|
||||
sudo zerotier-cli join 8056c2e21c000001
|
||||
|
||||
Try pinging earth.zerotier.net and going to http://earth.zerotier.net/ in a
|
||||
browser to see if you're online.
|
||||
|
||||
-- Linux
|
||||
|
||||
On Linux, the default ZeroTier home is:
|
||||
|
||||
/var/lib/zerotier-one
|
||||
|
||||
Just type:
|
||||
|
||||
sudo mkdir /var/lib/zerotier-one
|
||||
sudo ./zerotier-one &
|
||||
|
||||
When run with no options, ZT1 uses its default home path on the current
|
||||
platform. Note that ZT1 requires the Linux tap driver, so it must be
|
||||
available in the kernel or as a module. In most Linux distributions it's
|
||||
included out of the box and should just work.
|
||||
|
||||
Finally, join the Earth network (the big public LAN and the only net for now):
|
||||
|
||||
sudo zerotier-cli join bc8f9a8ee3000001
|
||||
|
||||
Try pinging earth.zerotier.net and going to http://earth.zerotier.net/ in a
|
||||
browser to see if you're online.
|
||||
|
||||
-- Windows
|
||||
|
||||
Port in progress, and it's going to pretty much always be more painful to
|
||||
build than *nix systems. Just wait for the binary release unless you're
|
||||
brave, in which case you can load the VS2012 solution and play around.
|
||||
|
||||
-- Open UDP port 9993
|
||||
|
||||
As noted in README.md, to actually function properly, you need to open
|
||||
UDP port 9993 in your firewall. Following are instructions to open UDP port
|
||||
9993 for specific operating systems.
|
||||
|
||||
--- Ubuntu (version 12.04 and possibly other versions, too)
|
||||
|
||||
Follow the Ubuntu documentation about UFW https://help.ubuntu.com/community/UFW
|
||||
|
||||
Check if your UFW is active.
|
||||
|
||||
sudo ufw status verbose
|
||||
|
||||
If it is active, open UDP port 9993
|
||||
|
||||
sudo ufw allow 9993/udp
|
||||
|
||||
You should now be able to ping and browse earth.zerotier.net
|
||||
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>zt1icon.icns</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>ZeroTier One (Mac GUI)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>ZeroTier One</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.ZeroTierOne</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,98 +0,0 @@
|
||||
QT += core gui widgets
|
||||
TARGET = "ZeroTier One"
|
||||
TEMPLATE = app
|
||||
|
||||
win32:RC_FILE = ZeroTierUI.rc
|
||||
mac:ICON = zt1icon.icns
|
||||
mac:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
mac:QMAKE_INFO_PLIST = Info.plist
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp \
|
||||
aboutwindow.cpp \
|
||||
../node/C25519.cpp \
|
||||
../node/CertificateOfMembership.cpp \
|
||||
../node/Defaults.cpp \
|
||||
../node/Demarc.cpp \
|
||||
../node/EthernetTap.cpp \
|
||||
../node/HttpClient.cpp \
|
||||
../node/Identity.cpp \
|
||||
../node/InetAddress.cpp \
|
||||
../node/Logger.cpp \
|
||||
../node/Multicaster.cpp \
|
||||
../node/Network.cpp \
|
||||
../node/NetworkConfig.cpp \
|
||||
../node/Node.cpp \
|
||||
../node/NodeConfig.cpp \
|
||||
../node/Packet.cpp \
|
||||
../node/PacketDecoder.cpp \
|
||||
../node/Peer.cpp \
|
||||
../node/Poly1305.cpp \
|
||||
../node/Salsa20.cpp \
|
||||
../node/Service.cpp \
|
||||
../node/SHA512.cpp \
|
||||
../node/SoftwareUpdater.cpp \
|
||||
../node/Switch.cpp \
|
||||
../node/SysEnv.cpp \
|
||||
../node/Topology.cpp \
|
||||
../node/UdpSocket.cpp \
|
||||
../node/Utils.cpp \
|
||||
../ext/lz4/lz4.c \
|
||||
../ext/lz4/lz4hc.c \
|
||||
networkwidget.cpp
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
aboutwindow.h \
|
||||
../node/Node.hpp \
|
||||
../node/Utils.hpp \
|
||||
../node/Defaults.hpp \
|
||||
../node/Address.hpp \
|
||||
../node/Array.hpp \
|
||||
../node/AtomicCounter.hpp \
|
||||
../node/BandwidthAccount.hpp \
|
||||
../node/Buffer.hpp \
|
||||
../node/C25519.hpp \
|
||||
../node/CertificateOfMembership.hpp \
|
||||
../node/CMWC4096.hpp \
|
||||
../node/Condition.hpp \
|
||||
../node/Constants.hpp \
|
||||
../node/Demarc.hpp \
|
||||
../node/Dictionary.hpp \
|
||||
../node/EthernetTap.hpp \
|
||||
../node/HttpClient.hpp \
|
||||
../node/Identity.hpp \
|
||||
../node/InetAddress.hpp \
|
||||
../node/Logger.hpp \
|
||||
../node/MAC.hpp \
|
||||
../node/Multicaster.hpp \
|
||||
../node/MulticastGroup.hpp \
|
||||
../node/Mutex.hpp \
|
||||
../node/Network.hpp \
|
||||
../node/NetworkConfig.hpp \
|
||||
../node/NodeConfig.hpp \
|
||||
../node/NonCopyable.hpp \
|
||||
../node/Packet.hpp \
|
||||
../node/PacketDecoder.hpp \
|
||||
../node/Peer.hpp \
|
||||
../node/Poly1305.hpp \
|
||||
../node/RuntimeEnvironment.hpp \
|
||||
../node/Salsa20.hpp \
|
||||
../node/Service.hpp \
|
||||
../node/SHA512.hpp \
|
||||
../node/SharedPtr.hpp \
|
||||
../node/SoftwareUpdater.hpp \
|
||||
../node/Switch.hpp \
|
||||
../node/SysEnv.hpp \
|
||||
../node/Thread.hpp \
|
||||
../node/Topology.hpp \
|
||||
../node/UdpSocket.hpp \
|
||||
../ext/lz4/lz4.h \
|
||||
../ext/lz4/lz4hc.h \
|
||||
networkwidget.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
@ -1 +0,0 @@
|
||||
IDI_ICON1 ICON DISCARDABLE "zt1icon.ico"
|
@ -1,17 +0,0 @@
|
||||
#include "aboutwindow.h"
|
||||
#include "ui_aboutwindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "../node/Defaults.hpp"
|
||||
|
||||
AboutWindow::AboutWindow(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AboutWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
AboutWindow::~AboutWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#ifndef AboutWindow_H
|
||||
#define AboutWindow_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AboutWindow;
|
||||
}
|
||||
|
||||
class AboutWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutWindow(QWidget *parent = 0);
|
||||
virtual ~AboutWindow();
|
||||
|
||||
private:
|
||||
Ui::AboutWindow *ui;
|
||||
};
|
||||
|
||||
#endif // AboutWindow_H
|
@ -1,261 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutWindow</class>
|
||||
<widget class="QDialog" name="AboutWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>261</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About ZeroTier One</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/img/zt1icon.png</normaloff>:/img/zt1icon.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="iconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/img/zt1icon.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="aboutTextLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ZeroTier One GUI
|
||||
(c)2012-2013 ZeroTier Networks LLC
|
||||
|
||||
Author(s): Adam Ierymenko
|
||||
Version: 1.0</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AboutWindow</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AboutWindow</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.one.ZeroTierOneMacAuthenticateScript</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>ZeroTier One (Authenticate)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>aplt</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>x86_64</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2013 ZeroTier Networks LLC</string>
|
||||
<key>WindowState</key>
|
||||
<dict>
|
||||
<key>dividerCollapsed</key>
|
||||
<false/>
|
||||
<key>eventLogLevel</key>
|
||||
<integer>-1</integer>
|
||||
<key>name</key>
|
||||
<string>ScriptWindowState</string>
|
||||
<key>positionOfDivider</key>
|
||||
<real>333</real>
|
||||
<key>savedFrame</key>
|
||||
<string>7 181 602 597 0 0 1280 778 </string>
|
||||
<key>selectedTabView</key>
|
||||
<string>result</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
APPLaplt
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 362 B |
@ -1,4 +0,0 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1265
|
||||
{\fonttbl}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
@ -1,289 +0,0 @@
|
||||
#include "mainwindow.h"
|
||||
#include "aboutwindow.h"
|
||||
#include "networkwidget.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QMutex>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
#include <QVBoxLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QEventLoop>
|
||||
|
||||
// Globally visible
|
||||
ZeroTier::Node::LocalClient *zeroTierClient = (ZeroTier::Node::LocalClient *)0;
|
||||
|
||||
// Main window instance for app
|
||||
static MainWindow *mainWindow = (MainWindow *)0;
|
||||
|
||||
static void handleZTMessage(void *arg,unsigned long id,const char *line)
|
||||
{
|
||||
static std::map< unsigned long,std::vector<std::string> > ztReplies;
|
||||
static QMutex ztReplies_m;
|
||||
|
||||
ztReplies_m.lock();
|
||||
if (*line) {
|
||||
ztReplies[id].push_back(std::string(line));
|
||||
ztReplies_m.unlock();
|
||||
} else { // empty lines conclude transmissions
|
||||
std::map< unsigned long,std::vector<std::string> >::iterator r(ztReplies.find(id));
|
||||
if (r != ztReplies.end()) {
|
||||
MainWindow::ZTMessageEvent *event = new MainWindow::ZTMessageEvent(r->second);
|
||||
ztReplies.erase(r);
|
||||
ztReplies_m.unlock();
|
||||
QCoreApplication::postEvent(mainWindow,event); // must post since this may be another thread
|
||||
} else ztReplies_m.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->startTimer(1000); // poll service every second
|
||||
this->setEnabled(false); // gets enabled when updates are received
|
||||
mainWindow = this;
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
|
||||
if (ui->networkListWidget->verticalScrollBar())
|
||||
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
||||
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget* widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
delete zeroTierClient;
|
||||
zeroTierClient = (ZeroTier::Node::LocalClient *)0;
|
||||
mainWindow = (MainWindow *)0;
|
||||
}
|
||||
|
||||
void MainWindow::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
event->accept();
|
||||
|
||||
if (!zeroTierClient) {
|
||||
std::string dotAuthFile((QDir::homePath() + QDir::separator() + ".zeroTierOneAuthToken").toStdString());
|
||||
std::string authToken;
|
||||
if (!ZeroTier::Utils::readFile(dotAuthFile.c_str(),authToken)) {
|
||||
#ifdef __APPLE__
|
||||
// Run the little AppleScript hack that asks for admin credentials and
|
||||
// then installs the auth token file in the current user's home.
|
||||
QString authHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet");
|
||||
if (!QFile::exists(authHelperPath)) {
|
||||
// Allow this to also work from the source tree if it's run from there.
|
||||
// This is for debugging purposes and shouldn't harm the live release
|
||||
// in any way.
|
||||
authHelperPath = QCoreApplication::applicationDirPath() + "/../../../../ZeroTierUI/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet";
|
||||
if (!QFile::exists(authHelperPath)) {
|
||||
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate authorization helper, cannot obtain authentication token.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
QProcess::execute(authHelperPath,QStringList());
|
||||
#endif
|
||||
|
||||
if (!ZeroTier::Utils::readFile(dotAuthFile.c_str(),authToken)) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One.\n\nTo do so manually, copy 'authtoken.secret' from the ZeroTier One home directory to '.zeroTierOneAuthToken' in your home directory and set file modes on this file to only be readable by you (e.g. 0600 on Mac or Linux systems).",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
zeroTierClient = new ZeroTier::Node::LocalClient(authToken.c_str(),0,&handleZTMessage,this);
|
||||
}
|
||||
|
||||
// TODO: do something more user-friendly here... or maybe try to restart
|
||||
// the service?
|
||||
if (++this->cyclesSinceResponseFromService == 3)
|
||||
QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
|
||||
zeroTierClient->send("info");
|
||||
zeroTierClient->send("listnetworks");
|
||||
zeroTierClient->send("listpeers");
|
||||
}
|
||||
|
||||
void MainWindow::customEvent(QEvent *event)
|
||||
{
|
||||
ZTMessageEvent *m = (ZTMessageEvent *)event; // only one custom event type so far
|
||||
if (m->ztMessage.size() == 0)
|
||||
return;
|
||||
|
||||
std::vector<std::string> hdr(ZeroTier::Node::LocalClient::splitLine(m->ztMessage[0]));
|
||||
if (hdr.size() < 2)
|
||||
return;
|
||||
if (hdr[0] != "200")
|
||||
return;
|
||||
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
|
||||
if (hdr[1] == "info") {
|
||||
if (hdr.size() >= 3)
|
||||
this->myAddress = hdr[2].c_str();
|
||||
if (hdr.size() >= 4)
|
||||
this->myStatus = hdr[3].c_str();
|
||||
if (hdr.size() >= 5)
|
||||
this->myVersion = hdr[4].c_str();
|
||||
} else if (hdr[1] == "listnetworks") {
|
||||
std::map< std::string,std::vector<std::string> > newNetworks;
|
||||
for(unsigned long i=1;i<m->ztMessage.size();++i) {
|
||||
std::vector<std::string> l(ZeroTier::Node::LocalClient::splitLine(m->ztMessage[i]));
|
||||
// 200 listnetworks <nwid> <name> <status> <config age> <type> <dev> <ips>
|
||||
if ((l.size() == 9)&&(l[2].length() == 16))
|
||||
newNetworks[l[2]] = l;
|
||||
}
|
||||
|
||||
if (newNetworks != networks) {
|
||||
networks = newNetworks;
|
||||
|
||||
for (bool removed=true;removed;) {
|
||||
removed = false;
|
||||
for(int r=0;r<ui->networkListWidget->count();++r) {
|
||||
NetworkWidget *nw = (NetworkWidget *)ui->networkListWidget->itemWidget(ui->networkListWidget->item(r));
|
||||
if (!networks.count(nw->networkId())) {
|
||||
ui->networkListWidget->setVisible(false); // HACK to prevent an occasional crash here, discovered through hours of shotgun debugging... :P
|
||||
delete ui->networkListWidget->takeItem(r);
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ui->networkListWidget->setVisible(true);
|
||||
std::set<std::string> alreadyDisplayed;
|
||||
for(int r=0;r<ui->networkListWidget->count();++r) {
|
||||
NetworkWidget *nw = (NetworkWidget *)ui->networkListWidget->itemWidget(ui->networkListWidget->item(r));
|
||||
if (networks.count(nw->networkId()) > 0) {
|
||||
alreadyDisplayed.insert(nw->networkId());
|
||||
std::vector<std::string> &l = networks[nw->networkId()];
|
||||
nw->setNetworkName(l[3]);
|
||||
nw->setStatus(l[4],l[5]);
|
||||
nw->setNetworkType(l[6]);
|
||||
nw->setNetworkDeviceName(l[7]);
|
||||
nw->setIps(l[8]);
|
||||
}
|
||||
}
|
||||
for(std::map< std::string,std::vector<std::string> >::iterator nwdata(networks.begin());nwdata!=networks.end();++nwdata) {
|
||||
if (alreadyDisplayed.count(nwdata->first) == 0) {
|
||||
std::vector<std::string> &l = nwdata->second;
|
||||
NetworkWidget *nw = new NetworkWidget((QWidget *)0,nwdata->first);
|
||||
nw->setNetworkName(l[3]);
|
||||
nw->setStatus(l[4],l[5]);
|
||||
nw->setNetworkType(l[6]);
|
||||
nw->setNetworkDeviceName(l[7]);
|
||||
nw->setIps(l[8]);
|
||||
QListWidgetItem *item = new QListWidgetItem();
|
||||
item->setSizeHint(nw->sizeHint());
|
||||
ui->networkListWidget->addItem(item);
|
||||
ui->networkListWidget->setItemWidget(item,nw);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (hdr[1] == "listpeers") {
|
||||
this->numPeers = 0;
|
||||
for(unsigned long i=1;i<m->ztMessage.size();++i) {
|
||||
std::vector<std::string> l(ZeroTier::Node::LocalClient::splitLine(m->ztMessage[i]));
|
||||
if ((l.size() >= 5)&&((l[3] != "-")||(l[4] != "-")))
|
||||
++this->numPeers; // number of direct peers online -- check for active IPv4 and/or IPv6 address
|
||||
}
|
||||
}
|
||||
|
||||
if (this->myAddress.size())
|
||||
ui->addressButton->setText(this->myAddress);
|
||||
else ui->addressButton->setText(" ");
|
||||
|
||||
QString st(this->myStatus);
|
||||
st += ", v";
|
||||
st += this->myVersion;
|
||||
st += ", ";
|
||||
st += QString::number(this->numPeers);
|
||||
st += " direct links to peers";
|
||||
ui->statusLabel->setText(st);
|
||||
|
||||
if (this->myStatus == "ONLINE") {
|
||||
if (!this->isEnabled())
|
||||
this->setEnabled(true);
|
||||
} else {
|
||||
if (this->isEnabled())
|
||||
this->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_joinNetworkButton_clicked()
|
||||
{
|
||||
QString toJoin(ui->networkIdLineEdit->text());
|
||||
ui->networkIdLineEdit->setText(QString());
|
||||
|
||||
if (!zeroTierClient) // sanity check
|
||||
return;
|
||||
|
||||
if (toJoin.size() != 16) {
|
||||
QMessageBox::information(this,"Invalid Network ID","The network ID you entered was not valid. Enter a 16-digit hexadecimal network ID, like '8056c2e21c000001'.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
|
||||
zeroTierClient->send((QString("join ") + toJoin).toStdString());
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_triggered()
|
||||
{
|
||||
AboutWindow *about = new AboutWindow(this);
|
||||
about->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_networkIdLineEdit_textChanged(const QString &text)
|
||||
{
|
||||
QString newText;
|
||||
for(QString::const_iterator i(text.begin());i!=text.end();++i) {
|
||||
switch(i->toLatin1()) {
|
||||
case '0': newText.append('0'); break;
|
||||
case '1': newText.append('1'); break;
|
||||
case '2': newText.append('2'); break;
|
||||
case '3': newText.append('3'); break;
|
||||
case '4': newText.append('4'); break;
|
||||
case '5': newText.append('5'); break;
|
||||
case '6': newText.append('6'); break;
|
||||
case '7': newText.append('7'); break;
|
||||
case '8': newText.append('8'); break;
|
||||
case '9': newText.append('9'); break;
|
||||
case 'a': newText.append('a'); break;
|
||||
case 'b': newText.append('b'); break;
|
||||
case 'c': newText.append('c'); break;
|
||||
case 'd': newText.append('d'); break;
|
||||
case 'e': newText.append('e'); break;
|
||||
case 'f': newText.append('f'); break;
|
||||
case 'A': newText.append('a'); break;
|
||||
case 'B': newText.append('b'); break;
|
||||
case 'C': newText.append('c'); break;
|
||||
case 'D': newText.append('d'); break;
|
||||
case 'E': newText.append('e'); break;
|
||||
case 'F': newText.append('f'); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
if (newText.size() > 16)
|
||||
newText.truncate(16);
|
||||
ui->networkIdLineEdit->setText(newText);
|
||||
}
|
||||
|
||||
void MainWindow::on_addressButton_clicked()
|
||||
{
|
||||
QApplication::clipboard()->setText(this->myAddress);
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QEvent>
|
||||
#include <QString>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../node/Node.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
// Globally visible instance of local client for communicating with ZT1
|
||||
// Can be null if not connected, or will point to current
|
||||
extern ZeroTier::Node::LocalClient *zeroTierClient;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Event used to pass messages from the Node::LocalClient thread to the
|
||||
// main window to update network lists and stats.
|
||||
class ZTMessageEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
ZTMessageEvent(const std::vector<std::string> &m) :
|
||||
QEvent(QEvent::User),
|
||||
ztMessage(m)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::string> ztMessage;
|
||||
};
|
||||
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
virtual ~MainWindow();
|
||||
|
||||
protected:
|
||||
virtual void timerEvent(QTimerEvent *event);
|
||||
virtual void customEvent(QEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_joinNetworkButton_clicked();
|
||||
void on_actionAbout_triggered();
|
||||
void on_networkIdLineEdit_textChanged(const QString &text);
|
||||
void on_addressButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
QString myAddress;
|
||||
QString myStatus;
|
||||
QString myVersion;
|
||||
unsigned int numPeers;
|
||||
unsigned int cyclesSinceResponseFromService;
|
||||
std::map< std::string,std::vector<std::string> > networks;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
@ -1,323 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>668</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ZeroTier One</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/img/zt1icon.png</normaloff>:/img/zt1icon.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="networkListWidget">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListWidget#networkListWidget {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QListWidget#networkListWidget::Item {
|
||||
background-color: palette(base);
|
||||
border: 0;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="autoScroll">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="bottomContainerWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addressButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Your 10-digit ZeroTier address; click to copy to clipboard.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
border: 0;
|
||||
text-align: left;
|
||||
padding: 0 5px 0 5px;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
s</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> </string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Your network connection status.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 0 0.75em 0 0.75em;
|
||||
margin: 0 4px 0 0;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>STATUS, etc.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="networkIdLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Enter a hexadecimal network ID to join a network.</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>(Network ID)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="joinNetworkButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Join this network.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
padding: 0 0.8em 0 0.8em;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
background-color: rgba(0,0,0,25);
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">+</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>668</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>actionExit</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>333</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,123 +0,0 @@
|
||||
#include "networkwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_networkwidget.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
|
||||
NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::NetworkWidget),
|
||||
networkIdStr(nwid)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->networkIdPushButton->setText(QString(nwid.c_str()));
|
||||
|
||||
QFontMetrics fm(ui->ipListWidget->font());
|
||||
int lineHeight = ui->ipListWidget->spacing() + fm.height();
|
||||
ui->ipListWidget->setMinimumHeight(lineHeight * 4);
|
||||
ui->ipListWidget->setMaximumHeight(lineHeight * 4);
|
||||
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget* widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
}
|
||||
|
||||
NetworkWidget::~NetworkWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NetworkWidget::setStatus(const std::string &status,const std::string &age)
|
||||
{
|
||||
ui->statusLabel->setText(QString(status.c_str()));
|
||||
if (status == "OK")
|
||||
ui->ageLabel->setText(QString("(configuration is ") + age.c_str() + " seconds old)");
|
||||
else ui->ageLabel->setText(QString());
|
||||
}
|
||||
|
||||
void NetworkWidget::setNetworkName(const std::string &name)
|
||||
{
|
||||
if (name == "?") {
|
||||
ui->nameLabel->setText("... waiting ...");
|
||||
ui->nameLabel->setEnabled(false);
|
||||
} else {
|
||||
ui->nameLabel->setText(QString(name.c_str()));
|
||||
ui->nameLabel->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkWidget::setNetworkType(const std::string &type)
|
||||
{
|
||||
ui->networkTypeLabel->setText(QString(type.c_str()));
|
||||
if (type == "?")
|
||||
ui->networkTypeLabel->setStatusTip("Waiting for configuration...");
|
||||
else if (type == "public")
|
||||
ui->networkTypeLabel->setStatusTip("This network can be joined by anyone in the world.");
|
||||
else if (type == "private")
|
||||
ui->networkTypeLabel->setStatusTip("This network is private; only authorized peers can join.");
|
||||
else ui->networkTypeLabel->setStatusTip("Unknown network type.");
|
||||
}
|
||||
|
||||
void NetworkWidget::setNetworkDeviceName(const std::string &dev)
|
||||
{
|
||||
ui->deviceLabel->setText(QString(dev.c_str()));
|
||||
}
|
||||
|
||||
void NetworkWidget::setIps(const std::string &commaSeparatedList)
|
||||
{
|
||||
QStringList ips(QString(commaSeparatedList.c_str()).split(QChar(','),QString::SkipEmptyParts));
|
||||
if (commaSeparatedList == "-")
|
||||
ips.clear();
|
||||
|
||||
QStringList tmp;
|
||||
ips.sort();
|
||||
for(QStringList::iterator i(ips.begin());i!=ips.end();++i) {
|
||||
QString ipOnly(*i);
|
||||
int slashIdx = ipOnly.indexOf('/');
|
||||
if (slashIdx > 0)
|
||||
ipOnly.truncate(slashIdx);
|
||||
tmp.append(ipOnly);
|
||||
}
|
||||
ips = tmp;
|
||||
|
||||
for(QStringList::iterator i(ips.begin());i!=ips.end();++i) {
|
||||
if (ui->ipListWidget->findItems(*i,Qt::MatchCaseSensitive).size() == 0)
|
||||
ui->ipListWidget->addItem(*i);
|
||||
}
|
||||
|
||||
for(int i=0;i<ui->ipListWidget->count();++i) {
|
||||
QListWidgetItem *item = ui->ipListWidget->item(i);
|
||||
if (!ips.contains(item->text()))
|
||||
ui->ipListWidget->removeItemWidget(item);
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &NetworkWidget::networkId()
|
||||
{
|
||||
return networkIdStr;
|
||||
}
|
||||
|
||||
void NetworkWidget::on_leaveNetworkButton_clicked()
|
||||
{
|
||||
if (QMessageBox::question(this,"Leave Network?",QString("Are you sure you want to leave network '") + networkIdStr.c_str() + "'?",QMessageBox::No,QMessageBox::Yes) == QMessageBox::Yes) {
|
||||
this->setEnabled(false);
|
||||
zeroTierClient->send((QString("leave ") + networkIdStr.c_str()).toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkWidget::on_networkIdPushButton_clicked()
|
||||
{
|
||||
QApplication::clipboard()->setText(ui->networkIdPushButton->text());
|
||||
}
|
||||
|
||||
void NetworkWidget::on_ipListWidget_itemActivated(QListWidgetItem *item)
|
||||
{
|
||||
if (item)
|
||||
QApplication::clipboard()->setText(item->text());
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QListWidgetItem>
|
||||
|
||||
namespace Ui {
|
||||
class NetworkWidget;
|
||||
}
|
||||
|
||||
class NetworkWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NetworkWidget(QWidget *parent = 0,const std::string &nwid = std::string());
|
||||
virtual ~NetworkWidget();
|
||||
|
||||
void setStatus(const std::string &status,const std::string &age);
|
||||
void setNetworkName(const std::string &name);
|
||||
void setNetworkType(const std::string &type);
|
||||
void setNetworkDeviceName(const std::string &dev);
|
||||
void setIps(const std::string &commaSeparatedList);
|
||||
|
||||
const std::string &networkId();
|
||||
|
||||
private slots:
|
||||
void on_leaveNetworkButton_clicked();
|
||||
void on_networkIdPushButton_clicked();
|
||||
void on_ipListWidget_itemActivated(QListWidgetItem *item);
|
||||
|
||||
private:
|
||||
Ui::NetworkWidget *ui;
|
||||
std::string networkIdStr;
|
||||
};
|
||||
|
||||
#endif // NETWORK_H
|
@ -1,535 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NetworkWidget</class>
|
||||
<widget class="QWidget" name="NetworkWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>580</width>
|
||||
<height>253</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Network</string>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string>NetworkWidget</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="leftWidget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>This network's short name.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>networkname</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="networkStatsWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Network ID:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="networkIdPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Hexadecimal network ID; click to copy to clipboard.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0000000000000000</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="networkTypeLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>What kind of network? Public or private?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>?</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Status of this network.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>?</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="ageLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>How recently did this network refresh its settings?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>(configuration is 0 seconds old)</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Device:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="deviceLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>The name of the network device on your system.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>?</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="rightWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<underline>false</underline>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 0.1em 0 0.1em 0;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP Address Assignments</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="ipListWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Double-click an IP to copy it to the clipboard.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListWidget {
|
||||
background-color: rgba(0,0,0,10);
|
||||
}
|
||||
|
||||
QListWidget:hover {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="leaveButtonContainerWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leaveNetworkButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Leave this network.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
padding: 0.25em;
|
||||
border: 0;
|
||||
margin: 2px 0 2px 0;
|
||||
background-color: rgba(0,0,0,25);
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Leave Network</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>ipListWidget</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/img">
|
||||
<file>zt1icon.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 361 KiB |
Binary file not shown.
Before Width: | Height: | Size: 44 KiB |
BIN
artwork/ZeroTierIcon.icns
Normal file
BIN
artwork/ZeroTierIcon.icns
Normal file
Binary file not shown.
BIN
artwork/ZeroTierIcon.ico
Normal file
BIN
artwork/ZeroTierIcon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
BIN
artwork/ZeroTierIcon.png
Normal file
BIN
artwork/ZeroTierIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
37
artwork/logo.html
Normal file
37
artwork/logo.html
Normal file
@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
html,body {
|
||||
background: #aaaaaa;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Helvetica";
|
||||
font-weight: bold;
|
||||
font-size: 12pt;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
div.icon {
|
||||
background: #ffb354;
|
||||
color: #000000;
|
||||
font-size: 150pt;
|
||||
border-radius: 2.5rem;
|
||||
display: inline-block;
|
||||
width: 1.3em;
|
||||
height: 1.3em;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height: 1.4em;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<br><br><br><br><br><br>
|
||||
<!-- Yes, our logo is a Unicode character. It sort of just turned out that way. -->
|
||||
<center>
|
||||
<div class="icon">⏁</div>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2012-2013 ZeroTier Networks LLC
|
||||
* 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2012-2013 ZeroTier Networks LLC
|
||||
* 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
|
||||
|
4
attic/README.md
Normal file
4
attic/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
Retired Code and Miscellaneous Junk
|
||||
======
|
||||
|
||||
This directory is for old code that isn't used but we don't want to lose track of, and for anything else random like debug scripts.
|
@ -1,2 +0,0 @@
|
||||
This directory is for old code that isn't used but we don't want to lose
|
||||
track of, and for anything else random like debug scripts.
|
123
attic/Range.hpp
123
attic/Range.hpp
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2012-2013 ZeroTier Networks LLC
|
||||
*
|
||||
* 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_RANGE_HPP
|
||||
#define _ZT_RANGE_HPP
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* A range of numeric values
|
||||
*
|
||||
* @tparam T Type, can be any numeric value (int, float, double, etc.)
|
||||
*/
|
||||
template<typename T>
|
||||
class Range
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct an empty range
|
||||
*/
|
||||
Range()
|
||||
throw() :
|
||||
start(0),
|
||||
end(0)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param s Starting value (inclusive)
|
||||
* @param e Ending value (exclusive)
|
||||
*/
|
||||
Range(T s,T e)
|
||||
throw() :
|
||||
start(s),
|
||||
end(e)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a range containing from n to n+1 (thus only n for integers)
|
||||
*
|
||||
* @param n Number to contain
|
||||
*/
|
||||
Range(T n)
|
||||
throw() :
|
||||
start(n),
|
||||
end(n+1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return end - start
|
||||
*/
|
||||
inline T magnitude() const
|
||||
throw()
|
||||
{
|
||||
return (end - start);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if range contains something (magnitude is nonzero)
|
||||
*/
|
||||
inline operator bool() const
|
||||
throw()
|
||||
{
|
||||
return (end > start);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param v Value to test
|
||||
* @return True if value is between start (inclusive) and end (exclusive)
|
||||
*/
|
||||
inline bool operator()(const T &v) const
|
||||
throw()
|
||||
{
|
||||
return ((v >= start)&&(v < end));
|
||||
}
|
||||
|
||||
inline bool operator==(const Range &r) const throw() { return ((start == r.start)&&(end == r.end)); }
|
||||
inline bool operator!=(const Range &r) const throw() { return (!(*this == r)); }
|
||||
inline bool operator<(const Range &r) const throw() { return ((start < r.start) ? true : ((start == r.start) ? (end < r.end) : false)); }
|
||||
inline bool operator>(const Range &r) const throw() { return (r < *this); }
|
||||
inline bool operator<=(const Range &r) const throw() { return !(r < *this); }
|
||||
inline bool operator>=(const Range &r) const throw() { return !(*this < r); }
|
||||
|
||||
/**
|
||||
* Start of range (may be modified directly)
|
||||
*/
|
||||
T start;
|
||||
|
||||
/**
|
||||
* End of range (may be modified directly)
|
||||
*/
|
||||
T end;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
32
attic/decrypt
Executable file
32
attic/decrypt
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin
|
||||
|
||||
if [ ! -e /usr/bin/openssl ]; then
|
||||
echo $0: requires /usr/bin/openssl, please install openssl tools
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo $0: Usage: $0 '<input>' '[output]'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -r "$1" ]; then
|
||||
echo $0: $1 does not exist or is not readable.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outpath=`echo "$1" | sed 's/[.]aes$//'`
|
||||
if [ "$#" -ge 2 ]; then
|
||||
outpath="$2"
|
||||
fi
|
||||
|
||||
if [ -f "$outpath" ]; then
|
||||
echo $0: $outpath already exists, delete or rename first.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
openssl aes-256-cbc -d -salt -in "$1" -out "$outpath"
|
||||
|
||||
echo $0: wrote "$outpath"
|
32
attic/encrypt
Executable file
32
attic/encrypt
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin
|
||||
|
||||
if [ ! -e /usr/bin/openssl ]; then
|
||||
echo $0: requires /usr/bin/openssl, please install openssl tools
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo $0: Usage: $0 '<input>' '[output]'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -r "$1" ]; then
|
||||
echo $0: $1 does not exist or is not readable.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outpath="$1.aes"
|
||||
if [ "$#" -ge 2 ]; then
|
||||
outpath="$2"
|
||||
fi
|
||||
|
||||
if [ -f "$outpath" ]; then
|
||||
echo $0: $outpath already exists, delete or rename first.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
openssl aes-256-cbc -salt -in "$1" -out "$outpath"
|
||||
|
||||
echo $0: wrote "$outpath"
|
764
attic/historic/anode_protocol.txt
Normal file
764
attic/historic/anode_protocol.txt
Normal file
@ -0,0 +1,764 @@
|
||||
*****************************************************************************
|
||||
Anode Protocol Specification Draft
|
||||
Version 0.8
|
||||
|
||||
(c)2009-2010 Adam Ierymenko
|
||||
*****************************************************************************
|
||||
|
||||
Table of Contents
|
||||
|
||||
*****************************************************************************
|
||||
|
||||
1. Introduction
|
||||
|
||||
Anode provides three components that work together to provide a global,
|
||||
secure, and mobile addressing system for computer networks:
|
||||
|
||||
1) An addressing system based on public key cryptography enabling network
|
||||
devices or applications to assign themselves secure, unique, and globally
|
||||
reachable network addresses in a flat address space.
|
||||
|
||||
2) A system enabling network participants holding global addresses to locate
|
||||
one another on local or global networks with "zero configuration."
|
||||
|
||||
3) A communications protocol for communication between addressed network
|
||||
participants that requires no special operating system support and no
|
||||
changes to existing network infrastructure.
|
||||
|
||||
Using Anode, both fixed and mobile applications and devices can communicate
|
||||
directly as if they were all connected to the same VPN. Anode restores the
|
||||
original vision of the Internet as a "flat" network where anything can talk
|
||||
to anything, and adds the added benefits of address mobility and strong
|
||||
protection against address spoofing and other protocol level attacks.
|
||||
|
||||
1.1. Design Philosophy
|
||||
|
||||
Anode's design philosophy is the classical "KISS" principle: "Keep It Simple
|
||||
Stupid." Anode's design principles are:
|
||||
|
||||
#1: Do not try to solve too many problems at once, and stay in scope.
|
||||
|
||||
Anode does not attempt to solve too many problems at once. It attempts to
|
||||
solve the problems of mobile addressing, address portability, and "flat"
|
||||
addressing in the presence of NAT or other barriers.
|
||||
|
||||
It does not attempt to duplicate the full functionality of SSL, X.509, SSH,
|
||||
XMPP, an enterprise service bus, a pub/sub architecture, BitTorrent, etc. All
|
||||
of those protocols and services can be used over Anode if their functionality
|
||||
is desired.
|
||||
|
||||
#2: Avoid state management.
|
||||
|
||||
State multiplies the complexity and failure modes of network protocols. State
|
||||
also tends to get in the way of the achievement of new features implicitly
|
||||
(see principle #4). Avoid state whenever possible.
|
||||
|
||||
#3: Avoid algorithm and dependency bloat.
|
||||
|
||||
Anode uses only elliptic curve Diffie-Hellman (EC-DH) and AES-256. No other
|
||||
cryptographic algorithms or hash functions are presently necessary. This
|
||||
yields implementations compact enough for embedded devices.
|
||||
|
||||
Anode also requires few or no dependencies, depending on whether the two
|
||||
needed cryptographic algorithms are obtained through a library or included.
|
||||
No other protocols or libraries are required in an implementation.
|
||||
|
||||
#4: Achieve features implicitly.
|
||||
|
||||
Use a simple stateless design that allows features to be achieved implicitly
|
||||
rather than specified explicitly. For example, Anode can do multi-homing and
|
||||
could be used to build a mesh network, but neither of these features is
|
||||
explicitly specified.
|
||||
|
||||
*****************************************************************************
|
||||
|
||||
2. Core Concepts and Algorithms
|
||||
|
||||
This section describes addresses, zones, common algorithms, and other core
|
||||
concepts.
|
||||
|
||||
2.1. Zones
|
||||
|
||||
A zone is a 32-bit integer encoded into every Anode address. Zones serve to
|
||||
assist in the location of peers by address on global IP networks. They are
|
||||
not presently significant for local communications, though they could be
|
||||
used to partition addresses into groups or link them with configuration
|
||||
options.
|
||||
|
||||
Each zone has a corresponding zone file which can be fetched in a number of
|
||||
ways (see below). A zone file is a flat text format dictionary of the format
|
||||
"key=value" separated by carriage returns. Line feeds are ignored, and any
|
||||
character may be escaped with a backslash (\) character. Blank lines are
|
||||
ignored.
|
||||
|
||||
The following entries must appear in a zone file:
|
||||
|
||||
n=<zone name>
|
||||
d=<zone description>
|
||||
c=<zone contact, e-mail address of zone administrator>
|
||||
r=<zone revision, monotonically increasing integer with each edit>
|
||||
ttl=<seconds before zone file should be re-checked for changes>
|
||||
|
||||
Additional fields may appear as well, including fields specific to special
|
||||
applications or protocols supported within the zone. Some of these are
|
||||
defined in this document.
|
||||
|
||||
Zone file fetching mechanisms are described below. Multiple mechanisms are
|
||||
specified to enable fallback in the event that one mechanism is not available.
|
||||
|
||||
2.1.1. Zone File Retrieval
|
||||
|
||||
Zone files are retrieved via HTTP, with the HTTP address being formed in one
|
||||
of two ways.
|
||||
|
||||
The preferred DNS method:
|
||||
|
||||
To fetch a zone file via DNS, use the zone ID to generate a host name and URI
|
||||
of the form:
|
||||
|
||||
http://a--XXXXXXXX.net/z
|
||||
|
||||
The XXXXXXXX field is the zone ID in hexadecimal.
|
||||
|
||||
The fallback IP method:
|
||||
|
||||
For fallback in the absence of DNS, the zone ID can be used directly as an
|
||||
IPv4 or IPv4-mapped-to-IPv6 IP address. A URI is generated of the form:
|
||||
|
||||
http://ip_address/z
|
||||
|
||||
Support for this method requires that a zone ID be chosen to correspond to a
|
||||
permanent IPv4 (preferably mappable to IPv6 space as well) IP address.
|
||||
|
||||
2.1.2. Zone ID Reservation
|
||||
|
||||
By convention, a zone ID is considered reserved when a domain of the form
|
||||
"a--XXXXXXXX.net" (where XXXXXXXX is the ID in hex) is registered.
|
||||
|
||||
It is recommended that this be done even for zone IDs not used for global
|
||||
address location in order to globally reserve them.
|
||||
|
||||
2.2. Addresses
|
||||
|
||||
Anode addresses are binary strings containing a 32-bit zone ID, a public key,
|
||||
and possibly other fields. Only one address type is presently defined:
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Name | Type ID | Elliptic Curve Parameters | Total Length |
|
||||
|---------------------------------------------------------------------------|
|
||||
| ANODE-256-40 | 1 | NIST-P-256 | 40 |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Name | Binary Layout |
|
||||
|---------------------------------------------------------------------------|
|
||||
| ANODE-256-40 | <type[1]><zone[4]><unused[2]><public key[33]> |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
The public key is a "compressed" form elliptic curve public key as described
|
||||
in RFC5480.
|
||||
|
||||
The unused section of the address must be zero. These bytes are reserved for
|
||||
future use.
|
||||
|
||||
2.2.1. ASCII Format For Addresses
|
||||
|
||||
Addresses are encoded in ASCII using base-32, which provides a quotable and
|
||||
printable encoding that is of manageable length and is case-insensitive. For
|
||||
example, an ANODE-256-40 address is 64 characters long in base-32 encoding.
|
||||
|
||||
2.3. Relaying
|
||||
|
||||
An Anode peer may optionally relay packets to any other reachable peer.
|
||||
Relaying is accomplished by sending a packet to a peer with the recipient set
|
||||
to the final recipient. The receiving peer will, if relaying is allowed and if
|
||||
it knows of or can reach the recipient, forward the packet.
|
||||
|
||||
No error is returned if relaying fails, so relay paths are treated as possible
|
||||
paths for communication until a return is received in the same way as direct
|
||||
paths.
|
||||
|
||||
Relaying can be used by peers to send messages indirectly, locate one
|
||||
another, and determine network location information to facilitate the
|
||||
establishment of direct communications.
|
||||
|
||||
Peers may refuse to relay or may limit the transmission rate at which packets
|
||||
can be relayed.
|
||||
|
||||
2.3.1. Zone Relays
|
||||
|
||||
If a zone's addresses are globally reachable on global IP networks, it must
|
||||
have one or more zone relays. These must have globally reachable public
|
||||
static IP addresses.
|
||||
|
||||
Zone relays are specified in the zone file in the following format:
|
||||
|
||||
zr.<address checksum>=<ip>[,<ip>]:<udp port>:<tcp port>:<anode addresses>
|
||||
|
||||
The address checksum is the sum of the bytes in the Anode address modulus
|
||||
the number of "zr" entries, in hexadecimal. For example, if a zone had four
|
||||
global relays its zone file could contain the lines:
|
||||
|
||||
zr.0=1.2.3.4:4343:4344:klj4j3...
|
||||
zr.1=2.3.4.5:4343:4344:00194j...
|
||||
zr.2=3.4.5.6:4343:4344:1j42zz...
|
||||
zr.3=4.5.6.7:4343:4344:z94j1q...
|
||||
|
||||
The relay would be chosen by taking the sum of the bytes in the address
|
||||
modulo 4. For example, if the bytes of an address sum to 5081 then relay
|
||||
zr.1 would be used to communicate with that address.
|
||||
|
||||
If more than one IP address is listed for a given relay, the peer must choose
|
||||
at random from among the addresses of the desired type (IPv4 or IPv6).
|
||||
|
||||
Each relay must have one Anode address for every address type supported within
|
||||
the zone. (At present there is only one address type defined.)
|
||||
|
||||
Peers should prefer UDP and fall back to TCP only if UDP is not available.
|
||||
|
||||
To make itself available, a peer must make itself known to its designated zone
|
||||
relay. This is accomplished by sending a PING message.
|
||||
|
||||
2.4. Key Agreement and Derivation
|
||||
|
||||
Key agreement is performed using elliptic curve Diffie-Hellman. This yields
|
||||
a raw key whose size depends on the elliptic curve parameters in use.
|
||||
|
||||
The following algorithm is used to derive a key of any length from a raw
|
||||
key generated through key agreement:
|
||||
|
||||
1) Zero the derived key buffer.
|
||||
2) Determine the largest of the original raw key or the derived key.
|
||||
3) Loop from 0 to the largest length determined in step 2, XOR each byte of
|
||||
the derived key buffer with the corresponding byte of the original key
|
||||
buffer with each index being modulus the length of the respective buffer.
|
||||
|
||||
2.5. Message Authentication
|
||||
|
||||
For message authentication, CMAC-AES (with AES-256) is used. This is also
|
||||
known in some literature as OMAC1-AES. The key is derived from key agreement
|
||||
between the key pair of the sending peer and the address of the recipient.
|
||||
|
||||
2.6. AES-DIGEST
|
||||
|
||||
To maintain cryptographic algorithm frugality, a cryptographic hash function
|
||||
is constructed from the AES-256 cipher. This hash function uses the common
|
||||
Davis-Meyer construction with Merkle-Damgård length padding.
|
||||
|
||||
It is described by the following pseudocode:
|
||||
|
||||
byte previous_digest[16]
|
||||
byte digest[16] = { 0,0,... }
|
||||
byte block[32] = { 0,0,... }
|
||||
integer block_counter = 0
|
||||
|
||||
; digest message
|
||||
for each byte b of message
|
||||
block[block_counter] = b
|
||||
block_counter = block_counter + 1
|
||||
if block_counter == 32 then
|
||||
block_counter = 0
|
||||
save digest[] in previous_digest[]
|
||||
encrypt digest[] with aes-256 using block[] as 256-bit aes-256 key
|
||||
xor digest[] with previous_digest[]
|
||||
end if
|
||||
next
|
||||
|
||||
; append end marker, do final block
|
||||
block[block_counter] = 0x80
|
||||
block_counter = block_counter + 1
|
||||
zero rest of block[] from block_counter to 15
|
||||
save digest[] in previous_digest[]
|
||||
encrypt digest[] with aes-256 using block[] as 256-bit aes-256 key
|
||||
xor digest[] with previous_digest[]
|
||||
|
||||
; Merkle-Damgård length padding
|
||||
zero first 8 bytes of block[]
|
||||
fill last 8 bytes of block[] w/64-bit length in big-endian order
|
||||
save digest[] in previous_digest[]
|
||||
encrypt digest[] with aes-256 using block[] as 256-bit aes-128 key
|
||||
xor digest[] with previous_digest[]
|
||||
|
||||
; digest[] now contains 128-bit message digest
|
||||
|
||||
2.7. Short Address Identifiers (Address IDs)
|
||||
|
||||
A short 8-byte version of the Anode address is used in the protocol to reduce
|
||||
transmission overhead when both sides are already aware of the other's full
|
||||
address.
|
||||
|
||||
The short address identifier is formed by computing the AES-DIGEST of the
|
||||
full address and then XORing the first 8 bytes of the digest with the last
|
||||
8 bytes to yield an 8-byte shortened digest.
|
||||
|
||||
2.8. DNS Resolution of Anode Addresses
|
||||
|
||||
Anode addresses can be saved in DNS TXT records in the following format:
|
||||
|
||||
anode:<address in base32 ASCII encoding>
|
||||
|
||||
This permits Anode addresses to be resolved from normal DNS host name.
|
||||
|
||||
2.9. Packet Transmission Mechanisms
|
||||
|
||||
2.9.1. UDP Transmission
|
||||
|
||||
The recommended method of sending Anode packets is UDP. Each packet is simply
|
||||
sent as a UDP packet.
|
||||
|
||||
2.9.2. TCP Transmission
|
||||
|
||||
To send packets over TCP, each packet is prefixed by its size as a 16-bit
|
||||
integer.
|
||||
|
||||
2.9.3. HTTP Transmission
|
||||
|
||||
Anode packets may be submitted in HTTP POST transactions for transport over
|
||||
networks where HTTP is the only available protocol.
|
||||
|
||||
Anode packets are simply prefixed with a 16-byte packet size and concatenated
|
||||
together just as they are in a TCP stream. One or more packets may be sent
|
||||
with each HTTP POST transaction for improved performance.
|
||||
|
||||
Since this method is intended for use in "hostile" or highly restricted
|
||||
circumstances, no additional details such as special headers or MIME types
|
||||
are specified to allow maximum flexibility. Peers should ignore anything
|
||||
other than the payload.
|
||||
|
||||
2.10. Endpoints
|
||||
|
||||
An endpoint indicates a place where Anode packets may be sent. The following
|
||||
endpoint types are specified:
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Endpoint Type | Description | Address Format |
|
||||
|---------------------------------------------------------------------------|
|
||||
| 0x00 | Unspecified | (none) |
|
||||
| 0x01 | Ethernet | <mac[6]> |
|
||||
| 0x02 | UDP/IPv4 | <ip[4]><port[2]> |
|
||||
| 0x03 | TCP/IPv4 | <ip[4]><port[2]> |
|
||||
| 0x04 | UDP/IPv6 | <ip[16]><port[2]> |
|
||||
| 0x05 | TCP/IPv6 | <ip[16]><port[2]> |
|
||||
| 0x06 | HTTP | <null-terminated full URI> |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Endpoints are encoded by beginning with a single byte indicating the endpoint
|
||||
type followed by the address information required for the given type.
|
||||
|
||||
Note that IP ports bear no relationship to Anode protocol ports.
|
||||
|
||||
2.11. Notes
|
||||
|
||||
All integers in the protocol are transmitted in network (big endian) byte
|
||||
order.
|
||||
|
||||
*****************************************************************************
|
||||
|
||||
3. Common Packet Format
|
||||
|
||||
A common header is used for all Anode packets:
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Hop Count | 1 | 8-bit hop count (not included in MAC) |
|
||||
| Flags | 1 | 8-bit flags |
|
||||
| MAC | 8 | 8 byte shortened CMAC-AES of packet |
|
||||
| Sender Address | ? | Full address or short ID of sender |
|
||||
| Recipient Address | ? | Full address or short ID of recipient |
|
||||
| Peer IDs | 1 | Two 4-bit peer IDs: sender, recipient |
|
||||
| Message Type | 1 | 8-bit message type |
|
||||
| Message | ? | Message payload |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
3.1. Hop Count
|
||||
|
||||
The hop count begins at zero and must be incremented by each peer that relays
|
||||
the packet to another peer. The hop count must not wrap to zero at 255.
|
||||
|
||||
Because the hop count is modified in transit, it is not included in MAC
|
||||
calculation or authentication.
|
||||
|
||||
The hop count is used to prioritize endpoints that are direct over endpoints
|
||||
that involve relaying, or to prioritize closer routes over more distant
|
||||
ones.
|
||||
|
||||
3.2. Flags and Flag Behavior
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Flag | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| 0x01 | Sender address fully specified |
|
||||
| 0x02 | Recipient address fully specified |
|
||||
| 0x04 | Authentication error response |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
If flag 0x01 is set, then the sender address will be the full address rather
|
||||
than a short address identifier. The length of the address can be determined
|
||||
from the first byte of the address, which always specifies the address type.
|
||||
Flag 0x02 has the same meaning for the recipient address.
|
||||
|
||||
A peer must send fully specified sender addresses until it receives a response
|
||||
from the recipient. At this point the sender may assume that the recipient
|
||||
knows its address and use short a short sender address instead. This
|
||||
assumption should time out, with a recommended timeout of 60 seconds.
|
||||
|
||||
There is presently no need to send fully specified recipient addresses, but
|
||||
the flag is present in case it is needed and must be honored.
|
||||
|
||||
Flag 0x04 indicates that this is an error response containing a failed
|
||||
authentication error. Since authentication failed, this packet may not have
|
||||
a valid MAC. Packets with this flag must never have any effect other than
|
||||
to inform of an error. This error, since it is unauthenticated, must never
|
||||
have any side effects such as terminating a connection.
|
||||
|
||||
3.3. MAC
|
||||
|
||||
The MAC is calculated as follows:
|
||||
|
||||
1) Temporarily set the 64-bit/8-byte MAC field in the packet to the packet's
|
||||
size as a 64-bit big-endian integer.
|
||||
2) Calculate the MAC for the entire packet (excluding the first byte) using
|
||||
the key agreed upon between the sender and the recipient, resulting in a
|
||||
16 byte full CMAC-AES MAC.
|
||||
3) Derive the 8 byte packet MAC by XORing the first 8 bytes of the full 16
|
||||
byte CMAC-AES MAC with the last 8 bytes. Place this into the packet's MAC
|
||||
field.
|
||||
|
||||
3.4. Peer IDs
|
||||
|
||||
Peer IDs provide a method for up to 15 different peers to share an address,
|
||||
each with a unique ID allowing packets to be routed to them individually.
|
||||
|
||||
A peer ID of zero indicates "any" or "unspecified." Real peers must have a
|
||||
nonzero peer ID. In the normal single peer per address case, any peer ID may
|
||||
be used. If multiple peers are to share an address, some implementation-
|
||||
dependent method must be used to ensure that each peer has a unique peer ID.
|
||||
|
||||
Relaying peers must follow these rules based on the recipient peer ID when
|
||||
relaying messages:
|
||||
|
||||
- IF the peer ID is zero or if the peer ID is not known, the message must
|
||||
be forwarded to a random endpoint for the given recipient address.
|
||||
- IF the peer ID is nonzero and matches one or more known endpoints for the
|
||||
given recipient address and peer ID, the message must only be sent to
|
||||
a matching endpoint.
|
||||
|
||||
A receiving peer should process any message that it receives regardless of
|
||||
whether its recipient peer ID is correct. The peer ID is primarily for relays.
|
||||
|
||||
Peers should typically send messages with a nonzero recipient peer ID when
|
||||
responding to or involved in a conversation with a specific peer (e.g. a
|
||||
streaming connection), and send zero recipient peer IDs otherwise.
|
||||
|
||||
3.5. Short Address Conflict Disambiguation
|
||||
|
||||
In the unlikely event of two Anode addresses with the same short identifier,
|
||||
the recipient should use MAC validation to disambiguate. The peer ID must not
|
||||
be relied upon for this purpose.
|
||||
|
||||
*****************************************************************************
|
||||
|
||||
4. Basic Signaling and Transport Protocol
|
||||
|
||||
4.1. Message Types
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Type | ID | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| ERROR | 0x00 | Error response |
|
||||
| PING | 0x01 | Echo request |
|
||||
| PONG | 0x02 | Echo response |
|
||||
| EPC_REQ | 0x03 | Endpoint check request |
|
||||
| EPC | 0x04 | Endpoint check response |
|
||||
| EPI | 0x05 | Endpoint information |
|
||||
| NAT_T | 0x06 | NAT traversal message |
|
||||
| NETID_REQ | 0x07 | Request network address identification and/or test |
|
||||
| NETID | 0x08 | Response to network address identification request |
|
||||
| DGRAM | 0x09 | Simple UDP-like datagram |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
4.2. Message Details
|
||||
|
||||
4.2.1. ERROR
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Error Code | 2 | 16-bit error code |
|
||||
| Error Arguments | ? | Error arguments, depending on error type |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Error arguments are empty unless otherwise stated below.
|
||||
|
||||
Error codes:
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Error Code | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| 0x01 | Message not valid |
|
||||
| 0x02 | Message authentication or decryption failed |
|
||||
| 0x03 | Relaying and related features not authorized |
|
||||
| 0x04 | Relay recipient not reachable |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Generation of errors is optional. A peer may choose to ignore invalid
|
||||
messages or to throttle the sending of errors.
|
||||
|
||||
4.2.2. PING
|
||||
|
||||
(Payload unspecified.)
|
||||
|
||||
Request echo of payload as PONG message.
|
||||
|
||||
4.2.3. PONG
|
||||
|
||||
(Payload unspecified.)
|
||||
|
||||
Echoed payload of received PING message.
|
||||
|
||||
4.2.4. EPC_REQ
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Request ID | 4 | 32-bit request ID |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Request echo of request ID in EPC message, used to check and learn endpoints.
|
||||
|
||||
To learn a network endpoint for a peer, CHECK_REQ is sent. If CHECK is
|
||||
returned with a valid request ID, the endpoint is considered valid.
|
||||
|
||||
4.2.5. EPC
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Request ID | 4 | 32-bit request ID echoed back |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Response to EPC_REQ containing request ID.
|
||||
|
||||
4.2.6. EPI
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Flags | 1 | 8-bit flags |
|
||||
| Endpoint | ? | Endpoint type and address |
|
||||
| NAT-T mode | 1 | 8-bit NAT traversal mode |
|
||||
| NAT-T options | ? | Options related to specified NAT-T mode |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
EPI stands for EndPoint Identification, and is sent to notify another peer of
|
||||
a network endpoint where the sending peer is reachable.
|
||||
|
||||
If the receiving peer is interested in communicating with the sending peer,
|
||||
the receiving peer must send EPC_REQ to the sending peer at the specified
|
||||
endpoint to check the validity of that endpoint. The endpoint is learned if a
|
||||
valid EPC is returned.
|
||||
|
||||
If the endpoint in EPI is unspecified, the actual source of the EPI message
|
||||
is the endpoint. This allows EPI messages to be broadcast on a local LAN
|
||||
segment to advertise the presence of an address on a local network. EPI
|
||||
broadcasts on local IP networks must be made to UDP port 8737.
|
||||
|
||||
Usually EPI is sent via relays (usually zone relays) to inform a peer of an
|
||||
endpoint for direct communication.
|
||||
|
||||
There are presently no flags, so flags must be zero.
|
||||
|
||||
4.2.7. NAT_T
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| NAT-T mode | 1 | 8-bit NAT traversal mode |
|
||||
| NAT-T options | ? | Options related to specified NAT-T mode |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
NAT_T is used to send messages specific to certain NAT traversal modes.
|
||||
|
||||
4.2.8. NETID_REQ
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Request ID | 4 | 32-bit request ID |
|
||||
| Endpoint | ? | Endpoint type and address information |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
When a NETID_REQ message is received, the recipient attempts to echo it back
|
||||
as a NETID message to the specified endpoint address. If the endpoint is
|
||||
unspecified, the recipient must fill it in with the actual origin of the
|
||||
NETID_REQ message. This allows a peer to cooperate with another peer (usually
|
||||
a zone relay) to empirically determine its externally visible network
|
||||
address information.
|
||||
|
||||
A peer may ignore NETID_REQ or respond with an error if it does not allow
|
||||
relaying.
|
||||
|
||||
4.2.9. NETID
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Request ID | 4 | 32-bit request ID echoed back |
|
||||
| Endpoint Type | 1 | 8-bit endpoint type |
|
||||
| Endpoint Address | ? | Endpoint Address (size depends on type) |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
NETID is sent in response to NETID_REQ to the specified endpoint address. It
|
||||
always contains the endpoint address to which it was sent.
|
||||
|
||||
4.2.10. DGRAM
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Source Port | 2 | 16-bit source port |
|
||||
| Destination Port | 2 | 16-bit destination port |
|
||||
| Payload | ? | Datagram packet payload |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
A datagram is a UDP-like message without flow control or delivery assurance.
|
||||
|
||||
*****************************************************************************
|
||||
|
||||
5. Stream Protocol
|
||||
|
||||
The stream protocol is very similar to TCP, though it omits some features
|
||||
that are not required since they are taken care of by the encapsulating
|
||||
protocol. SCTP was also an inspiration in the design.
|
||||
|
||||
5.1. Message Types
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Type | ID | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| S_OPEN | 20 | Initiate a streaming connection (like TCP SYN) |
|
||||
| S_CLOSE | 21 | Terminate a streaming connection (like TCP RST/FIN) |
|
||||
| S_DATA | 22 | Data packet |
|
||||
| S_ACK | 23 | Acknowedge receipt of one or more data packets |
|
||||
| S_DACK | 24 | Combination of DATA and ACK |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
5.2. Message Details
|
||||
|
||||
5.2.1. S_OPEN
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Sender Link ID | 2 | 16-bit sender link ID |
|
||||
| Destination Port | 2 | 16-bit destination port |
|
||||
| Window Size | 2 | 16-bit window size in 1024-byte increments |
|
||||
| Init. Seq. Number | 4 | 32-bit initial sequence number |
|
||||
| Flags | 1 | 8-bit flags |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
The OPEN message corresponds to TCP SYN, and initiates a connection. It
|
||||
specifies the initial window size for the sender and the sender's initial
|
||||
sequence number, which should be randomly chosen to prevent replay attacks.
|
||||
|
||||
If OPEN is successful, the recipient sends its own OPEN to establish the
|
||||
connetion. If OPEN is unsuccessful, CLOSE is sent with its initial and current
|
||||
sequence numbers equal and an appropriate reason such as "connection refused."
|
||||
|
||||
The sender link ID must be unique for a given recipient.
|
||||
|
||||
If flag 01 is set, the sender link ID is actually a source port where the
|
||||
sender might be listening for connections as well. This exactly duplicates
|
||||
the behavior of standard TCP. Otherwise, the sender link ID is simply an
|
||||
arbitrary number that the sender uses to identify the connection with this
|
||||
recipient and there is no port of origin. Ports of origin are optional for
|
||||
Anode streaming connections to permit greater scalability.
|
||||
|
||||
5.2.2. S_CLOSE
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Sender Link ID | 2 | 16-bit sender link ID |
|
||||
| Destination Port | 2 | 16-bit destination port |
|
||||
| Flags | 1 | 8-bit flags |
|
||||
| Reason | 1 | 8-bit close reason |
|
||||
| Init. Seq. Number | 4 | 32-bit initial sequence number |
|
||||
| Sequence Number | 4 | 32-bit current sequence number |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
The CLOSE message serves a function similar to TCP FIN. The initial sequence
|
||||
number is the original starting sequence number sent with S_OPEN, while the
|
||||
current sequence number is the sequence number corresponding to the close
|
||||
and must be ACKed to complete the close operation. The use of the initial
|
||||
sequence number helps to serve as a key to prevent replay attacks.
|
||||
|
||||
CLOSE is also used to indicate a failed OPEN attempt. In this case the current
|
||||
sequence number will be equal to the initial sequence number and no ACK will
|
||||
be expected.
|
||||
|
||||
There are currently no flags, so flags must be zero.
|
||||
|
||||
The reason field describes the reason for the close:
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Reason Code | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| 00 | Application closed connection |
|
||||
| 01 | Connection refused |
|
||||
| 02 | Protocol error |
|
||||
| 03 | Timed out |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Established connections will usually be closed with reason 00, while reason
|
||||
01 is usually provided if an OPEN is received but the port is not bound.
|
||||
|
||||
5.2.3. S_DATA
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Sender Link ID | 2 | 16-bit sender link ID |
|
||||
| Destination Port | 2 | 16-bit destination port |
|
||||
| Sequence Number | 4 | 32-bit sequence number |
|
||||
| Payload | ? | Data payload |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
The DATA message carries a packet of data, with the sequence number
|
||||
determining order. The sequence number is monotonically incremented with
|
||||
each data packet, and wraps at the maximum value of an unsigned 32-bit
|
||||
integer.
|
||||
|
||||
5.2.4. S_ACK
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Sender Link ID | 2 | 16-bit sender link ID |
|
||||
| Destination Port | 2 | 16-bit destination port |
|
||||
| Window Size | 2 | 16-bit window size in 1024-byte increments |
|
||||
| Acknowledgements | ? | One or more acknowledgements (see below) |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
Each acknowledgement is a 32-bit integer followed by an 8-bit integer (5 bytes
|
||||
total). The 32-bit integer is the first sequence number to acknowledge, and
|
||||
the 8-bit integer is the number of sequential following sequence numbers to
|
||||
acknowledge. For example "1, 4" would acknowledge sequence numbers 1, 2, 3,
|
||||
and 4.
|
||||
|
||||
5.2.5. S_DACK
|
||||
|
||||
|---------------------------------------------------------------------------|
|
||||
| Field | Length | Description |
|
||||
|---------------------------------------------------------------------------|
|
||||
| Sender Link ID | 2 | 16-bit sender link ID |
|
||||
| Destination Port | 2 | 16-bit destination port |
|
||||
| Window Size | 2 | 16-bit window size in 1024-byte increments |
|
||||
| Num. Acks | 1 | 8-bit number of acknowledgements |
|
||||
| Acknowledgements | ? | One or more acknowledgements |
|
||||
| Payload | ? | Data payload |
|
||||
|---------------------------------------------------------------------------|
|
||||
|
||||
The DACK message combines ACK and DATA, allowing two peers that are both
|
||||
transmitting data to efficiently ACK without a separate packet.
|
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
#
|
||||
# This can be used with the debug build option ZT_TRACE_MULTICAST to trace
|
||||
# a multicast cascade.
|
||||
#
|
||||
# Define ZT_TRACE_MULTICAST to the IP/port where this script will be listening.
|
||||
# The default port here is 6060, so an example would be to add:
|
||||
#
|
||||
# -DZT_TRACE_MULTICAST=\"10.0.0.1/6060\"
|
||||
#
|
||||
# ... to DEFS in the Makefile. Then build and run ZeroTier One on a testnet and
|
||||
# the box defined as the trace endpoint will get spammed with UDP packets
|
||||
# containing trace information for multicast propagation. This script then dumps
|
||||
# these trace packets to stdout. Look at the code in PacketDecoder.cpp to see
|
||||
# what this information entails.
|
||||
#
|
||||
|
||||
require 'socket'
|
||||
|
||||
s = UDPSocket.new
|
||||
s.bind('0.0.0.0',6060)
|
||||
|
||||
loop {
|
||||
m = s.recvfrom(4096)[0].chomp
|
||||
puts m if m.length > 0
|
||||
}
|
331
attic/rtbl/BSDRoutingTable.cpp
Normal file
331
attic/rtbl/BSDRoutingTable.cpp
Normal file
@ -0,0 +1,331 @@
|
||||
/*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/route.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <ifaddrs.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "BSDRoutingTable.hpp"
|
||||
|
||||
// All I wanted was the bloody rounting table. I didn't expect the Spanish inquisition.
|
||||
|
||||
#define ZT_BSD_ROUTE_CMD "/sbin/route"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
BSDRoutingTable::BSDRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
BSDRoutingTable::~BSDRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<RoutingTable::Entry> BSDRoutingTable::get(bool includeLinkLocal,bool includeLoopback) const
|
||||
{
|
||||
std::vector<RoutingTable::Entry> entries;
|
||||
int mib[6];
|
||||
size_t needed;
|
||||
|
||||
mib[0] = CTL_NET;
|
||||
mib[1] = PF_ROUTE;
|
||||
mib[2] = 0;
|
||||
mib[3] = 0;
|
||||
mib[4] = NET_RT_DUMP;
|
||||
mib[5] = 0;
|
||||
if (!sysctl(mib,6,NULL,&needed,NULL,0)) {
|
||||
if (needed <= 0)
|
||||
return entries;
|
||||
|
||||
char *buf = (char *)::malloc(needed);
|
||||
if (buf) {
|
||||
if (!sysctl(mib,6,buf,&needed,NULL,0)) {
|
||||
struct rt_msghdr *rtm;
|
||||
for(char *next=buf,*end=buf+needed;next<end;) {
|
||||
rtm = (struct rt_msghdr *)next;
|
||||
char *saptr = (char *)(rtm + 1);
|
||||
char *saend = next + rtm->rtm_msglen;
|
||||
|
||||
if (((rtm->rtm_flags & RTF_LLINFO) == 0)&&((rtm->rtm_flags & RTF_HOST) == 0)&&((rtm->rtm_flags & RTF_UP) != 0)&&((rtm->rtm_flags & RTF_MULTICAST) == 0)) {
|
||||
RoutingTable::Entry e;
|
||||
e.deviceIndex = -9999; // unset
|
||||
|
||||
int which = 0;
|
||||
while (saptr < saend) {
|
||||
struct sockaddr *sa = (struct sockaddr *)saptr;
|
||||
unsigned int salen = sa->sa_len;
|
||||
if (!salen)
|
||||
break;
|
||||
|
||||
// Skip missing fields in rtm_addrs bit field
|
||||
while ((rtm->rtm_addrs & 1) == 0) {
|
||||
rtm->rtm_addrs >>= 1;
|
||||
++which;
|
||||
if (which > 6)
|
||||
break;
|
||||
}
|
||||
if (which > 6)
|
||||
break;
|
||||
|
||||
rtm->rtm_addrs >>= 1;
|
||||
switch(which++) {
|
||||
case 0:
|
||||
//printf("RTA_DST\n");
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
|
||||
// Nobody expects the Spanish inquisition!
|
||||
if ((sin6->sin6_addr.s6_addr[0] == 0xfe)&&((sin6->sin6_addr.s6_addr[1] & 0xc0) == 0x80)) {
|
||||
// Our chief weapon is... in-band signaling!
|
||||
// Seriously who in the living fuck thought this was a good idea and
|
||||
// then had the sadistic idea to not document it anywhere? Of course it's
|
||||
// not like there is any documentation on BSD sysctls anyway.
|
||||
unsigned int interfaceIndex = ((((unsigned int)sin6->sin6_addr.s6_addr[2]) << 8) & 0xff) | (((unsigned int)sin6->sin6_addr.s6_addr[3]) & 0xff);
|
||||
sin6->sin6_addr.s6_addr[2] = 0;
|
||||
sin6->sin6_addr.s6_addr[3] = 0;
|
||||
if (!sin6->sin6_scope_id)
|
||||
sin6->sin6_scope_id = interfaceIndex;
|
||||
}
|
||||
}
|
||||
e.destination.set(sa);
|
||||
break;
|
||||
case 1:
|
||||
//printf("RTA_GATEWAY\n");
|
||||
switch(sa->sa_family) {
|
||||
case AF_LINK:
|
||||
e.deviceIndex = (int)((const struct sockaddr_dl *)sa)->sdl_index;
|
||||
break;
|
||||
case AF_INET:
|
||||
case AF_INET6:
|
||||
e.gateway.set(sa);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: {
|
||||
if (e.destination.isV6()) {
|
||||
salen = sizeof(struct sockaddr_in6); // Confess!
|
||||
unsigned int bits = 0;
|
||||
for(int i=0;i<16;++i) {
|
||||
unsigned char c = (unsigned char)((const struct sockaddr_in6 *)sa)->sin6_addr.s6_addr[i];
|
||||
if (c == 0xff)
|
||||
bits += 8;
|
||||
else break;
|
||||
/* must they be multiples of 8? Most of the BSD source I can find says yes..?
|
||||
else {
|
||||
while ((c & 0x80) == 0x80) {
|
||||
++bits;
|
||||
c <<= 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
e.destination.setPort(bits);
|
||||
} else {
|
||||
salen = sizeof(struct sockaddr_in); // Confess!
|
||||
e.destination.setPort((unsigned int)Utils::countBits((uint32_t)((const struct sockaddr_in *)sa)->sin_addr.s_addr));
|
||||
}
|
||||
//printf("RTA_NETMASK\n");
|
||||
} break;
|
||||
/*
|
||||
case 3:
|
||||
//printf("RTA_GENMASK\n");
|
||||
break;
|
||||
case 4:
|
||||
//printf("RTA_IFP\n");
|
||||
break;
|
||||
case 5:
|
||||
//printf("RTA_IFA\n");
|
||||
break;
|
||||
case 6:
|
||||
//printf("RTA_AUTHOR\n");
|
||||
break;
|
||||
*/
|
||||
}
|
||||
|
||||
saptr += salen;
|
||||
}
|
||||
|
||||
e.metric = (int)rtm->rtm_rmx.rmx_hopcount;
|
||||
if (e.metric < 0)
|
||||
e.metric = 0;
|
||||
|
||||
if (((includeLinkLocal)||(!e.destination.isLinkLocal()))&&((includeLoopback)||((!e.destination.isLoopback())&&(!e.gateway.isLoopback()))))
|
||||
entries.push_back(e);
|
||||
}
|
||||
|
||||
next = saend;
|
||||
}
|
||||
}
|
||||
|
||||
::free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
for(std::vector<ZeroTier::RoutingTable::Entry>::iterator e1(entries.begin());e1!=entries.end();++e1) {
|
||||
if ((!e1->device[0])&&(e1->deviceIndex >= 0))
|
||||
if_indextoname(e1->deviceIndex,e1->device);
|
||||
}
|
||||
for(std::vector<ZeroTier::RoutingTable::Entry>::iterator e1(entries.begin());e1!=entries.end();++e1) {
|
||||
if ((!e1->device[0])&&(e1->gateway)) {
|
||||
int bestMetric = 9999999;
|
||||
for(std::vector<ZeroTier::RoutingTable::Entry>::iterator e2(entries.begin());e2!=entries.end();++e2) {
|
||||
if ((e1->gateway.within(e2->destination))&&(e2->metric <= bestMetric)) {
|
||||
bestMetric = e2->metric;
|
||||
Utils::scopy(e1->device,sizeof(e1->device),e2->device);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(entries.begin(),entries.end());
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
RoutingTable::Entry BSDRoutingTable::set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric)
|
||||
{
|
||||
if ((!gateway)&&((!device)||(!device[0])))
|
||||
return RoutingTable::Entry();
|
||||
|
||||
std::vector<RoutingTable::Entry> rtab(get(true,true));
|
||||
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(rtab.begin());e!=rtab.end();++e) {
|
||||
if (e->destination == destination) {
|
||||
if (((!device)||(!device[0]))||(!strcmp(device,e->device))) {
|
||||
long p = (long)fork();
|
||||
if (p > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(p,&exitcode,0);
|
||||
} else if (p == 0) {
|
||||
::close(STDOUT_FILENO);
|
||||
::close(STDERR_FILENO);
|
||||
::execl(ZT_BSD_ROUTE_CMD,ZT_BSD_ROUTE_CMD,"delete",(destination.isV6() ? "-inet6" : "-inet"),destination.toString().c_str(),(const char *)0);
|
||||
::_exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (metric < 0)
|
||||
return RoutingTable::Entry();
|
||||
|
||||
{
|
||||
char hcstr[64];
|
||||
Utils::snprintf(hcstr,sizeof(hcstr),"%d",metric);
|
||||
long p = (long)fork();
|
||||
if (p > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(p,&exitcode,0);
|
||||
} else if (p == 0) {
|
||||
::close(STDOUT_FILENO);
|
||||
::close(STDERR_FILENO);
|
||||
if (gateway) {
|
||||
::execl(ZT_BSD_ROUTE_CMD,ZT_BSD_ROUTE_CMD,"add",(destination.isV6() ? "-inet6" : "-inet"),destination.toString().c_str(),gateway.toIpString().c_str(),"-hopcount",hcstr,(const char *)0);
|
||||
} else if ((device)&&(device[0])) {
|
||||
::execl(ZT_BSD_ROUTE_CMD,ZT_BSD_ROUTE_CMD,"add",(destination.isV6() ? "-inet6" : "-inet"),destination.toString().c_str(),"-interface",device,"-hopcount",hcstr,(const char *)0);
|
||||
}
|
||||
::_exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
rtab = get(true,true);
|
||||
std::vector<RoutingTable::Entry>::iterator bestEntry(rtab.end());
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(rtab.begin());e!=rtab.end();++e) {
|
||||
if ((e->destination == destination)&&(e->gateway.ipsEqual(gateway))) {
|
||||
if ((device)&&(device[0])) {
|
||||
if (!strcmp(device,e->device)) {
|
||||
if (metric == e->metric)
|
||||
bestEntry = e;
|
||||
}
|
||||
}
|
||||
if (bestEntry == rtab.end())
|
||||
bestEntry = e;
|
||||
}
|
||||
}
|
||||
if (bestEntry != rtab.end())
|
||||
return *bestEntry;
|
||||
|
||||
return RoutingTable::Entry();
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
// Enable and build to test routing table interface
|
||||
#if 0
|
||||
using namespace ZeroTier;
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
BSDRoutingTable rt;
|
||||
|
||||
printf("<destination> <gateway> <interface> <metric>\n");
|
||||
std::vector<RoutingTable::Entry> ents(rt.get());
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(ents.begin());e!=ents.end();++e)
|
||||
printf("%s\n",e->toString().c_str());
|
||||
printf("\n");
|
||||
|
||||
printf("adding 1.1.1.0 and 2.2.2.0...\n");
|
||||
rt.set(InetAddress("1.1.1.0",24),InetAddress("1.2.3.4",0),(const char *)0,1);
|
||||
rt.set(InetAddress("2.2.2.0",24),InetAddress(),"en0",1);
|
||||
printf("\n");
|
||||
|
||||
printf("<destination> <gateway> <interface> <metric>\n");
|
||||
ents = rt.get();
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(ents.begin());e!=ents.end();++e)
|
||||
printf("%s\n",e->toString().c_str());
|
||||
printf("\n");
|
||||
|
||||
printf("deleting 1.1.1.0 and 2.2.2.0...\n");
|
||||
rt.set(InetAddress("1.1.1.0",24),InetAddress("1.2.3.4",0),(const char *)0,-1);
|
||||
rt.set(InetAddress("2.2.2.0",24),InetAddress(),"en0",-1);
|
||||
printf("\n");
|
||||
|
||||
printf("<destination> <gateway> <interface> <metric>\n");
|
||||
ents = rt.get();
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(ents.begin());e!=ents.end();++e)
|
||||
printf("%s\n",e->toString().c_str());
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
51
attic/rtbl/BSDRoutingTable.hpp
Normal file
51
attic/rtbl/BSDRoutingTable.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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_BSDROUTINGTABLE_HPP
|
||||
#define ZT_BSDROUTINGTABLE_HPP
|
||||
|
||||
#include "../node/RoutingTable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* Routing table interface for BSD with sysctl() and BSD /sbin/route
|
||||
*
|
||||
* Has currently only been tested on OSX/Darwin.
|
||||
*/
|
||||
class BSDRoutingTable : public RoutingTable
|
||||
{
|
||||
public:
|
||||
BSDRoutingTable();
|
||||
virtual ~BSDRoutingTable();
|
||||
virtual std::vector<RoutingTable::Entry> get(bool includeLinkLocal = false,bool includeLoopback = false) const;
|
||||
virtual RoutingTable::Entry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric);
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
235
attic/rtbl/LinuxRoutingTable.cpp
Normal file
235
attic/rtbl/LinuxRoutingTable.cpp
Normal file
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <ifaddrs.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
#include "LinuxRoutingTable.hpp"
|
||||
|
||||
#define ZT_LINUX_IP_COMMAND "/sbin/ip"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
LinuxRoutingTable::LinuxRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
LinuxRoutingTable::~LinuxRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<RoutingTable::Entry> LinuxRoutingTable::get(bool includeLinkLocal,bool includeLoopback) const
|
||||
{
|
||||
char buf[131072];
|
||||
char *stmp,*stmp2;
|
||||
std::vector<RoutingTable::Entry> entries;
|
||||
|
||||
{
|
||||
int fd = ::open("/proc/net/route",O_RDONLY);
|
||||
if (fd <= 0)
|
||||
buf[0] = (char)0;
|
||||
else {
|
||||
int n = (int)::read(fd,buf,sizeof(buf) - 1);
|
||||
::close(fd);
|
||||
if (n < 0) n = 0;
|
||||
buf[n] = (char)0;
|
||||
}
|
||||
}
|
||||
|
||||
int lineno = 0;
|
||||
for(char *line=Utils::stok(buf,"\r\n",&stmp);(line);line=Utils::stok((char *)0,"\r\n",&stmp)) {
|
||||
if (lineno == 0) {
|
||||
++lineno;
|
||||
continue; // skip header
|
||||
}
|
||||
|
||||
char *iface = (char *)0;
|
||||
uint32_t destination = 0;
|
||||
uint32_t gateway = 0;
|
||||
int metric = 0;
|
||||
uint32_t mask = 0;
|
||||
|
||||
int fno = 0;
|
||||
for(char *f=Utils::stok(line,"\t \r\n",&stmp2);(f);f=Utils::stok((char *)0,"\t \r\n",&stmp2)) {
|
||||
switch(fno) {
|
||||
case 0: iface = f; break;
|
||||
case 1: destination = (uint32_t)Utils::hexStrToULong(f); break;
|
||||
case 2: gateway = (uint32_t)Utils::hexStrToULong(f); break;
|
||||
case 6: metric = (int)Utils::strToInt(f); break;
|
||||
case 7: mask = (uint32_t)Utils::hexStrToULong(f); break;
|
||||
}
|
||||
++fno;
|
||||
}
|
||||
|
||||
if ((iface)&&(destination)) {
|
||||
RoutingTable::Entry e;
|
||||
if (destination)
|
||||
e.destination.set(&destination,4,Utils::countBits(mask));
|
||||
e.gateway.set(&gateway,4,0);
|
||||
e.deviceIndex = 0; // not used on Linux
|
||||
e.metric = metric;
|
||||
Utils::scopy(e.device,sizeof(e.device),iface);
|
||||
if ((e.destination)&&((includeLinkLocal)||(!e.destination.isLinkLocal()))&&((includeLoopback)||((!e.destination.isLoopback())&&(!e.gateway.isLoopback())&&(strcmp(iface,"lo")))))
|
||||
entries.push_back(e);
|
||||
}
|
||||
|
||||
++lineno;
|
||||
}
|
||||
|
||||
{
|
||||
int fd = ::open("/proc/net/ipv6_route",O_RDONLY);
|
||||
if (fd <= 0)
|
||||
buf[0] = (char)0;
|
||||
else {
|
||||
int n = (int)::read(fd,buf,sizeof(buf) - 1);
|
||||
::close(fd);
|
||||
if (n < 0) n = 0;
|
||||
buf[n] = (char)0;
|
||||
}
|
||||
}
|
||||
|
||||
for(char *line=Utils::stok(buf,"\r\n",&stmp);(line);line=Utils::stok((char *)0,"\r\n",&stmp)) {
|
||||
char *destination = (char *)0;
|
||||
unsigned int destPrefixLen = 0;
|
||||
char *gateway = (char *)0; // next hop in ipv6 terminology
|
||||
int metric = 0;
|
||||
char *device = (char *)0;
|
||||
|
||||
int fno = 0;
|
||||
for(char *f=Utils::stok(line,"\t \r\n",&stmp2);(f);f=Utils::stok((char *)0,"\t \r\n",&stmp2)) {
|
||||
switch(fno) {
|
||||
case 0: destination = f; break;
|
||||
case 1: destPrefixLen = (unsigned int)Utils::hexStrToULong(f); break;
|
||||
case 4: gateway = f; break;
|
||||
case 5: metric = (int)Utils::hexStrToLong(f); break;
|
||||
case 9: device = f; break;
|
||||
}
|
||||
++fno;
|
||||
}
|
||||
|
||||
if ((device)&&(destination)) {
|
||||
unsigned char tmp[16];
|
||||
RoutingTable::Entry e;
|
||||
Utils::unhex(destination,tmp,16);
|
||||
if ((!Utils::isZero(tmp,16))&&(tmp[0] != 0xff))
|
||||
e.destination.set(tmp,16,destPrefixLen);
|
||||
Utils::unhex(gateway,tmp,16);
|
||||
e.gateway.set(tmp,16,0);
|
||||
e.deviceIndex = 0; // not used on Linux
|
||||
e.metric = metric;
|
||||
Utils::scopy(e.device,sizeof(e.device),device);
|
||||
if ((e.destination)&&((includeLinkLocal)||(!e.destination.isLinkLocal()))&&((includeLoopback)||((!e.destination.isLoopback())&&(!e.gateway.isLoopback())&&(strcmp(device,"lo")))))
|
||||
entries.push_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(entries.begin(),entries.end());
|
||||
return entries;
|
||||
}
|
||||
|
||||
RoutingTable::Entry LinuxRoutingTable::set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric)
|
||||
{
|
||||
char metstr[128];
|
||||
|
||||
if ((!gateway)&&((!device)||(!device[0])))
|
||||
return RoutingTable::Entry();
|
||||
|
||||
Utils::snprintf(metstr,sizeof(metstr),"%d",metric);
|
||||
|
||||
if (metric < 0) {
|
||||
long pid = (long)vfork();
|
||||
if (pid == 0) {
|
||||
if (gateway) {
|
||||
if ((device)&&(device[0])) {
|
||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,"route","del",destination.toString().c_str(),"via",gateway.toIpString().c_str(),"dev",device,(const char *)0);
|
||||
} else {
|
||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,"route","del",destination.toString().c_str(),"via",gateway.toIpString().c_str(),(const char *)0);
|
||||
}
|
||||
} else {
|
||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,"route","del",destination.toString().c_str(),"dev",device,(const char *)0);
|
||||
}
|
||||
::_exit(-1);
|
||||
} else if (pid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(pid,&exitcode,0);
|
||||
}
|
||||
} else {
|
||||
long pid = (long)vfork();
|
||||
if (pid == 0) {
|
||||
if (gateway) {
|
||||
if ((device)&&(device[0])) {
|
||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,"route","replace",destination.toString().c_str(),"metric",metstr,"via",gateway.toIpString().c_str(),"dev",device,(const char *)0);
|
||||
} else {
|
||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,"route","replace",destination.toString().c_str(),"metric",metstr,"via",gateway.toIpString().c_str(),(const char *)0);
|
||||
}
|
||||
} else {
|
||||
::execl(ZT_LINUX_IP_COMMAND,ZT_LINUX_IP_COMMAND,"route","replace",destination.toString().c_str(),"metric",metstr,"dev",device,(const char *)0);
|
||||
}
|
||||
::_exit(-1);
|
||||
} else if (pid > 0) {
|
||||
int exitcode = -1;
|
||||
::waitpid(pid,&exitcode,0);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RoutingTable::Entry> rtab(get(true,true));
|
||||
std::vector<RoutingTable::Entry>::iterator bestEntry(rtab.end());
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(rtab.begin());e!=rtab.end();++e) {
|
||||
if ((e->destination == destination)&&(e->gateway.ipsEqual(gateway))) {
|
||||
if ((device)&&(device[0])) {
|
||||
if (!strcmp(device,e->device)) {
|
||||
if (metric == e->metric)
|
||||
bestEntry = e;
|
||||
}
|
||||
}
|
||||
if (bestEntry == rtab.end())
|
||||
bestEntry = e;
|
||||
}
|
||||
}
|
||||
if (bestEntry != rtab.end())
|
||||
return *bestEntry;
|
||||
|
||||
return RoutingTable::Entry();
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
49
attic/rtbl/LinuxRoutingTable.hpp
Normal file
49
attic/rtbl/LinuxRoutingTable.hpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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_LINUXROUTINGTABLE_HPP
|
||||
#define ZT_LINUXROUTINGTABLE_HPP
|
||||
|
||||
#include "../node/RoutingTable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* Routing table interface via /proc/net/route, /proc/net/ipv6_route, and /sbin/route command
|
||||
*/
|
||||
class LinuxRoutingTable : public RoutingTable
|
||||
{
|
||||
public:
|
||||
LinuxRoutingTable();
|
||||
virtual ~LinuxRoutingTable();
|
||||
virtual std::vector<RoutingTable::Entry> get(bool includeLinkLocal = false,bool includeLoopback = false) const;
|
||||
virtual RoutingTable::Entry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric);
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
77
attic/rtbl/RoutingTable.cpp
Normal file
77
attic/rtbl/RoutingTable.cpp
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "RoutingTable.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
std::string RoutingTable::Entry::toString() const
|
||||
{
|
||||
char tmp[1024];
|
||||
Utils::snprintf(tmp,sizeof(tmp),"%s %s %s %d",destination.toString().c_str(),((gateway) ? gateway.toIpString().c_str() : "<link>"),device,metric);
|
||||
return std::string(tmp);
|
||||
}
|
||||
|
||||
bool RoutingTable::Entry::operator==(const Entry &re) const
|
||||
{
|
||||
return ((destination == re.destination)&&(gateway == re.gateway)&&(strcmp(device,re.device) == 0)&&(metric == re.metric));
|
||||
}
|
||||
|
||||
bool RoutingTable::Entry::operator<(const Entry &re) const
|
||||
{
|
||||
if (destination < re.destination)
|
||||
return true;
|
||||
else if (destination == re.destination) {
|
||||
if (gateway < re.gateway)
|
||||
return true;
|
||||
else if (gateway == re.gateway) {
|
||||
int tmp = (int)::strcmp(device,re.device);
|
||||
if (tmp < 0)
|
||||
return true;
|
||||
else if (tmp == 0)
|
||||
return (metric < re.metric);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
RoutingTable::RoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
RoutingTable::~RoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
122
attic/rtbl/RoutingTable.hpp
Normal file
122
attic/rtbl/RoutingTable.hpp
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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_ROUTINGTABLE_HPP
|
||||
#define ZT_ROUTINGTABLE_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "InetAddress.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* Base class for OS routing table interfaces
|
||||
*/
|
||||
class RoutingTable : NonCopyable
|
||||
{
|
||||
public:
|
||||
class Entry
|
||||
{
|
||||
public:
|
||||
Entry() throw() { device[0] = (char)0; }
|
||||
|
||||
/**
|
||||
* Destination IP and netmask bits (CIDR format)
|
||||
*/
|
||||
InetAddress destination;
|
||||
|
||||
/**
|
||||
* Gateway or null address if direct link-level route, netmask/port part of InetAddress not used
|
||||
*/
|
||||
InetAddress gateway;
|
||||
|
||||
/**
|
||||
* System device index or ID (not included in comparison operators, may not be set on all platforms)
|
||||
*/
|
||||
int deviceIndex;
|
||||
|
||||
/**
|
||||
* Metric or hop count -- higher = lower routing priority
|
||||
*/
|
||||
int metric;
|
||||
|
||||
/**
|
||||
* System device name
|
||||
*/
|
||||
char device[128];
|
||||
|
||||
/**
|
||||
* @return Human-readable representation of this route
|
||||
*/
|
||||
std::string toString() const;
|
||||
|
||||
/**
|
||||
* @return True if at least one required field is present (object is not null)
|
||||
*/
|
||||
inline operator bool() const { return ((destination)||(gateway)||(device[0])); }
|
||||
|
||||
bool operator==(const Entry &re) const;
|
||||
inline bool operator!=(const Entry &re) const { return (!(*this == re)); }
|
||||
bool operator<(const Entry &re) const;
|
||||
inline bool operator>(const Entry &re) const { return (re < *this); }
|
||||
inline bool operator<=(const Entry &re) const { return (!(re < *this)); }
|
||||
inline bool operator>=(const Entry &re) const { return (!(*this < re)); }
|
||||
};
|
||||
|
||||
RoutingTable();
|
||||
virtual ~RoutingTable();
|
||||
|
||||
/**
|
||||
* Get routing table
|
||||
*
|
||||
* @param includeLinkLocal If true, include link-local address routes (default: false)
|
||||
* @param includeLoopback Include loopback (default: false)
|
||||
* @return Sorted routing table entries
|
||||
*/
|
||||
virtual std::vector<RoutingTable::Entry> get(bool includeLinkLocal = false,bool includeLoopback = false) const = 0;
|
||||
|
||||
/**
|
||||
* Add or update a routing table entry
|
||||
*
|
||||
* If there is no change, the existing entry is returned. Use a value of -1
|
||||
* for metric to delete a route.
|
||||
*
|
||||
* @param destination Destination IP/netmask
|
||||
* @param gateway Gateway IP (netmask/port part unused) or NULL/zero for device-level route
|
||||
* @param device Device name (can be null for gateway routes)
|
||||
* @param metric Route metric or hop count (higher = lower priority) or negative to delete
|
||||
* @return Entry or null entry on failure (or delete)
|
||||
*/
|
||||
virtual RoutingTable::Entry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric) = 0;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2012-2013 ZeroTier Networks LLC
|
||||
* 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
|
||||
@ -25,35 +25,26 @@
|
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/
|
||||
|
||||
#ifndef ZT_SYSENV_HPP
|
||||
#define ZT_SYSENV_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "NonCopyable.hpp"
|
||||
#include "TestRoutingTable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class RuntimeEnvironment;
|
||||
|
||||
/**
|
||||
* Local system environment monitoring utilities
|
||||
*/
|
||||
class SysEnv : NonCopyable
|
||||
TestRoutingTable::TestRoutingTable()
|
||||
{
|
||||
public:
|
||||
SysEnv(const RuntimeEnvironment *renv);
|
||||
~SysEnv();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Fingerprint of currently running network environment
|
||||
*/
|
||||
uint64_t getNetworkConfigurationFingerprint();
|
||||
TestRoutingTable::~TestRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
const RuntimeEnvironment *_r;
|
||||
};
|
||||
std::vector<RoutingTable::Entry> TestRoutingTable::get(bool includeLinkLocal,bool includeLoopback) const
|
||||
{
|
||||
return std::vector<RoutingTable::Entry>();
|
||||
}
|
||||
|
||||
RoutingTable::Entry TestRoutingTable::set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric)
|
||||
{
|
||||
return RoutingTable::Entry();
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
50
attic/rtbl/TestRoutingTable.hpp
Normal file
50
attic/rtbl/TestRoutingTable.hpp
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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_TESTROUTINGTABLE_HPP
|
||||
#define ZT_TESTROUTINGTABLE_HPP
|
||||
|
||||
#include "../node/RoutingTable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* Dummy routing table -- right now this just does nothing
|
||||
*/
|
||||
class TestRoutingTable : public RoutingTable
|
||||
{
|
||||
public:
|
||||
TestRoutingTable();
|
||||
virtual ~TestRoutingTable();
|
||||
|
||||
virtual std::vector<RoutingTable::Entry> get(bool includeLinkLocal = false,bool includeLoopback = false) const;
|
||||
virtual RoutingTable::Entry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric);
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
178
attic/rtbl/WindowsRoutingTable.cpp
Normal file
178
attic/rtbl/WindowsRoutingTable.cpp
Normal file
@ -0,0 +1,178 @@
|
||||
/*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <netioapi.h>
|
||||
#include <IPHlpApi.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "WindowsRoutingTable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
static void _copyInetAddressToSockaddrInet(const InetAddress &a,SOCKADDR_INET &sinet)
|
||||
{
|
||||
memset(&sinet,0,sizeof(sinet));
|
||||
if (a.isV4()) {
|
||||
sinet.Ipv4.sin_addr.S_un.S_addr = *((const uint32_t *)a.rawIpData());
|
||||
sinet.Ipv4.sin_family = AF_INET;
|
||||
sinet.Ipv4.sin_port = htons(a.port());
|
||||
} else if (a.isV6()) {
|
||||
memcpy(sinet.Ipv6.sin6_addr.u.Byte,a.rawIpData(),16);
|
||||
sinet.Ipv6.sin6_family = AF_INET6;
|
||||
sinet.Ipv6.sin6_port = htons(a.port());
|
||||
}
|
||||
}
|
||||
|
||||
WindowsRoutingTable::WindowsRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
WindowsRoutingTable::~WindowsRoutingTable()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<RoutingTable::Entry> WindowsRoutingTable::get(bool includeLinkLocal,bool includeLoopback) const
|
||||
{
|
||||
std::vector<RoutingTable::Entry> entries;
|
||||
PMIB_IPFORWARD_TABLE2 rtbl = NULL;
|
||||
|
||||
if (GetIpForwardTable2(AF_UNSPEC,&rtbl) != NO_ERROR)
|
||||
return entries;
|
||||
if (!rtbl)
|
||||
return entries;
|
||||
|
||||
for(ULONG r=0;r<rtbl->NumEntries;++r) {
|
||||
RoutingTable::Entry e;
|
||||
switch(rtbl->Table[r].DestinationPrefix.Prefix.si_family) {
|
||||
case AF_INET:
|
||||
e.destination.set(&(rtbl->Table[r].DestinationPrefix.Prefix.Ipv4.sin_addr.S_un.S_addr),4,rtbl->Table[r].DestinationPrefix.PrefixLength);
|
||||
break;
|
||||
case AF_INET6:
|
||||
e.destination.set(rtbl->Table[r].DestinationPrefix.Prefix.Ipv6.sin6_addr.u.Byte,16,rtbl->Table[r].DestinationPrefix.PrefixLength);
|
||||
break;
|
||||
}
|
||||
switch(rtbl->Table[r].NextHop.si_family) {
|
||||
case AF_INET:
|
||||
e.gateway.set(&(rtbl->Table[r].NextHop.Ipv4.sin_addr.S_un.S_addr),4,0);
|
||||
break;
|
||||
case AF_INET6:
|
||||
e.gateway.set(rtbl->Table[r].NextHop.Ipv6.sin6_addr.u.Byte,16,0);
|
||||
break;
|
||||
}
|
||||
e.deviceIndex = (int)rtbl->Table[r].InterfaceIndex;
|
||||
e.metric = (int)rtbl->Table[r].Metric;
|
||||
ConvertInterfaceLuidToNameA(&(rtbl->Table[r].InterfaceLuid),e.device,sizeof(e.device));
|
||||
if ((e.destination)&&((includeLinkLocal)||(!e.destination.isLinkLocal()))&&((includeLoopback)||((!e.destination.isLoopback())&&(!e.gateway.isLoopback()))))
|
||||
entries.push_back(e);
|
||||
}
|
||||
|
||||
FreeMibTable(rtbl);
|
||||
std::sort(entries.begin(),entries.end());
|
||||
return entries;
|
||||
}
|
||||
|
||||
RoutingTable::Entry WindowsRoutingTable::set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric)
|
||||
{
|
||||
NET_LUID luid;
|
||||
luid.Value = 0;
|
||||
if (ConvertInterfaceNameToLuidA(device,&luid) != NO_ERROR)
|
||||
return RoutingTable::Entry();
|
||||
|
||||
bool needCreate = true;
|
||||
PMIB_IPFORWARD_TABLE2 rtbl = NULL;
|
||||
if (GetIpForwardTable2(AF_UNSPEC,&rtbl) != NO_ERROR)
|
||||
return RoutingTable::Entry();
|
||||
if (!rtbl)
|
||||
return RoutingTable::Entry();
|
||||
for(ULONG r=0;r<rtbl->NumEntries;++r) {
|
||||
if (rtbl->Table[r].InterfaceLuid.Value == luid.Value) {
|
||||
InetAddress rdest;
|
||||
switch(rtbl->Table[r].DestinationPrefix.Prefix.si_family) {
|
||||
case AF_INET:
|
||||
rdest.set(&(rtbl->Table[r].DestinationPrefix.Prefix.Ipv4.sin_addr.S_un.S_addr),4,rtbl->Table[r].DestinationPrefix.PrefixLength);
|
||||
break;
|
||||
case AF_INET6:
|
||||
rdest.set(rtbl->Table[r].DestinationPrefix.Prefix.Ipv6.sin6_addr.u.Byte,16,rtbl->Table[r].DestinationPrefix.PrefixLength);
|
||||
break;
|
||||
}
|
||||
if (rdest == destination) {
|
||||
if (metric >= 0) {
|
||||
_copyInetAddressToSockaddrInet(gateway,rtbl->Table[r].NextHop);
|
||||
rtbl->Table[r].Metric = metric;
|
||||
SetIpForwardEntry2(&(rtbl->Table[r]));
|
||||
needCreate = false;
|
||||
} else {
|
||||
DeleteIpForwardEntry2(&(rtbl->Table[r]));
|
||||
FreeMibTable(rtbl);
|
||||
return RoutingTable::Entry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FreeMibTable(rtbl);
|
||||
|
||||
if ((metric >= 0)&&(needCreate)) {
|
||||
MIB_IPFORWARD_ROW2 nr;
|
||||
InitializeIpForwardEntry(&nr);
|
||||
nr.InterfaceLuid.Value = luid.Value;
|
||||
_copyInetAddressToSockaddrInet(destination,nr.DestinationPrefix.Prefix);
|
||||
nr.DestinationPrefix.PrefixLength = destination.netmaskBits();
|
||||
_copyInetAddressToSockaddrInet(gateway,nr.NextHop);
|
||||
nr.Metric = metric;
|
||||
nr.Protocol = MIB_IPPROTO_NETMGMT;
|
||||
DWORD result = CreateIpForwardEntry2(&nr);
|
||||
if (result != NO_ERROR)
|
||||
return RoutingTable::Entry();
|
||||
}
|
||||
|
||||
std::vector<RoutingTable::Entry> rtab(get(true,true));
|
||||
std::vector<RoutingTable::Entry>::iterator bestEntry(rtab.end());
|
||||
for(std::vector<RoutingTable::Entry>::iterator e(rtab.begin());e!=rtab.end();++e) {
|
||||
if ((e->destination == destination)&&(e->gateway.ipsEqual(gateway))) {
|
||||
if ((device)&&(device[0])) {
|
||||
if (!strcmp(device,e->device)) {
|
||||
if (metric == e->metric)
|
||||
bestEntry = e;
|
||||
}
|
||||
}
|
||||
if (bestEntry == rtab.end())
|
||||
bestEntry = e;
|
||||
}
|
||||
}
|
||||
if (bestEntry != rtab.end())
|
||||
return *bestEntry;
|
||||
return RoutingTable::Entry();
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
49
attic/rtbl/WindowsRoutingTable.hpp
Normal file
49
attic/rtbl/WindowsRoutingTable.hpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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_WINDOWSROUTINGTABLE_HPP
|
||||
#define ZT_WINDOWSROUTINGTABLE_HPP
|
||||
|
||||
#include "../node/RoutingTable.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
* Interface to Microsoft Windows (Vista or newer) routing table
|
||||
*/
|
||||
class WindowsRoutingTable : public RoutingTable
|
||||
{
|
||||
public:
|
||||
WindowsRoutingTable();
|
||||
virtual ~WindowsRoutingTable();
|
||||
virtual std::vector<RoutingTable::Entry> get(bool includeLinkLocal = false,bool includeLoopback = false) const;
|
||||
virtual RoutingTable::Entry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric);
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
vMajor=999
|
||||
vMinor=999
|
||||
vRevision=999
|
||||
signedBy=e9bc3707b5
|
||||
ed25519=ca7b943ace5451f420f1f599822d7013534a7cb7997096141e6a1aa6398c5f260c19dc5eecb297c922950f26dee7f9db787f8dbf85bc422baf3bff94c1131e086a7fc85c26dbb8c1b0a9cae63acc34998d9e1ce553156ea5638f9c99a50f6e2e
|
||||
url=http://download.zerotier.com/update/update-dummy.sh
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Dummy updater -- run with opts: $*"
|
||||
exit 0
|
@ -1,101 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script builds the installer for *nix systems. Windows must do everything
|
||||
# completely differently, as usual.
|
||||
|
||||
if [ ! -f zerotier-one ]; then
|
||||
echo "Could not find 'zerotier-one' binary, please build before running this script."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
make -j 2 file2lz4c
|
||||
if [ ! -f file2lz4c ]; then
|
||||
echo "Build of file2lz4c utility failed, aborting installer build."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
machine=`uname -m`
|
||||
system=`uname -s`
|
||||
|
||||
vmajor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MAJOR | cut -d ' ' -f 3`
|
||||
vminor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MINOR | cut -d ' ' -f 3`
|
||||
revision=`cat version.h | grep -F ZEROTIER_ONE_VERSION_REVISION | cut -d ' ' -f 3`
|
||||
|
||||
if [ -z "$vmajor" -o -z "$vminor" -o -z "$revision" ]; then
|
||||
echo "Unable to extract version info from version.h, aborting installer build."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "Packaging common files: zerotier-one"
|
||||
|
||||
rm -rf installer-build
|
||||
mkdir installer-build
|
||||
|
||||
./file2lz4c zerotier-one zerotier_one >installer-build/zerotier_one.h
|
||||
|
||||
case "$system" in
|
||||
|
||||
Linux)
|
||||
# Canonicalize $machine for some architectures... we use x86
|
||||
# and x64 for Intel stuff. ARM and others should be fine if
|
||||
# we ever ship officially for those.
|
||||
case "$machine" in
|
||||
i386|i486|i586|i686)
|
||||
machine="x86"
|
||||
;;
|
||||
x86_64|amd64|x64)
|
||||
machine="x64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported machine type: $machine"
|
||||
exit 2
|
||||
esac
|
||||
|
||||
echo "Assembling Linux installer for $machine and ZT1 version $vmajor.$vminor.$revision"
|
||||
|
||||
./file2lz4c ext/installfiles/linux/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h
|
||||
./file2lz4c ext/installfiles/linux/init.d/zerotier-one linux__init_d__zerotier_one >installer-build/linux__init_d__zerotier_one.h
|
||||
|
||||
targ="zt1-${vmajor}_${vminor}_${revision}-linux-${machine}-install"
|
||||
|
||||
if [ -e /usr/bin/clang ]; then
|
||||
clang -Os -o $targ installer.c ext/lz4/lz4.o ext/lz4/lz4hc.o
|
||||
else
|
||||
gcc -Os -o $targ installer.c ext/lz4/lz4.o ext/lz4/lz4hc.o
|
||||
fi
|
||||
strip --strip-all $targ
|
||||
ls -l $targ
|
||||
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
echo "Assembling mac installer for x86/x64 (combined) and ZT1 version $vmajor.$vminor.$revision"
|
||||
|
||||
./file2lz4c ext/installfiles/mac/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h
|
||||
./file2lz4c ext/installfiles/mac/launch.sh mac__launch_sh >installer-build/mac__launch_sh.h
|
||||
./file2lz4c ext/installfiles/mac/com.zerotier.one.plist mac__com_zerotier_one_plist >installer-build/mac__com_zerotier_one_plist.h
|
||||
./file2lz4c ext/bin/tap-mac/tap.kext/Contents/Info.plist tap_mac__Info_plist >installer-build/tap_mac__Info_plist.h
|
||||
./file2lz4c ext/bin/tap-mac/tap.kext/Contents/MacOS/tap tap_mac__tap >installer-build/tap_mac__tap.h
|
||||
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Info.plist" mac_ui__contents_info_plist >installer-build/mac_ui__contents_info_plist.h
|
||||
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/PkgInfo" mac_ui__contents_pkginfo >installer-build/mac_ui__contents_pkginfo.h
|
||||
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One" mac_ui__contents_macos_zerotier_one >installer-build/mac_ui__contents_macos_zerotier_one.h
|
||||
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/empty.lproj" mac_ui__contents_resources_empty_lproj >installer-build/mac_ui__contents_resources_empty_lproj.h
|
||||
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/zt1icon.icns" mac_ui__contents_resources_zt1icon_icns >installer-build/mac_ui__contents_resources_zt1icon_icns.h
|
||||
|
||||
targ="zt1-${vmajor}_${vminor}_${revision}-mac-combined-install"
|
||||
|
||||
# Installer can be i386-only to save space, but installs combined
|
||||
# x86/x64 binaries for ZT1 itself.
|
||||
clang -Os -arch i386 -o $targ installer.c ext/lz4/lz4.o ext/lz4/lz4hc.o
|
||||
strip $targ
|
||||
ls -l $targ
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported platform: $system"
|
||||
exit 2
|
||||
|
||||
esac
|
||||
|
||||
exit 0
|
32
controller/README.md
Normal file
32
controller/README.md
Normal file
@ -0,0 +1,32 @@
|
||||
Network Controller Implementation
|
||||
======
|
||||
|
||||
This folder contains code implementing the node/NetworkController.hpp interface to allow ZeroTier nodes to create and manage virtual networks.
|
||||
|
||||
### Building
|
||||
|
||||
By default this code is not built or included in the client. To build on Linux, BSD, or Mac add ZT\_ENABLE\_NETCONF\_MASTER=1 to the make command line. You'll need the development headers for Sqlite3 installed. They ship as part of OSX and Xcode. On Linux or BSD you'll probably need to install a package.
|
||||
|
||||
### Running
|
||||
|
||||
When started, a controller-enabled build of ZeroTier One will automatically create and initialize a *controller.db* in its home folder. This is where all the controller's data and persistent state lives.
|
||||
|
||||
Since Sqlite3 supports multiple processes attached to the same database, it is safe to back up a running database with the command line *sqlite3* utility:
|
||||
|
||||
sqlite3 /path/to/controller.db .dump
|
||||
|
||||
In production ZeroTier runs this frequently and keeps many timestamped copies going back about a week. These are also backed up (encrypted) to Amazon S3 along with the rest of our data.
|
||||
|
||||
### Administrating
|
||||
|
||||
See service/README.md for documentation on the JSON API presented by this network controller implementation. Also see *nodejs-zt1-client* for a NodeJS JavaScript interface.
|
||||
|
||||
### Reliability
|
||||
|
||||
Network controllers can go offline without affecting already-configured members of running networks. You just won't be able to change anything and new members will not be able to join.
|
||||
|
||||
High-availability can be implemented through fail-over. A simple method involves making a frequent backup of the SQLite database (use the SQLite command line client to do this safely) and the network configuration master's working directory. Then, if the master goes down, another instance of it can rapidly be provisioned elsewhere. Since ZeroTier addresses are mobile, the new instance will quickly (usually no more than 30s) take over for the old one and service requests.
|
||||
|
||||
### Limits
|
||||
|
||||
A single network configuration master can administrate up to 2^24 (~16m) networks as per the ZeroTier protocol limit. There is no hard limit on the number of clients, though millions or more would impose significant CPU demands on a server. Optimizations could be implemented such as memoization/caching to reduce this.
|
1323
controller/SqliteNetworkController.cpp
Normal file
1323
controller/SqliteNetworkController.cpp
Normal file
File diff suppressed because it is too large
Load Diff
133
controller/SqliteNetworkController.hpp
Normal file
133
controller/SqliteNetworkController.hpp
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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_SQLITENETWORKCONTROLLER_HPP
|
||||
#define ZT_SQLITENETWORKCONTROLLER_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/NetworkController.hpp"
|
||||
#include "../node/Mutex.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class SqliteNetworkController : public NetworkController
|
||||
{
|
||||
public:
|
||||
SqliteNetworkController(const char *dbPath);
|
||||
virtual ~SqliteNetworkController();
|
||||
|
||||
virtual NetworkController::ResultCode doNetworkConfigRequest(
|
||||
const InetAddress &fromAddr,
|
||||
const Identity &signingId,
|
||||
const Identity &identity,
|
||||
uint64_t nwid,
|
||||
const Dictionary &metaData,
|
||||
uint64_t haveRevision,
|
||||
Dictionary &netconf);
|
||||
|
||||
unsigned int handleControlPlaneHttpGET(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
unsigned int handleControlPlaneHttpPOST(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
unsigned int handleControlPlaneHttpDELETE(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
|
||||
private:
|
||||
unsigned int _doCPGet(
|
||||
const std::vector<std::string> &path,
|
||||
const std::map<std::string,std::string> &urlArgs,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
const std::string &body,
|
||||
std::string &responseBody,
|
||||
std::string &responseContentType);
|
||||
|
||||
std::string _dbPath;
|
||||
sqlite3 *_db;
|
||||
|
||||
sqlite3_stmt *_sGetNetworkById;
|
||||
sqlite3_stmt *_sGetMember;
|
||||
sqlite3_stmt *_sCreateMember;
|
||||
sqlite3_stmt *_sGetNodeIdentity;
|
||||
sqlite3_stmt *_sCreateNode;
|
||||
sqlite3_stmt *_sUpdateNode;
|
||||
sqlite3_stmt *_sUpdateNode2;
|
||||
sqlite3_stmt *_sGetEtherTypesFromRuleTable;
|
||||
sqlite3_stmt *_sGetMulticastRates;
|
||||
sqlite3_stmt *_sGetActiveBridges;
|
||||
sqlite3_stmt *_sGetIpAssignmentsForNode;
|
||||
sqlite3_stmt *_sGetIpAssignmentPools;
|
||||
sqlite3_stmt *_sCheckIfIpIsAllocated;
|
||||
sqlite3_stmt *_sAllocateIp;
|
||||
sqlite3_stmt *_sDeleteIpAllocations;
|
||||
sqlite3_stmt *_sGetRelays;
|
||||
sqlite3_stmt *_sListNetworks;
|
||||
sqlite3_stmt *_sListNetworkMembers;
|
||||
sqlite3_stmt *_sGetMember2;
|
||||
sqlite3_stmt *_sGetIpAssignmentPools2;
|
||||
sqlite3_stmt *_sListRules;
|
||||
sqlite3_stmt *_sCreateRule;
|
||||
sqlite3_stmt *_sCreateNetwork;
|
||||
sqlite3_stmt *_sGetNetworkRevision;
|
||||
sqlite3_stmt *_sSetNetworkRevision;
|
||||
sqlite3_stmt *_sGetIpAssignmentsForNode2;
|
||||
sqlite3_stmt *_sDeleteRelaysForNetwork;
|
||||
sqlite3_stmt *_sCreateRelay;
|
||||
sqlite3_stmt *_sDeleteIpAssignmentPoolsForNetwork;
|
||||
sqlite3_stmt *_sDeleteRulesForNetwork;
|
||||
sqlite3_stmt *_sCreateIpAssignmentPool;
|
||||
sqlite3_stmt *_sDeleteMember;
|
||||
sqlite3_stmt *_sDeleteNetworkAndRelated;
|
||||
|
||||
Mutex _lock;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif
|
104
controller/schema.sql
Normal file
104
controller/schema.sql
Normal file
@ -0,0 +1,104 @@
|
||||
CREATE TABLE Config (
|
||||
k varchar(16) PRIMARY KEY NOT NULL,
|
||||
v varchar(1024) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IpAssignment (
|
||||
networkId char(16) NOT NULL,
|
||||
nodeId char(10) NOT NULL,
|
||||
ip blob(16) NOT NULL,
|
||||
ipNetmaskBits integer NOT NULL DEFAULT(0),
|
||||
ipVersion integer NOT NULL DEFAULT(4)
|
||||
);
|
||||
|
||||
CREATE INDEX IpAssignment_networkId_ip ON IpAssignment (networkId, ip);
|
||||
|
||||
CREATE INDEX IpAssignment_networkId_nodeId ON IpAssignment (networkId, nodeId);
|
||||
|
||||
CREATE INDEX IpAssignment_networkId ON IpAssignment (networkId);
|
||||
|
||||
CREATE TABLE IpAssignmentPool (
|
||||
networkId char(16) NOT NULL,
|
||||
ipNetwork blob(16) NOT NULL,
|
||||
ipNetmaskBits integer NOT NULL,
|
||||
ipVersion integer NOT NULL DEFAULT(4)
|
||||
);
|
||||
|
||||
CREATE INDEX IpAssignmentPool_networkId ON IpAssignmentPool (networkId);
|
||||
|
||||
CREATE TABLE Member (
|
||||
networkId char(16) NOT NULL,
|
||||
nodeId char(10) NOT NULL,
|
||||
authorized integer NOT NULL DEFAULT(0),
|
||||
activeBridge integer NOT NULL DEFAULT(0)
|
||||
);
|
||||
|
||||
CREATE INDEX Member_networkId ON Member (networkId);
|
||||
|
||||
CREATE INDEX Member_networkId_activeBridge ON Member(networkId, activeBridge);
|
||||
|
||||
CREATE UNIQUE INDEX Member_networkId_nodeId ON Member (networkId, nodeId);
|
||||
|
||||
CREATE TABLE MulticastRate (
|
||||
networkId char(16) NOT NULL,
|
||||
mgMac char(12) NOT NULL,
|
||||
mgAdi integer NOT NULL DEFAULT(0),
|
||||
preload integer NOT NULL,
|
||||
maxBalance integer NOT NULL,
|
||||
accrual integer NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX MulticastRate_networkId ON MulticastRate (networkId);
|
||||
|
||||
CREATE TABLE Network (
|
||||
id char(16) PRIMARY KEY NOT NULL,
|
||||
name varchar(128) NOT NULL,
|
||||
private integer NOT NULL DEFAULT(1),
|
||||
enableBroadcast integer NOT NULL DEFAULT(1),
|
||||
allowPassiveBridging integer NOT NULL DEFAULT(0),
|
||||
v4AssignMode varchar(8) NOT NULL DEFAULT('none'),
|
||||
v6AssignMode varchar(8) NOT NULL DEFAULT('none'),
|
||||
multicastLimit integer NOT NULL DEFAULT(32),
|
||||
creationTime integer NOT NULL DEFAULT(0),
|
||||
revision integer NOT NULL DEFAULT(1)
|
||||
);
|
||||
|
||||
CREATE TABLE Relay (
|
||||
networkId char(16) NOT NULL,
|
||||
nodeId char(10) NOT NULL,
|
||||
phyAddress varchar(64) NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX Relay_networkId ON Relay (networkId);
|
||||
|
||||
CREATE UNIQUE INDEX Relay_networkId_nodeId ON Relay (networkId, nodeId);
|
||||
|
||||
CREATE TABLE Node (
|
||||
id char(10) PRIMARY KEY NOT NULL,
|
||||
identity varchar(4096) NOT NULL,
|
||||
lastAt varchar(64),
|
||||
lastSeen integer NOT NULL DEFAULT(0),
|
||||
firstSeen integer NOT NULL DEFAULT(0)
|
||||
);
|
||||
|
||||
CREATE TABLE Rule (
|
||||
networkId char(16) NOT NULL,
|
||||
ruleId integer NOT NULL,
|
||||
nodeId char(10),
|
||||
vlanId integer,
|
||||
vlanPcp integer,
|
||||
etherType integer,
|
||||
macSource char(12),
|
||||
macDest char(12),
|
||||
ipSource varchar(64),
|
||||
ipDest varchar(64),
|
||||
ipTos integer,
|
||||
ipProtocol integer,
|
||||
ipSourcePort integer,
|
||||
ipDestPort integer,
|
||||
flags integer,
|
||||
invFlags integer,
|
||||
"action" varchar(4096) NOT NULL DEFAULT('accept')
|
||||
);
|
||||
|
||||
CREATE INDEX Rule_networkId ON Rule (networkId);
|
106
controller/schema.sql.c
Normal file
106
controller/schema.sql.c
Normal file
@ -0,0 +1,106 @@
|
||||
#define ZT_NETCONF_SCHEMA_SQL \
|
||||
"CREATE TABLE Config (\n"\
|
||||
" k varchar(16) PRIMARY KEY NOT NULL,\n"\
|
||||
" v varchar(1024) NOT NULL\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE IpAssignment (\n"\
|
||||
" networkId char(16) NOT NULL,\n"\
|
||||
" nodeId char(10) NOT NULL,\n"\
|
||||
" ip blob(16) NOT NULL,\n"\
|
||||
" ipNetmaskBits integer NOT NULL DEFAULT(0),\n"\
|
||||
" ipVersion integer NOT NULL DEFAULT(4)\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX IpAssignment_networkId_ip ON IpAssignment (networkId, ip);\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX IpAssignment_networkId_nodeId ON IpAssignment (networkId, nodeId);\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX IpAssignment_networkId ON IpAssignment (networkId);\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE IpAssignmentPool (\n"\
|
||||
" networkId char(16) NOT NULL,\n"\
|
||||
" ipNetwork blob(16) NOT NULL,\n"\
|
||||
" ipNetmaskBits integer NOT NULL,\n"\
|
||||
" ipVersion integer NOT NULL DEFAULT(4)\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX IpAssignmentPool_networkId ON IpAssignmentPool (networkId);\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE Member (\n"\
|
||||
" networkId char(16) NOT NULL,\n"\
|
||||
" nodeId char(10) NOT NULL,\n"\
|
||||
" authorized integer NOT NULL DEFAULT(0),\n"\
|
||||
" activeBridge integer NOT NULL DEFAULT(0)\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX Member_networkId ON Member (networkId);\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX Member_networkId_activeBridge ON Member(networkId, activeBridge);\n"\
|
||||
"\n"\
|
||||
"CREATE UNIQUE INDEX Member_networkId_nodeId ON Member (networkId, nodeId);\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE MulticastRate (\n"\
|
||||
" networkId char(16) NOT NULL,\n"\
|
||||
" mgMac char(12) NOT NULL,\n"\
|
||||
" mgAdi integer NOT NULL DEFAULT(0),\n"\
|
||||
" preload integer NOT NULL,\n"\
|
||||
" maxBalance integer NOT NULL,\n"\
|
||||
" accrual integer NOT NULL\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX MulticastRate_networkId ON MulticastRate (networkId);\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE Network (\n"\
|
||||
" id char(16) PRIMARY KEY NOT NULL,\n"\
|
||||
" name varchar(128) NOT NULL,\n"\
|
||||
" private integer NOT NULL DEFAULT(1),\n"\
|
||||
" enableBroadcast integer NOT NULL DEFAULT(1),\n"\
|
||||
" allowPassiveBridging integer NOT NULL DEFAULT(0),\n"\
|
||||
" v4AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
|
||||
" v6AssignMode varchar(8) NOT NULL DEFAULT('none'),\n"\
|
||||
" multicastLimit integer NOT NULL DEFAULT(32),\n"\
|
||||
" creationTime integer NOT NULL DEFAULT(0),\n"\
|
||||
" revision integer NOT NULL DEFAULT(1)\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE Relay (\n"\
|
||||
" networkId char(16) NOT NULL,\n"\
|
||||
" nodeId char(10) NOT NULL,\n"\
|
||||
" phyAddress varchar(64) NOT NULL\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX Relay_networkId ON Relay (networkId);\n"\
|
||||
"\n"\
|
||||
"CREATE UNIQUE INDEX Relay_networkId_nodeId ON Relay (networkId, nodeId);\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE Node (\n"\
|
||||
" id char(10) PRIMARY KEY NOT NULL,\n"\
|
||||
" identity varchar(4096) NOT NULL,\n"\
|
||||
" lastAt varchar(64),\n"\
|
||||
" lastSeen integer NOT NULL DEFAULT(0),\n"\
|
||||
" firstSeen integer NOT NULL DEFAULT(0)\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE TABLE Rule (\n"\
|
||||
" networkId char(16) NOT NULL,\n"\
|
||||
" ruleId integer NOT NULL,\n"\
|
||||
" nodeId char(10),\n"\
|
||||
" vlanId integer,\n"\
|
||||
" vlanPcp integer,\n"\
|
||||
" etherType integer,\n"\
|
||||
" macSource char(12),\n"\
|
||||
" macDest char(12),\n"\
|
||||
" ipSource varchar(64),\n"\
|
||||
" ipDest varchar(64),\n"\
|
||||
" ipTos integer,\n"\
|
||||
" ipProtocol integer,\n"\
|
||||
" ipSourcePort integer,\n"\
|
||||
" ipDestPort integer,\n"\
|
||||
" flags integer,\n"\
|
||||
" invFlags integer,\n"\
|
||||
" \"action\" varchar(4096) NOT NULL DEFAULT('accept')\n"\
|
||||
");\n"\
|
||||
"\n"\
|
||||
"CREATE INDEX Rule_networkId ON Rule (networkId);\n"\
|
||||
""
|
8
controller/schema2c.sh
Executable file
8
controller/schema2c.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Run this file to package the .sql file into a .c file whenever the SQL changes.
|
||||
|
||||
rm -f schema.sql.c
|
||||
echo '#define ZT_NETCONF_SCHEMA_SQL \' >schema.sql.c
|
||||
cat schema.sql | sed 's/"/\\"/g' | sed 's/^/"/' | sed 's/$/\\n"\\/' >>schema.sql.c
|
||||
echo '""' >>schema.sql.c
|
1
ext/README.md
Normal file
1
ext/README.md
Normal file
@ -0,0 +1 @@
|
||||
The ext/ folder contains third party code, drivers, installation support files, etc.
|
@ -1 +0,0 @@
|
||||
ext/ contains external code, such as libraries, and scripts for building such.
|
Binary file not shown.
Binary file not shown.
@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>tap</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.tap</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>tap</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>KEXT</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>20131028</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>OSBundleLibraries</key>
|
||||
<dict>
|
||||
<key>com.apple.kpi.mach</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.bsd</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.libkern</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.unsupported</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Binary file not shown.
Binary file not shown.
BIN
ext/bin/tap-mac/tap.kext/Contents/_CodeSignature/CodeDirectory
Normal file
BIN
ext/bin/tap-mac/tap.kext/Contents/_CodeSignature/CodeDirectory
Normal file
Binary file not shown.
Binary file not shown.
105
ext/bin/tap-mac/tap.kext/Contents/_CodeSignature/CodeResources
Normal file
105
ext/bin/tap-mac/tap.kext/Contents/_CodeSignature/CodeResources
Normal file
@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict/>
|
||||
<key>files2</key>
|
||||
<dict/>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*\.dSYM($|/)</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>11</real>
|
||||
</dict>
|
||||
<key>^(.*/)?\.DS_Store$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>2000</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^.*</key>
|
||||
<true/>
|
||||
<key>^Info\.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^PkgInfo$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>^embedded\.provisionprofile$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
<key>^version\.plist$</key>
|
||||
<dict>
|
||||
<key>weight</key>
|
||||
<real>20</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
BIN
ext/bin/tap-mac/tap.kext/Contents/_CodeSignature/CodeSignature
Normal file
BIN
ext/bin/tap-mac/tap.kext/Contents/_CodeSignature/CodeSignature
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis5/x64/WdfCoinstaller01011.dll
Normal file
BIN
ext/bin/tap-windows-ndis5/x64/WdfCoinstaller01011.dll
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis5/x64/zttap200.cat
Normal file
BIN
ext/bin/tap-windows-ndis5/x64/zttap200.cat
Normal file
Binary file not shown.
@ -3,39 +3,40 @@ Signature="$WINDOWS NT$"
|
||||
Class=Net
|
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider=%Provider%
|
||||
CatalogFile=ztTap100.cat
|
||||
|
||||
CatalogFile=zttap200.cat
|
||||
DriverVer=01/23/2014,15.19.17.816
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Ethernet Tap"
|
||||
Provider = "ZeroTier Networks"
|
||||
DeviceDescription = "ZeroTier One Virtual Network Port"
|
||||
Provider = "ZeroTier Networks LLC"
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=ztTap100,NTamd64
|
||||
%Provider%=zttap200,NTamd64
|
||||
|
||||
[ztTap100]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
[zttap200]
|
||||
%DeviceDescription%=zttap200.ndi,zttap200
|
||||
|
||||
[ztTap100.NTamd64]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
[ztTap200.NTamd64]
|
||||
%DeviceDescription%=zttap200.ndi,zttap200
|
||||
|
||||
[ztTap100.ndi]
|
||||
CopyFiles = ztTap100.driver,ztTap100.files
|
||||
AddReg = ztTap100.reg
|
||||
AddReg = ztTap100.params.reg
|
||||
[zttap200.ndi]
|
||||
CopyFiles = zttap200.driver,zttap200.files
|
||||
AddReg = zttap200.reg
|
||||
AddReg = zttap200.params.reg
|
||||
Characteristics = 0x81
|
||||
|
||||
[ztTap100.ndi.Services]
|
||||
AddService = ztTap100, 2, ztTap100.service
|
||||
[zttap200.ndi.Services]
|
||||
AddService = zttap200, 2, zttap200.service
|
||||
|
||||
[ztTap100.reg]
|
||||
HKR, Ndi, Service, 0, "ztTap100"
|
||||
[zttap200.reg]
|
||||
HKR, Ndi, Service, 0, "zttap200"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[ztTap100.params.reg]
|
||||
[zttap200.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
@ -52,33 +53,27 @@ HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
[ztTap100.service]
|
||||
[zttap200.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\ztTap100.sys
|
||||
ServiceBinary = %12%\zttap200.sys
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, ztTap100.sys
|
||||
1 = %DeviceDescription%, zttap200.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
ztTap100.sys = 1
|
||||
zttap200.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
ztTap100.files = 11
|
||||
ztTap100.driver = 12
|
||||
zttap200.files = 11
|
||||
zttap200.driver = 12
|
||||
|
||||
[ztTap100.files]
|
||||
[zttap200.files]
|
||||
;
|
||||
|
||||
[ztTap100.driver]
|
||||
ztTap100.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
[zttap200.driver]
|
||||
zttap200.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
BIN
ext/bin/tap-windows-ndis5/x64/zttap200.sys
Normal file
BIN
ext/bin/tap-windows-ndis5/x64/zttap200.sys
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis5/x86/WdfCoinstaller01011.dll
Normal file
BIN
ext/bin/tap-windows-ndis5/x86/WdfCoinstaller01011.dll
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis5/x86/zttap200.cat
Normal file
BIN
ext/bin/tap-windows-ndis5/x86/zttap200.cat
Normal file
Binary file not shown.
@ -3,40 +3,37 @@ Signature="$WINDOWS NT$"
|
||||
Class=Net
|
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider=%Provider%
|
||||
CatalogFile=ztTap100.cat
|
||||
DriverVer=08/24/2013,16.12.30.608
|
||||
|
||||
CatalogFile=zttap200.cat
|
||||
DriverVer=01/24/2014,17.25.51.226
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Ethernet Tap"
|
||||
Provider = "ZeroTier Networks"
|
||||
DeviceDescription = "ZeroTier One Virtual Network Port"
|
||||
Provider = "ZeroTier Networks LLC"
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=ztTap100,NTamd64
|
||||
%Provider%=zttap200
|
||||
|
||||
[ztTap100]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
[zttap200]
|
||||
%DeviceDescription%=zttap200.ndi,zttap200
|
||||
|
||||
[ztTap100.NTamd64]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
|
||||
[ztTap100.ndi]
|
||||
CopyFiles = ztTap100.driver,ztTap100.files
|
||||
AddReg = ztTap100.reg
|
||||
AddReg = ztTap100.params.reg
|
||||
[zttap200.ndi]
|
||||
CopyFiles = zttap200.driver,zttap200.files
|
||||
AddReg = zttap200.reg
|
||||
AddReg = zttap200.params.reg
|
||||
Characteristics = 0x81
|
||||
|
||||
[ztTap100.ndi.Services]
|
||||
AddService = ztTap100, 2, ztTap100.service
|
||||
[zttap200.ndi.Services]
|
||||
AddService = zttap200, 2, zttap200.service
|
||||
|
||||
[ztTap100.reg]
|
||||
HKR, Ndi, Service, 0, "ztTap100"
|
||||
[zttap200.reg]
|
||||
HKR, Ndi, Service, 0, "zttap200"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[ztTap100.params.reg]
|
||||
[zttap200.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
@ -53,33 +50,27 @@ HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
[ztTap100.service]
|
||||
[zttap200.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\ztTap100.sys
|
||||
ServiceBinary = %12%\zttap200.sys
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, ztTap100.sys
|
||||
1 = %DeviceDescription%, zttap200.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
ztTap100.sys = 1
|
||||
zttap200.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
ztTap100.files = 11
|
||||
ztTap100.driver = 12
|
||||
zttap200.files = 11
|
||||
zttap200.driver = 12
|
||||
|
||||
[ztTap100.files]
|
||||
[zttap200.files]
|
||||
;
|
||||
|
||||
[ztTap100.driver]
|
||||
ztTap100.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
[zttap200.driver]
|
||||
zttap200.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
BIN
ext/bin/tap-windows-ndis5/x86/zttap200.sys
Normal file
BIN
ext/bin/tap-windows-ndis5/x86/zttap200.sys
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis6/x64/WdfCoinstaller01011.dll
Normal file
BIN
ext/bin/tap-windows-ndis6/x64/WdfCoinstaller01011.dll
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi
Normal file
BIN
ext/bin/tap-windows-ndis6/x64/ZeroTierOne_NDIS6_x64.msi
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis6/x64/zttap300.cat
Normal file
BIN
ext/bin/tap-windows-ndis6/x64/zttap300.cat
Normal file
Binary file not shown.
143
ext/bin/tap-windows-ndis6/x64/zttap300.inf
Normal file
143
ext/bin/tap-windows-ndis6/x64/zttap300.inf
Normal file
@ -0,0 +1,143 @@
|
||||
;
|
||||
; ZeroTier One Virtual Network Port NDIS6 Driver
|
||||
;
|
||||
; Based on the OpenVPN tap-windows6 driver version 9.21.1 git
|
||||
; commit 48f027cfca52b16b5fd23d82e6016ed8a91fc4d3.
|
||||
; See: https://github.com/OpenVPN/tap-windows6
|
||||
;
|
||||
; Modified by ZeroTier, Inc. - https://www.zerotier.com/
|
||||
;
|
||||
; (1) Comment out 'tun' functionality and related features such as DHCP
|
||||
; emulation, since we don't use any of that. Just want straight 'tap'.
|
||||
; (2) Added custom IOCTL to enumerate L2 multicast memberships.
|
||||
; (3) Increase maximum number of multicast memberships to 128.
|
||||
; (4) Set default and max device MTU to 2800.
|
||||
; (5) Rename/rebrand driver as ZeroTier network port driver.
|
||||
;
|
||||
; Original copyright below. Modifications released under GPLv2 as well.
|
||||
;
|
||||
; ****************************************************************************
|
||||
; * Copyright (C) 2002-2014 OpenVPN Technologies, Inc. *
|
||||
; * This program is free software; you can redistribute it and/or modify *
|
||||
; * it under the terms of the GNU General Public License version 2 *
|
||||
; * as published by the Free Software Foundation. *
|
||||
; ****************************************************************************
|
||||
;
|
||||
|
||||
[Version]
|
||||
Signature = "$Windows NT$"
|
||||
CatalogFile = zttap300.cat
|
||||
ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider = %Provider%
|
||||
Class = Net
|
||||
DriverVer=04/25/2015,6.2.9200.20557
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Virtual Port"
|
||||
Provider = "ZeroTier Networks LLC" ; We're ZeroTier, Inc. now but kernel mode certs are $300+ so fuqdat.
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=zttap300,NTamd64
|
||||
|
||||
[zttap300]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
[zttap300.NTamd64]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
;----------------- Characteristics ------------
|
||||
; NCF_PHYSICAL = 0x04
|
||||
; NCF_VIRTUAL = 0x01
|
||||
; NCF_SOFTWARE_ENUMERATED = 0x02
|
||||
; NCF_HIDDEN = 0x08
|
||||
; NCF_NO_SERVICE = 0x10
|
||||
; NCF_HAS_UI = 0x80
|
||||
;----------------- Characteristics ------------
|
||||
[zttap300.ndi]
|
||||
CopyFiles = zttap300.driver, zttap300.files
|
||||
AddReg = zttap300.reg
|
||||
AddReg = zttap300.params.reg
|
||||
Characteristics = 0x81
|
||||
*IfType = 0x6 ; IF_TYPE_ETHERNET_CSMACD
|
||||
*MediaType = 0x0 ; NdisMedium802_3
|
||||
*PhysicalMediaType = 14 ; NdisPhysicalMedium802_3
|
||||
|
||||
[zttap300.ndi.Services]
|
||||
AddService = zttap300, 2, zttap300.service
|
||||
|
||||
[zttap300.reg]
|
||||
HKR, Ndi, Service, 0, "zttap300"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" ; yes, 'ndis5' is correct... yup, Windows.
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[zttap300.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
HKR, Ndi\params\MTU, Optional, 0, "0"
|
||||
HKR, Ndi\params\MTU, Min, 0, "100"
|
||||
HKR, Ndi\params\MTU, Max, 0, "2800"
|
||||
HKR, Ndi\params\MTU, Step, 0, "1"
|
||||
HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
|
||||
HKR, Ndi\params\MediaStatus, Type, 0, "enum"
|
||||
HKR, Ndi\params\MediaStatus, Default, 0, "0"
|
||||
HKR, Ndi\params\MediaStatus, Optional, 0, "0"
|
||||
HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled"
|
||||
HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
;---------- Service Type -------------
|
||||
; SERVICE_KERNEL_DRIVER = 0x01
|
||||
; SERVICE_WIN32_OWN_PROCESS = 0x10
|
||||
;---------- Service Type -------------
|
||||
|
||||
;---------- Start Mode ---------------
|
||||
; SERVICE_BOOT_START = 0x0
|
||||
; SERVICE_SYSTEM_START = 0x1
|
||||
; SERVICE_AUTO_START = 0x2
|
||||
; SERVICE_DEMAND_START = 0x3
|
||||
; SERVICE_DISABLED = 0x4
|
||||
;---------- Start Mode ---------------
|
||||
|
||||
[zttap300.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\zttap300.sys
|
||||
|
||||
;----------------- Copy Flags ------------
|
||||
; COPYFLG_NOSKIP = 0x02
|
||||
; COPYFLG_NOVERSIONCHECK = 0x04
|
||||
;----------------- Copy Flags ------------
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, zttap300.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
zttap300.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
zttap300.files = 11
|
||||
zttap300.driver = 12
|
||||
|
||||
[zttap300.files]
|
||||
;
|
||||
|
||||
[zttap300.driver]
|
||||
zttap300.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
|
BIN
ext/bin/tap-windows-ndis6/x64/zttap300.sys
Normal file
BIN
ext/bin/tap-windows-ndis6/x64/zttap300.sys
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis6/x86/WdfCoinstaller01011.dll
Normal file
BIN
ext/bin/tap-windows-ndis6/x86/WdfCoinstaller01011.dll
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi
Normal file
BIN
ext/bin/tap-windows-ndis6/x86/ZeroTierOne_NDIS6_x86.msi
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows-ndis6/x86/zttap300.cat
Normal file
BIN
ext/bin/tap-windows-ndis6/x86/zttap300.cat
Normal file
Binary file not shown.
139
ext/bin/tap-windows-ndis6/x86/zttap300.inf
Normal file
139
ext/bin/tap-windows-ndis6/x86/zttap300.inf
Normal file
@ -0,0 +1,139 @@
|
||||
;
|
||||
; ZeroTier One Virtual Network Port NDIS6 Driver
|
||||
;
|
||||
; Based on the OpenVPN tap-windows6 driver version 9.21.1 git
|
||||
; commit 48f027cfca52b16b5fd23d82e6016ed8a91fc4d3.
|
||||
; See: https://github.com/OpenVPN/tap-windows6
|
||||
;
|
||||
; Modified by ZeroTier, Inc. - https://www.zerotier.com/
|
||||
;
|
||||
; (1) Comment out 'tun' functionality and related features such as DHCP
|
||||
; emulation, since we don't use any of that. Just want straight 'tap'.
|
||||
; (2) Added custom IOCTL to enumerate L2 multicast memberships.
|
||||
; (3) Increase maximum number of multicast memberships to 128.
|
||||
; (4) Set default and max device MTU to 2800.
|
||||
; (5) Rename/rebrand driver as ZeroTier network port driver.
|
||||
;
|
||||
; Original copyright below. Modifications released under GPLv2 as well.
|
||||
;
|
||||
; ****************************************************************************
|
||||
; * Copyright (C) 2002-2014 OpenVPN Technologies, Inc. *
|
||||
; * This program is free software; you can redistribute it and/or modify *
|
||||
; * it under the terms of the GNU General Public License version 2 *
|
||||
; * as published by the Free Software Foundation. *
|
||||
; ****************************************************************************
|
||||
;
|
||||
|
||||
[Version]
|
||||
Signature = "$Windows NT$"
|
||||
CatalogFile = zttap300.cat
|
||||
ClassGUID = {4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider = %Provider%
|
||||
Class = Net
|
||||
DriverVer=04/25/2015,6.2.9200.20557
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Virtual Port"
|
||||
Provider = "ZeroTier Networks LLC" ; We're ZeroTier, Inc. now but kernel mode certs are $300+ so fuqdat.
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=zttap300
|
||||
|
||||
[zttap300]
|
||||
%DeviceDescription% = zttap300.ndi, root\zttap300 ; Root enumerated
|
||||
%DeviceDescription% = zttap300.ndi, zttap300 ; Legacy
|
||||
|
||||
;----------------- Characteristics ------------
|
||||
; NCF_PHYSICAL = 0x04
|
||||
; NCF_VIRTUAL = 0x01
|
||||
; NCF_SOFTWARE_ENUMERATED = 0x02
|
||||
; NCF_HIDDEN = 0x08
|
||||
; NCF_NO_SERVICE = 0x10
|
||||
; NCF_HAS_UI = 0x80
|
||||
;----------------- Characteristics ------------
|
||||
[zttap300.ndi]
|
||||
CopyFiles = zttap300.driver, zttap300.files
|
||||
AddReg = zttap300.reg
|
||||
AddReg = zttap300.params.reg
|
||||
Characteristics = 0x81
|
||||
*IfType = 0x6 ; IF_TYPE_ETHERNET_CSMACD
|
||||
*MediaType = 0x0 ; NdisMedium802_3
|
||||
*PhysicalMediaType = 14 ; NdisPhysicalMedium802_3
|
||||
|
||||
[zttap300.ndi.Services]
|
||||
AddService = zttap300, 2, zttap300.service
|
||||
|
||||
[zttap300.reg]
|
||||
HKR, Ndi, Service, 0, "zttap300"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5" ; yes, 'ndis5' is correct... yup, Windows.
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[zttap300.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
HKR, Ndi\params\MTU, Optional, 0, "0"
|
||||
HKR, Ndi\params\MTU, Min, 0, "100"
|
||||
HKR, Ndi\params\MTU, Max, 0, "2800"
|
||||
HKR, Ndi\params\MTU, Step, 0, "1"
|
||||
HKR, Ndi\params\MediaStatus, ParamDesc, 0, "Media Status"
|
||||
HKR, Ndi\params\MediaStatus, Type, 0, "enum"
|
||||
HKR, Ndi\params\MediaStatus, Default, 0, "0"
|
||||
HKR, Ndi\params\MediaStatus, Optional, 0, "0"
|
||||
HKR, Ndi\params\MediaStatus\enum, "0", 0, "Application Controlled"
|
||||
HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
;---------- Service Type -------------
|
||||
; SERVICE_KERNEL_DRIVER = 0x01
|
||||
; SERVICE_WIN32_OWN_PROCESS = 0x10
|
||||
;---------- Service Type -------------
|
||||
|
||||
;---------- Start Mode ---------------
|
||||
; SERVICE_BOOT_START = 0x0
|
||||
; SERVICE_SYSTEM_START = 0x1
|
||||
; SERVICE_AUTO_START = 0x2
|
||||
; SERVICE_DEMAND_START = 0x3
|
||||
; SERVICE_DISABLED = 0x4
|
||||
;---------- Start Mode ---------------
|
||||
|
||||
[zttap300.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\zttap300.sys
|
||||
|
||||
;----------------- Copy Flags ------------
|
||||
; COPYFLG_NOSKIP = 0x02
|
||||
; COPYFLG_NOVERSIONCHECK = 0x04
|
||||
;----------------- Copy Flags ------------
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, zttap300.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
zttap300.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
zttap300.files = 11
|
||||
zttap300.driver = 12
|
||||
|
||||
[zttap300.files]
|
||||
;
|
||||
|
||||
[zttap300.driver]
|
||||
zttap300.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
|
BIN
ext/bin/tap-windows-ndis6/x86/zttap300.sys
Normal file
BIN
ext/bin/tap-windows-ndis6/x86/zttap300.sys
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ext/bin/win-ui-wrapper/ZeroTier One.exe
Normal file
BIN
ext/bin/win-ui-wrapper/ZeroTier One.exe
Normal file
Binary file not shown.
63
ext/http-parser/AUTHORS
Normal file
63
ext/http-parser/AUTHORS
Normal file
@ -0,0 +1,63 @@
|
||||
# Authors ordered by first contribution.
|
||||
Ryan Dahl <ry@tinyclouds.org>
|
||||
Jeremy Hinegardner <jeremy@hinegardner.org>
|
||||
Sergey Shepelev <temotor@gmail.com>
|
||||
Joe Damato <ice799@gmail.com>
|
||||
tomika <tomika_nospam@freemail.hu>
|
||||
Phoenix Sol <phoenix@burninglabs.com>
|
||||
Cliff Frey <cliff@meraki.com>
|
||||
Ewen Cheslack-Postava <ewencp@cs.stanford.edu>
|
||||
Santiago Gala <sgala@apache.org>
|
||||
Tim Becker <tim.becker@syngenio.de>
|
||||
Jeff Terrace <jterrace@gmail.com>
|
||||
Ben Noordhuis <info@bnoordhuis.nl>
|
||||
Nathan Rajlich <nathan@tootallnate.net>
|
||||
Mark Nottingham <mnot@mnot.net>
|
||||
Aman Gupta <aman@tmm1.net>
|
||||
Tim Becker <tim.becker@kuriositaet.de>
|
||||
Sean Cunningham <sean.cunningham@mandiant.com>
|
||||
Peter Griess <pg@std.in>
|
||||
Salman Haq <salman.haq@asti-usa.com>
|
||||
Cliff Frey <clifffrey@gmail.com>
|
||||
Jon Kolb <jon@b0g.us>
|
||||
Fouad Mardini <f.mardini@gmail.com>
|
||||
Paul Querna <pquerna@apache.org>
|
||||
Felix Geisendörfer <felix@debuggable.com>
|
||||
koichik <koichik@improvement.jp>
|
||||
Andre Caron <andre.l.caron@gmail.com>
|
||||
Ivo Raisr <ivosh@ivosh.net>
|
||||
James McLaughlin <jamie@lacewing-project.org>
|
||||
David Gwynne <loki@animata.net>
|
||||
Thomas LE ROUX <thomas@november-eleven.fr>
|
||||
Randy Rizun <rrizun@ortivawireless.com>
|
||||
Andre Louis Caron <andre.louis.caron@usherbrooke.ca>
|
||||
Simon Zimmermann <simonz05@gmail.com>
|
||||
Erik Dubbelboer <erik@dubbelboer.com>
|
||||
Martell Malone <martellmalone@gmail.com>
|
||||
Bertrand Paquet <bpaquet@octo.com>
|
||||
BogDan Vatra <bogdan@kde.org>
|
||||
Peter Faiman <peter@thepicard.org>
|
||||
Corey Richardson <corey@octayn.net>
|
||||
Tóth Tamás <tomika_nospam@freemail.hu>
|
||||
Cam Swords <cam.swords@gmail.com>
|
||||
Chris Dickinson <christopher.s.dickinson@gmail.com>
|
||||
Uli Köhler <ukoehler@btronik.de>
|
||||
Charlie Somerville <charlie@charliesomerville.com>
|
||||
Patrik Stutz <patrik.stutz@gmail.com>
|
||||
Fedor Indutny <fedor.indutny@gmail.com>
|
||||
runner <runner.mei@gmail.com>
|
||||
Alexis Campailla <alexis@janeasystems.com>
|
||||
David Wragg <david@wragg.org>
|
||||
Vinnie Falco <vinnie.falco@gmail.com>
|
||||
Alex Butum <alexbutum@linux.com>
|
||||
Rex Feng <rexfeng@gmail.com>
|
||||
Alex Kocharin <alex@kocharin.ru>
|
||||
Mark Koopman <markmontymark@yahoo.com>
|
||||
Helge Heß <me@helgehess.eu>
|
||||
Alexis La Goutte <alexis.lagoutte@gmail.com>
|
||||
George Miroshnykov <george.miroshnykov@gmail.com>
|
||||
Maciej Małecki <me@mmalecki.com>
|
||||
Marc O'Morain <github.com@marcomorain.com>
|
||||
Jeff Pinner <jpinner@twitter.com>
|
||||
Timothy J Fontaine <tjfontaine@gmail.com>
|
||||
Akagi201 <akagi201@gmail.com>
|
23
ext/http-parser/LICENSE-MIT
Normal file
23
ext/http-parser/LICENSE-MIT
Normal file
@ -0,0 +1,23 @@
|
||||
http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright
|
||||
Igor Sysoev.
|
||||
|
||||
Additional changes are licensed under the same terms as NGINX and
|
||||
copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
2418
ext/http-parser/http_parser.c
Normal file
2418
ext/http-parser/http_parser.c
Normal file
File diff suppressed because it is too large
Load Diff
335
ext/http-parser/http_parser.h
Normal file
335
ext/http-parser/http_parser.h
Normal file
@ -0,0 +1,335 @@
|
||||
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef http_parser_h
|
||||
#define http_parser_h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Also update SONAME in the Makefile whenever you change these. */
|
||||
#define HTTP_PARSER_VERSION_MAJOR 2
|
||||
#define HTTP_PARSER_VERSION_MINOR 4
|
||||
#define HTTP_PARSER_VERSION_PATCH 2
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
|
||||
#include <BaseTsd.h>
|
||||
#include <stddef.h>
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
/* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run
|
||||
* faster
|
||||
*/
|
||||
#ifndef HTTP_PARSER_STRICT
|
||||
# define HTTP_PARSER_STRICT 1
|
||||
#endif
|
||||
|
||||
/* Maximium header size allowed. If the macro is not defined
|
||||
* before including this header then the default is used. To
|
||||
* change the maximum header size, define the macro in the build
|
||||
* environment (e.g. -DHTTP_MAX_HEADER_SIZE=<value>). To remove
|
||||
* the effective limit on the size of the header, define the macro
|
||||
* to a very large number (e.g. -DHTTP_MAX_HEADER_SIZE=0x7fffffff)
|
||||
*/
|
||||
#ifndef HTTP_MAX_HEADER_SIZE
|
||||
# define HTTP_MAX_HEADER_SIZE (80*1024)
|
||||
#endif
|
||||
|
||||
typedef struct http_parser http_parser;
|
||||
typedef struct http_parser_settings http_parser_settings;
|
||||
|
||||
|
||||
/* Callbacks should return non-zero to indicate an error. The parser will
|
||||
* then halt execution.
|
||||
*
|
||||
* The one exception is on_headers_complete. In a HTTP_RESPONSE parser
|
||||
* returning '1' from on_headers_complete will tell the parser that it
|
||||
* should not expect a body. This is used when receiving a response to a
|
||||
* HEAD request which may contain 'Content-Length' or 'Transfer-Encoding:
|
||||
* chunked' headers that indicate the presence of a body.
|
||||
*
|
||||
* http_data_cb does not return data chunks. It will be called arbitrarily
|
||||
* many times for each string. E.G. you might get 10 callbacks for "on_url"
|
||||
* each providing just a few characters more data.
|
||||
*/
|
||||
typedef int (*http_data_cb) (http_parser*, const char *at, size_t length);
|
||||
typedef int (*http_cb) (http_parser*);
|
||||
|
||||
|
||||
/* Request Methods */
|
||||
#define HTTP_METHOD_MAP(XX) \
|
||||
XX(0, DELETE, DELETE) \
|
||||
XX(1, GET, GET) \
|
||||
XX(2, HEAD, HEAD) \
|
||||
XX(3, POST, POST) \
|
||||
XX(4, PUT, PUT) \
|
||||
/* pathological */ \
|
||||
XX(5, CONNECT, CONNECT) \
|
||||
XX(6, OPTIONS, OPTIONS) \
|
||||
XX(7, TRACE, TRACE) \
|
||||
/* webdav */ \
|
||||
XX(8, COPY, COPY) \
|
||||
XX(9, LOCK, LOCK) \
|
||||
XX(10, MKCOL, MKCOL) \
|
||||
XX(11, MOVE, MOVE) \
|
||||
XX(12, PROPFIND, PROPFIND) \
|
||||
XX(13, PROPPATCH, PROPPATCH) \
|
||||
XX(14, SEARCH, SEARCH) \
|
||||
XX(15, UNLOCK, UNLOCK) \
|
||||
/* subversion */ \
|
||||
XX(16, REPORT, REPORT) \
|
||||
XX(17, MKACTIVITY, MKACTIVITY) \
|
||||
XX(18, CHECKOUT, CHECKOUT) \
|
||||
XX(19, MERGE, MERGE) \
|
||||
/* upnp */ \
|
||||
XX(20, MSEARCH, M-SEARCH) \
|
||||
XX(21, NOTIFY, NOTIFY) \
|
||||
XX(22, SUBSCRIBE, SUBSCRIBE) \
|
||||
XX(23, UNSUBSCRIBE, UNSUBSCRIBE) \
|
||||
/* RFC-5789 */ \
|
||||
XX(24, PATCH, PATCH) \
|
||||
XX(25, PURGE, PURGE) \
|
||||
/* CalDAV */ \
|
||||
XX(26, MKCALENDAR, MKCALENDAR) \
|
||||
|
||||
enum http_method
|
||||
{
|
||||
#define XX(num, name, string) HTTP_##name = num,
|
||||
HTTP_METHOD_MAP(XX)
|
||||
#undef XX
|
||||
};
|
||||
|
||||
|
||||
enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH };
|
||||
|
||||
|
||||
/* Flag values for http_parser.flags field */
|
||||
enum flags
|
||||
{ F_CHUNKED = 1 << 0
|
||||
, F_CONNECTION_KEEP_ALIVE = 1 << 1
|
||||
, F_CONNECTION_CLOSE = 1 << 2
|
||||
, F_CONNECTION_UPGRADE = 1 << 3
|
||||
, F_TRAILING = 1 << 4
|
||||
, F_UPGRADE = 1 << 5
|
||||
, F_SKIPBODY = 1 << 6
|
||||
};
|
||||
|
||||
|
||||
/* Map for errno-related constants
|
||||
*
|
||||
* The provided argument should be a macro that takes 2 arguments.
|
||||
*/
|
||||
#define HTTP_ERRNO_MAP(XX) \
|
||||
/* No error */ \
|
||||
XX(OK, "success") \
|
||||
\
|
||||
/* Callback-related errors */ \
|
||||
XX(CB_message_begin, "the on_message_begin callback failed") \
|
||||
XX(CB_url, "the on_url callback failed") \
|
||||
XX(CB_header_field, "the on_header_field callback failed") \
|
||||
XX(CB_header_value, "the on_header_value callback failed") \
|
||||
XX(CB_headers_complete, "the on_headers_complete callback failed") \
|
||||
XX(CB_body, "the on_body callback failed") \
|
||||
XX(CB_message_complete, "the on_message_complete callback failed") \
|
||||
XX(CB_status, "the on_status callback failed") \
|
||||
\
|
||||
/* Parsing-related errors */ \
|
||||
XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \
|
||||
XX(HEADER_OVERFLOW, \
|
||||
"too many header bytes seen; overflow detected") \
|
||||
XX(CLOSED_CONNECTION, \
|
||||
"data received after completed connection: close message") \
|
||||
XX(INVALID_VERSION, "invalid HTTP version") \
|
||||
XX(INVALID_STATUS, "invalid HTTP status code") \
|
||||
XX(INVALID_METHOD, "invalid HTTP method") \
|
||||
XX(INVALID_URL, "invalid URL") \
|
||||
XX(INVALID_HOST, "invalid host") \
|
||||
XX(INVALID_PORT, "invalid port") \
|
||||
XX(INVALID_PATH, "invalid path") \
|
||||
XX(INVALID_QUERY_STRING, "invalid query string") \
|
||||
XX(INVALID_FRAGMENT, "invalid fragment") \
|
||||
XX(LF_EXPECTED, "LF character expected") \
|
||||
XX(INVALID_HEADER_TOKEN, "invalid character in header") \
|
||||
XX(INVALID_CONTENT_LENGTH, \
|
||||
"invalid character in content-length header") \
|
||||
XX(INVALID_CHUNK_SIZE, \
|
||||
"invalid character in chunk size header") \
|
||||
XX(INVALID_CONSTANT, "invalid constant string") \
|
||||
XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\
|
||||
XX(STRICT, "strict mode assertion failed") \
|
||||
XX(PAUSED, "parser is paused") \
|
||||
XX(UNKNOWN, "an unknown error occurred")
|
||||
|
||||
|
||||
/* Define HPE_* values for each errno value above */
|
||||
#define HTTP_ERRNO_GEN(n, s) HPE_##n,
|
||||
enum http_errno {
|
||||
HTTP_ERRNO_MAP(HTTP_ERRNO_GEN)
|
||||
};
|
||||
#undef HTTP_ERRNO_GEN
|
||||
|
||||
|
||||
/* Get an http_errno value from an http_parser */
|
||||
#define HTTP_PARSER_ERRNO(p) ((enum http_errno) (p)->http_errno)
|
||||
|
||||
|
||||
struct http_parser {
|
||||
/** PRIVATE **/
|
||||
unsigned int type : 2; /* enum http_parser_type */
|
||||
unsigned int flags : 7; /* F_* values from 'flags' enum; semi-public */
|
||||
unsigned int state : 7; /* enum state from http_parser.c */
|
||||
unsigned int header_state : 8; /* enum header_state from http_parser.c */
|
||||
unsigned int index : 8; /* index into current matcher */
|
||||
|
||||
uint32_t nread; /* # bytes read in various scenarios */
|
||||
uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */
|
||||
|
||||
/** READ-ONLY **/
|
||||
unsigned short http_major;
|
||||
unsigned short http_minor;
|
||||
unsigned int status_code : 16; /* responses only */
|
||||
unsigned int method : 8; /* requests only */
|
||||
unsigned int http_errno : 7;
|
||||
|
||||
/* 1 = Upgrade header was present and the parser has exited because of that.
|
||||
* 0 = No upgrade header present.
|
||||
* Should be checked when http_parser_execute() returns in addition to
|
||||
* error checking.
|
||||
*/
|
||||
unsigned int upgrade : 1;
|
||||
|
||||
/** PUBLIC **/
|
||||
void *data; /* A pointer to get hook to the "connection" or "socket" object */
|
||||
};
|
||||
|
||||
|
||||
struct http_parser_settings {
|
||||
http_cb on_message_begin;
|
||||
http_data_cb on_url;
|
||||
http_data_cb on_status;
|
||||
http_data_cb on_header_field;
|
||||
http_data_cb on_header_value;
|
||||
http_cb on_headers_complete;
|
||||
http_data_cb on_body;
|
||||
http_cb on_message_complete;
|
||||
};
|
||||
|
||||
|
||||
enum http_parser_url_fields
|
||||
{ UF_SCHEMA = 0
|
||||
, UF_HOST = 1
|
||||
, UF_PORT = 2
|
||||
, UF_PATH = 3
|
||||
, UF_QUERY = 4
|
||||
, UF_FRAGMENT = 5
|
||||
, UF_USERINFO = 6
|
||||
, UF_MAX = 7
|
||||
};
|
||||
|
||||
|
||||
/* Result structure for http_parser_parse_url().
|
||||
*
|
||||
* Callers should index into field_data[] with UF_* values iff field_set
|
||||
* has the relevant (1 << UF_*) bit set. As a courtesy to clients (and
|
||||
* because we probably have padding left over), we convert any port to
|
||||
* a uint16_t.
|
||||
*/
|
||||
struct http_parser_url {
|
||||
uint16_t field_set; /* Bitmask of (1 << UF_*) values */
|
||||
uint16_t port; /* Converted UF_PORT string */
|
||||
|
||||
struct {
|
||||
uint16_t off; /* Offset into buffer in which field starts */
|
||||
uint16_t len; /* Length of run in buffer */
|
||||
} field_data[UF_MAX];
|
||||
};
|
||||
|
||||
|
||||
/* Returns the library version. Bits 16-23 contain the major version number,
|
||||
* bits 8-15 the minor version number and bits 0-7 the patch level.
|
||||
* Usage example:
|
||||
*
|
||||
* unsigned long version = http_parser_version();
|
||||
* unsigned major = (version >> 16) & 255;
|
||||
* unsigned minor = (version >> 8) & 255;
|
||||
* unsigned patch = version & 255;
|
||||
* printf("http_parser v%u.%u.%u\n", major, minor, patch);
|
||||
*/
|
||||
unsigned long http_parser_version(void);
|
||||
|
||||
void http_parser_init(http_parser *parser, enum http_parser_type type);
|
||||
|
||||
|
||||
/* Initialize http_parser_settings members to 0
|
||||
*/
|
||||
void http_parser_settings_init(http_parser_settings *settings);
|
||||
|
||||
|
||||
/* Executes the parser. Returns number of parsed bytes. Sets
|
||||
* `parser->http_errno` on error. */
|
||||
size_t http_parser_execute(http_parser *parser,
|
||||
const http_parser_settings *settings,
|
||||
const char *data,
|
||||
size_t len);
|
||||
|
||||
|
||||
/* If http_should_keep_alive() in the on_headers_complete or
|
||||
* on_message_complete callback returns 0, then this should be
|
||||
* the last message on the connection.
|
||||
* If you are the server, respond with the "Connection: close" header.
|
||||
* If you are the client, close the connection.
|
||||
*/
|
||||
int http_should_keep_alive(const http_parser *parser);
|
||||
|
||||
/* Returns a string version of the HTTP method. */
|
||||
const char *http_method_str(enum http_method m);
|
||||
|
||||
/* Return a string name of the given error */
|
||||
const char *http_errno_name(enum http_errno err);
|
||||
|
||||
/* Return a string description of the given error */
|
||||
const char *http_errno_description(enum http_errno err);
|
||||
|
||||
/* Parse a URL; return nonzero on failure */
|
||||
int http_parser_parse_url(const char *buf, size_t buflen,
|
||||
int is_connect,
|
||||
struct http_parser_url *u);
|
||||
|
||||
/* Pause or un-pause the parser; a nonzero value pauses */
|
||||
void http_parser_pause(http_parser *parser, int paused);
|
||||
|
||||
/* Checks if this is the final chunk of the body. */
|
||||
int http_body_is_final(const http_parser *parser);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
0
ext/installfiles/linux/DEBIAN/conffiles
Normal file
0
ext/installfiles/linux/DEBIAN/conffiles
Normal file
10
ext/installfiles/linux/DEBIAN/control.in
Normal file
10
ext/installfiles/linux/DEBIAN/control.in
Normal file
@ -0,0 +1,10 @@
|
||||
Package: zerotier-one
|
||||
Architecture: __ARCH__
|
||||
Maintainer: ZeroTier, Inc. <contact@zerotier.com>
|
||||
Priority: optional
|
||||
Version: __VERSION__
|
||||
Homepage: https://github.com/zerotier/ZeroTierOne
|
||||
Description: ZeroTier One network virtualization service
|
||||
ZeroTier One is a fast, secure, and easy to use peer to peer network
|
||||
virtualization engine. Visit https://www.zerotier.com/ for more
|
||||
information.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user